Skip to content

Instantly share code, notes, and snippets.

@clayrat
Created August 1, 2020 23:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayrat/6d6ad8a01e9fc911aa295b5505989ef8 to your computer and use it in GitHub Desktop.
Save clayrat/6d6ad8a01e9fc911aa295b5505989ef8 to your computer and use it in GitHub Desktop.
module Const
import Interfaces.Verified
%default total
data Const : Type -> Type -> Type where
MkConst : a -> Const a b
getConst : Const a b -> a
getConst (MkConst a) = a
Functor (Const a) where
map _ (MkConst b) = MkConst b
VerifiedFunctor (Const a) where
functorIdentity g prf (MkConst x) = Refl
functorComposition (MkConst x) g1 g2 = Refl
Monoid a => Applicative (Const a) where
pure _ = MkConst neutral
(MkConst f) <*> (MkConst fa) = MkConst (f <+> fa)
-- we run into diamond inheritance here :(
VerifiedMonoid a => VerifiedApplicative (Const a) where
applicativeMap (MkConst x) g = ?wot0 --rewrite monoidNeutralIsNeutralR x in Refl
applicativeIdentity (MkConst x) = ?wot1 --rewrite monoidNeutralIsNeutralR x in Refl
applicativeComposition (MkConst x) (MkConst g1) (MkConst g2) = ?wot2 --rewrite semigroupOpIsAssociative g2 g1 x in ?wat
applicativeHomomorphism x g = ?wot3 --rewrite monoidNeutralIsNeutralR neutral in Refl
applicativeInterchange x (MkConst g) = ?wot4 --rewrite monoidNeutralIsNeutralR g in rewrite monoidNeutralIsNeutralL g in Refl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment