Skip to content

Commit 627a6cd

Browse files
committed
Initial commit for nbe elaborator
No error messages, no import resolution yet
1 parent f462dcc commit 627a6cd

File tree

14 files changed

+3825
-1609
lines changed

14 files changed

+3825
-1609
lines changed

dhall/dhall.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ Library
392392
directory >= 1.2.2.0 && < 1.4 ,
393393
dotgen >= 0.4.2 && < 0.5 ,
394394
exceptions >= 0.8.3 && < 0.11,
395+
ghc-prim >= 0.3.1.0 && < 0.6,
395396
filepath >= 1.4 && < 1.5 ,
396397
haskeline >= 0.7.2.1 && < 0.8 ,
397398
lens-family-core >= 1.0.0 && < 1.3 ,
@@ -450,6 +451,8 @@ Library
450451
Dhall.Parser.Token,
451452
Dhall.Import.Types,
452453
Dhall.Eval,
454+
Dhall.Elaboration,
455+
Dhall.TypeErrors,
453456
Dhall.Util,
454457
Paths_dhall
455458
if flag(with-http)

dhall/src/Dhall/Binary.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@ class ToTerm a where
131131

132132
instance ToTerm a => ToTerm (Expr s a) where
133133
encode (Var (V "_" n)) =
134-
TInteger n
134+
TInt n
135135
encode (Var (V x 0)) =
136136
TString x
137137
encode (Var (V x n)) =
138-
TList [ TString x, TInteger n ]
138+
TList [ TString x, TInt n ]
139139
encode NaturalBuild =
140140
TString "Natural/build"
141141
encode NaturalFold =
@@ -499,9 +499,9 @@ class FromTerm a where
499499

500500
instance FromTerm a => FromTerm (Expr s a) where
501501
decode (TInt n) =
502-
return (Var (V "_" (fromIntegral n)))
503-
decode (TInteger n) =
504502
return (Var (V "_" n))
503+
decode (TInteger n) =
504+
return (Var (V "_" (fromIntegral n)))
505505
decode (TString "Natural/build") =
506506
return NaturalBuild
507507
decode (TString "Natural/fold") =
@@ -571,7 +571,7 @@ instance FromTerm a => FromTerm (Expr s a) where
571571
decode (TList [ TString x, TInt n ]) =
572572
return (Var (V x (fromIntegral n)))
573573
decode (TList [ TString x, TInteger n ]) =
574-
return (Var (V x n))
574+
return (Var (V x (fromIntegral n)))
575575
decode (TList (TInt 0 : f₁ : xs₁)) = do
576576
f₀ <- decode f₁
577577
xs₀ <- traverse decode xs₁

dhall/src/Dhall/Binary.hs-boot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ class ToTerm a where
88
encode :: a -> Term
99

1010
instance ToTerm a => ToTerm (Expr s a)
11+
12+
class FromTerm a where
13+
decode :: Term -> Maybe a

0 commit comments

Comments
 (0)