Skip to content

Eff computations are coercible to each other #41

@UlfNorell

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)

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