-- 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 <a>Choice</a>.
--   
--   <a>Boolean blindness</a> refers to the problem that boolean literals
--   on their own aren't very informative. In any given context, what does
--   <a>True</a> mean? What does <a>False</a> mean? Instead of passing
--   arguments of type <a>Bool</a> to functions, consider using
--   <a>Choice</a>.
--   
--   <a>Choice</a> is the type of labeled booleans. Use it as follows:
--   
--   <pre>
--   {-# 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 -&gt; Choice "block" -&gt; Int -&gt; IO ByteString
--   readBytes = ...
--   
--   action1 = print =&lt;&lt; readBytes h (Don't #block) 1024
--   </pre>
--   
--   For GHC &lt; 8.0, where overloaded labels are not available,
--   substitute <tt>(Label :: Label "block")</tt> for <tt>#block</tt>.
--   
--   <b>A comment on labels:</b> 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 <a>Choice</a> type. <tt>choice x y p</tt>
--   evaluates to <tt>x</tt> when <tt>p</tt> is false, and evaluates to
--   <tt>y</tt> when <tt>p</tt> is true.
--   
--   This is equivalent to <tt><a>bool</a> x y (<a>toBool</a> p)</tt>.
choice :: forall a (b :: Symbol). a -> a -> Choice b -> a

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

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

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

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

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

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

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

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

-- | Alias for <a>False</a>, e.g. <tt>Needn't #succeed</tt>.

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

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

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

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

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

-- | A synonym for <a>Proxy</a>.
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)
