[Haskell-cafe] Prolog-style patterns

Daniel Trstenjak daniel.trstenjak at gmail.com
Tue Apr 9 13:01:07 CEST 2013


Hi Roman,

> In fact, lots of Haskell newcomers are surprised that
> 
>   f 10 = 42
> 
> is not the same as
> 
>   n = 10
>   f n = 42

Well, yes, at the beginning I've been also surprised about this.

But allowing this seems to be even more error prone, because now you
could "bind" function arguments to values by just importing a module.


module Foo where
n = 10


module Bar where
import Foo

f n = 42


By constraining this "binding" to only the current module you would just add
an other inconsistency.



Greetings,
Daniel



More information about the Haskell-Cafe mailing list