[Haskell-cafe] Can I write this function without doing the action on a different line?

Kim-Ee Yeoh ky3 at atamo.com
Mon Apr 7 22:03:23 UTC 2014

On Sun, Apr 6, 2014 at 2:15 PM, Karl Voelker <karl at karlv.net> wrote:

> last . splitDirectories . normalise . joinPath . (: maybeToList package)
> <$> getCurrentDirectory

The thing to notice is that we really want to write

    getCurrentDirectory : maybeToList package

but the effect-typing won't let us.

This kludge:

    let x = flip (<$>) in getCurrentDirectory `x` (: maybeToList package)

restores the smile in our haskell, where 'x' can be as imperceptibly
unicoded as desired.

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140408/f658af0a/attachment.html>

More information about the Haskell-Cafe mailing list