Skip to content

Instantly share code, notes, and snippets.

@sordina
sordina / OverloadedStrings.hs
Last active December 18, 2015 02:58
Overloaded Strings Example
{-# LANGUAGE OverloadedStrings #-}
import GHC.Exts ( IsString(..) )
data Foo = A | B | Other String deriving Show
instance IsString Foo where
fromString "A" = A
fromString "B" = B
fromString xs = Other xs