This is the issue that drove me to stop using the equality operator in any 
"generic" code.

It would be nice if the compiler would catch this.

I would argue for using instantiation equality as a fallback but that would 
eliminate various opportunities for compiler optimization.

Mark

> On Jul 9, 2016, at 5:28 PM, [email protected] wrote:
> 
> I'm not too sure about the behavior of these code snippets.  Is it a bug?
> 
> --this has expected behavior; prints True
> import Html exposing (text)
> 
> type TestType = Equation (Int -> Int)
>               | None
> 
> eq1 = None
> eq2 = None
> 
> main = Html.text (toString (eq1 == eq2))
> 
> 
> --expected behavior; prints False
> import Html exposing (text)
> 
> type TestType = Equation (Int -> Int)
>               | None
> 
> eq1 = Equation (\x -> x+2)
> eq2 = None
> 
> main = Html.text (toString (eq1 == eq2))
> 
> 
> --expected behavior; prints True
> import Html exposing (text)
> 
> type TestType = Equation (Int -> Int)
>               | None
> 
> eq1 = Equation (\x -> x+2)
> eq2 = None
> 
> main = Html.text (toString (eq1 == eq1))
> 
> --but not this; it just goes blank and the console has an error
> --"Equality error: general function equality is undecidable, and therefore, 
> unsupported"
> import Html exposing (text)
> 
> type TestType = Equation (Int -> Int)
>               | None
> 
> eq1 = Equation (\x -> x+2)
> eq2 = Equation (\x -> x+3)
> 
> main = Html.text (toString (eq1 == eq2))
> 
> 
> 
> 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.

-- 
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