-
Notifications
You must be signed in to change notification settings - Fork 4
Mapping of types
arata, mizuki edited this page Dec 6, 2019
·
1 revision
Primitive types:
-
s -> t(orFunction s t) -->(_: s) => t -
Array t-->Array<t> -
{ key1 :: Type1, key2 :: Type2 }(orRecord (key1 :: Type1, key2 :: Type2)) -->{ key1: Type1, key2: Type2 } -
Number,Int-->number -
String,Char-->string -
Boolean-->boolean
Types with built-in support:
-
Data.Function.Uncurried-
Fn0 r-->() => r -
Fn2 a0 a1 r-->(_0: a0, _1: a2) => r -
Fn3 a0 a1 a2 r-->(_0: a0, _1: a1, _2: a2) => r - ...
-
Fn10 a0 a1 ... a9 r-->(_0: a0, _1: a1, ..., _9: a9) => r
-
-
Effect(from purescript-effect)-
Effect a-->() => a
-
-
Effect.Uncurried(from purescript-effect)-
EffectFn1 a0 r-->(_0: a0) => r -
EffectFn2 a0 a1 r-->(_0: a0, _1: a1) => r -
EffectFn3 a0 a1 a2 r-->(_0: a0, _1: a1, _2: a2) => r - ...
-
EffectFn10 a0 a1 ... a9 r-->(_0: a0, _1: a1, ..., _9: a9) => r
-
-
Data.Variant(from purescript-variant)-
Variant (tag1 :: Type1, tag2 :: Type2)-->{type: "tag1", value: Type1} | {type: "tag2", value: Type2}
-
-
Data.Nullable(from purescript-nullable)-
Nullable a-->a | null
-
-
Foreign.Object(from purescript-foreign-object)-
Object t-->{[_: string]: t}
-
-
Control.Monad.Eff(deprecated)-
Eff e r-->() => r
-
-
Data.StrMap(deprecated)-
StrMap t-->{[_: string]: t}
-
Candidates:
-
Date.JSDatefrom purescript-js-date-
JSDate-->Date
-
-
Data.String.Regexfrom purescript-strings-
Regex-->RegExp
-
- Are there wrappers for other JS built-ins?
TODO:
- Should
Data.Voidmap tonever? - Should
Data.Unitmap tovoid?
Ideas:
- Support type-level boolean (
Prim.Boolean)?