Skip to content

Instantly share code, notes, and snippets.

@vic
Created May 31, 2016 05:30
Show Gist options
  • Save vic/f486ac7a87492f737f4d08ef5b7cd7c7 to your computer and use it in GitHub Desktop.
Save vic/f486ac7a87492f737f4d08ef5b7cd7c7 to your computer and use it in GitHub Desktop.
empty useless effect manager
effect module My where { command = MyCmd } exposing
( init
)
import Task exposing (Task)
import Platform.Cmd exposing (Cmd)
-- Manager
type MyState x
= State ()
type alias MyTask msg
= Task Never (MyState msg)
type MyCmd msg
= NoOp
init : MyTask msg
init =
Task.succeed (State ())
cmdMap : (a -> b) -> MyCmd a -> MyCmd b
cmdMap tagger cmd =
case cmd of
NoOp -> NoOp
onEffects
: Platform.Router msg (MyCmd msg)
-> List (MyCmd msg)
-> MyState msg
-> MyTask msg
onEffects router commands state =
Task.succeed state
onSelfMsg
: Platform.Router msg (MyCmd msg)
-> MyCmd msg
-> MyState msg
-> MyTask msg
onSelfMsg router command state =
Task.succeed state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment