mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-19 14:29:27 +03:00
parser and prettypinter fix
This commit is contained in:
parent
7f0de0c143
commit
c76a40c282
@ -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
|
||||
|
@ -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) <-
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user