1-----------------------------------------------------------------------------
3-- Module : Language.PureScript.Sugar
4-- Copyright : (c) Phil Freeman 2013
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
14-----------------------------------------------------------------------------
16{-# LANGUAGE FlexibleContexts #-}
18module Language.PureScript.Sugar (desugar, module S) where
21import Control.Category ((>>>))
22import Control.Applicative
23import Control.Monad.Error.Class
24import Control.Monad.Supply.Class
26import Language.PureScript.AST
27import Language.PureScript.Errors
29import Language.PureScript.Sugar.BindingGroups as S
30import Language.PureScript.Sugar.CaseDeclarations as S
31import Language.PureScript.Sugar.DoNotation as S
32import Language.PureScript.Sugar.Names as S
33import Language.PureScript.Sugar.ObjectWildcards as S
34import Language.PureScript.Sugar.Operators as S
35import Language.PureScript.Sugar.TypeClasses as S
36import Language.PureScript.Sugar.TypeDeclarations as S
39-- The desugaring pipeline proceeds as follows:
41-- * Remove signed literals in favour of `negate` applications
43-- * Desugar object literals with wildcards into lambdas
45-- * Desugar operator sections
47-- * Desugar do-notation using the @Prelude.Monad@ type class
49-- * Desugar top-level case declarations into explicit case expressions
51-- * Desugar type declarations into value declarations with explicit type annotations
53-- * Qualify any unqualified names and types
55-- * Rebracket user-defined binary operators
57-- * Introduce type synonyms for type class dictionaries
59-- * Group mutually recursive value and data declarations into binding groups.
61desugar :: (Applicative m, MonadSupply m, MonadError MultipleErrors m) => [Module] -> m [Module]
62desugar = map removeSignedLiterals
63 >>> mapM desugarObjectConstructors
64 >=> mapM desugarOperatorSections
65 >=> mapM desugarDoModule
66 >=> desugarCasesModule
67 >=> desugarTypeDeclarationsModule
70 >=> desugarTypeClasses
71 >=> createBindingGroupsModule
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list