Skip to content

Instantly share code, notes, and snippets.

@dela3499
Created July 14, 2015 19:04
Show Gist options
  • Save dela3499/bdaee46975c50b4e54ef to your computer and use it in GitHub Desktop.
Save dela3499/bdaee46975c50b4e54ef to your computer and use it in GitHub Desktop.
First Impressions of Elm

First impressions of Elm

Though I'm familiar with functional programming, I mainly work in Python, so I'm new to Elm's type annotations, tagged unions, and purity. I thought I'd play around with Elm a bit by writing a program to generate a random name. I've done this for a number of different programming languages, and found it helpful.

There are three areas I'm interested in exploring more after my first attempt at Elm.

Monads

Though I've never used monads, I understand they are helpful in writing programs that depend on random numbers, like this one. My code seems a bit crufty in this first iteration, since I have to explicitly create a variable for every value that depends on a random seed, and I also have to create a variable for every seed.

Tags in tagged unions

I ran into a compiler error that seemed to result from my using one tag in multiple tagged unions. In my case, it was using Just a in both Maybe and Length.

Higher-level types

It doesn't seem like I can express a data type that would allow arbitrary function composition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment