module Language.PureScript.Sugar (desugar, module S) where
import Control.Category ((>>>))
import Control.Monad
import Control.Monad.Error.Class (MonadError())
import Control.Monad.Supply.Class
import Control.Monad.Writer.Class (MonadWriter())
import Data.List (map)
import Data.Traversable (traverse)
import Language.PureScript.AST
import Language.PureScript.Errors
import Language.PureScript.Externs
import Language.PureScript.Sugar.BindingGroups as S
import Language.PureScript.Sugar.CaseDeclarations as S
import Language.PureScript.Sugar.DoNotation as S
import Language.PureScript.Sugar.AdoNotation as S
import Language.PureScript.Sugar.LetPattern as S
import Language.PureScript.Sugar.Names as S
import Language.PureScript.Sugar.ObjectWildcards as S
import Language.PureScript.Sugar.Operators as S
import Language.PureScript.Sugar.TypeClasses as S
import Language.PureScript.Sugar.TypeClasses.Deriving as S
import Language.PureScript.Sugar.TypeDeclarations as S
desugar
:: (MonadSupply m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
=> [ExternsFile]
-> [Module]
-> m [Module]
desugar externs =
map desugarSignedLiterals
>>> traverse desugarObjectConstructors
>=> traverse desugarDoModule
>=> traverse desugarAdoModule
>=> map desugarLetPatternModule
>>> traverse desugarCasesModule
>=> traverse desugarTypeDeclarationsModule
>=> desugarImports externs
>=> rebracket externs
>=> traverse checkFixityExports
>=> traverse (deriveInstances externs)
>=> desugarTypeClasses externs
>=> traverse createBindingGroupsModule