Quick actions

cmd+k|ctrl+k

Navigation

Languages

Verypure

Snippet info

Language

Haskell

Visibility

public

Author

rightfold

Created

2020-05-26T12:36:23Z

Updated

2020-05-26T12:44:26Z

{-# 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, []]
INFO