[Timber] Bindings

Andrey Kruglyak kruglyak at mac.com
Sun May 2 20:54:11 EDT 2010


Oh, when two name bindings follow one another, this is probably seen as an extreme form of pattern matching, just as when we define a function on more than one line. 

On the other hand, maybe the compiler should detect that there are no arguments and consider this an error? And what is the correct behavior for:

A x = z
B x = z

(assuming z is a value of the data type D = A Int | B Int)? Should the first line cause an exception if z is B 4, or should  the second line succeed?

Andrey
Sent from my iPhone

On May 3, 2010, at 1:44, Andrey Kruglyak <kruglyak at mac.com> wrote:

> Hi!
> 
> This must be a bug (and one that should be fixed ASAP), not only because it's not how we define bindings (a name can only be bound once), but also because if we separate the two definitions of "temp" we do get a compile error "duplicate variable":
> 
> import POSIX
> 
> root :: RootType
> root w = do
>  temp = "12"
>  env = new posix w 
>  temp = "abc"
>  env.stdout.write (show temp)
> 
> I hope that Johan can fix it soon.
> 
> Regards,
> Andrey
> 
> On May 2, 2010, at 23:41, Per Lindgren wrote:
> 
>> Hi
>> 
>> Consider:
>> -------------
>> module Err1 where
>> 
>> import POSIX
>> 
>> root :: RootType
>> root w = do
>>       env = new posix w 
>>       temp = "12"
>>       temp = "abc"
>>       env.stdout.write (show temp)
>> 
>> What is the defined behavior?
>> 
>> (The result using timberc is no compiler error and the output "12" when executed. If that is what's intended, then we might be in for some confused programmers. )
>> 
>> /Per
>> 
>> 
>> _______________________________________________
>> Timber mailing list
>> Timber at haskell.org
>> http://www.haskell.org/mailman/listinfo/timber
> 
> ------------------------------------------------------------------------
> Andrey Kruglyak
> PhD student
> 
> http://www.andreykruglyak.com
> 
> Dept. of Computer Science and Electrical Engineering
> Lulea University of Technology, Lulea, Sweden
> T +46 920 49 23 57 (office)
> T +46 706 16 76 03 (mobile)
> Office A2314 (A-huset)
> 
> _______________________________________________
> Timber mailing list
> Timber at haskell.org
> http://www.haskell.org/mailman/listinfo/timber


More information about the Timber mailing list