[Haskell-cafe] Re: Tips of Conditional Expression

Christian Maeder Christian.Maeder at dfki.de
Fri Feb 22 10:17:37 EST 2008


TOPE KAREM wrote:
> Thanks. My question is whether it can call a function (say map)
> previously defined elsewhere in the program. Same goes for filter.

I'm still not sure what to answer. If map and filter were user defined
functions they may occur anywhere in your current module (or must be
imported) and you can apply any argument in scope (of proper type).

You could i.e. apply "(if <cond> then map else filter)" to "id"
  which is the same as "if <cond> then map id else filter id"

C.

> On Fri, Feb 22, 2008 at 6:04 AM, Christian Maeder
> <Christian.Maeder at dfki.de <mailto:Christian.Maeder at dfki.de>> wrote:
>     I'm not sure what you're asking, but exp1 and exp2 may have (the same)
>     function type:
> 
>     if <cond> then map else filter :: (Bool -> Bool) -> [Bool] -> [Bool]



More information about the Haskell-Cafe mailing list