I'm working with the following algebraic data type in PureScript...
data Extended a = Infinite | Finite a
v1 = Finite 11
v2 = Infinite
I'm having trouble figuring out how to pattern match the "Infinite" case, since it appears that v2
has type forall t140. Extended t140
. I'm assuming t140 is some sort of placeholder the compiler automatically fills in. The type of v1 is Extended Int
. So if I setup an instance of Eq to compare values of Extended, the Infinite case does not match...
instance extendedEq :: (Eq a) => Eq (Extended a) where
eq (Finite a) (Finite b) = eq a b
eq Infinite Infinite = true
eq Infinite _ = false
eq _ Infinite = false
So when I try and run v2 == v2
I get the error...
No type class instance was found for Prelude.Eq (Extended _0)
Which makes sense, since I imagine it's trying to find an Eq instance for t140.
So my question is, how can I pattern matching on the Infinite type?