diff options
author | Péter Diviánszky <divipp@gmail.com> | 2016-05-03 16:34:31 +0200 |
---|---|---|
committer | Péter Diviánszky <divipp@gmail.com> | 2016-05-03 16:34:31 +0200 |
commit | fa47957b930c53d78d2da0bcb948e2fbff11f59d (patch) | |
tree | 25ba37580c8a73e9a8cc7fce31030c8a1a7dbf72 /src | |
parent | 9c258737a3a4cfabec6804947ccf64a552db4c27 (diff) |
refactoring
Diffstat (limited to 'src')
-rw-r--r-- | src/LambdaCube/Compiler/DesugaredSource.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/LambdaCube/Compiler/DesugaredSource.hs b/src/LambdaCube/Compiler/DesugaredSource.hs index 3f1cbc1a..8efa8e76 100644 --- a/src/LambdaCube/Compiler/DesugaredSource.hs +++ b/src/LambdaCube/Compiler/DesugaredSource.hs | |||
@@ -443,11 +443,11 @@ data Stmt | |||
443 | pattern Primitive n t = Let n (Just t) (SBuiltin "undefined") | 443 | pattern Primitive n t = Let n (Just t) (SBuiltin "undefined") |
444 | 444 | ||
445 | instance PShow Stmt where | 445 | instance PShow Stmt where |
446 | pShow stmt = DResetFreshNames $ case stmt of | 446 | pShow stmt = vcat . map DResetFreshNames $ case stmt of |
447 | Primitive n t -> shAnn (pShow n) (pShow t) | 447 | Primitive n t -> pure $ shAnn (pShow n) (pShow t) |
448 | Let n ty e -> DLet "=" (pShow n) $ maybe (pShow e) (\ty -> shAnn (pShow e) (pShow ty)) ty | 448 | Let n ty e -> [shAnn (pShow n) (pShow t) | Just t <- [ty]] ++ [DLet "=" (pShow n) (pShow e)] |
449 | Data n ps ty cs -> nest 2 $ "data" <+> nest 2 (shAnn (foldl dApp (DTypeNamespace True $ pShow n) [shAnn (text "_") (pShow t) | (v, t) <- ps]) (pShow ty)) </> "where" <> nest 2 (hardline <> vcat [shAnn (pShow n) $ pShow $ UncurryS (first (const Hidden) <$> ps) t | (n, t) <- cs]) | 449 | Data n ps ty cs -> pure $ nest 2 $ "data" <+> nest 2 (shAnn (foldl dApp (DTypeNamespace True $ pShow n) [shAnn (text "_") (pShow t) | (v, t) <- ps]) (pShow ty)) </> "where" <> nest 2 (hardline <> vcat [shAnn (pShow n) $ pShow $ UncurryS (first (const Hidden) <$> ps) t | (n, t) <- cs]) |
450 | PrecDef n i -> pShow i <+> text (sName n) --DOp0 (sName n) i | 450 | PrecDef n i -> pure $ pShow i <+> text (sName n) --DOp0 (sName n) i |
451 | 451 | ||
452 | instance DeBruijnify SIName Stmt where | 452 | instance DeBruijnify SIName Stmt where |
453 | deBruijnify_ k v = \case | 453 | deBruijnify_ k v = \case |