Created
May 14, 2016 20:48
-
-
Save crazymykl/8d3c75897c524939d806288adf440f42 to your computer and use it in GitHub Desktop.
Repetition.
This file contains 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
import Array exposing (Array) | |
type alias Model = Array (Array Color) | |
type alias Point = (Int, Int) | |
type Color = Red | Green | Blue | Purple | |
set2d : Point -> Color -> Model -> Model | |
set2d (x, y) color model = | |
Array.get y model | |
|> Maybe.map (flip (Array.set y << Array.set x color) model) | |
|> Maybe.withDefault model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment