News for hackers. Stuff that matters.
Re:Use Haskell for shell scripting by lmm on Friday January 30, 2015 @05:04AM (#8971295)
It's in a do block, so you can see that these are not simple function calls; they're being composed via some monad. In cases where you're actually chaining values together it's more obvious which things are which:

    do
      value1 <- function1 --effectful function
      let value2 = function2(value1) --pure function
      value3 <- function3(value1, value2) --effectful function
      ...
But the notation is a bit more magic for this "no return" case; I prefer the Scala approach where even if you don't care about the return values you'd have to write this as

    for {
      _ ← cd "/tmp" // effectful function
      _ ← mkdir "test" //effectful function
      _ = someCalculation() //pure function
      ...
Re:Use Haskell for shell scripting by Peaker on Friday January 30, 2015 @05:16AM (#8971335)
If you enable -Wall, Haskell forces you to use "_ <-" for any action that has a stateful result.

But the "let" vs no "let" is a pretty strong hint anyway :)

Re:Use Haskell for shell scripting by mercurial on Friday January 30, 2015 @05:47AM (#8971407)
Control.Monad.void is your friend.
Re:Use Haskell for shell scripting by Peaker on Saturday January 31, 2015 @06:49AM (#8976501)
Data.Functor.void you mean? :)