It does make sense that functions aren't equatable.
For example, in Haskell, this doesn't work, because it can't derive Eq on 
the equation.


data TestType = Equation (Int -> Int)
              | None  
              deriving (Eq)

eq1 = Equation (\x -> x+2)
eq2 = Equation (\x -> x+3)

main = (eq1 == eq2)


I get an error and have to define equality myself, like this.


instance Eq TestType where
    (==) None None = True
    (==) None (Equation x) = False
    (==) (Equation x) None = False
    (==) (Equation x) (Equation y) = True


Is there a way that I can define my own instance of equality for a type in 
elm? Otherwise I can just define a function called isEqual.

I would really like the elm compiler to catch this kind of thing so it 
doesn't mysteriously fail like this.

Tanya

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to