On Wed, 2011-12-21 at 18:34 +0000, Daniel Waterworth wrote: > I made this simple state machine combinator library today. I think it > works as a simple example of a good use for GADTs. > > https://gist.github.com/1507107
Any way to do something along the lines of type StateChange a = SC a a handleChange :: Monad m => StateChange ConnectionState -> m () handleChange (SC Closed Opening) = return () handleChange (SC Opening Closed) = return () handleChange (SC Closed Open) = return () where the last line would yield a type checking error at compile time, and the compiler can warn about handleChange not being exhaustive (for the valid state change steps)? Nicolas _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe