git.iko.soy/rowtype-yoga/purescript-native
on 44d6326 help sign in
69 lines 2.1 kB history raw
1-----------------------------------------------------------------------------
2--
3-- Module : Language.PureScript.Prim
4-- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors
5-- License : MIT
6--
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
9-- Portability :
10--
11-- |
12--
13-----------------------------------------------------------------------------
15module Language.PureScript.Prim where
17import Language.PureScript.Kinds
18import Language.PureScript.Names
19import Language.PureScript.Types
21import qualified Data.Map as M
23-- |
24-- Type constructor for functions
25--
26tyFunction :: Type
27tyFunction = TypeConstructor $ (Qualified $ Just $ ModuleName [ProperName "Prim"]) (ProperName "Function")
29-- |
30-- Type constructor for strings
31--
32tyString :: Type
33tyString = TypeConstructor $ (Qualified $ Just $ ModuleName [ProperName "Prim"]) (ProperName "String")
35-- |
36-- Type constructor for numbers
37--
38tyNumber :: Type
39tyNumber = TypeConstructor $ (Qualified $ Just $ ModuleName [ProperName "Prim"]) (ProperName "Number")
41-- |
42-- Type constructor for booleans
43--
44tyBoolean :: Type
45tyBoolean = TypeConstructor $ (Qualified $ Just $ ModuleName [ProperName "Prim"]) (ProperName "Boolean")
47-- |
48-- Type constructor for arrays
49--
50tyArray :: Type
51tyArray = TypeConstructor $ (Qualified $ Just $ ModuleName [ProperName "Prim"]) (ProperName "Array")
53-- |
54-- Smart constructor for function types
55--
56function :: Type -> Type -> Type
57function t1 = TypeApp (TypeApp tyFunction t1)
59-- |
60-- The primitive types in the external javascript environment with their associated kinds.
61--
62primTypes :: M.Map (Qualified ProperName) Kind
63primTypes = M.fromList [ (primName "Function" , FunKind Star (FunKind Star Star))
64 , (primName "Array" , FunKind Star Star)
65 , (primName "String" , Star)
66 , (primName "Number" , Star)
67 , (primName "Boolean" , Star) ]
68 where
69 primName name = Qualified (Just $ ModuleName [ProperName "Prim"]) (ProperName name)