Skip to content

Instantly share code, notes, and snippets.

@knowthen
Last active February 24, 2017 18:21
Show Gist options
  • Save knowthen/387164751d76a3d096780799c923a3dd to your computer and use it in GitHub Desktop.
Save knowthen/387164751d76a3d096780799c923a3dd to your computer and use it in GitHub Desktop.
Valley Software Developers | Functional Programming Elm Meetup

Data Modeling

Overall App Model (ie the shape of the data we'll need for our app)

type alias Model =
    { nextId : Int
    , devices : List Device
    , page : Page
    , name : String
    , ip : String
    , deviceType : DeviceType
    , editId : Maybe Int
    }

Device Alias Type

type alias Device =
    { id : Int
    , name : String
    , ip : String
    , deviceType : DeviceType
    , status : DeviceStatus
    }

Page Type

type Page
    = Home
    | Edit

Device Type

type DeviceType
    = Ceiling
    | Floor

Device Status Type

type DeviceStatus
    = On
    | Pending
    | Off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment