Skip to content

Commit

Permalink
Generate a Gang!
Browse files Browse the repository at this point in the history
  • Loading branch information
mwunsch committed Oct 13, 2016
1 parent 9a6a26b commit 3d597be
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/Gang.elm
@@ -1,10 +1,31 @@
module Gang exposing (..)

import Dict exposing (Dict)
import List
import Model exposing (Model, Id)
import Random exposing (Generator)
import Svg exposing (Svg)

type alias Gang = Dict Id Model

type alias Gang =
Dict Id Model


empty : Gang
empty =
Dict.empty


fromList : List Model -> Gang
fromList =
Dict.fromList << List.map (\m -> ( m.id, m ))


generator : Generator Gang
generator =
Random.list 5 Model.generator
|> Random.map fromList


view : Gang -> (Model -> msg) -> List (Svg msg)
view gang msg =
Expand Down

0 comments on commit 3d597be

Please sign in to comment.