Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-25 Thread Alberto G. Corona
What about extending haskell (or ghc) with mixfix operators, Agda style?. At first sigth it would permit the creation of custom control structures and perhaps more readable DSLs. 2009/6/25 Stephan Friedrichs > Henning Thielemann wrote: > > [...] > > > > http://haskell.org/haskellwiki/Case > > Ma

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-24 Thread Stephan Friedrichs
Henning Thielemann wrote: > [...] > > http://haskell.org/haskellwiki/Case Maybe we (i. e. someone with a wiki account ;) ) should add Jeremy's proposal - using let and guards - to the page (under section 2.2, "syntactic suger")? IMHO this is much clearer than "case () of _". foo = let x | 1

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-24 Thread Henning Thielemann
Deniz Dogan schrieb: > 2009/6/20 Stephan Friedrichs : >> Deniz Dogan wrote: >>> I (too) often find myself writing code such as this: >>> >>> if something >>> then putStrLn "howdy there!" >>> else if somethingElse >>> then putStrLn "howdy ho!" >>> else ... >>> >>> [...] http

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-21 Thread Claus Reinke
I (too) often find myself writing code such as this: if something then putStrLn "howdy there!" else if somethingElse then putStrLn "howdy ho!" else ... 1. recognize something odd. done. 2. look for improvements. good. 3. define suitable abstractions for your special case 4.

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Brandon S. Allbery KF8NH
On Jun 20, 2009, at 14:05 , Deniz Dogan wrote: if something then putStrLn "howdy there!" else if somethingElse then putStrLn "howdy ho!" else ... FWIW, when I see this I generally start looking for a higher order way to express it. The monoid instance for lists can be a g

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Jochem Berndsen
Antoine Latter wrote: > On Sat, Jun 20, 2009 at 1:05 PM, Deniz Dogan wrote: >> I (too) often find myself writing code such as this: >> >> if something >> then putStrLn "howdy there!" >> else if somethingElse >> then putStrLn "howdy ho!" >> else ... >> >> I recall reading some tu

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Daniel Peebles
The when and unless functions might come in handy too (both have type forall (m :: * -> *). (Monad m) => Bool -> m () -> m ()) On Sat, Jun 20, 2009 at 2:05 PM, Deniz Dogan wrote: > I (too) often find myself writing code such as this: > > if something >  then putStrLn "howdy there!" >  else if some

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Antoine Latter
On Sat, Jun 20, 2009 at 1:05 PM, Deniz Dogan wrote: > I (too) often find myself writing code such as this: > > if something >  then putStrLn "howdy there!" >  else if somethingElse >          then putStrLn "howdy ho!" >          else ... > > I recall reading some tutorial about how you can use the

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Jeremy Shaw
At Sat, 20 Jun 2009 20:45:16 +0200, Stephan Friedrichs wrote: > If it's a function, you can use guards: > > foo :: ... > foo something somethingElse > | something -> putStrLn "howdy there!" > | somethingElse -> putStrLn "howdy ho!" > | otherwise -> ... You can also artificial

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Deniz Dogan
2009/6/20 Stephan Friedrichs : > Deniz Dogan wrote: >> I (too) often find myself writing code such as this: >> >> if something >>   then putStrLn "howdy there!" >>   else if somethingElse >>           then putStrLn "howdy ho!" >>           else ... >> >> [...] >> >> So how do I make code like this

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Stephan Friedrichs
Deniz Dogan wrote: > I (too) often find myself writing code such as this: > > if something > then putStrLn "howdy there!" > else if somethingElse > then putStrLn "howdy ho!" > else ... > > [...] > > So how do I make code like this prettier? If it's a function, you can us

[Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Deniz Dogan
I (too) often find myself writing code such as this: if something then putStrLn "howdy there!" else if somethingElse then putStrLn "howdy ho!" else ... I recall reading some tutorial about how you can use the Maybe monad if your code starts looking like this, but as you ca