New import
syntax with keyword exposing
.
- Move
Http
toelm-http
package and totally redo API - Remove
WebSocket
module - Add
Task
module
Graphics.Input
now works with this API (from module Signal
):
type alias Mailbox a = { address : Address a, signal : Signal a }
mailbox : a -> Mailbox a
You can then send messages to the Address
with functions like Signal.send
and Signal.message
, or create forwarding addresses with Signal.forwardTo
.
Graphics.Collage
now has two new functions:
text : Text -> Form
outlinedText : LineStyle -> Text -> Form
These functions render text with the canvas, making things quite a bit faster.
The underlying implementation of Text
has also been improved dramatically.
- Change types of
head
,tail
,maximum
,minimum
by wrapping output inMaybe
- Move
leftAligned
,centered
,rightAligned
fromText
toGraphics.Element
- Move
asText
fromText
toGraphics.Element
, renaming it toshow
in the process - Remove
Text.plainText
(can be replaced byGraphics.Element.leftAligned << Text.fromString
) - Change type of
Keyboard.keysDown
fromSignal (List KeyCode)
toSignal (Set KeyCode)
- Remove
Keyboard.directions
- Rename
Keyboard.lastPressed
toKeyboard.presses
- Keyword
type
becomestype alias
- Keyword
data
becomestype
- Remove special list syntax in types, so
[a]
becomesList a
The set of default imports has been reduced to the following:
import Basics (..)
import Maybe ( Maybe( Just, Nothing ) )
import Result ( Result( Ok, Err ) )
import List ( List )
import Signal ( Signal )
- Added
Json.Decode
andJson.Encode
libraries
-
Rename
String.show
toString.toString
-
Replace
List.zip
withList.map2 (,)
-
Replace
List.zipWith f
withList.map2 f
-
Rename
Signal.liftN
toSignal.mapN
-
Rename
Signal.merges
toSignal.mergeMany
- Revamp
Input
concept asSignal.Channel
- Remove
Signal.count
- Remove
Signal.countIf
- Remove
Signal.combine
- No longer signal-based
- Use a
Generator
to create random values
-
Add the following functions to
Maybe
withDefault : a -> Maybe a -> a oneOf : List (Maybe a) -> Maybe a map : (a -> b) -> Maybe a -> Maybe b andThen : Maybe a -> (a -> Maybe b) -> Maybe b
-
Remove
Maybe.maybe
somaybe 0 sqrt Nothing
becomeswithDefault 0 (map sqrt Nothing)
-
Remove
Maybe.isJust
andMaybe.isNothing
in favor of pattern matching -
Add
Result
library for proper error handling. This is for cases when you want a computation to succeed, but if there is a mistake, it should produce a nice error message. -
Remove
Either
in favor ofResult
or custom union types -
Revamp functions that result in a
Maybe
.- Remove
Dict.getOrElse
andDict.getOrFail
in favor ofwithDefault 0 (Dict.get key dict)
- Remove
Array.getOrElse
andArray.getOrFail
in favor ofwithDefault 0 (Array.get index array)
- Change
String.toInt : String -> Maybe Int
toString.toInt : String -> Result String Int
- Change
String.toFloat : String -> Maybe Float
toString.toFloat : String -> Result String Float
- Remove
-
Add the following functions to
Text
:empty : Text append : Text -> Text -> Text concat : [Text] -> Text join : Text -> [Text] -> Text
-
Make the following changes in
List
:- Replace
(++)
withappend
- Remove
join
- Replace
- Rename
Text.toText
toText.fromString