This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- This is what the runtime passes in -} | |
type alias UnsafeFlags = | |
{ browser : Maybe String | |
, version : Maybe String | |
, randomSeed : Int | |
} | |
{- And this is what we want to work with -} | |
type alias Flags = | |
{ browser : String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type alias HasAnInt = { foo : Int } | |
badExample : HasAnInt -> HasAnInt | |
badExample record = | |
{ record | foo = toString record.foo } | |
{- Since we're changing the type, we need to give the correct | |
type annotation for the new return value | |
-} | |
thisWorks : HasAnInt -> { foo : String } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nodeDecoder : Decoder Node | |
nodeDecoder = | |
oneOf | |
[ intNodeDecoder | |
, stringNodeDecoder | |
] | |
intNodeDecoder : Decoder Node | |
intNodeDecoder = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nodeDecoder : Decoder Node | |
nodeDecoder = | |
oneOf | |
[ intNodeDecoder | |
, stringNodeDecoder | |
] | |
intNodeDecoder : Decoder Node | |
intNodeDecoder = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Dict k v | |
= Empty | |
| Node Int k v (Dict k v) (Dict k v) | |
balance : Dict k v -> Dict k v | |
balance dict = | |
case dict of | |
Empty -> | |
dict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isValidBst : Tree comparable -> Bool | |
isValidBst tree = | |
case tree of | |
Empty -> | |
True | |
Node value left right -> | |
all (\x -> x < value) left | |
&& all (\x -> x > value) right | |
&& isValidBst left |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Test exposing (..) | |
{-| A binary search tree will often look roughly like this. | |
Every node will either be the `Empty` node, or a node with | |
a key, a value and left and right children. In this case, we | |
also have an extra `Int` to keep track of the height, but | |
that's not relevant to the example at hand. | |
-} | |
type Dict k v | |
= Empty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Random.Insertion exposing (..) | |
import Benchmark exposing (..) | |
import Benchmark.Runner exposing (BenchmarkProgram, program) | |
import Char | |
import Dict | |
import Dict.AVL as AvlDict | |
import Time exposing (Time) | |
import Random.Pcg as Random exposing (int, list, Seed) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Pages.SearchPage.Rest exposing (..) | |
import Html exposing (..) | |
import Http | |
import Json.Decode as JD exposing (..) | |
import Pages.SearchPage.Types exposing (Model, ImagePic, Msg) | |
import Json.Decode.Pipeline as JP | |
import RemoteData | |
fetchImagePics : Cmd Msg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"testStarted": { | |
"name": "My test suite", | |
"id": "8f22cce8-c281-456e-a2ef-54a863a0ccdd" | |
} | |
} | |
{ | |
"testStarted": { | |
"name": "My test", | |
"parentId": "8f22cce8-c281-456e-a2ef-54a863a0ccdd", |