packages feed

minesweeper-0.9: When.hs

{-# LANGUAGE ExistentialQuantification #-}

module When
    ( Timed
    , When (Now, At, Later, AfterEval)
    ) where

import Data.Time.Clock
import Data.Time.Format()

--------------

type Timed e 
    = (When, e)

data When
    =            Now
    |            At        UTCTime
    |            Later     NominalDiffTime
    | forall a . AfterEval a

instance Show When where
    show Now = "Now"
    show (At t) = "At " ++ show t
    show (Later t) = "Later " ++ show t
    show (AfterEval _) = "AfterEval _"