From 4866f2e367dfcf22a9591231ba40948826a1b438 Mon Sep 17 00:00:00 2001 From: Spencer Janssen Date: Thu, 1 Nov 2007 21:10:59 +0100 Subject: Hierarchify darcs-hash:20071101201059-a5988-fc1f1262bec1b69e13ba18ae7cefeafc8c4471d4.gz --- Invisible.hs | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 Invisible.hs (limited to 'Invisible.hs') diff --git a/Invisible.hs b/Invisible.hs deleted file mode 100644 index 5ee9c25..0000000 --- a/Invisible.hs +++ /dev/null @@ -1,45 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} - ------------------------------------------------------------------------------ --- | --- Module : XMonadContrib.Invisible --- Copyright : (c) 2007 Andrea Rossato, David Roundy --- License : BSD-style (see xmonad/LICENSE) --- --- Maintainer : andrea.rossato@unibz.it, droundy@darcs.net --- Stability : unstable --- Portability : unportable --- --- A data type to store the layout state --- ------------------------------------------------------------------------------ - -module XMonadContrib.Invisible ( - -- * Usage: - -- $usage - Invisible (..) - , whenIJust - , fromIMaybe - ) where - --- $usage --- A wrapper data type to store layout state that shouldn't be persisted across --- restarts. A common wrapped type to use is @Maybe a@. --- Invisible derives trivial definitions for Read and Show, so the wrapped data --- type need not do so. - -newtype Invisible m a = I (m a) deriving (Monad, Functor) - -instance (Functor m, Monad m) => Read (Invisible m a) where - readsPrec _ s = [(fail "Read Invisible", s)] - -instance Monad m => Show (Invisible m a) where - show _ = "" - -whenIJust :: (Monad m) => Invisible Maybe a -> (a -> m ()) -> m () -whenIJust (I (Just x)) f = f x -whenIJust (I Nothing) _ = return () - -fromIMaybe :: a -> Invisible Maybe a -> a -fromIMaybe _ (I (Just x)) = x -fromIMaybe a (I Nothing) = a -- cgit v1.2.3