Skip to content

Eff computations are coercible to each other #41

Description

@UlfNorell
{-# LANGUAGE DataKinds #-}

import Control.Monad.Freer
import Control.Monad.Freer.Reader
import Control.Monad.Freer.State
import Data.Coerce

badness :: Eff '[Reader (Int, Int)] a -> Eff '[State Int] a
badness = coerce

boom :: (Int, Int)
boom = run $ evalState 17 (badness ask)

I believe the fix is to add a role annotation

type role Union nominal nominal

here:

-- | Open union is a strong sum (existential with an evidence).
data Union (r :: [Type -> Type]) a where
Union :: {-# UNPACK #-} !Word -> t a -> Union r a

(I can make a PR if welcome)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions