[Haskell-cafe] Re[2]: [Haskell] GHC inferred type different for pointed/point-free defs?

Bulat Ziganshin bulat.ziganshin at gmail.com
Sat Nov 4 02:11:00 EST 2006


Hello Dan,

Saturday, November 4, 2006, 3:49:13 AM, you wrote:
> You might want to rename your (&&&) and (|||), though, since they clash
> with those defined in Control.Arrow.

> I found that by defining (???) then way I did, I could use 
> (Control.Arrow.|||) as-is for the second part.

i just not use arrows because i don't understand them. my definitions of
"&&&" and "|||" is like those in C/perl/ruby and most times i use them
alone: debugging &&& debug_info, first_time ||| putStrLn ""

in the far future, i will be glad to see && and || redefined in this
way (or some like this; it should just provide ruby's look&feel plus
extensibility). although for my own program this may be solved by just
not importing Prelude. hmmm, i should think about it..

but && and || functions is not exactly the same as ?: operator (nor in
C, nor in standard Haskell, nor in my implementation). with these
operations condition is tested _twice_ and if second argument has
"false" value, third one will be returned anyway:

True && False || True  =>  True
True ?  False :  True  =>  False


btw, it may be extended slightly more by adding application version:

a &&. f  =  a &&& (f a)

example:
str &&. ("debug info: "++)

now such function named unlessNull that is not so neat


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list