{-# LANGUAGE DataKinds #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE InstanceSigs #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Singletons.Prelude.Monad.Internal -- Copyright : (C) 2018 Ryan Scott -- License : BSD-style (see LICENSE) -- Maintainer : Ryan Scott -- Stability : experimental -- Portability : non-portable -- -- Defines the promoted and singled versions of: -- -- * Functor -- * Applicative -- * Alternative -- * Monad -- * MonadPlus -- -- As well as auxiliary definitions. -- -- This module exists to break up import cycles. -- ---------------------------------------------------------------------------- module Data.Singletons.Prelude.Monad.Internal where import Control.Applicative import Control.Monad import Data.Kind import Data.List.NonEmpty (NonEmpty(..)) import Data.Singletons.Prelude.Base import Data.Singletons.Prelude.Instances import Data.Singletons.Single {- Note [How to get the right kinds when promoting Functor and friends] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To avoid running afoul of a CUSK validity check (see Note [CUSKification]), classes with type parameters that lack explicit kind signatures will be defaulted to be of kind Type. This is not what you want for Functor, however, since its argument is of kind (Type -> Type), so we must explicitly use this kind when declaring the Functor class (and other classes in this module). -} $(