-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | A solution to boolean blindness.
--   
--   Please see README.md.
@package choice
@version 0.2.4.1

-- | Represent do/don't, is/isn't, with/without flags with Choice.
--   
--   Boolean blindness refers to the problem that boolean literals
--   on their own aren't very informative. In any given context, what does
--   True mean? What does False mean? Instead of passing
--   arguments of type Bool to functions, consider using
--   Choice.
--   
--   Choice is the type of labeled booleans. Use it as follows:
--   
--   
--   {-# LANGUAGE DataKinds #-}
--   {-# LANGUAGE OverloadedLabels #-}
--   {-# LANGUAGE PatternSynonyms #-}
--   
--   import Data.Choice (Choice, pattern Do, pattern Don't)
--   
--   -- Blocking read: block until N bytes available.
--   -- Non-blocking: return as many bytes as are available.
--   readBytes :: Handle -> Choice "block" -> Int -> IO ByteString
--   readBytes = ...
--   
--   action1 = print =<< readBytes h (Don't #block) 1024
--   
--   
--   For GHC < 8.0, where overloaded labels are not available,
--   substitute (Label :: Label "block") for #block.
--   
--   A comment on labels: why use labels? We could as well ask the
--   user to define ad hoc constructors. But unlike constructors, labels
--   are guaranteed to be singletons. That's exactly what we want: a label
--   doesn't carry any runtime information, it's just a type annotation.
--   Better yet, with labels, there is no need to ensure that constructor
--   names are unique, nor to pollute the precious constructor namespace in
--   a large module with many flags.
module Data.Choice

-- | A labeled boolean choice.
data Choice (a :: Symbol)
fromBool :: forall (a :: Symbol). Bool -> Choice a
toBool :: forall (a :: Symbol). Choice a -> Bool
isFalse :: forall (a :: Symbol). Choice a -> Bool
isTrue :: forall (a :: Symbol). Choice a -> Bool

-- | Case analysis for the Choice type. choice x y p
--   evaluates to x when p is false, and evaluates to
--   y when p is true.
--   
--   This is equivalent to bool x y (toBool p).
choice :: forall a (b :: Symbol). a -> a -> Choice b -> a

-- | Alias for True, e.g. Do #block.
pattern Do :: Label a -> Choice a

-- | Alias for False, e.g. Don't #block.
pattern Don't :: Label a -> Choice a

-- | Alias for True, e.g. Is #ordered.
pattern Is :: Label a -> Choice a

-- | Alias for False, e.g. Isn't #ordered.
pattern Isn't :: Label a -> Choice a

-- | Alias for True, e.g. With #ownDirectory.
pattern With :: Label a -> Choice a

-- | Alias for False, e.g. Without #ownDirectory.
pattern Without :: Label a -> Choice a

-- | Alias for True, e.g. Must #succeed.
pattern Must :: Label a -> Choice a

-- | Alias for False, e.g. Mustn't #succeed.
pattern Mustn't :: Label a -> Choice a

-- | Alias for False, e.g. Needn't #succeed.

-- | Deprecated: Use Can or Can't.
pattern Needn't :: Label a -> Choice a

-- | Alias for True, e.g. Can #fail.
pattern Can :: Label a -> Choice a

-- | Alias for False, e.g. Can't #fail.
pattern Can't :: Label a -> Choice a

-- | Alias for True, e.g. Should #succeed.
pattern Should :: Label a -> Choice a

-- | Alias for False, e.g. Shouldn't #succeed.
pattern Shouldn't :: Label a -> Choice a

-- | A synonym for Proxy.
data Label (a :: Symbol)
Label :: Label (a :: Symbol)
instance GHC.Internal.Enum.Bounded (Data.Choice.Choice a)
instance GHC.Internal.Enum.Enum (Data.Choice.Choice a)
instance GHC.Classes.Eq (Data.Choice.Choice a)
instance GHC.Classes.Eq (Data.Choice.Label a)
instance GHC.Internal.Generics.Generic (Data.Choice.Choice a)
instance (x GHC.Types.~ x') => GHC.Internal.OverloadedLabels.IsLabel x (Data.Choice.Label x')
instance GHC.Classes.Ord (Data.Choice.Choice a)
instance GHC.Classes.Ord (Data.Choice.Label a)
instance GHC.Internal.Show.Show (Data.Choice.Choice a)
instance GHC.Internal.Show.Show (Data.Choice.Label a)
