[ fix ] solve autos in data declarations
This commit is contained in:
@@ -115,7 +115,6 @@ processTypeSig ns fc names tm = do
|
|||||||
ignore $ for names $ \nm => setDef (QN ns nm) fc ty Axiom Nil
|
ignore $ for names $ \nm => setDef (QN ns nm) fc ty Axiom Nil
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
processPrimType : List Name → FC → Name → Maybe Raw → M Unit
|
processPrimType : List Name → FC → Name → Maybe Raw → M Unit
|
||||||
processPrimType ns fc nm ty = do
|
processPrimType ns fc nm ty = do
|
||||||
top <- getTop
|
top <- getTop
|
||||||
@@ -439,6 +438,8 @@ processData ns fc nm ty cons = do
|
|||||||
error (getFC codomain) "Constructor codomain is \{render 90 $ pprint tnames codomain} rather than \{nm}"
|
error (getFC codomain) "Constructor codomain is \{render 90 $ pprint tnames codomain} rather than \{nm}"
|
||||||
pure $ map (\ nm' => (MkEntry fc (QN ns nm') dty (DCon NormalCon (getArity dty) hn) Nil)) names
|
pure $ map (\ nm' => (MkEntry fc (QN ns nm') dty (DCon NormalCon (getArity dty) hn) Nil)) names
|
||||||
decl => throwError $ E (getFC decl) "expected constructor declaration")
|
decl => throwError $ E (getFC decl) "expected constructor declaration")
|
||||||
|
-- type level autos like _++_
|
||||||
|
solveAutos
|
||||||
let entries = populateConInfo entries
|
let entries = populateConInfo entries
|
||||||
for entries $ \case (MkEntry name fc dty def flags) => setDef fc name dty def flags
|
for entries $ \case (MkEntry name fc dty def flags) => setDef fc name dty def flags
|
||||||
let cnames = map (\x => x.name) entries
|
let cnames = map (\x => x.name) entries
|
||||||
|
|||||||
14
tests/AutoInData.newt
Normal file
14
tests/AutoInData.newt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
module AutoInData
|
||||||
|
|
||||||
|
import Prelude
|
||||||
|
|
||||||
|
rep : ∀ a. Nat → a → List a
|
||||||
|
rep Z x = Nil
|
||||||
|
rep (S k) x = x :: rep k x
|
||||||
|
|
||||||
|
data RunLength : ∀ ty. List ty → U where
|
||||||
|
Empty : ∀ ty. RunLength {ty} Nil
|
||||||
|
Run : ∀ ty more. (n : Nat) →
|
||||||
|
(x : ty) →
|
||||||
|
RunLength more →
|
||||||
|
RunLength (rep n x ++ more)
|
||||||
Reference in New Issue
Block a user