module Unison.Hashing.V2.TypeEdit (TypeEdit (..)) where

import Unison.Hashing.V2.Reference (Reference)
import Unison.Hashing.V2.Tokenizable (Tokenizable)
import Unison.Hashing.V2.Tokenizable qualified as H

data TypeEdit
  = TypeEditReplace Reference
  | TypeEditDeprecate
  deriving (TypeEdit -> TypeEdit -> Bool
(TypeEdit -> TypeEdit -> Bool)
-> (TypeEdit -> TypeEdit -> Bool) -> Eq TypeEdit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TypeEdit -> TypeEdit -> Bool
== :: TypeEdit -> TypeEdit -> Bool
$c/= :: TypeEdit -> TypeEdit -> Bool
/= :: TypeEdit -> TypeEdit -> Bool
Eq, Eq TypeEdit
Eq TypeEdit =>
(TypeEdit -> TypeEdit -> Ordering)
-> (TypeEdit -> TypeEdit -> Bool)
-> (TypeEdit -> TypeEdit -> Bool)
-> (TypeEdit -> TypeEdit -> Bool)
-> (TypeEdit -> TypeEdit -> Bool)
-> (TypeEdit -> TypeEdit -> TypeEdit)
-> (TypeEdit -> TypeEdit -> TypeEdit)
-> Ord TypeEdit
TypeEdit -> TypeEdit -> Bool
TypeEdit -> TypeEdit -> Ordering
TypeEdit -> TypeEdit -> TypeEdit
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: TypeEdit -> TypeEdit -> Ordering
compare :: TypeEdit -> TypeEdit -> Ordering
$c< :: TypeEdit -> TypeEdit -> Bool
< :: TypeEdit -> TypeEdit -> Bool
$c<= :: TypeEdit -> TypeEdit -> Bool
<= :: TypeEdit -> TypeEdit -> Bool
$c> :: TypeEdit -> TypeEdit -> Bool
> :: TypeEdit -> TypeEdit -> Bool
$c>= :: TypeEdit -> TypeEdit -> Bool
>= :: TypeEdit -> TypeEdit -> Bool
$cmax :: TypeEdit -> TypeEdit -> TypeEdit
max :: TypeEdit -> TypeEdit -> TypeEdit
$cmin :: TypeEdit -> TypeEdit -> TypeEdit
min :: TypeEdit -> TypeEdit -> TypeEdit
Ord, Int -> TypeEdit -> ShowS
[TypeEdit] -> ShowS
TypeEdit -> String
(Int -> TypeEdit -> ShowS)
-> (TypeEdit -> String) -> ([TypeEdit] -> ShowS) -> Show TypeEdit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TypeEdit -> ShowS
showsPrec :: Int -> TypeEdit -> ShowS
$cshow :: TypeEdit -> String
show :: TypeEdit -> String
$cshowList :: [TypeEdit] -> ShowS
showList :: [TypeEdit] -> ShowS
Show)

instance Tokenizable TypeEdit where
  tokens :: TypeEdit -> [Token]
tokens (TypeEditReplace Reference
r) = Word8 -> Token
H.Tag Word8
0 Token -> [Token] -> [Token]
forall a. a -> [a] -> [a]
: Reference -> [Token]
forall t. Tokenizable t => t -> [Token]
H.tokens Reference
r
  tokens TypeEdit
TypeEditDeprecate = [Word8 -> Token
H.Tag Word8
1]