Type.Hint

type-hint-0.1: Guide type inference with proxy values

Safe Haskell | Safe
Language | Haskell2010

Type.Hint

Contents

- Hinting functions
- Standard types proxies

Description

This module provides `Proxy` values for various types from the `base` library and functions to use these values as hints for type inference.

Synopsis

- hintType :: α -> p α -> α
- hintType1 :: f α -> p f -> f α
- hintTypeArg :: f α -> p α -> f α
- hintType2 :: f α β -> p f -> f α β
- hintType2Arg1 :: f α β -> p α -> f α β
- hintType2Arg2 :: f α β -> p β -> f α β
- hintType3 :: f α β γ -> p f -> f α β γ
- hintType3Arg1 :: f α β γ -> p α -> f α β γ
- hintType3Arg2 :: f α β γ -> p β -> f α β γ
- hintType3Arg3 :: f α β γ -> p γ -> f α β γ
- data Proxy k t :: forall k. k -> * = Proxy
- aUnit :: Proxy ()
- aChar :: Proxy Char
- anInteger :: Proxy Integer
- anInt :: Proxy Int
- anInt8 :: Proxy Int8
- anInt16 :: Proxy Int16
- anInt32 :: Proxy Int32
- anInt64 :: Proxy Int64
- aWord :: Proxy Word
- aWord8 :: Proxy Word8
- aWord16 :: Proxy Word16
- aWord32 :: Proxy Word32
- aWord64 :: Proxy Word64
- aRatio :: Proxy Ratio
- aRatioOf :: Proxy α -> Proxy (Ratio α)
- aRational :: Proxy Rational
- aFixed :: Proxy Fixed
- aFixedOf :: Proxy α -> Proxy (Fixed α)
- aUni :: Proxy Uni
- aDeci :: Proxy Deci
- aCenti :: Proxy Centi
- aMilli :: Proxy Milli
- aMicro :: Proxy Micro
- aNano :: Proxy Nano
- aPico :: Proxy Pico
- aFloat :: Proxy Float
- aDouble :: Proxy Double
- aMaybe :: Proxy Maybe
- aMaybeOf :: Proxy α -> Proxy (Maybe α)
- aPair :: Proxy (,)
- aPairOf :: Proxy α -> Proxy β -> Proxy (α, β)
- aTriple :: Proxy (,,)
- aTripleOf :: Proxy α -> Proxy β -> Proxy γ -> Proxy (α, β, γ)
- anEither :: Proxy Either
- anEitherOf :: Proxy α -> Proxy β -> Proxy (Either α β)
- aList :: Proxy []
- aListOf :: Proxy α -> Proxy [α]
- anIo :: Proxy IO
- anIoOf :: Proxy α -> Proxy (IO α)
- anIoRef :: Proxy IORef
- anIoRefOf :: Proxy α -> Proxy (IORef α)
- anSt :: Proxy ST
- anStOf :: Proxy α -> Proxy (ST α)
- anStRef :: Proxy STRef
- anStRefOf :: Proxy α -> Proxy (STRef α)

# Hinting functions

hintType :: α -> p α -> α infixl 1 #

Hint the type system about the type.

hintType1 :: f α -> p f -> f α infixl 1 #

Hint the type system about the type constructor.

hintTypeArg :: f α -> p α -> f α infixl 1 #

Hint the type system about the type argument.

hintType2 :: f α β -> p f -> f α β infixl 1 #

Hint the type system about the two-argument type constructor.

hintType2Arg1 :: f α β -> p α -> f α β infixl 1 #

Hint the type system about the first type argument.

hintType2Arg2 :: f α β -> p β -> f α β infixl 1 #

Hint the type system about the second type argument.

hintType3 :: f α β γ -> p f -> f α β γ infixl 1 #

Hint the type system about the three-argument type constructor.

hintType3Arg1 :: f α β γ -> p α -> f α β γ infixl 1 #

Hint the type system about the first type argument.

hintType3Arg2 :: f α β γ -> p β -> f α β γ infixl 1 #

Hint the type system about the second type argument.

hintType3Arg3 :: f α β γ -> p γ -> f α β γ infixl 1 #

Hint the type system about the third type argument.

# Standard types proxies

data Proxy k t :: forall k. k -> * #

A concrete, poly-kinded proxy type

Constructors

Proxy |

Instances

Monad (Proxy *) |
Methods (>>=) :: Proxy * a -> (a -> Proxy * b) -> Proxy * b # (>>) :: Proxy * a -> Proxy * b -> Proxy * b # return :: a -> Proxy * a # fail :: String -> Proxy * a #
Functor (Proxy *) |
Methods fmap :: (a -> b) -> Proxy * a -> Proxy * b # (<$) :: a -> Proxy * b -> Proxy * a #
Applicative (Proxy *) |
Methods pure :: a -> Proxy * a # (<*>) :: Proxy * (a -> b) -> Proxy * a -> Proxy * b # (*>) :: Proxy * a -> Proxy * b -> Proxy * b # (<*) :: Proxy * a -> Proxy * b -> Proxy * a #
Alternative (Proxy *) |
Methods empty :: Proxy * a # (<|>) :: Proxy * a -> Proxy * a -> Proxy * a # some :: Proxy * a -> Proxy * [a] # many :: Proxy * a -> Proxy * [a] #
MonadPlus (Proxy *) |
Methods mzero :: Proxy * a # mplus :: Proxy * a -> Proxy * a -> Proxy * a #
Bounded (Proxy k s) |
Methods minBound :: Proxy k s # maxBound :: Proxy k s #
Enum (Proxy k s) |
Methods succ :: Proxy k s -> Proxy k s # pred :: Proxy k s -> Proxy k s # toEnum :: Int -> Proxy k s # fromEnum :: Proxy k s -> Int # enumFrom :: Proxy k s -> [Proxy k s] # enumFromThen :: Proxy k s -> Proxy k s -> [Proxy k s] # enumFromTo :: Proxy k s -> Proxy k s -> [Proxy k s] # enumFromThenTo :: Proxy k s -> Proxy k s -> Proxy k s -> [Proxy k s] #
Eq (Proxy k s) |
Methods (==) :: Proxy k s -> Proxy k s -> Bool # (/=) :: Proxy k s -> Proxy k s -> Bool #
Ord (Proxy k s) |
Methods compare :: Proxy k s -> Proxy k s -> Ordering # (<) :: Proxy k s -> Proxy k s -> Bool # (<=) :: Proxy k s -> Proxy k s -> Bool # (>) :: Proxy k s -> Proxy k s -> Bool # (>=) :: Proxy k s -> Proxy k s -> Bool # max :: Proxy k s -> Proxy k s -> Proxy k s # min :: Proxy k s -> Proxy k s -> Proxy k s #
Read (Proxy k s) |
Methods readsPrec :: Int -> ReadS (Proxy k s) # readList :: ReadS [Proxy k s] # readPrec :: ReadPrec (Proxy k s) # readListPrec :: ReadPrec [Proxy k s] #
Show (Proxy k s) |
Methods showsPrec :: Int -> Proxy k s -> ShowS # show :: Proxy k s -> String # showList :: [Proxy k s] -> ShowS #
Ix (Proxy k s) |
Methods range :: (Proxy k s, Proxy k s) -> [Proxy k s] # index :: (Proxy k s, Proxy k s) -> Proxy k s -> Int # unsafeIndex :: (Proxy k s, Proxy k s) -> Proxy k s -> Int inRange :: (Proxy k s, Proxy k s) -> Proxy k s -> Bool # rangeSize :: (Proxy k s, Proxy k s) -> Int # unsafeRangeSize :: (Proxy k s, Proxy k s) -> Int
Monoid (Proxy k s) |
Methods mempty :: Proxy k s # mappend :: Proxy k s -> Proxy k s -> Proxy k s # mconcat :: [Proxy k s] -> Proxy k s #

aUnit :: Proxy () #

() proxy value.

aChar :: Proxy Char #

`Char` proxy value.

anInteger :: Proxy Integer #

`Integer` proxy value.

anInt :: Proxy Int #

`Int` proxy value.

anInt8 :: Proxy Int8 #

`Int8` proxy value.

anInt16 :: Proxy Int16 #

`Int16` proxy value.

anInt32 :: Proxy Int32 #

`Int32` proxy value.

anInt64 :: Proxy Int64 #

`Int64` proxy value.

aWord :: Proxy Word #

`Word` proxy value.

aWord8 :: Proxy Word8 #

`Word8` proxy value.

aWord16 :: Proxy Word16 #

`Word16` proxy value.

aWord32 :: Proxy Word32 #

`Word32` proxy value.

aWord64 :: Proxy Word64 #

`Word64` proxy value.

aRatio :: Proxy Ratio #

`Ratio` proxy value.

aRatioOf :: Proxy α -> Proxy (Ratio α) #

`Ratio` α proxy value.

aRational :: Proxy Rational #

`Rational` proxy value.

aFixed :: Proxy Fixed #

`Fixed` proxy value.

aFixedOf :: Proxy α -> Proxy (Fixed α) #

`Fixed` α proxy value.

aUni :: Proxy Uni #

`Uni` proxy value.

aDeci :: Proxy Deci #

`Deci` proxy value.

aCenti :: Proxy Centi #

`Centi` proxy value.

aMilli :: Proxy Milli #

`Milli` proxy value.

aMicro :: Proxy Micro #

`Micro` proxy value.

aNano :: Proxy Nano #

`Nano` proxy value.

aPico :: Proxy Pico #

`Pico` proxy value.

aFloat :: Proxy Float #

`Float` proxy value.

aDouble :: Proxy Double #

`Double` proxy value.

aMaybe :: Proxy Maybe #

`Maybe` proxy value.

aMaybeOf :: Proxy α -> Proxy (Maybe α) #

`Maybe` α proxy value.

aPair :: Proxy (,) #

Pair proxy value.

aPairOf :: Proxy α -> Proxy β -> Proxy (α, β) #

`(α, β)` proxy value.

aTriple :: Proxy (,,) #

Triple proxy value.

aTripleOf :: Proxy α -> Proxy β -> Proxy γ -> Proxy (α, β, γ) #

`(α, β, γ)` proxy value.

anEither :: Proxy Either #

`Either` proxy value.

anEitherOf :: Proxy α -> Proxy β -> Proxy (Either α β) #

`Either` α β proxy value.

aList :: Proxy [] #

List proxy value.

aListOf :: Proxy α -> Proxy [α] #

List of α proxy value.

anIo :: Proxy IO #

`IO` proxy value.

anIoOf :: Proxy α -> Proxy (IO α) #

`IO` α proxy value.

anIoRef :: Proxy IORef #

`IORef` proxy value.

anIoRefOf :: Proxy α -> Proxy (IORef α) #

`IORef` α proxy value.

anSt :: Proxy ST #

`ST` proxy value.

anStOf :: Proxy α -> Proxy (ST α) #

`ST` α proxy value.

anStRef :: Proxy STRef #

`STRef` proxy value.

anStRefOf :: Proxy α -> Proxy (STRef α) #

`STRef` α proxy value.