Skip to content

Instantly share code, notes, and snippets.

@pete-murphy
Created July 15, 2022 17:21
Show Gist options
  • Select an option

  • Save pete-murphy/0af4ae4f5f141509e9bca4f19826eeca to your computer and use it in GitHub Desktop.

Select an option

Save pete-murphy/0af4ae4f5f141509e9bca4f19826eeca to your computer and use it in GitHub Desktop.
Derive Functor for Cont-like type
module Main where
import Prelude
import Effect (Effect)
import Elmish.Dispatch (Dispatch)
import Control.Monad.Cont (Cont, runCont)
import Data.Newtype (class Newtype)
newtype Effect' a = Effect' (Cont (Effect Unit) a)
derive instance Newtype (Effect' a) _
derive newtype instance Functor Effect'
runEffect' :: forall a. Effect' a -> (Dispatch a -> Effect Unit)
runEffect' (Effect' c) = runCont c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment