This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE UnsaturatedTypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
module Main where | |
import Data.Kind |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Interpreting Free Monads of Functor Sums | |
======================================== | |
This text deals with a way to compose certain kinds of monads, thereby mixing | |
their capabilities. It is a literate Haskell file, so let's begin with a | |
bunch of noise. | |
> {-# LANGUAGE MultiParamTypeClasses #-} | |
> {-# LANGUAGE FlexibleInstances #-} | |
> {-# LANGUAGE FlexibleContexts #-} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--license: CC-0 | |
--see: https://creativecommons.org/publicdomain/zero/1.0/ | |
--Elm version: http://share-elm.com/sprout/53ee4e81e4b07afa6f9844c9 | |
import FRP.Helm | |
import qualified FRP.Helm.Window as Window | |
import qualified FRP.Helm.Mouse as Mouse | |
data Branch = Branch { branch_x1 :: Double |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- in reply to http://www.reddit.com/r/haskell/comments/21mja6/make_lllegal_state_transitions_unrepresentable/ | |
-- | |
-- We implement a tiny language with three commands: Open, Close, and Get. | |
-- The first Get after an Open returns 1, the second Get returns 2, and so on. | |
-- | |
-- Get is only valid while the state is open, and | |
-- Open must always be matched by a Close. | |
-- We enforce both restrictions via the type system. | |
-- | |
-- There are two valid states: Opened and Closed. |