[Haskell-cafe] [Maybe Int] sans Nothings

Henning Thielemann schlepptop at henning-thielemann.de
Tue May 24 21:42:20 CEST 2011

Alexander Solla schrieb:

> Personally, I find non-functional values without Eq instances to be
> degenerate.  So I really do not mind superfluous Eq constraints.  I
> would not hesitate to use filter ((/=) Nothing) in a function whose type
> has no free type variables.  It's just a bit of plumbing inside of a
> more complex function.

Sometimes it seems to be better to not allow Eq on Float and Double.
Since most algebraic laws do not hold for those types, it is more often
an error than an intention to compare two Float values. And how to
compare (IO a) values? Also, by thinking about function types, you often
get interesting use cases. Thus I would not assume too quickly that a
type will always be instantiated by types other than a function type.
Thus I would stick to (filter isJust) and use this consistently for
monomorphic and polymorphic types.

More information about the Haskell-Cafe mailing list