[Haskell-cafe] Ported a Python script for use with Go to Haskell

Andrew Gibiansky andrew.gibiansky at gmail.com
Sat Apr 5 15:48:33 UTC 2014


The script itself looks pretty good to me, but you might want to take a
look at Shelly <https://hackage.haskell.org/package/shelly> [0] for Haskell
scripting in the future. It's a really nice library / DSL for "bash"-like
scripting directly in Haskell. If you try out Shelly, I suggest trying it
with ClassyPrelude and -XOverloadedStrings, which makes dealing with all
the Text and FilePath types bearable. (Heh, though it's annoying, having
FilePath as a separate type once prevented me from writing code that
deleted my home directory upon being run... fun story.)

[0] https://hackage.haskell.org/package/shelly


On Sat, Apr 5, 2014 at 4:33 AM, Kim-Ee Yeoh <ky3 at atamo.com> wrote:

>
> On Sat, Apr 5, 2014 at 5:21 PM, Robert Vollmert <rvollmert-lists at gmx.net>wrote:
>
>> - clobbering the environment by prepending to an association list makes
>> me wonder if that's really what happens when the variable is already defined
>
>
> Yes, that does raise flags.
>
> The haskell here:
>
>     installEnv <- getEnvironment >>= return . (:) ("GOBIN", gOBIN)
>
> which I'd probably write as
>
>     installEnv <- (("GOBIN", gOBIN) :) <$> getEnvironment
>
> doesn't match the python here:
>
>     GOBIN = tempfile.gettempdir()
>     os.environ['GOBIN'] = GOBIN
>
> in the sense that the case for a predefined GOBIN in the environment will
> lead to different results. At least I'll be surprised if otherwise.
>
> To Matt: have you tested your haskell version? You might want to take a
> look at System.Posix.Env.putenv.
>
> -- Kim-Ee
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140405/d32c5665/attachment.html>


More information about the Haskell-Cafe mailing list