[Haskell] ANNOUNCE: reference 0.1

Bas van Dijk v.dijk.bas at gmail.com
Mon Sep 6 20:20:46 EDT 2010


On Tue, Sep 7, 2010 at 2:15 AM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> They do allow some

now finishing my sentence...

The parameterization of α and β in Readable and Writable do allow some
nice instances like:

instance Readable (TMVar α) STM (Maybe α) where
    read = TMVar.tryTakeTMVar

instance Writable (TMVar α) α STM Bool where
    write = TMVar.tryPutTMVar

instance Writable (Chan α) (End α) IO () where
    write t = Chan.unGetChan t ∘ unEnd

-- | Writing @End x@ to a 'Chan' or 'TChan' writes @x@ to the end of the channel
-- instead of to the front. Also see 'unGetChan' and 'unGetTChan'.
newtype End α = End {unEnd ∷ α}

Regards,

Bas


More information about the Haskell mailing list