Skip to content

Instantly share code, notes, and snippets.

@acple

acple/TypeClassTest.purs

Last active Jan 21, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.