git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Update types.rst
commit8b0704c89d352915bdc40e3fe9aaca5b2cab9598 authorPhil Freeman <paf31@cantab.net> dateWed 22 Jan 2014, 22:22 (13 years ago) parent3608e18
1 file changed+13
docs/source/types.rst+13
docs/source/types.rst+13
@@ -222,6 +222,19 @@ test = poly (\n -> n + 1)
222222
223223since the skolemized type variable `a` does not unify with `Number`.
224224
225+## Type Synonyms
226+
227+For convenience, it is possible to declare a synonym for a type using the `type` keyword. Type synonyms can include type arguments.
228+
229+For example:
230+
231+```haskell
232+type Foo = { foo :: Number, bar Number }
233+
234+addFoo :: Foo -> Number
235+addFoo = \o -> o.foo + o.bar
236+```
237+
225238## Type Inference
226239
227240All types can be inferred, but annotations can optionally be provided.