Skip to content

Instantly share code, notes, and snippets.

@cschneid
Created February 24, 2015 19:33
Show Gist options
  • Select an option

  • Save cschneid/01fae1e7727a2ab8563f to your computer and use it in GitHub Desktop.

Select an option

Save cschneid/01fae1e7727a2ab8563f to your computer and use it in GitHub Desktop.
{-# LANGUAGE DeriveGeneric #-}
module StrawPoll.Types where
import GHC.Generics
import Data.Aeson
data Poll = Poll String
data Counter = Counter { count :: Int } deriving (Show, Generic)
instance Counter ToJSON
instance Counter FromJSON
incrementCounter :: Counter -> Counter
incrementCounter (Counter i) = Counter (i + 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment