on master help sign in
Merge branch 'type-decls'
commite5310461f1d591a287c7c38d27de0ad10c5f0750 authorEvan Czaplicki <info@elm-lang.org> dateThu 16 Oct 2014, 12:30 (12 years ago) parent439068a7c670bb
27 files changed+189−140
compiler/Docs.hs+2−2 compiler/Parse/Declaration.hs+23−20 compiler/Parse/Helpers.hs+11−9 libraries/Array.elm+1−1 libraries/Basics.elm+1−1 libraries/Char.elm+1−1 libraries/Color.elm+2−2 libraries/Date.elm+6−5 libraries/Dict.elm+5−8 libraries/Either.elm+3−1 libraries/Graphics/Collage.elm+39−39 libraries/Graphics/Element.elm+22−14 libraries/Graphics/Input.elm+2−2 libraries/Graphics/Input/Field.elm+36−17 libraries/Http.elm+5−2 libraries/JavaScript/Experimental.elm+1−1 libraries/Json.elm+1−1 libraries/Keyboard.elm+1−1 libraries/Maybe.elm+1−1 libraries/Regex.elm+8−3 libraries/Set.elm+1−1 libraries/Signal.elm+1−1 libraries/Text.elm+3−3 libraries/Time.elm+1−1 libraries/Touch.elm+8−1 libraries/Trampoline.elm+3−1 libraries/Transform2D.elm+1−1
compiler/Docs.hs+2−2
@@ -25,7 +25,7 @@ import qualified AST.Expression.Source as Src
2525import qualified AST.Variable as Var
2626
2727import Text.Parsec hiding (newline,spaces)
28−import Parse.Declaration (alias,datatype,infixDecl)
28+import Parse.Declaration (typeDecl,infixDecl)
2929import Parse.Expression (typeAnnotation)
3030import Parse.Helpers
3131import Parse.Module (moduleDef)
@@ -102,7 +102,7 @@ docThing = uncommentable <|> commented <|> uncommented ""
102102 uncommented comment
103103
104104 uncommented comment = do
105− (src,def) <- withSource $ choice [ alias, datatype, D.Definition <$> typeAnnotation ]
105+ (src,def) <- withSource $ choice [ typeDecl, D.Definition <$> typeAnnotation ]
106106 return (comment, def, src)
107107
108108
compiler/Parse/Declaration.hs+23−20
@@ -9,31 +9,34 @@ import qualified Parse.Expression as Expr
99import qualified Parse.Type as Type
1010import qualified AST.Declaration as D
1111
12+
1213declaration :: IParser D.SourceDecl
13−declaration = alias <|> datatype <|> infixDecl <|> port <|> definition
14+declaration = typeDecl <|> infixDecl <|> port <|> definition
15+
1416
1517definition :: IParser D.SourceDecl
1618definition = D.Definition <$> Expr.def
1719
18−alias :: IParser D.SourceDecl
19−alias = do
20− reserved "type" <?> "type alias (type Point = {x:Int, y:Int})"
21− forcedWS
22− name <- capVar
23− args <- spacePrefix lowVar
24− padded equals
25− tipe <- Type.expr
26− return (D.TypeAlias name args tipe)
27−
28−datatype :: IParser D.SourceDecl
29−datatype = do
30− reserved "data" <?> "datatype definition (data T = A | B | ...)"
31− forcedWS
32− name <- capVar <?> "name of data-type"
33− args <- spacePrefix lowVar
34− padded equals
35− tcs <- pipeSep1 Type.constructor
36− return $ D.Datatype name args tcs
20+
21+typeDecl :: IParser D.SourceDecl
22+typeDecl =
23+ do reserved "type" <?> "type declaration"
24+ forcedWS
25+ isAlias <- optionMaybe (string "alias" >> forcedWS)
26+ case isAlias of
27+ Just _ ->
28+ do name <- capVar
29+ args <- spacePrefix lowVar
30+ padded equals
31+ tipe <- Type.expr
32+ return (D.TypeAlias name args tipe)
33+
34+ Nothing ->
35+ do name <- capVar <?> "name of data-type"
36+ args <- spacePrefix lowVar
37+ padded equals
38+ tcs <- pipeSep1 Type.constructor
39+ return $ D.Datatype name args tcs
3740
3841
3942infixDecl :: IParser D.SourceDecl
compiler/Parse/Helpers.hs+11−9
@@ -22,15 +22,17 @@ import AST.Literal as Literal
2222import AST.PrettyPrint
2323import qualified AST.Variable as Variable
2424
25−reserveds = [ "if", "then", "else"
26− , "case", "of"
27− , "let", "in"
28− , "data", "type"
29− , "module", "where"
30− , "import", "as", "hiding", "open"
31− , "export", "foreign"
32− , "deriving", "port"
33− ]
25+reserveds :: [String]
26+reserveds =
27+ [ "if", "then", "else"
28+ , "case", "of"
29+ , "let", "in"
30+ , "data", "type"
31+ , "module", "where"
32+ , "import", "as", "hiding", "open"
33+ , "export", "foreign"
34+ , "deriving", "port"
35+ ]
3436
3537expecting = flip (<?>)
3638
libraries/Array.elm+1−1
@@ -25,7 +25,7 @@ import Basics (..)
2525import Maybe (..)
2626import List
2727
28−data Array a = Array
28+type Array a = Array
2929
3030{-| Initialize an array. `initialize n f` creates an array of length `n` with
3131the element at index `i` initialized to the result of `(f i)`.
libraries/Basics.elm+1−1
@@ -234,7 +234,7 @@ compare = Native.Basics.compare
234234{-| Represents the relative ordering of two things.
235235The relations are less than, equal to, and greater than.
236236-}
237−data Order = LT | EQ | GT
237+type Order = LT | EQ | GT
238238
239239{-| Find the smaller of two comparables. -}
240240min : comparable -> comparable -> comparable
libraries/Char.elm+1−1
@@ -50,7 +50,7 @@ toLocaleUpper = Native.Char.toLocaleUpper
5050toLocaleLower : Char -> Char
5151toLocaleLower = Native.Char.toLocaleLower
5252
53−type KeyCode = Int
53+type alias KeyCode = Int
5454
5555{-| Convert to unicode. Used with the `Keyboard` library, which expects the
5656input to be uppercase. -}
libraries/Color.elm+2−2
@@ -42,7 +42,7 @@ that has never helped me remember which one I should be writing.
4242
4343import Basics (..)
4444
45−data Color
45+type Color
4646 = RGBA Int Int Int Float
4747 | HSLA Float Float Float Float
4848
@@ -174,7 +174,7 @@ hslToRgb hue saturation lightness =
174174
175175--toV4 : Color -> V4
176176
177−data Gradient
177+type Gradient
178178 = Linear (Float,Float) (Float,Float) [(Float,Color)]
179179 | Radial (Float,Float) Float (Float,Float) Float [(Float,Color)]
180180
libraries/Date.elm+6−5
@@ -16,15 +16,16 @@ import Native.Date
1616import Time (Time)
1717import Maybe (Maybe)
1818
19−data Date = Date
19+type Date = Date
2020
2121{-| Represents the days of the week. -}
22−data Day = Mon | Tue | Wed | Thu | Fri | Sat | Sun
22+type Day = Mon | Tue | Wed | Thu | Fri | Sat | Sun
2323
2424{-| Represents the month of the year. -}
25−data Month = Jan | Feb | Mar | Apr
26− | May | Jun | Jul | Aug
27− | Sep | Oct | Nov | Dec
25+type Month
26+ = Jan | Feb | Mar | Apr
27+ | May | Jun | Jul | Aug
28+ | Sep | Oct | Nov | Dec
2829
2930{-| Attempt to read a date from a string. -}
3031read : String -> Maybe Date
libraries/Dict.elm+5−8
@@ -42,13 +42,10 @@ import List
4242import List ((::))
4343import Native.Utils
4444
45−type Fakeout = (Int, Int)
46−
47−type Another = (Int, Int)
4845
4946-- BBlack and NBlack should only be used during the deletion
5047-- algorithm. Any other occurrence is a bug and should fail an assert.
51−data NColor
48+type NColor
5249 = Red
5350 | Black
5451 | BBlack -- Double Black, counts as 2 blacks for the invariant
@@ -63,7 +60,7 @@ showNColor c =
6360 BBlack -> "BBlack"
6461 NBlack -> "NBlack"
6562
66−data LeafColor
63+type LeafColor
6764 = LBlack
6865 | LBBlack -- Double Black, counts as 2
6966
@@ -72,7 +69,7 @@ showLColor c = case c of
7269 LBlack -> "LBlack"
7370 LBBlack -> "LBBlack"
7471
75−data Dict k v
72+type Dict k v
7673 = RBNode NColor k v (Dict k v) (Dict k v)
7774 | RBEmpty LeafColor
7875
@@ -160,7 +157,6 @@ getOrFail k t =
160157
161158{-| Determine if a key is in a dictionary. -}
162159member : comparable -> Dict comparable v -> Bool
163−-- Does t contain k?
164160member k t = isJust <| get k t
165161
166162ensureBlackRoot : Dict k v -> Dict k v
@@ -182,7 +178,8 @@ remove : comparable -> Dict comparable v -> Dict comparable v
182178remove k t = let u _ = Nothing in
183179 update k u t
184180
185−data Flag = Insert | Remove | Same
181+type Flag = Insert | Remove | Same
182+
186183showFlag : Flag -> String
187184showFlag f = case f of
188185 Insert -> "Insert"
libraries/Either.elm+3−1
@@ -23,7 +23,9 @@ This can also be used for error handling `(Either String a)` where
2323error messages are stored on the left, and the correct values
2424(&ldquo;right&rdquo; values) are stored on the right.
2525-}
26−data Either a b = Left a | Right b
26+type Either a b
27+ = Left a
28+ | Right b
2729
2830{-| Apply the first function to a `Left` and the second function to a `Right`.
2931This allows the extraction of a value from an `Either`.
libraries/Graphics/Collage.elm+39−39
@@ -40,40 +40,40 @@ import Graphics.Element (Element)
4040import Color (Color, black, Gradient)
4141import Maybe (Maybe)
4242
43−type Form = {
44− theta : Float,
45− scale : Float,
46− x : Float,
47− y : Float,
48− alpha : Float,
49− form : BasicForm
50− }
51−
52−data FillStyle
53− = Solid Color
54− | Texture String
55− | Grad Gradient
43+type alias Form =
44+ { theta : Float
45+ , scale : Float
46+ , x : Float
47+ , y : Float
48+ , alpha : Float
49+ , form : BasicForm
50+ }
51+
52+type FillStyle
53+ = Solid Color
54+ | Texture String
55+ | Grad Gradient
5656
5757{-| The shape of the ends of a line. -}
58−data LineCap = Flat | Round | Padded
58+type LineCap = Flat | Round | Padded
5959
6060{-| The shape of the &ldquo;joints&rdquo; of a line, where each line segment
6161meets. `Sharp` takes an argument to limit the length of the joint. This
6262defaults to 10.
6363-}
64−data LineJoin = Smooth | Sharp Float | Clipped
64+type LineJoin = Smooth | Sharp Float | Clipped
6565
6666{-| All of the attributes of a line style. This lets you build up a line style
6767however you want. You can also update existing line styles with record updates.
6868-}
69−type LineStyle = {
70− color : Color,
71− width : Float,
72− cap : LineCap,
73− join : LineJoin,
74− dashing : [Int],
75− dashOffset : Int
76− }
69+type alias LineStyle =
70+ { color : Color
71+ , width : Float
72+ , cap : LineCap
73+ , join : LineJoin
74+ , dashing : [Int]
75+ , dashOffset : Int
76+ }
7777
7878{-| The default line style, which is solid black with flat caps and sharp joints.
7979You can use record updates to build the line style you
@@ -82,14 +82,14 @@ want. For example, to make a thicker line, you could say:
8282 { defaultLine | width <- 10 }
8383-}
8484defaultLine : LineStyle
85−defaultLine = {
86− color = black,
87− width = 1,
88− cap = Flat,
89− join = Sharp 10,
90− dashing = [],
91− dashOffset = 0
92− }
85+defaultLine =
86+ { color = black
87+ , width = 1
88+ , cap = Flat
89+ , join = Sharp 10
90+ , dashing = []
91+ , dashOffset = 0
92+ }
9393
9494{-| Create a solid line style with a given color. -}
9595solid : Color -> LineStyle
@@ -103,12 +103,12 @@ dashed clr = { defaultLine | color <- clr, dashing <- [8,4] }
103103dotted : Color -> LineStyle
104104dotted clr = { defaultLine | color <- clr, dashing <- [3,3] }
105105
106−data BasicForm
107− = FPath LineStyle Path
108− | FShape (Either LineStyle FillStyle) Shape
109− | FImage Int Int (Int,Int) String
110− | FElement Element
111− | FGroup Transform2D [Form]
106+type BasicForm
107+ = FPath LineStyle Path
108+ | FShape (Either LineStyle FillStyle) Shape
109+ | FImage Int Int (Int,Int) String
110+ | FElement Element
111+ | FGroup Transform2D [Form]
112112
113113form : BasicForm -> Form
114114form f = { theta=0, scale=1, x=0, y=0, alpha=1, form=f }
@@ -204,7 +204,7 @@ collage : Int -> Int -> [Form] -> Element
204204collage = Native.Graphics.Collage.collage
205205
206206
207−type Path = [(Float,Float)]
207+type alias Path = [(Float,Float)]
208208
209209{-| Create a path that follows a sequence of points. -}
210210path : [(Float,Float)] -> Path
@@ -214,7 +214,7 @@ path ps = ps
214214segment : (Float,Float) -> (Float,Float) -> Path
215215segment p1 p2 = [p1,p2]
216216
217−type Shape = [(Float,Float)]
217+type alias Shape = [(Float,Float)]
218218
219219{-| Create an arbitrary polygon by specifying its corners in order.
220220`polygon` will automatically close all shapes, so the given list
libraries/Graphics/Element.elm+22−14
@@ -43,7 +43,7 @@ import List as List
4343import Color (..)
4444import Maybe ( Maybe(..) )
4545
46−type Properties = {
46+type alias Properties = {
4747 id : Int,
4848 width : Int,
4949 height : Int,
@@ -55,7 +55,10 @@ type Properties = {
5555 click : ()
5656 }
5757
58−type Element = { props : Properties, element : ElementPrim }
58+type alias Element =
59+ { props : Properties
60+ , element : ElementPrim
61+ }
5962
6063{-| An Element that takes up no space. Good for things that appear conditionally:
6164
@@ -130,15 +133,15 @@ newElement w h e =
130133 , element = e
131134 }
132135
133−data ElementPrim
134− = Image ImageStyle Int Int String
135− | Container Position Element
136− | Flow Direction [Element]
137− | Spacer
138− | RawHtml
139− | Custom -- for custom Elements implemented in JS, see collage for example
136+type ElementPrim
137+ = Image ImageStyle Int Int String
138+ | Container Position Element
139+ | Flow Direction [Element]
140+ | Spacer
141+ | RawHtml
142+ | Custom -- for custom Elements implemented in JS, see collage for example
140143
141−data ImageStyle = Plain | Fitted | Cropped (Int,Int) | Tiled
144+type ImageStyle = Plain | Fitted | Cropped (Int,Int) | Tiled
142145
143146{-| Create an image given a width, height, and image source. -}
144147image : Int -> Int -> String -> Element
@@ -164,9 +167,14 @@ tiledImage : Int -> Int -> String -> Element
164167tiledImage w h src =
165168 newElement w h (Image Tiled w h src)
166169
167−data Three = P | Z | N
168−data Pos = Absolute Int | Relative Float
169−type Position = { horizontal : Three, vertical : Three, x : Pos, y : Pos }
170+type Three = P | Z | N
171+type Pos = Absolute Int | Relative Float
172+type alias Position =
173+ { horizontal : Three
174+ , vertical : Three
175+ , x : Pos
176+ , y : Pos
177+ }
170178
171179{-| Put an element in a container. This lets you position the element really
172180easily, and there are tons of ways to set the `Position`.
@@ -185,7 +193,7 @@ for making borders.
185193spacer : Int -> Int -> Element
186194spacer w h = newElement w h Spacer
187195
188−data Direction = DUp | DDown | DLeft | DRight | DIn | DOut
196+type Direction = DUp | DDown | DLeft | DRight | DIn | DOut
189197
190198{-| Have a list of elements flow in a particular direction.
191199The `Direction` starts from the first element in the list.
libraries/Graphics/Input.elm+2−2
@@ -42,9 +42,9 @@ of two fields:
4242
4343This will make more sense as you see more examples.
4444-}
45−type Input a = { signal : Signal a, handle : Handle a }
45+type alias Input a = { signal : Signal a, handle : Handle a }
4646
47−data Handle a = Handle
47+type Handle a = Handle
4848
4949{-| This creates a new `Input`. You provide a single argument that will serve
5050as the initial value of the input&rsquo;s `signal`. For example:
libraries/Graphics/Input/Field.elm+36−17
@@ -40,7 +40,12 @@ dimensions such that the left and right are twice as wide as the top and bottom:
4040 myDimensions : Int -> Dimensions
4141 myDimensions n = { left = 2 * n, right = 2 * n, top = n, bottom = n }
4242-}
43−type Dimensions = { left:Int, right:Int, top:Int, bottom:Int }
43+type alias Dimensions =
44+ { left:Int
45+ , right:Int
46+ , top:Int
47+ , bottom:Int
48+ }
4449
4550{-| A field can have a outline around it. This lets you set its color, width,
4651and radius. The radius allows you to round the corners of your field. Set the
@@ -49,7 +54,11 @@ and thin with slightly rounded corners:
4954
5055 { color = grey, width = uniformly 1, radius = 4 }
5156-}
52−type Outline = { color:Color, width:Dimensions, radius:Int }
57+type alias Outline =
58+ { color:Color
59+ , width:Dimensions
60+ , radius:Int
61+ }
5362
5463{-| An outline with zero width, so you cannot see it. -}
5564noOutline : Outline
@@ -62,7 +71,10 @@ is blue and thin:
6271
6372 { color = blue, width = 1 }
6473-}
65−type Highlight = { color:Color, width:Int }
74+type alias Highlight =
75+ { color:Color
76+ , width:Int
77+ }
6678
6779{-| An highlight with zero width, so you cannot see it. -}
6880noHighlight : Highlight
@@ -81,12 +93,12 @@ from the total height to determine how much room there is for text. The
8193`padding` and `outline` appear on the top and bottom, so there will be 28
8294vertical pixels remaining for the text (40 - 1 - 5 - 5 - 1).
8395-}
84−type Style =
85− { padding : Dimensions
86− , outline : Outline
87− , highlight : Highlight
88− , style : Text.Style
89− }
96+type alias Style =
97+ { padding : Dimensions
98+ , outline : Outline
99+ , highlight : Highlight
100+ , style : Text.Style
101+ }
90102
91103{-| The default style for a text field. The outline is `Color.grey` with width
921041 and radius 2. The highlight is `Color.blue` with width 1, and the default
@@ -94,11 +106,11 @@ text color is black.
94106-}
95107defaultStyle : Style
96108defaultStyle =
97− { padding = uniformly 4
98− , outline = Outline Color.grey (uniformly 1) 2
99− , highlight = Highlight Color.blue 1
100− , style = Text.defaultStyle
101− }
109+ { padding = uniformly 4
110+ , outline = Outline Color.grey (uniformly 1) 2
111+ , highlight = Highlight Color.blue 1
112+ , style = Text.defaultStyle
113+ }
102114
103115{-| Represents the current content of a text field. For example:
104116
@@ -107,7 +119,10 @@ defaultStyle =
107119This means the user highlighted the substring `"She"` backwards. The value of
108120`content.string` is `"She sells sea shells"`.
109121-}
110−type Content = { string:String, selection:Selection }
122+type alias Content =
123+ { string:String
124+ , selection:Selection
125+ }
111126
112127{-| The selection within a text field. `start` is never greater than `end`:
113128
@@ -116,14 +131,18 @@ type Content = { string:String, selection:Selection }
116131 Selection 5 9 Backward -- highlighting characters starting after
117132 -- the 5th and ending after the 9th
118133-}
119−type Selection = { start:Int, end:Int, direction:Direction }
134+type alias Selection =
135+ { start:Int
136+ , end:Int
137+ , direction:Direction
138+ }
120139
121140{-| The direction of selection. When the user highlights a selection in a text
122141field, they must do it in a particular direction. This determines which end of
123142the selection moves when they change the selection by pressing Shift-Left or
124143Shift-Right.
125144-}
126−data Direction = Forward | Backward
145+type Direction = Forward | Backward
127146
128147{-| A field with no content:
129148
libraries/Http.elm+5−2
@@ -18,9 +18,12 @@ import Native.Http
1818{-| The datatype for responses. Success contains only the returned message.
1919Failures contain both an error code and an error message.
2020-}
21−data Response a = Success a | Waiting | Failure Int String
21+type Response a
22+ = Success a
23+ | Waiting
24+ | Failure Int String
2225
23−type Request a = {
26+type alias Request a = {
2427 verb : String,
2528 url : String,
2629 body : a,
libraries/JavaScript/Experimental.elm+1−1
@@ -12,7 +12,7 @@ import Native.JavaScript
1212import Native.Json
1313import Json
1414
15−data RawObject = RawObject
15+type RawObject = RawObject
1616
1717{-| Turn arbitrary JavaScript objects into Elm records.
1818Arrays are converted into lists, nested objects are allowed.
libraries/Json.elm+1−1
@@ -19,7 +19,7 @@ through ports, and the runtime will do a conversion like this:
1919JSON is an intentional subset of JavaScript values which excludes functions.
2020This ensures that impure functions cannot sneak into Elm through ports.
2121-}
22−data Value
22+type Value
2323 = String String
2424 | Number Float
2525 | Boolean Bool
libraries/Keyboard.elm+1−1
@@ -25,7 +25,7 @@ import Native.Keyboard
2525in this library. Use `Char.toCode` and `Char.fromCode` to convert key codes
2626to characters. Use the uppercase character with `toCode`.
2727-}
28−type KeyCode = Int
28+type alias KeyCode = Int
2929
3030{-| Custom key directions to support different locales. The order is up, down,
3131left, right.
libraries/Maybe.elm+1−1
@@ -16,7 +16,7 @@ module Maybe (Maybe(..), maybe, isJust, isNothing, map) where
1616result in a value (e.g. logarithm is defined only for positive
1717numbers).
1818-}
19−data Maybe a = Just a | Nothing
19+type Maybe a = Just a | Nothing
2020
2121{-| Provide a default value and a function to extract the contents of a `Maybe`.
2222When given `Nothing` you get the default, when given a `Just` you apply the
libraries/Regex.elm+8−3
@@ -20,7 +20,7 @@ and [`replace`](#replace).
2020import Maybe (Maybe)
2121import Native.Regex
2222
23−data Regex = Regex
23+type Regex = Regex
2424
2525{-| Escape strings to be regular expressions, making all special characters
2626safe. So `regex (escape "^a+")` will match exactly `"^a+"` instead of a series
@@ -73,13 +73,18 @@ Here are details on each field:
7373 This is useful when paired with `replace All` if replacement is dependent on how
7474 many times a pattern has appeared before.
7575-}
76−type Match = { match : String, submatches : [Maybe String], index : Int, number : Int }
76+type alias Match =
77+ { match : String
78+ , submatches : [Maybe String]
79+ , index : Int
80+ , number : Int
81+ }
7782
7883{-| `HowMany` is used to specify how many matches you want to make. So
7984`replace All` would replace every match, but `replace (AtMost 2)` would
8085replace at most two matches (i.e. zero, one, two, but never three or more).
8186-}
82−data HowMany = All | AtMost Int
87+type HowMany = All | AtMost Int
8388
8489{-| Find matches in a string:
8590
libraries/Set.elm+1−1
@@ -36,7 +36,7 @@ import Maybe (Maybe)
3636import Dict as Dict
3737import List as List
3838
39−type Set t = Dict.Dict t ()
39+type alias Set t = Dict.Dict t ()
4040
4141{-| Create an empty set. -}
4242empty : Set comparable
libraries/Signal.elm+1−1
@@ -33,7 +33,7 @@ import Native.Signal
3333import List (foldr, (::))
3434import Basics (fst, snd, not)
3535
36−data Signal a = Signal
36+type Signal a = Signal
3737
3838{-| Create a constant signal that never changes. -}
3939constant : a -> Signal a
libraries/Text.elm+3−3
@@ -38,7 +38,7 @@ import Maybe (Maybe(Nothing))
3838import Native.Show
3939import Native.Text
4040
41−data Text = Text
41+type Text = Text
4242
4343{-| Styles for lines on text. This allows you to add an underline, an overline,
4444or a strike out text:
@@ -47,7 +47,7 @@ or a strike out text:
4747 line Over (toText "overline")
4848 line Through (toText "strike out")
4949-}
50−data Line = Under | Over | Through
50+type Line = Under | Over | Through
5151
5252{-| Represents all the ways you can style `Text`. If the `typeface` list is
5353empty or the `height` is `Nothing`, the users will fall back on their browser's
@@ -62,7 +62,7 @@ Times New Roman (assuming that typeface is available on the user's computer):
6262 , line = Just Under
6363 }
6464-}
65−type Style =
65+type alias Style =
6666 { typeface : [String]
6767 , height : Maybe Float
6868 , color : Color
libraries/Time.elm+1−1
@@ -21,7 +21,7 @@ import Signal (Signal)
2121{-| Type alias to make it clearer when you are working with time values.
2222Using the `Time` constants instead of raw numbers is very highly recommended.
2323-}
24−type Time = Float
24+type alias Time = Float
2525
2626{-| Units of time, making it easier to specify things like a half-second
2727`(500 * milliseconds)` without remembering Elm&rsquo;s underlying units of time.
libraries/Touch.elm+8−1
@@ -21,7 +21,14 @@ A touch also keeps info about the initial point and time of contact:
2121`x0`, `y0`, and `t0`. This helps compute more complicated gestures
2222like taps, drags, and swipes which need to know about timing or direction.
2323-}
24−type Touch = { x:Int, y:Int, id:Int, x0:Int, y0:Int, t0:Time }
24+type alias Touch =
25+ { x:Int
26+ , y:Int
27+ , id:Int
28+ , x0:Int
29+ , y0:Int
30+ , t0:Time
31+ }
2532
2633{-| A list of ongoing touches. -}
2734touches : Signal [Touch]
libraries/Trampoline.elm+3−1
@@ -42,7 +42,9 @@ stack overflow. We can rewrite it as follows:
4242
4343Now it uses a trampoline and can recurse without growing the stack!
4444-}
45−data Trampoline a = Done a | Continue (() -> Trampoline a)
45+type Trampoline a
46+ = Done a
47+ | Continue (() -> Trampoline a)
4648
4749{-| Evaluate a trampolined value in constant space. -}
4850trampoline : Trampoline a -> a
libraries/Transform2D.elm+1−1
@@ -22,7 +22,7 @@ always `0 0 1` in these matrices, it is omitted in the diagrams below.
2222
2323import Native.Transform2D
2424
25−data Transform2D = Transform2D
25+type Transform2D = Transform2D
2626
2727{-| Create an identity transform. Transforming by the identity does
2828not change anything, but it can come in handy as a default or