From 97da83cd7707dbb2a8d7984f2a3083fc19f93923 Mon Sep 17 00:00:00 2001 From: Justin Calleja Date: Thu, 9 Mar 2017 20:16:21 +0100 Subject: [PATCH] Replace type definitions with examples in "type constructors" part --- README.md | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 176f8eb..11255ae 100644 --- a/README.md +++ b/README.md @@ -61,18 +61,14 @@ id="sanctuary-types-return">[1](#sanctuary-types) - `42 :: Integer, Number` - "`42` is a member of type `Integer` or `Number`" (the value of the expression `42` is `42` and we claim that it qualifies for membership in both the `Integer` and `Number` types). -* _The value of an expression may be a type_ - - When this is the case, the expression is called a "type expression"[2](#agith). - - The type `Type` is used to denote the type of a "type expression".[3](#thetypetype) * _New types can be created via type constructors._ - Type constructors can take zero or more type arguments. - - `Name :: String` - "the type expression `Name` has type `String`". - - `Array :: Type -> Type` - "the type expression `Array` has type `Type -> - Type`". `Array` is a type constructor which takes a "type expression" and - returns a "type expression". - - `Array String :: Type` + - `Array` is a type constructor which takes one type argument. + - `Array String` is the type of all arrays of strings. Each of the + following has type `Array String`: `[]`, `['foo', 'bar', 'baz']`. + - `Array (Array String)` is the type of all arrays of arrays of strings. + Each of the following has type `Array (Array String)`: `[]`, `[ [], [] + ]`, `[ [], ['foo'], ['bar', 'baz'] ]`. * _Lowercase letters stand for type variables._ - Type variables can take any type unless they have been restricted by means of type constraints (see fat arrow below). @@ -120,12 +116,6 @@ traverse :: Applicative f, Traversable t => t a ~> (TypeRep f, a -> f b) -> f (t - - - 1. See the [Types](https://sanctuary.js.org/#types) section in `Sanctuary`'s docs for more info. [↩](#sanctuary-types-return) -2. See [A Gentle Introduction to - Haskell](https://www.haskell.org/tutorial/goodies.html) for more info. - [↩](#agith-return) -3. See - [sanctuary-def](https://github.com/sanctuary-js/sanctuary-def) for more - info. [↩](#thetypetype-return) ## Prefixed method names