parser and prettypinter fix

This commit is contained in:
Paul Chiusano 2019-05-10 03:20:47 -04:00
parent 7f0de0c143
commit c76a40c282
3 changed files with 5 additions and 2 deletions

View File

@ -88,7 +88,7 @@ prettyDataDecl env r name dd =
(field <$> zip fs (init ts))
<> " }"
field (fname, typ) = P.group $
prettyHashQualified fname <> " :" `P.hang` TypePrinter.pretty0 env 10 typ
prettyHashQualified fname <> " :" `P.hang` TypePrinter.pretty0 env (-1) typ
header = prettyDataHeader name dd <> (" = " `P.orElse` "\n = ")
-- Comes up with field names for a data declaration which has the form of a

View File

@ -209,10 +209,11 @@ dataDeclaration mod = do
in (ann ctorName, Var.namespaced [L.payload name, L.payload ctorName],
Type.foralls ctorAnn typeArgVs ctorType)
dataConstructor = go <$> prefixVar <*> many TypeParser.valueTypeLeaf
wordyIdVar = fmap Var.nameds <$> wordyId
record = do
_ <- openBlockWith "{"
fields <- sepBy1 (reserved ",") $
liftA2 (,) (prefixVar <* reserved ":") TypeParser.valueTypeLeaf
liftA2 (,) (wordyIdVar <* reserved ":") TypeParser.valueType
_ <- closeBlock
pure $ ([go name (snd <$> fields)], [(name, fields)])
(constructors, accessors) <-

View File

@ -3,6 +3,8 @@ type Point x y = { x : x, y : y }
type Point2 = { point2 : Nat, f : Nat }
type Monoid a = { zero : a, plus : a -> a -> a }
> Point.x.set 10 (Point 0 0)
> Point.x (Point 10 0)
> Point.y (Point 0 10)