Skip to content

Instantly share code, notes, and snippets.

@cutsea110
Created July 10, 2015 06:03
Show Gist options
  • Save cutsea110/0afdd72f62036575456e to your computer and use it in GitHub Desktop.
Save cutsea110/0afdd72f62036575456e to your computer and use it in GitHub Desktop.
type class
module Test where
open import Data.Bool
open import Data.Char hiding (_==_)
open import Data.String hiding (_==_)
record Eq (A : Set) : Set₁ where
field
_==_ : A → A → Bool
open Eq {{...}}
EqChar : Eq Char
EqChar = record { _==_ = Data.Char._==_ }
EqString : Eq String
EqString = record { _==_ = Data.String._==_ }
test : Bool
test = (_==_ ⦃ EqChar ⦄ 'a' 'A') ∧ (_==_ ⦃ EqString ⦄ "foo" "foo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment