tags: markdown cheatsheet help author: admin protected: admin
{:.no_toc}
- toc {:toc}
// | |
// Creates a new e-mail forwarder for your DomainFactory (www.df.eu) account | |
// | |
// Sadly DomainFactory doesn't provide an API for managing "ManagedHosting" | |
// accounts, so I decided to write a short script for creating e-mail | |
// forwarders, because I like to have one e-mail address for every service | |
// I register for and I don't like to waste my time clicking through several | |
// pages to archive this ;) | |
// | |
// To run this code you need PhantomJS - http://www.phantomjs.org/ (1.0.0) |
A problem that I've seen beginners run into in Haskell or PureScript a couple of times now is how to generate a List of random numbers. It's a common requirement for little games (which make for great first projects) to generate these, and it definitely seems to be a stumbling block.
Randomness is considered a side effect in purely functional languages, which means that to generate them you usually need access to Eff/IO, which in turn means we need to deal with Monads. And while generating a single random number is usually pretty easy with do-notation, the typical intuition beginners have built when going from single values to a collection is to use map
, but that fails.
A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments: