{-# LANGUAGE Safe #-}
{-# LANGUAGE MultiParamTypeClasses, ConstraintKinds, TypeOperators, FlexibleInstances #-}
module Text.Gigaparsec.Expr.Subtype (module Text.Gigaparsec.Expr.Subtype) where
import Data.Kind (Constraint)
type Subtype :: * -> * -> Constraint
class Subtype sub sup where
upcast :: sub -> sup
downcast :: sup -> Maybe sub
type (<) :: * -> * -> Constraint
type sub < sup = Subtype sub sup
instance Subtype a a where
upcast :: a -> a
upcast = a -> a
forall a. a -> a
id
downcast :: a -> Maybe a
downcast = a -> Maybe a
forall a. a -> Maybe a
Just