[Haskell-cafe] Re: Re-order type (flip map)

Dan Doel dan.doel at gmail.com
Sun Oct 10 21:02:43 EDT 2010


On Sunday 10 October 2010 5:32:16 pm Johannes Waldmann wrote:
> I mean instead of      h . g . f $ x
> I'd sometimes prefer   x ? f ? g ? h
> but what are the "?"

Note, before anyone gets too excited about this, there are some built-in 
things about the language that make forward chaining less nice. For instance:

  (f $ \x -> ...) /= (\x -> ... ? f)
  (f $ do ...)    /= (do ... ? f)

You need to add parentheses for the right sides, which defeats at least part 
of the point of ($).

The second is even incompatible in two ways, because left-to-right 
impredicative instantiation seems to be back in GHC 7, and so:

  runST $ do ...

will work, while

  (do ...) ? runST

will be a type error, assuming it's just flip ($) with the usual type.

-- Dan


More information about the Haskell-Cafe mailing list