Skip to content

Commit

Permalink
Add instances
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Nov 20, 2024
1 parent 7f96a4d commit 40eac6a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions unison-share-api/src/Unison/Server/Doc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,21 @@ data DocG specialForm
| UntitledSection [(DocG specialForm)]
| Column [(DocG specialForm)]
| Group (DocG specialForm)
deriving stock (Eq, Show, Generic, Functor, Foldable, Traversable)
deriving stock (Eq, Ord, Show, Generic, Functor, Foldable, Traversable)
deriving anyclass (ToJSON)

deriving instance (ToSchema specialForm) => ToSchema (DocG specialForm)

type UnisonHash = Text

data Ref a = Term a | Type a
deriving stock (Eq, Show, Generic, Functor, Foldable, Traversable)
deriving stock (Eq, Ord, Show, Generic, Functor, Foldable, Traversable)
deriving anyclass (ToJSON)

instance (ToSchema a) => ToSchema (Ref a)

data MediaSource = MediaSource {mediaSourceUrl :: Text, mediaSourceMimeType :: Maybe Text}
deriving stock (Eq, Show, Generic)
deriving stock (Eq, Ord, Show, Generic)
deriving anyclass (ToJSON, ToSchema)

data RenderedSpecialForm
Expand All @@ -124,7 +124,7 @@ data RenderedSpecialForm
| LaTeXInline Text
| Svg Text
| RenderError (RenderError SyntaxText)
deriving stock (Eq, Show, Generic)
deriving stock (Eq, Ord, Show, Generic)
deriving anyclass (ToJSON, ToSchema)

data EvaluatedSpecialForm v
Expand All @@ -146,11 +146,11 @@ data EvaluatedSpecialForm v
| ELaTeXInline Text
| ESvg Text
| ERenderError (RenderError (Term v ()))
deriving stock (Eq, Show, Generic)
deriving stock (Eq, Ord, Show, Generic)

-- `Src folded unfolded`
data Src = Src SyntaxText SyntaxText
deriving stock (Eq, Show, Generic)
deriving stock (Eq, Ord, Show, Generic)
deriving anyclass (ToJSON, ToSchema)

-- | Evaluate the doc, then render it.
Expand Down Expand Up @@ -447,28 +447,28 @@ evalDoc terms typeOf eval types tm =

data RenderError trm
= InvalidTerm trm
deriving stock (Eq, Show, Generic)
deriving stock (Eq, Ord, Show, Generic)
deriving anyclass (ToJSON)

deriving anyclass instance (ToSchema trm) => ToSchema (RenderError trm)

data EvaluatedSrc v
= EvaluatedSrcDecl (EvaluatedDecl v)
| EvaluatedSrcTerm (EvaluatedTerm v)
deriving stock (Show, Eq, Generic)
deriving stock (Show, Ord, Eq, Generic)

data EvaluatedDecl v
= MissingDecl Reference
| BuiltinDecl Reference
| FoundDecl Reference (DD.Decl v ())
deriving stock (Show, Eq, Generic)
deriving stock (Show, Ord, Eq, Generic)

data EvaluatedTerm v
= MissingTerm Reference
| BuiltinTypeSig Reference (Type v ())
| MissingBuiltinTypeSig Reference
| FoundTerm Reference (Type v ()) (Term v ())
deriving stock (Show, Eq, Generic)
deriving stock (Show, Eq, Ord, Generic)

-- Determines all dependencies which will be required to render a doc.
dependencies :: (Ord v) => EvaluatedDoc v -> Set LD.LabeledDependency
Expand Down

0 comments on commit 40eac6a

Please sign in to comment.