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
-- This is in response to Robert Smallshire's talk titled | |
-- 'The Unreasonable Effectiveness of Dynamic Typing for Practical Programs'. | |
-- http://www.infoq.com/presentations/dynamic-static-typing/ | |
-- Around the 30 minute mark he gives an example of what he calls a failure | |
-- of the F# type system, because it allows him to add energy to torque. | |
-- I demonstrate here that Haskell's type system is capable of ruling | |
-- out this nonsense. I have no experience with F#; maybe its type system | |
-- can do the same, if appropriately handled. | |
-- We'll need some multiparameter typeclasses. |
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
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeInType #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE RankNTypes #-} | |
import Data.Proxy |
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 GADTSyntax #-} | |
-- # Inter-node messages | |
-- | A single 'Message' type for all inter-node communication. | |
data Message where | |
MessageControl :: Control -> Message | |
MessageDatum :: Datum -> Message | |
MessageAnnounce :: Announce -> Message | |
MessageRequest :: Request -> Message |
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 GADTs #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE EmptyCase #-} | |
{-# OPTIONS_GHC "-fwarn-incomplete-patterns" #-} |
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 RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE AllowAmbiguousTypes #-} | |
{-# LANGUAGE FunctionalDependencies #-} |