Skip to content

Instantly share code, notes, and snippets.

@TethysSvensson
Created October 15, 2016 20:26
Show Gist options
  • Save TethysSvensson/d334edfac2420a4e6a4fd0360f340382 to your computer and use it in GitHub Desktop.
Save TethysSvensson/d334edfac2420a4e6a4fd0360f340382 to your computer and use it in GitHub Desktop.
module Test where
open import Function using (id ; _∘_)
open import Relation.Binary.PropositionalEquality using (_≡_ ; refl)
record RawFunctor (F : Set → Set) : Set₁ where
field
fmap : ∀ {A B} → (A → B) → F A → F B
open RawFunctor {{...}} public
record Functor (F : Set → Set) : Set₁ where
field
raw : RawFunctor F
fmap-id :
∀ {A} → (x : F A) → fmap id x ≡ x
fmap-combine :
∀ {A B C} (f : A → B) (g : B → C) (x : F A) →
fmap g (fmap f x) ≡ fmap (g ∘ f) x
open Functor {{...}} hiding (raw) public
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment