{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
import Data.Functor.Identity (Identity)
class Verypure (fs :: [* -> *]) t | fs -> t where
verypure :: t
instance Applicative f => Verypure '[f] (f ()) where
verypure = pure ()
instance (Applicative a, Verypure (b ': cs) t) => Verypure (a ': b ': cs) (a t) where
verypure = pure (verypure @(b ': cs))
main :: IO ()
main = print $ verypure @'[Identity, Maybe, []]