{-# LANGUAGE PatternSynonyms #-}
module Unison.Codebase.Transcript
( ExpectingError,
HasBug,
ScratchFileName,
Hidden (..),
UcmLine (..),
UcmContext (..),
APIRequest (..),
pattern CMarkCodeBlock,
Stanza,
InfoTags (..),
defaultInfoTags,
defaultInfoTags',
ProcessedBlock (..),
CMark.Node,
)
where
import CMark qualified
import Unison.Core.Project (ProjectBranchName, ProjectName)
import Unison.Prelude
import Unison.Project (ProjectAndBranch)
type ExpectingError = Bool
type HasBug = Bool
type ScratchFileName = Text
data Hidden = Shown | HideOutput | HideAll
deriving (Hidden -> Hidden -> Bool
(Hidden -> Hidden -> Bool)
-> (Hidden -> Hidden -> Bool) -> Eq Hidden
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Hidden -> Hidden -> Bool
== :: Hidden -> Hidden -> Bool
$c/= :: Hidden -> Hidden -> Bool
/= :: Hidden -> Hidden -> Bool
Eq, Eq Hidden
Eq Hidden =>
(Hidden -> Hidden -> Ordering)
-> (Hidden -> Hidden -> Bool)
-> (Hidden -> Hidden -> Bool)
-> (Hidden -> Hidden -> Bool)
-> (Hidden -> Hidden -> Bool)
-> (Hidden -> Hidden -> Hidden)
-> (Hidden -> Hidden -> Hidden)
-> Ord Hidden
Hidden -> Hidden -> Bool
Hidden -> Hidden -> Ordering
Hidden -> Hidden -> Hidden
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 :: Hidden -> Hidden -> Ordering
compare :: Hidden -> Hidden -> Ordering
$c< :: Hidden -> Hidden -> Bool
< :: Hidden -> Hidden -> Bool
$c<= :: Hidden -> Hidden -> Bool
<= :: Hidden -> Hidden -> Bool
$c> :: Hidden -> Hidden -> Bool
> :: Hidden -> Hidden -> Bool
$c>= :: Hidden -> Hidden -> Bool
>= :: Hidden -> Hidden -> Bool
$cmax :: Hidden -> Hidden -> Hidden
max :: Hidden -> Hidden -> Hidden
$cmin :: Hidden -> Hidden -> Hidden
min :: Hidden -> Hidden -> Hidden
Ord, ReadPrec [Hidden]
ReadPrec Hidden
Int -> ReadS Hidden
ReadS [Hidden]
(Int -> ReadS Hidden)
-> ReadS [Hidden]
-> ReadPrec Hidden
-> ReadPrec [Hidden]
-> Read Hidden
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Hidden
readsPrec :: Int -> ReadS Hidden
$creadList :: ReadS [Hidden]
readList :: ReadS [Hidden]
$creadPrec :: ReadPrec Hidden
readPrec :: ReadPrec Hidden
$creadListPrec :: ReadPrec [Hidden]
readListPrec :: ReadPrec [Hidden]
Read, Int -> Hidden -> ShowS
[Hidden] -> ShowS
Hidden -> String
(Int -> Hidden -> ShowS)
-> (Hidden -> String) -> ([Hidden] -> ShowS) -> Show Hidden
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Hidden -> ShowS
showsPrec :: Int -> Hidden -> ShowS
$cshow :: Hidden -> String
show :: Hidden -> String
$cshowList :: [Hidden] -> ShowS
showList :: [Hidden] -> ShowS
Show)
data UcmLine
= UcmCommand UcmContext Text
|
Text
| UcmOutputLine Text
deriving (UcmLine -> UcmLine -> Bool
(UcmLine -> UcmLine -> Bool)
-> (UcmLine -> UcmLine -> Bool) -> Eq UcmLine
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UcmLine -> UcmLine -> Bool
== :: UcmLine -> UcmLine -> Bool
$c/= :: UcmLine -> UcmLine -> Bool
/= :: UcmLine -> UcmLine -> Bool
Eq, Int -> UcmLine -> ShowS
[UcmLine] -> ShowS
UcmLine -> String
(Int -> UcmLine -> ShowS)
-> (UcmLine -> String) -> ([UcmLine] -> ShowS) -> Show UcmLine
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UcmLine -> ShowS
showsPrec :: Int -> UcmLine -> ShowS
$cshow :: UcmLine -> String
show :: UcmLine -> String
$cshowList :: [UcmLine] -> ShowS
showList :: [UcmLine] -> ShowS
Show)
data UcmContext
= UcmContextProject (ProjectAndBranch ProjectName ProjectBranchName)
deriving (UcmContext -> UcmContext -> Bool
(UcmContext -> UcmContext -> Bool)
-> (UcmContext -> UcmContext -> Bool) -> Eq UcmContext
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UcmContext -> UcmContext -> Bool
== :: UcmContext -> UcmContext -> Bool
$c/= :: UcmContext -> UcmContext -> Bool
/= :: UcmContext -> UcmContext -> Bool
Eq, Int -> UcmContext -> ShowS
[UcmContext] -> ShowS
UcmContext -> String
(Int -> UcmContext -> ShowS)
-> (UcmContext -> String)
-> ([UcmContext] -> ShowS)
-> Show UcmContext
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UcmContext -> ShowS
showsPrec :: Int -> UcmContext -> ShowS
$cshow :: UcmContext -> String
show :: UcmContext -> String
$cshowList :: [UcmContext] -> ShowS
showList :: [UcmContext] -> ShowS
Show)
data APIRequest
= GetRequest Text
| Text
| APIResponseLine Text
deriving (APIRequest -> APIRequest -> Bool
(APIRequest -> APIRequest -> Bool)
-> (APIRequest -> APIRequest -> Bool) -> Eq APIRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: APIRequest -> APIRequest -> Bool
== :: APIRequest -> APIRequest -> Bool
$c/= :: APIRequest -> APIRequest -> Bool
/= :: APIRequest -> APIRequest -> Bool
Eq, Int -> APIRequest -> ShowS
[APIRequest] -> ShowS
APIRequest -> String
(Int -> APIRequest -> ShowS)
-> (APIRequest -> String)
-> ([APIRequest] -> ShowS)
-> Show APIRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> APIRequest -> ShowS
showsPrec :: Int -> APIRequest -> ShowS
$cshow :: APIRequest -> String
show :: APIRequest -> String
$cshowList :: [APIRequest] -> ShowS
showList :: [APIRequest] -> ShowS
Show)
pattern CMarkCodeBlock :: (Maybe CMark.PosInfo) -> Text -> Text -> CMark.Node
pattern $mCMarkCodeBlock :: forall {r}.
Node -> (Maybe PosInfo -> Text -> Text -> r) -> ((# #) -> r) -> r
$bCMarkCodeBlock :: Maybe PosInfo -> Text -> Text -> Node
CMarkCodeBlock pos info body = CMark.Node pos (CMark.CODE_BLOCK info body) []
type Stanza = Either CMark.Node ProcessedBlock
data InfoTags a = InfoTags
{ forall a. InfoTags a -> Hidden
hidden :: Hidden,
forall a. InfoTags a -> Bool
expectingError :: ExpectingError,
forall a. InfoTags a -> Bool
hasBug :: HasBug,
forall a. InfoTags a -> Bool
generated :: Bool,
forall a. InfoTags a -> a
additionalTags :: a
}
deriving (InfoTags a -> InfoTags a -> Bool
(InfoTags a -> InfoTags a -> Bool)
-> (InfoTags a -> InfoTags a -> Bool) -> Eq (InfoTags a)
forall a. Eq a => InfoTags a -> InfoTags a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => InfoTags a -> InfoTags a -> Bool
== :: InfoTags a -> InfoTags a -> Bool
$c/= :: forall a. Eq a => InfoTags a -> InfoTags a -> Bool
/= :: InfoTags a -> InfoTags a -> Bool
Eq, Eq (InfoTags a)
Eq (InfoTags a) =>
(InfoTags a -> InfoTags a -> Ordering)
-> (InfoTags a -> InfoTags a -> Bool)
-> (InfoTags a -> InfoTags a -> Bool)
-> (InfoTags a -> InfoTags a -> Bool)
-> (InfoTags a -> InfoTags a -> Bool)
-> (InfoTags a -> InfoTags a -> InfoTags a)
-> (InfoTags a -> InfoTags a -> InfoTags a)
-> Ord (InfoTags a)
InfoTags a -> InfoTags a -> Bool
InfoTags a -> InfoTags a -> Ordering
InfoTags a -> InfoTags a -> InfoTags a
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
forall a. Ord a => Eq (InfoTags a)
forall a. Ord a => InfoTags a -> InfoTags a -> Bool
forall a. Ord a => InfoTags a -> InfoTags a -> Ordering
forall a. Ord a => InfoTags a -> InfoTags a -> InfoTags a
$ccompare :: forall a. Ord a => InfoTags a -> InfoTags a -> Ordering
compare :: InfoTags a -> InfoTags a -> Ordering
$c< :: forall a. Ord a => InfoTags a -> InfoTags a -> Bool
< :: InfoTags a -> InfoTags a -> Bool
$c<= :: forall a. Ord a => InfoTags a -> InfoTags a -> Bool
<= :: InfoTags a -> InfoTags a -> Bool
$c> :: forall a. Ord a => InfoTags a -> InfoTags a -> Bool
> :: InfoTags a -> InfoTags a -> Bool
$c>= :: forall a. Ord a => InfoTags a -> InfoTags a -> Bool
>= :: InfoTags a -> InfoTags a -> Bool
$cmax :: forall a. Ord a => InfoTags a -> InfoTags a -> InfoTags a
max :: InfoTags a -> InfoTags a -> InfoTags a
$cmin :: forall a. Ord a => InfoTags a -> InfoTags a -> InfoTags a
min :: InfoTags a -> InfoTags a -> InfoTags a
Ord, ReadPrec [InfoTags a]
ReadPrec (InfoTags a)
Int -> ReadS (InfoTags a)
ReadS [InfoTags a]
(Int -> ReadS (InfoTags a))
-> ReadS [InfoTags a]
-> ReadPrec (InfoTags a)
-> ReadPrec [InfoTags a]
-> Read (InfoTags a)
forall a. Read a => ReadPrec [InfoTags a]
forall a. Read a => ReadPrec (InfoTags a)
forall a. Read a => Int -> ReadS (InfoTags a)
forall a. Read a => ReadS [InfoTags a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: forall a. Read a => Int -> ReadS (InfoTags a)
readsPrec :: Int -> ReadS (InfoTags a)
$creadList :: forall a. Read a => ReadS [InfoTags a]
readList :: ReadS [InfoTags a]
$creadPrec :: forall a. Read a => ReadPrec (InfoTags a)
readPrec :: ReadPrec (InfoTags a)
$creadListPrec :: forall a. Read a => ReadPrec [InfoTags a]
readListPrec :: ReadPrec [InfoTags a]
Read, Int -> InfoTags a -> ShowS
[InfoTags a] -> ShowS
InfoTags a -> String
(Int -> InfoTags a -> ShowS)
-> (InfoTags a -> String)
-> ([InfoTags a] -> ShowS)
-> Show (InfoTags a)
forall a. Show a => Int -> InfoTags a -> ShowS
forall a. Show a => [InfoTags a] -> ShowS
forall a. Show a => InfoTags a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> InfoTags a -> ShowS
showsPrec :: Int -> InfoTags a -> ShowS
$cshow :: forall a. Show a => InfoTags a -> String
show :: InfoTags a -> String
$cshowList :: forall a. Show a => [InfoTags a] -> ShowS
showList :: [InfoTags a] -> ShowS
Show)
defaultInfoTags :: a -> InfoTags a
defaultInfoTags :: forall a. a -> InfoTags a
defaultInfoTags = Hidden -> Bool -> Bool -> Bool -> a -> InfoTags a
forall a. Hidden -> Bool -> Bool -> Bool -> a -> InfoTags a
InfoTags Hidden
Shown Bool
False Bool
False Bool
False
defaultInfoTags' :: (Monoid a) => InfoTags a
defaultInfoTags' :: forall a. Monoid a => InfoTags a
defaultInfoTags' = a -> InfoTags a
forall a. a -> InfoTags a
defaultInfoTags a
forall a. Monoid a => a
mempty
data ProcessedBlock
= Ucm (InfoTags ()) [UcmLine]
| Unison (InfoTags (Maybe ScratchFileName)) Text
| API (InfoTags ()) [APIRequest]
deriving (ProcessedBlock -> ProcessedBlock -> Bool
(ProcessedBlock -> ProcessedBlock -> Bool)
-> (ProcessedBlock -> ProcessedBlock -> Bool) -> Eq ProcessedBlock
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ProcessedBlock -> ProcessedBlock -> Bool
== :: ProcessedBlock -> ProcessedBlock -> Bool
$c/= :: ProcessedBlock -> ProcessedBlock -> Bool
/= :: ProcessedBlock -> ProcessedBlock -> Bool
Eq, Int -> ProcessedBlock -> ShowS
[ProcessedBlock] -> ShowS
ProcessedBlock -> String
(Int -> ProcessedBlock -> ShowS)
-> (ProcessedBlock -> String)
-> ([ProcessedBlock] -> ShowS)
-> Show ProcessedBlock
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ProcessedBlock -> ShowS
showsPrec :: Int -> ProcessedBlock -> ShowS
$cshow :: ProcessedBlock -> String
show :: ProcessedBlock -> String
$cshowList :: [ProcessedBlock] -> ShowS
showList :: [ProcessedBlock] -> ShowS
Show)