playground/agda/hottest-2022/general-notation.agda

30 lines
683 B
Agda

{-# OPTIONS --without-K --safe #-}
-- safe disables experimental agda features
module general-notation where
-- Type are called an Sets in agda.
-- Because in HoTT, only /some/ type are called Sets.
-- And there are type which are not sets.
-- Making an alias
Type = Set
Type₁ = Set
-- Find type of a value
type-of : {X : Type} X Type
type-of {X} x = X
-- Find domain of a function
domain : {X Y : Type} (X Y) Type
domain {X} {Y} f = X
-- Find codomain of a function
codomain : {X Y : Type} (X Y) Type
codomain {X} {Y} f = Y
-- A notation to avoid too many parenthesis
_$_ : {X Y : Type} (X Y) X Y
f $ g = f g
infix 0 _$_