Skip to content

Commit

Permalink
Split CExpr and SExpr into different ADTs (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
dougalm committed May 18, 2024
1 parent 0e6e527 commit d8fe2d4
Show file tree
Hide file tree
Showing 8 changed files with 559 additions and 1,767 deletions.
3 changes: 2 additions & 1 deletion dex.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ library
, SourceIdTraversal
, TopLevel
-- , Transpose
, Types.Core
, Types.Simple
, Types.Complicated
, Types.Imp
, Types.Primitives
, Types.Source
Expand Down
3 changes: 2 additions & 1 deletion src/lib/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import qualified Data.Map.Strict as M
import Name
import Err

import Types.Core
import Types.Complicated
import Types.Simple
import Types.Top
import Types.Imp
import Types.Primitives
Expand Down
8 changes: 3 additions & 5 deletions src/lib/Name.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ import Control.Monad.Writer.Strict
import Control.Monad.State.Strict
import qualified Data.HashMap.Strict as HM
import qualified Data.Map.Strict as M
import Data.Bits
import Data.Functor ((<&>))
import Data.Foldable (toList, foldl')
import Data.Maybe (fromJust, catMaybes)
import Data.Hashable
import Data.Kind (Type)
import Data.Function ((&))
Expand Down Expand Up @@ -2192,7 +2190,7 @@ absurdNameFunction :: Name VoidS -> a
absurdNameFunction v = error $ "Void names shouldn't exist: " ++ show v

scopeFragToSubstFrag :: forall v i i' o
. (forall c. Name (i:=>:i') -> v o)
. (Name (i:=>:i') -> v o)
-> ScopeFrag i i' -> SubstFrag v i i' o
scopeFragToSubstFrag f (UnsafeScopeFromSubst m) = fmapSubstFrag (\n _ -> f n) m

Expand Down Expand Up @@ -2220,7 +2218,7 @@ newNames n = do
let bs = unsafeListToNest $ map UnsafeMakeBinder ns
unsafeCoerceE $ Abs bs $ ListE vs

withFresh :: forall n c a. (Distinct n)
withFresh :: forall n a. (Distinct n)
=> NameHint -> Scope n
-> (forall l. DExt n l => NameBinder n l -> a) -> a
withFresh hint (Scope (UnsafeMakeScopeFrag scope)) cont =
Expand Down Expand Up @@ -2749,7 +2747,7 @@ instance BindsNames (SubstPair v o) where

-- === instances ===

instance (forall c. Pretty (v n)) => Pretty (SubstItem v n) where
instance Pretty (v n) => Pretty (SubstItem v n) where
pretty (SubstItem _ val) = pretty val

instance SinkableE v => SinkableE (SubstFrag v i i') where
Expand Down
3 changes: 2 additions & 1 deletion src/lib/QueryTypePure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
module QueryTypePure where

import Types.Primitives
import Types.Core
import Types.Simple
import Types.Complicated
import Types.Top
import Name

Expand Down
Loading

0 comments on commit d8fe2d4

Please sign in to comment.