Skip to content

coerce and phantom types #442

Description

@claudeha
{-# LANGUAGE RoleAnnotations #-}
module Coerce where
                                                  
import Data.Coerce (coerce)
import Data.Kind (Type)                           

type role Foo phantom                             
data Foo a = Foo
                                                 
foo :: forall (a :: Type) (b :: Type) . Foo a -> Foo b                                              
foo = coerce

accepted by ghc 9.12.1
rejected by mhs 0.15.5.0

*** Exception: error: "./Coerce.hs": line 11, col 7: 
Cannot satisfy constraint: (Coercible a b)
     fully qualified: (Data.Coerce.Coercible a b)

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