
Write you a Haskell (2015) - myth_drannon
http://dev.stephendiehl.com/fun/
======
Dangeranger
It seems that development on the book has slowed or halted.

Is the author planning to continue? This sounds like a rich and interesting
subject that I would enjoy following through to the end.

Another book I've found helpful for Haskell is:

Haskell Programming from First Principles
([http://haskellbook.com/](http://haskellbook.com/))

~~~
ffreire
Simon Peyton Jones' seminal work "Implementation of Functional Programming
Languages" is available free of charge now that it's out of print[0]. If you
haven't read it yet I'd highly encourage it!

[0]: [https://www.microsoft.com/en-us/research/publication/the-
imp...](https://www.microsoft.com/en-us/research/publication/the-
implementation-of-functional-programming-languages/)

~~~
vajrabum
Implementing Functional Languages: A Tutorial is also available and is
somewhat more accessible [https://www.microsoft.com/en-
us/research/publication/impleme...](https://www.microsoft.com/en-
us/research/publication/implementing-functional-languages-a-tutorial/)

------
amelius
If someone could write a Haskell with a simpler build system, and better
internal documentation so it becomes more "hackable", that would be great. The
structure of GHC seems more complicated than necessary, as the first comment
of [1] states. GHC seems much too monolithic for a functional programming
environment.

[1]
[https://www.reddit.com/r/haskell/comments/3jq3cu/hacking_on_...](https://www.reddit.com/r/haskell/comments/3jq3cu/hacking_on_ghc_is_not_that_hard/)

~~~
macawfish
I actually don't know how much my frustration relates to the hackability of
the ghc.

I'd _LOVE_ to "write me a haskell". I've been trying for the last 3 days to
wrap my work style around cabal/stack... It's so so so frustrating (especially
on Arch Linux). This is something I come back to every 6 months or so.

Ideally, I'd be able to write Haskell that compiles into concise, trimmed
down, readable javascript bundles, (as you can compile OCaml with
bucklescript). But I don't think it's really possible right now. Once upon a
time I successfully managed to get ghcjs to compile code using a library I was
interested in. It spit out a 1 MB bundle, without even doing much of anything.
No thanks! Organizing a project around this system sounds not very enjoyable.

Yesterday I managed to get Reason (OCaml) running, but figured out that using
any existing OCaml libraries means I have to manually manage & compile them.
Also, it doesn't seem like the OCaml community has nearly as many libraries as
the Haskell community.

It's weird to say, but I think I am spoiled by npm-based tools! As hard as it
was to get used to, I actually really appreciate their hardiness.

I still may end up going with OCaml/Reason and bucklescript, and just not
worry about libraries. Maybe writing more functional programs will decrease my
reliance on libraries in the first place, since stuff can be done so
concisely.

If anyone has advice about this stuff, I'd gladly take it!

~~~
dualogy
> _I 've been trying for the last 3 days to wrap my work style around
> cabal/stack..._

You have me puzzled! You can totally ignore/skip cabal and just use

\- to create project dir with stack.yaml

    
    
        stack new myproject simple
    

\- to ensure all dependencies and a ghc for that stack.yaml are present

    
    
        stack setup
    

\- to rebuild any changes

    
    
        stack make
    

\- to live-code in your project

    
    
        stack repl
    

\- to run interpreted any one of your mains:

    
    
        stack runghc some/tool.hs
    

\- to grab 3rd-party dependencies for the project:

    
    
        stack install some-external-lib
    

Pretty similar to most other modern languages' "canonical" build/run/package-
management tooling really.

> _Ideally, I 'd be able to write Haskell that compiles into concise, trimmed
> down, readable javascript bundles, (as you can compile OCaml with
> bucklescript). But I don't think it's really possible right now. Once upon a
> time I successfully managed to get ghcjs to compile code using a library I
> was interested in. It spit out a 1 MB bundle, without even doing much of
> anything._

Well. For JavaScript from Haskell, other than GHCJS that "compiles the whole
runtime system" to multi-MB packages, there's more lightweight options
(outside of PureScript/Elm), namely: Fay and Haste. Fear not, a new from-
scratch transpiler is also next on _my_ agenda however! ;) that's because Fay
parses Haskell to transpile, but I definitely want to transpile from the
highly optimized and richly annotated-with-compilation-hints "STG" IR. Not
sure how Haste does it, but I'd rather have full control over the JS I emit
over the coming half-decade anyway and it's certainly a bit dated (ES 6+ can
be emitted _so_ much more "compactly" than legacy JS!)

That being said, from what you're saying I think you're better served with
ReasonML or PureScript as these projects seem to already have matured somewhat
yet also not-yet-stale =)

~~~
macawfish
Thanks for the tips! I guess some of my frustration was that I was trying to
get haste running with stack, but it needs ghc v7-something, but I'm getting
ghc from pacman, so stack kept asking me to manually resolve libraries...
there were other dramas and confusions too, but mostly I have little patience
for making package managers play nicely, especially when I'm not very familiar
with them in the first place and am new to the language! I get distracted and
go off to play piano or something that's more straightforward to me :)

~~~
mrkgnao
It's better to use

    
    
        stack --install-ghc $whatever_command
    

which gets you the version of GHC you need to be able to run $whatever_command
into ~/.stack if you don't have it. Much less brittle than a system-wide
installation, and perfect for working with multiple GHCs. Anecdotally: I setup
the Arch Linux machine I'm typing this on yesterday. I installed[1] Stack/GHC
before xorg :)

[1]: It was so that I could run Aura:
[https://github.com/aurapm/aura](https://github.com/aurapm/aura)

~~~
macawfish
oh my goodness.... this is an amazing tip!

~~~
mrkgnao
Great, Haskell away!

------
nilved
This website needs some work. If you're as confused as I was, try scrolling
down.

