{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# OPTIONS_HADDOCK not-home #-}
module Optics.Internal.Optic.TypeLevel where
import GHC.TypeLits
type family QuoteType (x :: *) :: ErrorMessage where
QuoteType x = 'Text "‘" ':<>: 'ShowType x ':<>: 'Text "’"
type family Curry (xs :: [*]) (y :: *) :: * where
Curry '[] y = y
Curry (x ': xs) y = x -> Curry xs y
type family Append (xs :: [*]) (ys :: [*]) :: [*] where
Append '[] ys = ys
Append xs '[] = xs
Append (x ': xs) ys = x ': Append xs ys
class CurryCompose xs where
composeN :: (i -> j) -> Curry xs i -> Curry xs j
instance CurryCompose '[] where
composeN = id
{-# INLINE composeN #-}
instance CurryCompose xs => CurryCompose (x ': xs) where
composeN ij f = composeN @xs ij . f
{-# INLINE composeN #-}