Skip to content

Instantly share code, notes, and snippets.

@as-capabl as-capabl/upgrade.hs
Created Aug 25, 2017

What would you like to do?
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeFamilies #-}
import Control.Eff
import Control.Monad.Free.Reflection
import Data.OpenUnion
import Data.Typeable
upgrade :: (Functor t, Typeable t) => Eff r a -> Eff (t :> r) a
upgrade = fromView . go . toView
go (Impure uni) = Impure $ weaken (upgrade <$> uni)
go (Pure x) = Pure x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.