on 267f708 help sign in
elk/src/Elm/Compiler/Imports.hs
39 lines 1.1 kB history raw
1module Elm.Compiler.Imports (defaults) where
3import qualified AST.Module as Module
4import qualified AST.Variable as Var
7-- DEFAULT IMPORTS
9(==>) :: a -> b -> (a,b)
10(==>) = (,)
13defaults :: [Module.DefaultImport]
14defaults =
15 [ ["Basics"] ==> Module.ImportMethod Nothing Var.openListing
16 , ["Debug"] ==> Module.ImportMethod Nothing Var.closedListing
17 , ["List"] ==> exposing [Var.Value "::"]
18 , ["Maybe"] ==> exposing [Var.Union "Maybe" Var.openListing]
19 , ["Result"] ==> exposing [Var.Union "Result" Var.openListing]
20 , ["Platform"] ==> exposing [closedType "Program"]
21 , ["Platform","Cmd"] ==> named "Cmd" [closedType "Cmd", Var.Value "!"]
22 , ["Platform","Sub"] ==> named "Sub" [closedType "Sub"]
23 ]
26exposing :: [Var.Value] -> Module.ImportMethod
27exposing vars =
28 Module.ImportMethod Nothing (Var.listing vars)
31closedType :: String -> Var.Value
32closedType name =
33 Var.Union name Var.closedListing
36named :: String -> [Var.Value] -> Module.ImportMethod
37named name vars =
38 Module.ImportMethod (Just name) (Var.listing vars)