quox/src/Quox/Syntax/Universe.idr

29 lines
636 B
Idris
Raw Normal View History

2021-07-20 16:05:19 -04:00
module Quox.Syntax.Universe
import Quox.Pretty
import Data.Fin
%default total
||| `UAny` doesn't show up in programs, but when checking something is
||| just some type (e.g. in a signature) it's checked against `Star UAny`
public export
data Universe = U Nat | UAny
%name Universe l
private Repr : Type
Repr = (Fin 2, Nat)
private %inline repr : Universe -> Repr
repr u = case u of U i => (0, i); UAny => (1, 0)
export Eq Universe where (==) = (==) `on` repr
export Ord Universe where compare = compare `on` repr
export
PrettyHL Universe where
prettyM UAny = pure $ hl Delim "_"
prettyM (U l) = pure $ hl Free $ pretty l