Skip to content

Commit a79f927

Browse files
committed
[ fix ] solve autos in data declarations
1 parent 0e110cd commit a79f927

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Lib/ProcessDecl.newt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ processTypeSig ns fc names tm = do
115115
ignore $ for names $ \nm => setDef (QN ns nm) fc ty Axiom Nil
116116

117117

118-
119118
processPrimType : List Name → FC → Name → Maybe Raw → M Unit
120119
processPrimType ns fc nm ty = do
121120
top <- getTop
@@ -439,6 +438,8 @@ processData ns fc nm ty cons = do
439438
error (getFC codomain) "Constructor codomain is \{render 90 $ pprint tnames codomain} rather than \{nm}"
440439
pure $ map (\ nm' => (MkEntry fc (QN ns nm') dty (DCon NormalCon (getArity dty) hn) Nil)) names
441440
decl => throwError $ E (getFC decl) "expected constructor declaration")
441+
-- type level autos like _++_
442+
solveAutos
442443
let entries = populateConInfo entries
443444
for entries $ \case (MkEntry name fc dty def flags) => setDef fc name dty def flags
444445
let cnames = map (\x => x.name) entries

tests/AutoInData.newt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module AutoInData
2+
3+
import Prelude
4+
5+
rep : ∀ a. Nat → a → List a
6+
rep Z x = Nil
7+
rep (S k) x = x :: rep k x
8+
9+
data RunLength : ∀ ty. List ty → U where
10+
Empty : ∀ ty. RunLength {ty} Nil
11+
Run : ∀ ty more. (n : Nat) →
12+
(x : ty) →
13+
RunLength more →
14+
RunLength (rep n x ++ more)

0 commit comments

Comments
 (0)