Skip to content

Instantly share code, notes, and snippets.

@acple
Last active January 21, 2020 22:51
Show Gist options
  • Save acple/71e4470e7e6f4c77fb239b63252625eb to your computer and use it in GitHub Desktop.
Save acple/71e4470e7e6f4c77fb239b63252625eb to your computer and use it in GitHub Desktop.
module TypeClassTest where
import Prelude
import Unsafe.Coerce (unsafeCoerce)
class TwoParams a b where
func :: a -> b
instance equals :: TwoParams a a where
func = identity
else
instance any :: TwoParams a b where
func = unsafeCoerce
-- test2 :: forall a. a -> Array a
-- test2 = func
test3 :: forall m a. a -> m a
test3 = func
-- ^^^^
--
-- No type class instance was found for
--
-- TypeClassTest.TwoParams a0
-- (m1 a0)
--
--
-- while checking that type forall b a. TwoParams a b => a -> b
-- is at least as general as type a0 -> m1 a0
-- while checking that expression func
-- has type a0 -> m1 a0
-- in value declaration test3
--
-- where a0 is a rigid type variable
-- bound at (line 18, column 9 - line 18, column 13)
-- m1 is a rigid type variable
-- bound at (line 18, column 9 - line 18, column 13)
--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment