{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE Trustworthy #-}

-----------------------------------------------------------------------------
-- |
-- Module      :  Data.Functor.Const
-- Copyright   :  Conor McBride and Ross Paterson 2005
-- License     :  BSD-style (see the LICENSE file in the distribution)
--
-- Maintainer  :  libraries@haskell.org
-- Stability   :  stable
-- Portability :  portable

-- The 'Const' functor.
--
-- @since 4.9.0.0

module Data.Functor.Const (Const(..)) where

import Data.Bits (Bits, FiniteBits)
import Data.Foldable (Foldable(foldMap))
import Foreign.Storable (Storable)

import GHC.Ix (Ix)
import GHC.Base
import GHC.Enum (Bounded, Enum)
import GHC.Float (Floating, RealFloat)
import GHC.Generics (Generic, Generic1)
import GHC.Num (Num)
import GHC.Real (Fractional, Integral, Real, RealFrac)
import GHC.Read (Read(readsPrec), readParen, lex)
import GHC.Show (Show(showsPrec), showParen, showString)

-- | The 'Const' functor.
newtype Const a b = Const { forall {k} a (b :: k). Const a b -> a
getConst :: a }
    deriving ( Eq (Const a b)
Const a b
Eq (Const a b)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Int -> Const a b)
-> (Const a b -> Int -> Const a b)
-> Const a b
-> (Int -> Const a b)
-> (Const a b -> Int -> Const a b)
-> (Const a b -> Int -> Const a b)
-> (Const a b -> Int -> Const a b)
-> (Const a b -> Int -> Bool)
-> (Const a b -> Maybe Int)
-> (Const a b -> Int)
-> (Const a b -> Bool)
-> (Const a b -> Int -> Const a b)
-> (Const a b -> Int -> Const a b)
-> (Const a b -> Int -> Const a b)
-> (Const a b -> Int -> Const a b)
-> (Const a b -> Int -> Const a b)
-> (Const a b -> Int -> Const a b)
-> (Const a b -> Int)
-> Bits (Const a b)
Int -> Const a b
Const a b -> Bool
Const a b -> Int
Const a b -> Maybe Int
Const a b -> Const a b
Const a b -> Int -> Bool
Const a b -> Int -> Const a b
Const a b -> Const a b -> Const a b
forall a.
Eq a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> a
-> (Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> Bool)
-> (a -> Maybe Int)
-> (a -> Int)
-> (a -> Bool)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int)
-> Bits a
forall {a} {k} {b :: k}. Bits a => Eq (Const a b)
forall a k (b :: k). Bits a => Const a b
forall a k (b :: k). Bits a => Int -> Const a b
forall a k (b :: k). Bits a => Const a b -> Bool
forall a k (b :: k). Bits a => Const a b -> Int
forall a k (b :: k). Bits a => Const a b -> Maybe Int
forall a k (b :: k). Bits a => Const a b -> Const a b
forall a k (b :: k). Bits a => Const a b -> Int -> Bool
forall a k (b :: k). Bits a => Const a b -> Int -> Const a b
forall a k (b :: k). Bits a => Const a b -> Const a b -> Const a b
$c.&. :: forall a k (b :: k). Bits a => Const a b -> Const a b -> Const a b
.&. :: Const a b -> Const a b -> Const a b
$c.|. :: forall a k (b :: k). Bits a => Const a b -> Const a b -> Const a b
.|. :: Const a b -> Const a b -> Const a b
$cxor :: forall a k (b :: k). Bits a => Const a b -> Const a b -> Const a b
xor :: Const a b -> Const a b -> Const a b
$ccomplement :: forall a k (b :: k). Bits a => Const a b -> Const a b
complement :: Const a b -> Const a b
$cshift :: forall a k (b :: k). Bits a => Const a b -> Int -> Const a b
shift :: Const a b -> Int -> Const a b
$crotate :: forall a k (b :: k). Bits a => Const a b -> Int -> Const a b
rotate :: Const a b -> Int -> Const a b
$czeroBits :: forall a k (b :: k). Bits a => Const a b
zeroBits :: Const a b
$cbit :: forall a k (b :: k). Bits a => Int -> Const a b
bit :: Int -> Const a b
$csetBit :: forall a k (b :: k). Bits a => Const a b -> Int -> Const a b
setBit :: Const a b -> Int -> Const a b
$cclearBit :: forall a k (b :: k). Bits a => Const a b -> Int -> Const a b
clearBit :: Const a b -> Int -> Const a b
$ccomplementBit :: forall a k (b :: k). Bits a => Const a b -> Int -> Const a b
complementBit :: Const a b -> Int -> Const a b
$ctestBit :: forall a k (b :: k). Bits a => Const a b -> Int -> Bool
testBit :: Const a b -> Int -> Bool
$cbitSizeMaybe :: forall a k (b :: k). Bits a => Const a b -> Maybe Int
bitSizeMaybe :: Const a b -> Maybe Int
$cbitSize :: forall a k (b :: k). Bits a => Const a b -> Int
bitSize :: Const a b -> Int
$cisSigned :: forall a k (b :: k). Bits a => Const a b -> Bool
isSigned :: Const a b -> Bool
$cshiftL :: forall a k (b :: k). Bits a => Const a b -> Int -> Const a b
shiftL :: Const a b -> Int -> Const a b
$cunsafeShiftL :: forall a k (b :: k). Bits a => Const a b -> Int -> Const a b
unsafeShiftL :: Const a b -> Int -> Const a b
$cshiftR :: forall a k (b :: k). Bits a => Const a b -> Int -> Const a b
shiftR :: Const a b -> Int -> Const a b
$cunsafeShiftR :: forall a k (b :: k). Bits a => Const a b -> Int -> Const a b
unsafeShiftR :: Const a b -> Int -> Const a b
$crotateL :: forall a k (b :: k). Bits a => Const a b -> Int -> Const a b
rotateL :: Const a b -> Int -> Const a b
$crotateR :: forall a k (b :: k). Bits a => Const a b -> Int -> Const a b
rotateR :: Const a b -> Int -> Const a b
$cpopCount :: forall a k (b :: k). Bits a => Const a b -> Int
popCount :: Const a b -> Int
Bits       -- ^ @since 4.9.0.0
             , Const a b
Const a b -> Const a b -> Bounded (Const a b)
forall a. a -> a -> Bounded a
forall a k (b :: k). Bounded a => Const a b
$cminBound :: forall a k (b :: k). Bounded a => Const a b
minBound :: Const a b
$cmaxBound :: forall a k (b :: k). Bounded a => Const a b
maxBound :: Const a b
Bounded    -- ^ @since 4.9.0.0
             , Int -> Const a b
Const a b -> Int
Const a b -> [Const a b]
Const a b -> Const a b
Const a b -> Const a b -> [Const a b]
Const a b -> Const a b -> Const a b -> [Const a b]
(Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Int -> Const a b)
-> (Const a b -> Int)
-> (Const a b -> [Const a b])
-> (Const a b -> Const a b -> [Const a b])
-> (Const a b -> Const a b -> [Const a b])
-> (Const a b -> Const a b -> Const a b -> [Const a b])
-> Enum (Const a b)
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
forall a k (b :: k). Enum a => Int -> Const a b
forall a k (b :: k). Enum a => Const a b -> Int
forall a k (b :: k). Enum a => Const a b -> [Const a b]
forall a k (b :: k). Enum a => Const a b -> Const a b
forall a k (b :: k).
Enum a =>
Const a b -> Const a b -> [Const a b]
forall a k (b :: k).
Enum a =>
Const a b -> Const a b -> Const a b -> [Const a b]
$csucc :: forall a k (b :: k). Enum a => Const a b -> Const a b
succ :: Const a b -> Const a b
$cpred :: forall a k (b :: k). Enum a => Const a b -> Const a b
pred :: Const a b -> Const a b
$ctoEnum :: forall a k (b :: k). Enum a => Int -> Const a b
toEnum :: Int -> Const a b
$cfromEnum :: forall a k (b :: k). Enum a => Const a b -> Int
fromEnum :: Const a b -> Int
$cenumFrom :: forall a k (b :: k). Enum a => Const a b -> [Const a b]
enumFrom :: Const a b -> [Const a b]
$cenumFromThen :: forall a k (b :: k).
Enum a =>
Const a b -> Const a b -> [Const a b]
enumFromThen :: Const a b -> Const a b -> [Const a b]
$cenumFromTo :: forall a k (b :: k).
Enum a =>
Const a b -> Const a b -> [Const a b]
enumFromTo :: Const a b -> Const a b -> [Const a b]
$cenumFromThenTo :: forall a k (b :: k).
Enum a =>
Const a b -> Const a b -> Const a b -> [Const a b]
enumFromThenTo :: Const a b -> Const a b -> Const a b -> [Const a b]
Enum       -- ^ @since 4.9.0.0
             , Const a b -> Const a b -> Bool
(Const a b -> Const a b -> Bool)
-> (Const a b -> Const a b -> Bool) -> Eq (Const a b)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall a k (b :: k). Eq a => Const a b -> Const a b -> Bool
$c== :: forall a k (b :: k). Eq a => Const a b -> Const a b -> Bool
== :: Const a b -> Const a b -> Bool
$c/= :: forall a k (b :: k). Eq a => Const a b -> Const a b -> Bool
/= :: Const a b -> Const a b -> Bool
Eq         -- ^ @since 4.9.0.0
             , Bits (Const a b)
Bits (Const a b)
-> (Const a b -> Int)
-> (Const a b -> Int)
-> (Const a b -> Int)
-> FiniteBits (Const a b)
Const a b -> Int
forall b.
Bits b -> (b -> Int) -> (b -> Int) -> (b -> Int) -> FiniteBits b
forall {a} {k} {b :: k}. FiniteBits a => Bits (Const a b)
forall a k (b :: k). FiniteBits a => Const a b -> Int
$cfiniteBitSize :: forall a k (b :: k). FiniteBits a => Const a b -> Int
finiteBitSize :: Const a b -> Int
$ccountLeadingZeros :: forall a k (b :: k). FiniteBits a => Const a b -> Int
countLeadingZeros :: Const a b -> Int
$ccountTrailingZeros :: forall a k (b :: k). FiniteBits a => Const a b -> Int
countTrailingZeros :: Const a b -> Int
FiniteBits -- ^ @since 4.9.0.0
             , Fractional (Const a b)
Const a b
Fractional (Const a b)
-> Const a b
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> Floating (Const a b)
Const a b -> Const a b
Const a b -> Const a b -> Const a b
forall a.
Fractional a
-> a
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> Floating a
forall {a} {k} {b :: k}. Floating a => Fractional (Const a b)
forall a k (b :: k). Floating a => Const a b
forall a k (b :: k). Floating a => Const a b -> Const a b
forall a k (b :: k).
Floating a =>
Const a b -> Const a b -> Const a b
$cpi :: forall a k (b :: k). Floating a => Const a b
pi :: Const a b
$cexp :: forall a k (b :: k). Floating a => Const a b -> Const a b
exp :: Const a b -> Const a b
$clog :: forall a k (b :: k). Floating a => Const a b -> Const a b
log :: Const a b -> Const a b
$csqrt :: forall a k (b :: k). Floating a => Const a b -> Const a b
sqrt :: Const a b -> Const a b
$c** :: forall a k (b :: k).
Floating a =>
Const a b -> Const a b -> Const a b
** :: Const a b -> Const a b -> Const a b
$clogBase :: forall a k (b :: k).
Floating a =>
Const a b -> Const a b -> Const a b
logBase :: Const a b -> Const a b -> Const a b
$csin :: forall a k (b :: k). Floating a => Const a b -> Const a b
sin :: Const a b -> Const a b
$ccos :: forall a k (b :: k). Floating a => Const a b -> Const a b
cos :: Const a b -> Const a b
$ctan :: forall a k (b :: k). Floating a => Const a b -> Const a b
tan :: Const a b -> Const a b
$casin :: forall a k (b :: k). Floating a => Const a b -> Const a b
asin :: Const a b -> Const a b
$cacos :: forall a k (b :: k). Floating a => Const a b -> Const a b
acos :: Const a b -> Const a b
$catan :: forall a k (b :: k). Floating a => Const a b -> Const a b
atan :: Const a b -> Const a b
$csinh :: forall a k (b :: k). Floating a => Const a b -> Const a b
sinh :: Const a b -> Const a b
$ccosh :: forall a k (b :: k). Floating a => Const a b -> Const a b
cosh :: Const a b -> Const a b
$ctanh :: forall a k (b :: k). Floating a => Const a b -> Const a b
tanh :: Const a b -> Const a b
$casinh :: forall a k (b :: k). Floating a => Const a b -> Const a b
asinh :: Const a b -> Const a b
$cacosh :: forall a k (b :: k). Floating a => Const a b -> Const a b
acosh :: Const a b -> Const a b
$catanh :: forall a k (b :: k). Floating a => Const a b -> Const a b
atanh :: Const a b -> Const a b
$clog1p :: forall a k (b :: k). Floating a => Const a b -> Const a b
log1p :: Const a b -> Const a b
$cexpm1 :: forall a k (b :: k). Floating a => Const a b -> Const a b
expm1 :: Const a b -> Const a b
$clog1pexp :: forall a k (b :: k). Floating a => Const a b -> Const a b
log1pexp :: Const a b -> Const a b
$clog1mexp :: forall a k (b :: k). Floating a => Const a b -> Const a b
log1mexp :: Const a b -> Const a b
Floating   -- ^ @since 4.9.0.0
             , Num (Const a b)
Num (Const a b)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Rational -> Const a b)
-> Fractional (Const a b)
Rational -> Const a b
Const a b -> Const a b
Const a b -> Const a b -> Const a b
forall a.
Num a
-> (a -> a -> a) -> (a -> a) -> (Rational -> a) -> Fractional a
forall {a} {k} {b :: k}. Fractional a => Num (Const a b)
forall a k (b :: k). Fractional a => Rational -> Const a b
forall a k (b :: k). Fractional a => Const a b -> Const a b
forall a k (b :: k).
Fractional a =>
Const a b -> Const a b -> Const a b
$c/ :: forall a k (b :: k).
Fractional a =>
Const a b -> Const a b -> Const a b
/ :: Const a b -> Const a b -> Const a b
$crecip :: forall a k (b :: k). Fractional a => Const a b -> Const a b
recip :: Const a b -> Const a b
$cfromRational :: forall a k (b :: k). Fractional a => Rational -> Const a b
fromRational :: Rational -> Const a b
Fractional -- ^ @since 4.9.0.0
             , (forall x. Const a b -> Rep (Const a b) x)
-> (forall x. Rep (Const a b) x -> Const a b)
-> Generic (Const a b)
forall x. Rep (Const a b) x -> Const a b
forall x. Const a b -> Rep (Const a b) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a k (b :: k) x. Rep (Const a b) x -> Const a b
forall a k (b :: k) x. Const a b -> Rep (Const a b) x
$cfrom :: forall a k (b :: k) x. Const a b -> Rep (Const a b) x
$cto :: forall a k (b :: k) x. Rep (Const a b) x -> Const a b
Generic    -- ^ @since 4.9.0.0
             , (forall (a :: k). Const a a -> Rep1 (Const a) a)
-> (forall (a :: k). Rep1 (Const a) a -> Const a a)
-> Generic1 (Const a)
forall (a :: k). Rep1 (Const a) a -> Const a a
forall (a :: k). Const a a -> Rep1 (Const a) a
forall k a (a :: k). Rep1 (Const a) a -> Const a a
forall k a (a :: k). Const a a -> Rep1 (Const a) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cfrom1 :: forall k a (a :: k). Const a a -> Rep1 (Const a) a
$cto1 :: forall k a (a :: k). Rep1 (Const a) a -> Const a a
Generic1   -- ^ @since 4.9.0.0
             , Enum (Const a b)
Real (Const a b)
Real (Const a b)
-> Enum (Const a b)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b -> (Const a b, Const a b))
-> (Const a b -> Const a b -> (Const a b, Const a b))
-> (Const a b -> Integer)
-> Integral (Const a b)
Const a b -> Integer
Const a b -> Const a b -> (Const a b, Const a b)
Const a b -> Const a b -> Const a b
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
forall {a} {k} {b :: k}. Integral a => Enum (Const a b)
forall {a} {k} {b :: k}. Integral a => Real (Const a b)
forall a k (b :: k). Integral a => Const a b -> Integer
forall a k (b :: k).
Integral a =>
Const a b -> Const a b -> (Const a b, Const a b)
forall a k (b :: k).
Integral a =>
Const a b -> Const a b -> Const a b
$cquot :: forall a k (b :: k).
Integral a =>
Const a b -> Const a b -> Const a b
quot :: Const a b -> Const a b -> Const a b
$crem :: forall a k (b :: k).
Integral a =>
Const a b -> Const a b -> Const a b
rem :: Const a b -> Const a b -> Const a b
$cdiv :: forall a k (b :: k).
Integral a =>
Const a b -> Const a b -> Const a b
div :: Const a b -> Const a b -> Const a b
$cmod :: forall a k (b :: k).
Integral a =>
Const a b -> Const a b -> Const a b
mod :: Const a b -> Const a b -> Const a b
$cquotRem :: forall a k (b :: k).
Integral a =>
Const a b -> Const a b -> (Const a b, Const a b)
quotRem :: Const a b -> Const a b -> (Const a b, Const a b)
$cdivMod :: forall a k (b :: k).
Integral a =>
Const a b -> Const a b -> (Const a b, Const a b)
divMod :: Const a b -> Const a b -> (Const a b, Const a b)
$ctoInteger :: forall a k (b :: k). Integral a => Const a b -> Integer
toInteger :: Const a b -> Integer
Integral   -- ^ @since 4.9.0.0
             , Ord (Const a b)
Ord (Const a b)
-> ((Const a b, Const a b) -> [Const a b])
-> ((Const a b, Const a b) -> Const a b -> Int)
-> ((Const a b, Const a b) -> Const a b -> Int)
-> ((Const a b, Const a b) -> Const a b -> Bool)
-> ((Const a b, Const a b) -> Int)
-> ((Const a b, Const a b) -> Int)
-> Ix (Const a b)
(Const a b, Const a b) -> Int
(Const a b, Const a b) -> [Const a b]
(Const a b, Const a b) -> Const a b -> Bool
(Const a b, Const a b) -> Const a b -> Int
forall a.
Ord a
-> ((a, a) -> [a])
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Bool)
-> ((a, a) -> Int)
-> ((a, a) -> Int)
-> Ix a
forall {a} {k} {b :: k}. Ix a => Ord (Const a b)
forall a k (b :: k). Ix a => (Const a b, Const a b) -> Int
forall a k (b :: k). Ix a => (Const a b, Const a b) -> [Const a b]
forall a k (b :: k).
Ix a =>
(Const a b, Const a b) -> Const a b -> Bool
forall a k (b :: k).
Ix a =>
(Const a b, Const a b) -> Const a b -> Int
$crange :: forall a k (b :: k). Ix a => (Const a b, Const a b) -> [Const a b]
range :: (Const a b, Const a b) -> [Const a b]
$cindex :: forall a k (b :: k).
Ix a =>
(Const a b, Const a b) -> Const a b -> Int
index :: (Const a b, Const a b) -> Const a b -> Int
$cunsafeIndex :: forall a k (b :: k).
Ix a =>
(Const a b, Const a b) -> Const a b -> Int
unsafeIndex :: (Const a b, Const a b) -> Const a b -> Int
$cinRange :: forall a k (b :: k).
Ix a =>
(Const a b, Const a b) -> Const a b -> Bool
inRange :: (Const a b, Const a b) -> Const a b -> Bool
$crangeSize :: forall a k (b :: k). Ix a => (Const a b, Const a b) -> Int
rangeSize :: (Const a b, Const a b) -> Int
$cunsafeRangeSize :: forall a k (b :: k). Ix a => (Const a b, Const a b) -> Int
unsafeRangeSize :: (Const a b, Const a b) -> Int
Ix         -- ^ @since 4.9.0.0
             , NonEmpty (Const a b) -> Const a b
Const a b -> Const a b -> Const a b
(Const a b -> Const a b -> Const a b)
-> (NonEmpty (Const a b) -> Const a b)
-> (forall b. Integral b => b -> Const a b -> Const a b)
-> Semigroup (Const a b)
forall b. Integral b => b -> Const a b -> Const a b
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
forall a k (b :: k).
Semigroup a =>
NonEmpty (Const a b) -> Const a b
forall a k (b :: k).
Semigroup a =>
Const a b -> Const a b -> Const a b
forall a k (b :: k) b.
(Semigroup a, Integral b) =>
b -> Const a b -> Const a b
$c<> :: forall a k (b :: k).
Semigroup a =>
Const a b -> Const a b -> Const a b
<> :: Const a b -> Const a b -> Const a b
$csconcat :: forall a k (b :: k).
Semigroup a =>
NonEmpty (Const a b) -> Const a b
sconcat :: NonEmpty (Const a b) -> Const a b
$cstimes :: forall a k (b :: k) b.
(Semigroup a, Integral b) =>
b -> Const a b -> Const a b
stimes :: forall b. Integral b => b -> Const a b -> Const a b
Semigroup  -- ^ @since 4.9.0.0
             , Semigroup (Const a b)
Const a b
Semigroup (Const a b)
-> Const a b
-> (Const a b -> Const a b -> Const a b)
-> ([Const a b] -> Const a b)
-> Monoid (Const a b)
[Const a b] -> Const a b
Const a b -> Const a b -> Const a b
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall {a} {k} {b :: k}. Monoid a => Semigroup (Const a b)
forall a k (b :: k). Monoid a => Const a b
forall a k (b :: k). Monoid a => [Const a b] -> Const a b
forall a k (b :: k).
Monoid a =>
Const a b -> Const a b -> Const a b
$cmempty :: forall a k (b :: k). Monoid a => Const a b
mempty :: Const a b
$cmappend :: forall a k (b :: k).
Monoid a =>
Const a b -> Const a b -> Const a b
mappend :: Const a b -> Const a b -> Const a b
$cmconcat :: forall a k (b :: k). Monoid a => [Const a b] -> Const a b
mconcat :: [Const a b] -> Const a b
Monoid     -- ^ @since 4.9.0.0
             , Integer -> Const a b
Const a b -> Const a b
Const a b -> Const a b -> Const a b
(Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Const a b -> Const a b)
-> (Integer -> Const a b)
-> Num (Const a b)
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
forall a k (b :: k). Num a => Integer -> Const a b
forall a k (b :: k). Num a => Const a b -> Const a b
forall a k (b :: k). Num a => Const a b -> Const a b -> Const a b
$c+ :: forall a k (b :: k). Num a => Const a b -> Const a b -> Const a b
+ :: Const a b -> Const a b -> Const a b
$c- :: forall a k (b :: k). Num a => Const a b -> Const a b -> Const a b
- :: Const a b -> Const a b -> Const a b
$c* :: forall a k (b :: k). Num a => Const a b -> Const a b -> Const a b
* :: Const a b -> Const a b -> Const a b
$cnegate :: forall a k (b :: k). Num a => Const a b -> Const a b
negate :: Const a b -> Const a b
$cabs :: forall a k (b :: k). Num a => Const a b -> Const a b
abs :: Const a b -> Const a b
$csignum :: forall a k (b :: k). Num a => Const a b -> Const a b
signum :: Const a b -> Const a b
$cfromInteger :: forall a k (b :: k). Num a => Integer -> Const a b
fromInteger :: Integer -> Const a b
Num        -- ^ @since 4.9.0.0
             , Eq (Const a b)
Eq (Const a b)
-> (Const a b -> Const a b -> Ordering)
-> (Const a b -> Const a b -> Bool)
-> (Const a b -> Const a b -> Bool)
-> (Const a b -> Const a b -> Bool)
-> (Const a b -> Const a b -> Bool)
-> (Const a b -> Const a b -> Const a b)
-> (Const a b -> Const a b -> Const a b)
-> Ord (Const a b)
Const a b -> Const a b -> Bool
Const a b -> Const a b -> Ordering
Const a b -> Const a b -> Const a b
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a} {k} {b :: k}. Ord a => Eq (Const a b)
forall a k (b :: k). Ord a => Const a b -> Const a b -> Bool
forall a k (b :: k). Ord a => Const a b -> Const a b -> Ordering
forall a k (b :: k). Ord a => Const a b -> Const a b -> Const a b
$ccompare :: forall a k (b :: k). Ord a => Const a b -> Const a b -> Ordering
compare :: Const a b -> Const a b -> Ordering
$c< :: forall a k (b :: k). Ord a => Const a b -> Const a b -> Bool
< :: Const a b -> Const a b -> Bool
$c<= :: forall a k (b :: k). Ord a => Const a b -> Const a b -> Bool
<= :: Const a b -> Const a b -> Bool
$c> :: forall a k (b :: k). Ord a => Const a b -> Const a b -> Bool
> :: Const a b -> Const a b -> Bool
$c>= :: forall a k (b :: k). Ord a => Const a b -> Const a b -> Bool
>= :: Const a b -> Const a b -> Bool
$cmax :: forall a k (b :: k). Ord a => Const a b -> Const a b -> Const a b
max :: Const a b -> Const a b -> Const a b
$cmin :: forall a k (b :: k). Ord a => Const a b -> Const a b -> Const a b
min :: Const a b -> Const a b -> Const a b
Ord        -- ^ @since 4.9.0.0
             , Num (Const a b)
Ord (Const a b)
Num (Const a b)
-> Ord (Const a b) -> (Const a b -> Rational) -> Real (Const a b)
Const a b -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
forall {a} {k} {b :: k}. Real a => Num (Const a b)
forall {a} {k} {b :: k}. Real a => Ord (Const a b)
forall a k (b :: k). Real a => Const a b -> Rational
$ctoRational :: forall a k (b :: k). Real a => Const a b -> Rational
toRational :: Const a b -> Rational
Real       -- ^ @since 4.9.0.0
             , Fractional (Const a b)
Real (Const a b)
Real (Const a b)
-> Fractional (Const a b)
-> (forall b. Integral b => Const a b -> (b, Const a b))
-> (forall b. Integral b => Const a b -> b)
-> (forall b. Integral b => Const a b -> b)
-> (forall b. Integral b => Const a b -> b)
-> (forall b. Integral b => Const a b -> b)
-> RealFrac (Const a b)
forall b. Integral b => Const a b -> b
forall b. Integral b => Const a b -> (b, Const a b)
forall a.
Real a
-> Fractional a
-> (forall b. Integral b => a -> (b, a))
-> (forall b. Integral b => a -> b)
-> (forall b. Integral b => a -> b)
-> (forall b. Integral b => a -> b)
-> (forall b. Integral b => a -> b)
-> RealFrac a
forall {a} {k} {b :: k}. RealFrac a => Fractional (Const a b)
forall {a} {k} {b :: k}. RealFrac a => Real (Const a b)
forall a k (b :: k) b. (RealFrac a, Integral b) => Const a b -> b
forall a k (b :: k) b.
(RealFrac a, Integral b) =>
Const a b -> (b, Const a b)
$cproperFraction :: forall a k (b :: k) b.
(RealFrac a, Integral b) =>
Const a b -> (b, Const a b)
properFraction :: forall b. Integral b => Const a b -> (b, Const a b)
$ctruncate :: forall a k (b :: k) b. (RealFrac a, Integral b) => Const a b -> b
truncate :: forall b. Integral b => Const a b -> b
$cround :: forall a k (b :: k) b. (RealFrac a, Integral b) => Const a b -> b
round :: forall b. Integral b => Const a b -> b
$cceiling :: forall a k (b :: k) b. (RealFrac a, Integral b) => Const a b -> b
ceiling :: forall b. Integral b => Const a b -> b
$cfloor :: forall a k (b :: k) b. (RealFrac a, Integral b) => Const a b -> b
floor :: forall b. Integral b => Const a b -> b
RealFrac   -- ^ @since 4.9.0.0
             , Floating (Const a b)
RealFrac (Const a b)
RealFrac (Const a b)
-> Floating (Const a b)
-> (Const a b -> Integer)
-> (Const a b -> Int)
-> (Const a b -> (Int, Int))
-> (Const a b -> (Integer, Int))
-> (Integer -> Int -> Const a b)
-> (Const a b -> Int)
-> (Const a b -> Const a b)
-> (Int -> Const a b -> Const a b)
-> (Const a b -> Bool)
-> (Const a b -> Bool)
-> (Const a b -> Bool)
-> (Const a b -> Bool)
-> (Const a b -> Bool)
-> (Const a b -> Const a b -> Const a b)
-> RealFloat (Const a b)
Int -> Const a b -> Const a b
Integer -> Int -> Const a b
Const a b -> Bool
Const a b -> Int
Const a b -> Integer
Const a b -> (Int, Int)
Const a b -> (Integer, Int)
Const a b -> Const a b
Const a b -> Const a b -> Const a b
forall a.
RealFrac a
-> Floating a
-> (a -> Integer)
-> (a -> Int)
-> (a -> (Int, Int))
-> (a -> (Integer, Int))
-> (Integer -> Int -> a)
-> (a -> Int)
-> (a -> a)
-> (Int -> a -> a)
-> (a -> Bool)
-> (a -> Bool)
-> (a -> Bool)
-> (a -> Bool)
-> (a -> Bool)
-> (a -> a -> a)
-> RealFloat a
forall {a} {k} {b :: k}. RealFloat a => Floating (Const a b)
forall {a} {k} {b :: k}. RealFloat a => RealFrac (Const a b)
forall a k (b :: k). RealFloat a => Int -> Const a b -> Const a b
forall a k (b :: k). RealFloat a => Integer -> Int -> Const a b
forall a k (b :: k). RealFloat a => Const a b -> Bool
forall a k (b :: k). RealFloat a => Const a b -> Int
forall a k (b :: k). RealFloat a => Const a b -> Integer
forall a k (b :: k). RealFloat a => Const a b -> (Int, Int)
forall a k (b :: k). RealFloat a => Const a b -> (Integer, Int)
forall a k (b :: k). RealFloat a => Const a b -> Const a b
forall a k (b :: k).
RealFloat a =>
Const a b -> Const a b -> Const a b
$cfloatRadix :: forall a k (b :: k). RealFloat a => Const a b -> Integer
floatRadix :: Const a b -> Integer
$cfloatDigits :: forall a k (b :: k). RealFloat a => Const a b -> Int
floatDigits :: Const a b -> Int
$cfloatRange :: forall a k (b :: k). RealFloat a => Const a b -> (Int, Int)
floatRange :: Const a b -> (Int, Int)
$cdecodeFloat :: forall a k (b :: k). RealFloat a => Const a b -> (Integer, Int)
decodeFloat :: Const a b -> (Integer, Int)
$cencodeFloat :: forall a k (b :: k). RealFloat a => Integer -> Int -> Const a b
encodeFloat :: Integer -> Int -> Const a b
$cexponent :: forall a k (b :: k). RealFloat a => Const a b -> Int
exponent :: Const a b -> Int
$csignificand :: forall a k (b :: k). RealFloat a => Const a b -> Const a b
significand :: Const a b -> Const a b
$cscaleFloat :: forall a k (b :: k). RealFloat a => Int -> Const a b -> Const a b
scaleFloat :: Int -> Const a b -> Const a b
$cisNaN :: forall a k (b :: k). RealFloat a => Const a b -> Bool
isNaN :: Const a b -> Bool
$cisInfinite :: forall a k (b :: k). RealFloat a => Const a b -> Bool
isInfinite :: Const a b -> Bool
$cisDenormalized :: forall a k (b :: k). RealFloat a => Const a b -> Bool
isDenormalized :: Const a b -> Bool
$cisNegativeZero :: forall a k (b :: k). RealFloat a => Const a b -> Bool
isNegativeZero :: Const a b -> Bool
$cisIEEE :: forall a k (b :: k). RealFloat a => Const a b -> Bool
isIEEE :: Const a b -> Bool
$catan2 :: forall a k (b :: k).
RealFloat a =>
Const a b -> Const a b -> Const a b
atan2 :: Const a b -> Const a b -> Const a b
RealFloat  -- ^ @since 4.9.0.0
             , Ptr (Const a b) -> IO (Const a b)
Ptr (Const a b) -> Int -> IO (Const a b)
Ptr (Const a b) -> Int -> Const a b -> IO ()
Ptr (Const a b) -> Const a b -> IO ()
Const a b -> Int
(Const a b -> Int)
-> (Const a b -> Int)
-> (Ptr (Const a b) -> Int -> IO (Const a b))
-> (Ptr (Const a b) -> Int -> Const a b -> IO ())
-> (forall b. Ptr b -> Int -> IO (Const a b))
-> (forall b. Ptr b -> Int -> Const a b -> IO ())
-> (Ptr (Const a b) -> IO (Const a b))
-> (Ptr (Const a b) -> Const a b -> IO ())
-> Storable (Const a b)
forall b. Ptr b -> Int -> IO (Const a b)
forall b. Ptr b -> Int -> Const a b -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
forall a k (b :: k).
Storable a =>
Ptr (Const a b) -> IO (Const a b)
forall a k (b :: k).
Storable a =>
Ptr (Const a b) -> Int -> IO (Const a b)
forall a k (b :: k).
Storable a =>
Ptr (Const a b) -> Int -> Const a b -> IO ()
forall a k (b :: k).
Storable a =>
Ptr (Const a b) -> Const a b -> IO ()
forall a k (b :: k). Storable a => Const a b -> Int
forall a k (b :: k) b. Storable a => Ptr b -> Int -> IO (Const a b)
forall a k (b :: k) b.
Storable a =>
Ptr b -> Int -> Const a b -> IO ()
$csizeOf :: forall a k (b :: k). Storable a => Const a b -> Int
sizeOf :: Const a b -> Int
$calignment :: forall a k (b :: k). Storable a => Const a b -> Int
alignment :: Const a b -> Int
$cpeekElemOff :: forall a k (b :: k).
Storable a =>
Ptr (Const a b) -> Int -> IO (Const a b)
peekElemOff :: Ptr (Const a b) -> Int -> IO (Const a b)
$cpokeElemOff :: forall a k (b :: k).
Storable a =>
Ptr (Const a b) -> Int -> Const a b -> IO ()
pokeElemOff :: Ptr (Const a b) -> Int -> Const a b -> IO ()
$cpeekByteOff :: forall a k (b :: k) b. Storable a => Ptr b -> Int -> IO (Const a b)
peekByteOff :: forall b. Ptr b -> Int -> IO (Const a b)
$cpokeByteOff :: forall a k (b :: k) b.
Storable a =>
Ptr b -> Int -> Const a b -> IO ()
pokeByteOff :: forall b. Ptr b -> Int -> Const a b -> IO ()
$cpeek :: forall a k (b :: k).
Storable a =>
Ptr (Const a b) -> IO (Const a b)
peek :: Ptr (Const a b) -> IO (Const a b)
$cpoke :: forall a k (b :: k).
Storable a =>
Ptr (Const a b) -> Const a b -> IO ()
poke :: Ptr (Const a b) -> Const a b -> IO ()
Storable   -- ^ @since 4.9.0.0
             )

-- | This instance would be equivalent to the derived instances of the
-- 'Const' newtype if the 'getConst' field were removed
--
-- @since 4.8.0.0
instance Read a => Read (Const a b) where
    readsPrec :: Int -> ReadS (Const a b)
readsPrec Int
d = Bool -> ReadS (Const a b) -> ReadS (Const a b)
forall a. Bool -> ReadS a -> ReadS a
readParen (Int
d Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
10)
        (ReadS (Const a b) -> ReadS (Const a b))
-> ReadS (Const a b) -> ReadS (Const a b)
forall a b. (a -> b) -> a -> b
$ \String
r -> [(a -> Const a b
forall {k} a (b :: k). a -> Const a b
Const a
x,String
t) | (String
"Const", String
s) <- ReadS String
lex String
r, (a
x, String
t) <- Int -> ReadS a
forall a. Read a => Int -> ReadS a
readsPrec Int
11 String
s]

-- | This instance would be equivalent to the derived instances of the
-- 'Const' newtype if the 'getConst' field were removed
--
-- @since 4.8.0.0
instance Show a => Show (Const a b) where
    showsPrec :: Int -> Const a b -> ShowS
showsPrec Int
d (Const a
x) = Bool -> ShowS -> ShowS
showParen (Int
d Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
10) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
                            String -> ShowS
showString String
"Const " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 a
x

-- | @since 4.7.0.0
instance Foldable (Const m) where
    foldMap :: forall m a. Monoid m => (a -> m) -> Const m a -> m
foldMap a -> m
_ Const m a
_ = m
forall a. Monoid a => a
mempty

-- | @since 2.01
instance Functor (Const m) where
    fmap :: forall a b. (a -> b) -> Const m a -> Const m b
fmap a -> b
_ (Const m
v) = m -> Const m b
forall {k} a (b :: k). a -> Const a b
Const m
v

-- | @since 2.0.1
instance Monoid m => Applicative (Const m) where
    pure :: forall a. a -> Const m a
pure a
_ = m -> Const m a
forall {k} a (b :: k). a -> Const a b
Const m
forall a. Monoid a => a
mempty
    liftA2 :: forall a b c. (a -> b -> c) -> Const m a -> Const m b -> Const m c
liftA2 a -> b -> c
_ (Const m
x) (Const m
y) = m -> Const m c
forall {k} a (b :: k). a -> Const a b
Const (m
x m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` m
y)
    <*> :: forall a b. Const m (a -> b) -> Const m a -> Const m b
(<*>) = (m -> m -> m) -> Const m (a -> b) -> Const m a -> Const m b
forall a b. Coercible a b => a -> b
coerce (m -> m -> m
forall a. Monoid a => a -> a -> a
mappend :: m -> m -> m)
-- This is pretty much the same as
-- Const f <*> Const v = Const (f `mappend` v)
-- but guarantees that mappend for Const a b will have the same arity
-- as the one for a; it won't create a closure to raise the arity
-- to 2.