{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE ViewPatterns #-}
module Unison.Server.Doc where
import Control.Monad
import Data.Aeson (ToJSON)
import Data.Foldable
import Data.Functor
import Data.Map qualified as Map
import Data.OpenApi (ToSchema)
import Data.Set qualified as Set
import Data.Word
import Unison.ABT qualified as ABT
import Unison.Builtin.Decls qualified as DD
import Unison.Builtin.Decls qualified as Decls
import Unison.Codebase.Editor.DisplayObject (DisplayObject)
import Unison.Codebase.Editor.DisplayObject qualified as DO
import Unison.ConstructorReference qualified as ConstructorReference
import Unison.DataDeclaration qualified as DD
import Unison.LabeledDependency qualified as LD
import Unison.Prelude
import Unison.PrettyPrintEnv qualified as PPE
import Unison.PrettyPrintEnvDecl qualified as PPE
import Unison.Reference (Reference)
import Unison.Reference qualified as Reference
import Unison.Referent (Referent)
import Unison.Referent qualified as Referent
import Unison.Runtime.IOSource qualified as DD
import Unison.Server.Orphans ()
import Unison.Server.Syntax (SyntaxText)
import Unison.Server.Syntax qualified as Syntax
import Unison.Syntax.DeclPrinter qualified as DeclPrinter
import Unison.Syntax.NamePrinter qualified as NP
import Unison.Syntax.TermPrinter qualified as TermPrinter
import Unison.Syntax.TypePrinter qualified as TypePrinter
import Unison.Term (Term)
import Unison.Term qualified as Term
import Unison.Type (Type)
import Unison.Type qualified as Type
import Unison.Util.List qualified as List
import Unison.Util.Pretty qualified as P
import Unison.Util.SyntaxText qualified as S
import Unison.Var (Var)
type Nat = Word64
type SSyntaxText = S.SyntaxText' Reference
type Doc = DocG RenderedSpecialForm
type EvaluatedDoc v = DocG (EvaluatedSpecialForm v)
type SrcRefs = Ref (UnisonHash, DisplayObject SyntaxText Src)
data DocG specialForm
= Word Text
| Code (DocG specialForm)
| CodeBlock Text (DocG specialForm)
| Bold (DocG specialForm)
| Italic (DocG specialForm)
| Strikethrough (DocG specialForm)
| Style Text (DocG specialForm)
| Anchor Text (DocG specialForm)
| Blockquote (DocG specialForm)
| Blankline
| Linebreak
| SectionBreak
| Tooltip (DocG specialForm) (DocG specialForm)
| Aside (DocG specialForm)
| Callout (Maybe (DocG specialForm)) (DocG specialForm)
| Table [[(DocG specialForm)]]
| Folded Bool (DocG specialForm) (DocG specialForm)
| Paragraph [(DocG specialForm)]
| BulletedList [(DocG specialForm)]
| NumberedList Nat [(DocG specialForm)]
| Section (DocG specialForm) [(DocG specialForm)]
| NamedLink (DocG specialForm) (DocG specialForm)
| Image (DocG specialForm) (DocG specialForm) (Maybe (DocG specialForm))
| Special specialForm
| Join [(DocG specialForm)]
| UntitledSection [(DocG specialForm)]
| Column [(DocG specialForm)]
| Group (DocG specialForm)
deriving stock (DocG specialForm -> DocG specialForm -> Bool
(DocG specialForm -> DocG specialForm -> Bool)
-> (DocG specialForm -> DocG specialForm -> Bool)
-> Eq (DocG specialForm)
forall specialForm.
Eq specialForm =>
DocG specialForm -> DocG specialForm -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall specialForm.
Eq specialForm =>
DocG specialForm -> DocG specialForm -> Bool
== :: DocG specialForm -> DocG specialForm -> Bool
$c/= :: forall specialForm.
Eq specialForm =>
DocG specialForm -> DocG specialForm -> Bool
/= :: DocG specialForm -> DocG specialForm -> Bool
Eq, Eq (DocG specialForm)
Eq (DocG specialForm) =>
(DocG specialForm -> DocG specialForm -> Ordering)
-> (DocG specialForm -> DocG specialForm -> Bool)
-> (DocG specialForm -> DocG specialForm -> Bool)
-> (DocG specialForm -> DocG specialForm -> Bool)
-> (DocG specialForm -> DocG specialForm -> Bool)
-> (DocG specialForm -> DocG specialForm -> DocG specialForm)
-> (DocG specialForm -> DocG specialForm -> DocG specialForm)
-> Ord (DocG specialForm)
DocG specialForm -> DocG specialForm -> Bool
DocG specialForm -> DocG specialForm -> Ordering
DocG specialForm -> DocG specialForm -> DocG specialForm
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 specialForm. Ord specialForm => Eq (DocG specialForm)
forall specialForm.
Ord specialForm =>
DocG specialForm -> DocG specialForm -> Bool
forall specialForm.
Ord specialForm =>
DocG specialForm -> DocG specialForm -> Ordering
forall specialForm.
Ord specialForm =>
DocG specialForm -> DocG specialForm -> DocG specialForm
$ccompare :: forall specialForm.
Ord specialForm =>
DocG specialForm -> DocG specialForm -> Ordering
compare :: DocG specialForm -> DocG specialForm -> Ordering
$c< :: forall specialForm.
Ord specialForm =>
DocG specialForm -> DocG specialForm -> Bool
< :: DocG specialForm -> DocG specialForm -> Bool
$c<= :: forall specialForm.
Ord specialForm =>
DocG specialForm -> DocG specialForm -> Bool
<= :: DocG specialForm -> DocG specialForm -> Bool
$c> :: forall specialForm.
Ord specialForm =>
DocG specialForm -> DocG specialForm -> Bool
> :: DocG specialForm -> DocG specialForm -> Bool
$c>= :: forall specialForm.
Ord specialForm =>
DocG specialForm -> DocG specialForm -> Bool
>= :: DocG specialForm -> DocG specialForm -> Bool
$cmax :: forall specialForm.
Ord specialForm =>
DocG specialForm -> DocG specialForm -> DocG specialForm
max :: DocG specialForm -> DocG specialForm -> DocG specialForm
$cmin :: forall specialForm.
Ord specialForm =>
DocG specialForm -> DocG specialForm -> DocG specialForm
min :: DocG specialForm -> DocG specialForm -> DocG specialForm
Ord, Int -> DocG specialForm -> ShowS
[DocG specialForm] -> ShowS
DocG specialForm -> String
(Int -> DocG specialForm -> ShowS)
-> (DocG specialForm -> String)
-> ([DocG specialForm] -> ShowS)
-> Show (DocG specialForm)
forall specialForm.
Show specialForm =>
Int -> DocG specialForm -> ShowS
forall specialForm. Show specialForm => [DocG specialForm] -> ShowS
forall specialForm. Show specialForm => DocG specialForm -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall specialForm.
Show specialForm =>
Int -> DocG specialForm -> ShowS
showsPrec :: Int -> DocG specialForm -> ShowS
$cshow :: forall specialForm. Show specialForm => DocG specialForm -> String
show :: DocG specialForm -> String
$cshowList :: forall specialForm. Show specialForm => [DocG specialForm] -> ShowS
showList :: [DocG specialForm] -> ShowS
Show, (forall x. DocG specialForm -> Rep (DocG specialForm) x)
-> (forall x. Rep (DocG specialForm) x -> DocG specialForm)
-> Generic (DocG specialForm)
forall x. Rep (DocG specialForm) x -> DocG specialForm
forall x. DocG specialForm -> Rep (DocG specialForm) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall specialForm x. Rep (DocG specialForm) x -> DocG specialForm
forall specialForm x. DocG specialForm -> Rep (DocG specialForm) x
$cfrom :: forall specialForm x. DocG specialForm -> Rep (DocG specialForm) x
from :: forall x. DocG specialForm -> Rep (DocG specialForm) x
$cto :: forall specialForm x. Rep (DocG specialForm) x -> DocG specialForm
to :: forall x. Rep (DocG specialForm) x -> DocG specialForm
Generic, (forall a b. (a -> b) -> DocG a -> DocG b)
-> (forall a b. a -> DocG b -> DocG a) -> Functor DocG
forall a b. a -> DocG b -> DocG a
forall a b. (a -> b) -> DocG a -> DocG b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> DocG a -> DocG b
fmap :: forall a b. (a -> b) -> DocG a -> DocG b
$c<$ :: forall a b. a -> DocG b -> DocG a
<$ :: forall a b. a -> DocG b -> DocG a
Functor, (forall m. Monoid m => DocG m -> m)
-> (forall m a. Monoid m => (a -> m) -> DocG a -> m)
-> (forall m a. Monoid m => (a -> m) -> DocG a -> m)
-> (forall a b. (a -> b -> b) -> b -> DocG a -> b)
-> (forall a b. (a -> b -> b) -> b -> DocG a -> b)
-> (forall b a. (b -> a -> b) -> b -> DocG a -> b)
-> (forall b a. (b -> a -> b) -> b -> DocG a -> b)
-> (forall a. (a -> a -> a) -> DocG a -> a)
-> (forall a. (a -> a -> a) -> DocG a -> a)
-> (forall a. DocG a -> [a])
-> (forall a. DocG a -> Bool)
-> (forall a. DocG a -> Int)
-> (forall a. Eq a => a -> DocG a -> Bool)
-> (forall a. Ord a => DocG a -> a)
-> (forall a. Ord a => DocG a -> a)
-> (forall a. Num a => DocG a -> a)
-> (forall a. Num a => DocG a -> a)
-> Foldable DocG
forall a. Eq a => a -> DocG a -> Bool
forall a. Num a => DocG a -> a
forall a. Ord a => DocG a -> a
forall m. Monoid m => DocG m -> m
forall a. DocG a -> Bool
forall a. DocG a -> Int
forall a. DocG a -> [a]
forall a. (a -> a -> a) -> DocG a -> a
forall m a. Monoid m => (a -> m) -> DocG a -> m
forall b a. (b -> a -> b) -> b -> DocG a -> b
forall a b. (a -> b -> b) -> b -> DocG a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => DocG m -> m
fold :: forall m. Monoid m => DocG m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> DocG a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> DocG a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> DocG a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> DocG a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> DocG a -> b
foldr :: forall a b. (a -> b -> b) -> b -> DocG a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> DocG a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> DocG a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> DocG a -> b
foldl :: forall b a. (b -> a -> b) -> b -> DocG a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> DocG a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> DocG a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> DocG a -> a
foldr1 :: forall a. (a -> a -> a) -> DocG a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> DocG a -> a
foldl1 :: forall a. (a -> a -> a) -> DocG a -> a
$ctoList :: forall a. DocG a -> [a]
toList :: forall a. DocG a -> [a]
$cnull :: forall a. DocG a -> Bool
null :: forall a. DocG a -> Bool
$clength :: forall a. DocG a -> Int
length :: forall a. DocG a -> Int
$celem :: forall a. Eq a => a -> DocG a -> Bool
elem :: forall a. Eq a => a -> DocG a -> Bool
$cmaximum :: forall a. Ord a => DocG a -> a
maximum :: forall a. Ord a => DocG a -> a
$cminimum :: forall a. Ord a => DocG a -> a
minimum :: forall a. Ord a => DocG a -> a
$csum :: forall a. Num a => DocG a -> a
sum :: forall a. Num a => DocG a -> a
$cproduct :: forall a. Num a => DocG a -> a
product :: forall a. Num a => DocG a -> a
Foldable, Functor DocG
Foldable DocG
(Functor DocG, Foldable DocG) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> DocG a -> f (DocG b))
-> (forall (f :: * -> *) a.
Applicative f =>
DocG (f a) -> f (DocG a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> DocG a -> m (DocG b))
-> (forall (m :: * -> *) a. Monad m => DocG (m a) -> m (DocG a))
-> Traversable DocG
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => DocG (m a) -> m (DocG a)
forall (f :: * -> *) a. Applicative f => DocG (f a) -> f (DocG a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> DocG a -> m (DocG b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> DocG a -> f (DocG b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> DocG a -> f (DocG b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> DocG a -> f (DocG b)
$csequenceA :: forall (f :: * -> *) a. Applicative f => DocG (f a) -> f (DocG a)
sequenceA :: forall (f :: * -> *) a. Applicative f => DocG (f a) -> f (DocG a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> DocG a -> m (DocG b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> DocG a -> m (DocG b)
$csequence :: forall (m :: * -> *) a. Monad m => DocG (m a) -> m (DocG a)
sequence :: forall (m :: * -> *) a. Monad m => DocG (m a) -> m (DocG a)
Traversable)
deriving anyclass ([DocG specialForm] -> Value
[DocG specialForm] -> Encoding
DocG specialForm -> Value
DocG specialForm -> Encoding
(DocG specialForm -> Value)
-> (DocG specialForm -> Encoding)
-> ([DocG specialForm] -> Value)
-> ([DocG specialForm] -> Encoding)
-> ToJSON (DocG specialForm)
forall specialForm.
ToJSON specialForm =>
[DocG specialForm] -> Value
forall specialForm.
ToJSON specialForm =>
[DocG specialForm] -> Encoding
forall specialForm. ToJSON specialForm => DocG specialForm -> Value
forall specialForm.
ToJSON specialForm =>
DocG specialForm -> Encoding
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: forall specialForm. ToJSON specialForm => DocG specialForm -> Value
toJSON :: DocG specialForm -> Value
$ctoEncoding :: forall specialForm.
ToJSON specialForm =>
DocG specialForm -> Encoding
toEncoding :: DocG specialForm -> Encoding
$ctoJSONList :: forall specialForm.
ToJSON specialForm =>
[DocG specialForm] -> Value
toJSONList :: [DocG specialForm] -> Value
$ctoEncodingList :: forall specialForm.
ToJSON specialForm =>
[DocG specialForm] -> Encoding
toEncodingList :: [DocG specialForm] -> Encoding
ToJSON)
deriving instance (ToSchema specialForm) => ToSchema (DocG specialForm)
type UnisonHash = Text
data Ref a = Term a | Type a
deriving stock (Ref a -> Ref a -> Bool
(Ref a -> Ref a -> Bool) -> (Ref a -> Ref a -> Bool) -> Eq (Ref a)
forall a. Eq a => Ref a -> Ref a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => Ref a -> Ref a -> Bool
== :: Ref a -> Ref a -> Bool
$c/= :: forall a. Eq a => Ref a -> Ref a -> Bool
/= :: Ref a -> Ref a -> Bool
Eq, Eq (Ref a)
Eq (Ref a) =>
(Ref a -> Ref a -> Ordering)
-> (Ref a -> Ref a -> Bool)
-> (Ref a -> Ref a -> Bool)
-> (Ref a -> Ref a -> Bool)
-> (Ref a -> Ref a -> Bool)
-> (Ref a -> Ref a -> Ref a)
-> (Ref a -> Ref a -> Ref a)
-> Ord (Ref a)
Ref a -> Ref a -> Bool
Ref a -> Ref a -> Ordering
Ref a -> Ref a -> Ref 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 (Ref a)
forall a. Ord a => Ref a -> Ref a -> Bool
forall a. Ord a => Ref a -> Ref a -> Ordering
forall a. Ord a => Ref a -> Ref a -> Ref a
$ccompare :: forall a. Ord a => Ref a -> Ref a -> Ordering
compare :: Ref a -> Ref a -> Ordering
$c< :: forall a. Ord a => Ref a -> Ref a -> Bool
< :: Ref a -> Ref a -> Bool
$c<= :: forall a. Ord a => Ref a -> Ref a -> Bool
<= :: Ref a -> Ref a -> Bool
$c> :: forall a. Ord a => Ref a -> Ref a -> Bool
> :: Ref a -> Ref a -> Bool
$c>= :: forall a. Ord a => Ref a -> Ref a -> Bool
>= :: Ref a -> Ref a -> Bool
$cmax :: forall a. Ord a => Ref a -> Ref a -> Ref a
max :: Ref a -> Ref a -> Ref a
$cmin :: forall a. Ord a => Ref a -> Ref a -> Ref a
min :: Ref a -> Ref a -> Ref a
Ord, Int -> Ref a -> ShowS
[Ref a] -> ShowS
Ref a -> String
(Int -> Ref a -> ShowS)
-> (Ref a -> String) -> ([Ref a] -> ShowS) -> Show (Ref a)
forall a. Show a => Int -> Ref a -> ShowS
forall a. Show a => [Ref a] -> ShowS
forall a. Show a => Ref a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> Ref a -> ShowS
showsPrec :: Int -> Ref a -> ShowS
$cshow :: forall a. Show a => Ref a -> String
show :: Ref a -> String
$cshowList :: forall a. Show a => [Ref a] -> ShowS
showList :: [Ref a] -> ShowS
Show, (forall x. Ref a -> Rep (Ref a) x)
-> (forall x. Rep (Ref a) x -> Ref a) -> Generic (Ref a)
forall x. Rep (Ref a) x -> Ref a
forall x. Ref a -> Rep (Ref a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Ref a) x -> Ref a
forall a x. Ref a -> Rep (Ref a) x
$cfrom :: forall a x. Ref a -> Rep (Ref a) x
from :: forall x. Ref a -> Rep (Ref a) x
$cto :: forall a x. Rep (Ref a) x -> Ref a
to :: forall x. Rep (Ref a) x -> Ref a
Generic, (forall a b. (a -> b) -> Ref a -> Ref b)
-> (forall a b. a -> Ref b -> Ref a) -> Functor Ref
forall a b. a -> Ref b -> Ref a
forall a b. (a -> b) -> Ref a -> Ref b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> Ref a -> Ref b
fmap :: forall a b. (a -> b) -> Ref a -> Ref b
$c<$ :: forall a b. a -> Ref b -> Ref a
<$ :: forall a b. a -> Ref b -> Ref a
Functor, (forall m. Monoid m => Ref m -> m)
-> (forall m a. Monoid m => (a -> m) -> Ref a -> m)
-> (forall m a. Monoid m => (a -> m) -> Ref a -> m)
-> (forall a b. (a -> b -> b) -> b -> Ref a -> b)
-> (forall a b. (a -> b -> b) -> b -> Ref a -> b)
-> (forall b a. (b -> a -> b) -> b -> Ref a -> b)
-> (forall b a. (b -> a -> b) -> b -> Ref a -> b)
-> (forall a. (a -> a -> a) -> Ref a -> a)
-> (forall a. (a -> a -> a) -> Ref a -> a)
-> (forall a. Ref a -> [a])
-> (forall a. Ref a -> Bool)
-> (forall a. Ref a -> Int)
-> (forall a. Eq a => a -> Ref a -> Bool)
-> (forall a. Ord a => Ref a -> a)
-> (forall a. Ord a => Ref a -> a)
-> (forall a. Num a => Ref a -> a)
-> (forall a. Num a => Ref a -> a)
-> Foldable Ref
forall a. Eq a => a -> Ref a -> Bool
forall a. Num a => Ref a -> a
forall a. Ord a => Ref a -> a
forall m. Monoid m => Ref m -> m
forall a. Ref a -> Bool
forall a. Ref a -> Int
forall a. Ref a -> [a]
forall a. (a -> a -> a) -> Ref a -> a
forall m a. Monoid m => (a -> m) -> Ref a -> m
forall b a. (b -> a -> b) -> b -> Ref a -> b
forall a b. (a -> b -> b) -> b -> Ref a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => Ref m -> m
fold :: forall m. Monoid m => Ref m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Ref a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Ref a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Ref a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> Ref a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> Ref a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Ref a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Ref a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Ref a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Ref a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Ref a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Ref a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> Ref a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> Ref a -> a
foldr1 :: forall a. (a -> a -> a) -> Ref a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Ref a -> a
foldl1 :: forall a. (a -> a -> a) -> Ref a -> a
$ctoList :: forall a. Ref a -> [a]
toList :: forall a. Ref a -> [a]
$cnull :: forall a. Ref a -> Bool
null :: forall a. Ref a -> Bool
$clength :: forall a. Ref a -> Int
length :: forall a. Ref a -> Int
$celem :: forall a. Eq a => a -> Ref a -> Bool
elem :: forall a. Eq a => a -> Ref a -> Bool
$cmaximum :: forall a. Ord a => Ref a -> a
maximum :: forall a. Ord a => Ref a -> a
$cminimum :: forall a. Ord a => Ref a -> a
minimum :: forall a. Ord a => Ref a -> a
$csum :: forall a. Num a => Ref a -> a
sum :: forall a. Num a => Ref a -> a
$cproduct :: forall a. Num a => Ref a -> a
product :: forall a. Num a => Ref a -> a
Foldable, Functor Ref
Foldable Ref
(Functor Ref, Foldable Ref) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Ref a -> f (Ref b))
-> (forall (f :: * -> *) a.
Applicative f =>
Ref (f a) -> f (Ref a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Ref a -> m (Ref b))
-> (forall (m :: * -> *) a. Monad m => Ref (m a) -> m (Ref a))
-> Traversable Ref
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Ref (m a) -> m (Ref a)
forall (f :: * -> *) a. Applicative f => Ref (f a) -> f (Ref a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Ref a -> m (Ref b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Ref a -> f (Ref b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Ref a -> f (Ref b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Ref a -> f (Ref b)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Ref (f a) -> f (Ref a)
sequenceA :: forall (f :: * -> *) a. Applicative f => Ref (f a) -> f (Ref a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Ref a -> m (Ref b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Ref a -> m (Ref b)
$csequence :: forall (m :: * -> *) a. Monad m => Ref (m a) -> m (Ref a)
sequence :: forall (m :: * -> *) a. Monad m => Ref (m a) -> m (Ref a)
Traversable)
deriving anyclass ([Ref a] -> Value
[Ref a] -> Encoding
Ref a -> Value
Ref a -> Encoding
(Ref a -> Value)
-> (Ref a -> Encoding)
-> ([Ref a] -> Value)
-> ([Ref a] -> Encoding)
-> ToJSON (Ref a)
forall a. ToJSON a => [Ref a] -> Value
forall a. ToJSON a => [Ref a] -> Encoding
forall a. ToJSON a => Ref a -> Value
forall a. ToJSON a => Ref a -> Encoding
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: forall a. ToJSON a => Ref a -> Value
toJSON :: Ref a -> Value
$ctoEncoding :: forall a. ToJSON a => Ref a -> Encoding
toEncoding :: Ref a -> Encoding
$ctoJSONList :: forall a. ToJSON a => [Ref a] -> Value
toJSONList :: [Ref a] -> Value
$ctoEncodingList :: forall a. ToJSON a => [Ref a] -> Encoding
toEncodingList :: [Ref a] -> Encoding
ToJSON)
instance (ToSchema a) => ToSchema (Ref a)
data MediaSource = MediaSource {MediaSource -> Text
mediaSourceUrl :: Text, MediaSource -> Maybe Text
mediaSourceMimeType :: Maybe Text}
deriving stock (MediaSource -> MediaSource -> Bool
(MediaSource -> MediaSource -> Bool)
-> (MediaSource -> MediaSource -> Bool) -> Eq MediaSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MediaSource -> MediaSource -> Bool
== :: MediaSource -> MediaSource -> Bool
$c/= :: MediaSource -> MediaSource -> Bool
/= :: MediaSource -> MediaSource -> Bool
Eq, Eq MediaSource
Eq MediaSource =>
(MediaSource -> MediaSource -> Ordering)
-> (MediaSource -> MediaSource -> Bool)
-> (MediaSource -> MediaSource -> Bool)
-> (MediaSource -> MediaSource -> Bool)
-> (MediaSource -> MediaSource -> Bool)
-> (MediaSource -> MediaSource -> MediaSource)
-> (MediaSource -> MediaSource -> MediaSource)
-> Ord MediaSource
MediaSource -> MediaSource -> Bool
MediaSource -> MediaSource -> Ordering
MediaSource -> MediaSource -> MediaSource
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 :: MediaSource -> MediaSource -> Ordering
compare :: MediaSource -> MediaSource -> Ordering
$c< :: MediaSource -> MediaSource -> Bool
< :: MediaSource -> MediaSource -> Bool
$c<= :: MediaSource -> MediaSource -> Bool
<= :: MediaSource -> MediaSource -> Bool
$c> :: MediaSource -> MediaSource -> Bool
> :: MediaSource -> MediaSource -> Bool
$c>= :: MediaSource -> MediaSource -> Bool
>= :: MediaSource -> MediaSource -> Bool
$cmax :: MediaSource -> MediaSource -> MediaSource
max :: MediaSource -> MediaSource -> MediaSource
$cmin :: MediaSource -> MediaSource -> MediaSource
min :: MediaSource -> MediaSource -> MediaSource
Ord, Int -> MediaSource -> ShowS
[MediaSource] -> ShowS
MediaSource -> String
(Int -> MediaSource -> ShowS)
-> (MediaSource -> String)
-> ([MediaSource] -> ShowS)
-> Show MediaSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MediaSource -> ShowS
showsPrec :: Int -> MediaSource -> ShowS
$cshow :: MediaSource -> String
show :: MediaSource -> String
$cshowList :: [MediaSource] -> ShowS
showList :: [MediaSource] -> ShowS
Show, (forall x. MediaSource -> Rep MediaSource x)
-> (forall x. Rep MediaSource x -> MediaSource)
-> Generic MediaSource
forall x. Rep MediaSource x -> MediaSource
forall x. MediaSource -> Rep MediaSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MediaSource -> Rep MediaSource x
from :: forall x. MediaSource -> Rep MediaSource x
$cto :: forall x. Rep MediaSource x -> MediaSource
to :: forall x. Rep MediaSource x -> MediaSource
Generic)
deriving anyclass ([MediaSource] -> Value
[MediaSource] -> Encoding
MediaSource -> Value
MediaSource -> Encoding
(MediaSource -> Value)
-> (MediaSource -> Encoding)
-> ([MediaSource] -> Value)
-> ([MediaSource] -> Encoding)
-> ToJSON MediaSource
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: MediaSource -> Value
toJSON :: MediaSource -> Value
$ctoEncoding :: MediaSource -> Encoding
toEncoding :: MediaSource -> Encoding
$ctoJSONList :: [MediaSource] -> Value
toJSONList :: [MediaSource] -> Value
$ctoEncodingList :: [MediaSource] -> Encoding
toEncodingList :: [MediaSource] -> Encoding
ToJSON, Typeable MediaSource
Typeable MediaSource =>
(Proxy MediaSource -> Declare (Definitions Schema) NamedSchema)
-> ToSchema MediaSource
Proxy MediaSource -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a =>
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy MediaSource -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy MediaSource -> Declare (Definitions Schema) NamedSchema
ToSchema)
data RenderedSpecialForm
= Source [SrcRefs]
| FoldedSource [SrcRefs]
| Example SyntaxText
| ExampleBlock SyntaxText
| Link SyntaxText
| Signature [SyntaxText]
| SignatureInline SyntaxText
| Eval SyntaxText SyntaxText
| EvalInline SyntaxText SyntaxText
| Embed SyntaxText
| EmbedInline SyntaxText
| Video [MediaSource] (Map Text Text)
| FrontMatter (Map Text [Text])
| LaTeXInline Text
| Svg Text
| RenderError (RenderError SyntaxText)
deriving stock (RenderedSpecialForm -> RenderedSpecialForm -> Bool
(RenderedSpecialForm -> RenderedSpecialForm -> Bool)
-> (RenderedSpecialForm -> RenderedSpecialForm -> Bool)
-> Eq RenderedSpecialForm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RenderedSpecialForm -> RenderedSpecialForm -> Bool
== :: RenderedSpecialForm -> RenderedSpecialForm -> Bool
$c/= :: RenderedSpecialForm -> RenderedSpecialForm -> Bool
/= :: RenderedSpecialForm -> RenderedSpecialForm -> Bool
Eq, Eq RenderedSpecialForm
Eq RenderedSpecialForm =>
(RenderedSpecialForm -> RenderedSpecialForm -> Ordering)
-> (RenderedSpecialForm -> RenderedSpecialForm -> Bool)
-> (RenderedSpecialForm -> RenderedSpecialForm -> Bool)
-> (RenderedSpecialForm -> RenderedSpecialForm -> Bool)
-> (RenderedSpecialForm -> RenderedSpecialForm -> Bool)
-> (RenderedSpecialForm
-> RenderedSpecialForm -> RenderedSpecialForm)
-> (RenderedSpecialForm
-> RenderedSpecialForm -> RenderedSpecialForm)
-> Ord RenderedSpecialForm
RenderedSpecialForm -> RenderedSpecialForm -> Bool
RenderedSpecialForm -> RenderedSpecialForm -> Ordering
RenderedSpecialForm -> RenderedSpecialForm -> RenderedSpecialForm
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 :: RenderedSpecialForm -> RenderedSpecialForm -> Ordering
compare :: RenderedSpecialForm -> RenderedSpecialForm -> Ordering
$c< :: RenderedSpecialForm -> RenderedSpecialForm -> Bool
< :: RenderedSpecialForm -> RenderedSpecialForm -> Bool
$c<= :: RenderedSpecialForm -> RenderedSpecialForm -> Bool
<= :: RenderedSpecialForm -> RenderedSpecialForm -> Bool
$c> :: RenderedSpecialForm -> RenderedSpecialForm -> Bool
> :: RenderedSpecialForm -> RenderedSpecialForm -> Bool
$c>= :: RenderedSpecialForm -> RenderedSpecialForm -> Bool
>= :: RenderedSpecialForm -> RenderedSpecialForm -> Bool
$cmax :: RenderedSpecialForm -> RenderedSpecialForm -> RenderedSpecialForm
max :: RenderedSpecialForm -> RenderedSpecialForm -> RenderedSpecialForm
$cmin :: RenderedSpecialForm -> RenderedSpecialForm -> RenderedSpecialForm
min :: RenderedSpecialForm -> RenderedSpecialForm -> RenderedSpecialForm
Ord, Int -> RenderedSpecialForm -> ShowS
[RenderedSpecialForm] -> ShowS
RenderedSpecialForm -> String
(Int -> RenderedSpecialForm -> ShowS)
-> (RenderedSpecialForm -> String)
-> ([RenderedSpecialForm] -> ShowS)
-> Show RenderedSpecialForm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RenderedSpecialForm -> ShowS
showsPrec :: Int -> RenderedSpecialForm -> ShowS
$cshow :: RenderedSpecialForm -> String
show :: RenderedSpecialForm -> String
$cshowList :: [RenderedSpecialForm] -> ShowS
showList :: [RenderedSpecialForm] -> ShowS
Show, (forall x. RenderedSpecialForm -> Rep RenderedSpecialForm x)
-> (forall x. Rep RenderedSpecialForm x -> RenderedSpecialForm)
-> Generic RenderedSpecialForm
forall x. Rep RenderedSpecialForm x -> RenderedSpecialForm
forall x. RenderedSpecialForm -> Rep RenderedSpecialForm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. RenderedSpecialForm -> Rep RenderedSpecialForm x
from :: forall x. RenderedSpecialForm -> Rep RenderedSpecialForm x
$cto :: forall x. Rep RenderedSpecialForm x -> RenderedSpecialForm
to :: forall x. Rep RenderedSpecialForm x -> RenderedSpecialForm
Generic)
deriving anyclass ([RenderedSpecialForm] -> Value
[RenderedSpecialForm] -> Encoding
RenderedSpecialForm -> Value
RenderedSpecialForm -> Encoding
(RenderedSpecialForm -> Value)
-> (RenderedSpecialForm -> Encoding)
-> ([RenderedSpecialForm] -> Value)
-> ([RenderedSpecialForm] -> Encoding)
-> ToJSON RenderedSpecialForm
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: RenderedSpecialForm -> Value
toJSON :: RenderedSpecialForm -> Value
$ctoEncoding :: RenderedSpecialForm -> Encoding
toEncoding :: RenderedSpecialForm -> Encoding
$ctoJSONList :: [RenderedSpecialForm] -> Value
toJSONList :: [RenderedSpecialForm] -> Value
$ctoEncodingList :: [RenderedSpecialForm] -> Encoding
toEncodingList :: [RenderedSpecialForm] -> Encoding
ToJSON, Typeable RenderedSpecialForm
Typeable RenderedSpecialForm =>
(Proxy RenderedSpecialForm
-> Declare (Definitions Schema) NamedSchema)
-> ToSchema RenderedSpecialForm
Proxy RenderedSpecialForm
-> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a =>
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy RenderedSpecialForm
-> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy RenderedSpecialForm
-> Declare (Definitions Schema) NamedSchema
ToSchema)
data EvaluatedSpecialForm v
= ESource [(EvaluatedSrc v)]
| EFoldedSource [(EvaluatedSrc v)]
| EExample (Term v ())
| EExampleBlock (Term v ())
| ELink (Either (Term v ()) LD.LabeledDependency)
| ESignature [(Referent, Type v ())]
| ESignatureInline (Referent, Type v ())
|
EEval (Term v ()) (Maybe (Term v ()))
|
EEvalInline (Term v ()) (Maybe (Term v ()))
| EEmbed (Term v ())
| EEmbedInline (Term v ())
| EVideo [MediaSource] (Map Text Text)
| EFrontMatter (Map Text [Text])
| ELaTeXInline Text
| ESvg Text
| ERenderError (RenderError (Term v ()))
deriving stock (EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
(EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool)
-> (EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool)
-> Eq (EvaluatedSpecialForm v)
forall v.
Var v =>
EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall v.
Var v =>
EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
== :: EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
$c/= :: forall v.
Var v =>
EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
/= :: EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
Eq, Eq (EvaluatedSpecialForm v)
Eq (EvaluatedSpecialForm v) =>
(EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Ordering)
-> (EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool)
-> (EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool)
-> (EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool)
-> (EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool)
-> (EvaluatedSpecialForm v
-> EvaluatedSpecialForm v -> EvaluatedSpecialForm v)
-> (EvaluatedSpecialForm v
-> EvaluatedSpecialForm v -> EvaluatedSpecialForm v)
-> Ord (EvaluatedSpecialForm v)
EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Ordering
EvaluatedSpecialForm v
-> EvaluatedSpecialForm v -> EvaluatedSpecialForm v
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 v. Var v => Eq (EvaluatedSpecialForm v)
forall v.
Var v =>
EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
forall v.
Var v =>
EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Ordering
forall v.
Var v =>
EvaluatedSpecialForm v
-> EvaluatedSpecialForm v -> EvaluatedSpecialForm v
$ccompare :: forall v.
Var v =>
EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Ordering
compare :: EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Ordering
$c< :: forall v.
Var v =>
EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
< :: EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
$c<= :: forall v.
Var v =>
EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
<= :: EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
$c> :: forall v.
Var v =>
EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
> :: EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
$c>= :: forall v.
Var v =>
EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
>= :: EvaluatedSpecialForm v -> EvaluatedSpecialForm v -> Bool
$cmax :: forall v.
Var v =>
EvaluatedSpecialForm v
-> EvaluatedSpecialForm v -> EvaluatedSpecialForm v
max :: EvaluatedSpecialForm v
-> EvaluatedSpecialForm v -> EvaluatedSpecialForm v
$cmin :: forall v.
Var v =>
EvaluatedSpecialForm v
-> EvaluatedSpecialForm v -> EvaluatedSpecialForm v
min :: EvaluatedSpecialForm v
-> EvaluatedSpecialForm v -> EvaluatedSpecialForm v
Ord, Int -> EvaluatedSpecialForm v -> ShowS
[EvaluatedSpecialForm v] -> ShowS
EvaluatedSpecialForm v -> String
(Int -> EvaluatedSpecialForm v -> ShowS)
-> (EvaluatedSpecialForm v -> String)
-> ([EvaluatedSpecialForm v] -> ShowS)
-> Show (EvaluatedSpecialForm v)
forall v. Show v => Int -> EvaluatedSpecialForm v -> ShowS
forall v. Show v => [EvaluatedSpecialForm v] -> ShowS
forall v. Show v => EvaluatedSpecialForm v -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall v. Show v => Int -> EvaluatedSpecialForm v -> ShowS
showsPrec :: Int -> EvaluatedSpecialForm v -> ShowS
$cshow :: forall v. Show v => EvaluatedSpecialForm v -> String
show :: EvaluatedSpecialForm v -> String
$cshowList :: forall v. Show v => [EvaluatedSpecialForm v] -> ShowS
showList :: [EvaluatedSpecialForm v] -> ShowS
Show, (forall x.
EvaluatedSpecialForm v -> Rep (EvaluatedSpecialForm v) x)
-> (forall x.
Rep (EvaluatedSpecialForm v) x -> EvaluatedSpecialForm v)
-> Generic (EvaluatedSpecialForm v)
forall x. Rep (EvaluatedSpecialForm v) x -> EvaluatedSpecialForm v
forall x. EvaluatedSpecialForm v -> Rep (EvaluatedSpecialForm v) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall v x.
Rep (EvaluatedSpecialForm v) x -> EvaluatedSpecialForm v
forall v x.
EvaluatedSpecialForm v -> Rep (EvaluatedSpecialForm v) x
$cfrom :: forall v x.
EvaluatedSpecialForm v -> Rep (EvaluatedSpecialForm v) x
from :: forall x. EvaluatedSpecialForm v -> Rep (EvaluatedSpecialForm v) x
$cto :: forall v x.
Rep (EvaluatedSpecialForm v) x -> EvaluatedSpecialForm v
to :: forall x. Rep (EvaluatedSpecialForm v) x -> EvaluatedSpecialForm v
Generic)
data Src = Src SyntaxText SyntaxText
deriving stock (Src -> Src -> Bool
(Src -> Src -> Bool) -> (Src -> Src -> Bool) -> Eq Src
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Src -> Src -> Bool
== :: Src -> Src -> Bool
$c/= :: Src -> Src -> Bool
/= :: Src -> Src -> Bool
Eq, Eq Src
Eq Src =>
(Src -> Src -> Ordering)
-> (Src -> Src -> Bool)
-> (Src -> Src -> Bool)
-> (Src -> Src -> Bool)
-> (Src -> Src -> Bool)
-> (Src -> Src -> Src)
-> (Src -> Src -> Src)
-> Ord Src
Src -> Src -> Bool
Src -> Src -> Ordering
Src -> Src -> Src
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 :: Src -> Src -> Ordering
compare :: Src -> Src -> Ordering
$c< :: Src -> Src -> Bool
< :: Src -> Src -> Bool
$c<= :: Src -> Src -> Bool
<= :: Src -> Src -> Bool
$c> :: Src -> Src -> Bool
> :: Src -> Src -> Bool
$c>= :: Src -> Src -> Bool
>= :: Src -> Src -> Bool
$cmax :: Src -> Src -> Src
max :: Src -> Src -> Src
$cmin :: Src -> Src -> Src
min :: Src -> Src -> Src
Ord, Int -> Src -> ShowS
[Src] -> ShowS
Src -> String
(Int -> Src -> ShowS)
-> (Src -> String) -> ([Src] -> ShowS) -> Show Src
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Src -> ShowS
showsPrec :: Int -> Src -> ShowS
$cshow :: Src -> String
show :: Src -> String
$cshowList :: [Src] -> ShowS
showList :: [Src] -> ShowS
Show, (forall x. Src -> Rep Src x)
-> (forall x. Rep Src x -> Src) -> Generic Src
forall x. Rep Src x -> Src
forall x. Src -> Rep Src x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Src -> Rep Src x
from :: forall x. Src -> Rep Src x
$cto :: forall x. Rep Src x -> Src
to :: forall x. Rep Src x -> Src
Generic)
deriving anyclass ([Src] -> Value
[Src] -> Encoding
Src -> Value
Src -> Encoding
(Src -> Value)
-> (Src -> Encoding)
-> ([Src] -> Value)
-> ([Src] -> Encoding)
-> ToJSON Src
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: Src -> Value
toJSON :: Src -> Value
$ctoEncoding :: Src -> Encoding
toEncoding :: Src -> Encoding
$ctoJSONList :: [Src] -> Value
toJSONList :: [Src] -> Value
$ctoEncodingList :: [Src] -> Encoding
toEncodingList :: [Src] -> Encoding
ToJSON, Typeable Src
Typeable Src =>
(Proxy Src -> Declare (Definitions Schema) NamedSchema)
-> ToSchema Src
Proxy Src -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a =>
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy Src -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy Src -> Declare (Definitions Schema) NamedSchema
ToSchema)
evalAndRenderDoc ::
forall v m.
(Var v, Monad m) =>
PPE.PrettyPrintEnvDecl ->
(Reference -> m (Maybe (Term v ()))) ->
(Referent -> m (Maybe (Type v ()))) ->
(Term v () -> m (Maybe (Term v ()))) ->
(Reference -> m (Maybe (DD.Decl v ()))) ->
Term v () ->
m Doc
evalAndRenderDoc :: forall v (m :: * -> *).
(Var v, Monad m) =>
PrettyPrintEnvDecl
-> (Reference' Text Hash -> m (Maybe (Term v ())))
-> (Referent -> m (Maybe (Type v ())))
-> (Term v () -> m (Maybe (Term v ())))
-> (Reference' Text Hash -> m (Maybe (Decl v ())))
-> Term v ()
-> m Doc
evalAndRenderDoc PrettyPrintEnvDecl
pped Reference' Text Hash -> m (Maybe (Term v ()))
terms Referent -> m (Maybe (Type v ()))
typeOf Term v () -> m (Maybe (Term v ()))
eval Reference' Text Hash -> m (Maybe (Decl v ()))
types Term v ()
tm =
PrettyPrintEnvDecl -> EvaluatedDoc v -> Doc
forall v. Var v => PrettyPrintEnvDecl -> EvaluatedDoc v -> Doc
renderDoc PrettyPrintEnvDecl
pped (EvaluatedDoc v -> Doc) -> m (EvaluatedDoc v) -> m Doc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Reference' Text Hash -> m (Maybe (Term v ())))
-> (Referent -> m (Maybe (Type v ())))
-> (Term v () -> m (Maybe (Term v ())))
-> (Reference' Text Hash -> m (Maybe (Decl v ())))
-> Term v ()
-> m (EvaluatedDoc v)
forall v (m :: * -> *).
(Var v, Monad m) =>
(Reference' Text Hash -> m (Maybe (Term v ())))
-> (Referent -> m (Maybe (Type v ())))
-> (Term v () -> m (Maybe (Term v ())))
-> (Reference' Text Hash -> m (Maybe (Decl v ())))
-> Term v ()
-> m (EvaluatedDoc v)
evalDoc Reference' Text Hash -> m (Maybe (Term v ()))
terms Referent -> m (Maybe (Type v ()))
typeOf Term v () -> m (Maybe (Term v ()))
eval Reference' Text Hash -> m (Maybe (Decl v ()))
types Term v ()
tm
renderDoc ::
forall v.
(Var v) =>
PPE.PrettyPrintEnvDecl ->
EvaluatedDoc v ->
Doc
renderDoc :: forall v. Var v => PrettyPrintEnvDecl -> EvaluatedDoc v -> Doc
renderDoc PrettyPrintEnvDecl
pped EvaluatedDoc v
doc = EvaluatedSpecialForm v -> RenderedSpecialForm
renderSpecial (EvaluatedSpecialForm v -> RenderedSpecialForm)
-> EvaluatedDoc v -> Doc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> EvaluatedDoc v
doc
where
suffixifiedPPE :: PrettyPrintEnv
suffixifiedPPE = PrettyPrintEnvDecl -> PrettyPrintEnv
PPE.suffixifiedPPE PrettyPrintEnvDecl
pped
formatPretty :: Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty = (Element (Reference' Text Hash) -> Element)
-> AnnotatedText (Element (Reference' Text Hash)) -> SyntaxText
forall a b. (a -> b) -> AnnotatedText a -> AnnotatedText b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Element (Reference' Text Hash) -> Element
Syntax.convertElement (AnnotatedText (Element (Reference' Text Hash)) -> SyntaxText)
-> (Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> AnnotatedText (Element (Reference' Text Hash)))
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Width
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> AnnotatedText (Element (Reference' Text Hash))
forall s. (Monoid s, IsString s) => Width -> Pretty s -> s
P.render (Int -> Width
P.Width Int
70)
formatPrettyType :: PPE.PrettyPrintEnv -> Type v a -> SyntaxText
formatPrettyType :: forall a. PrettyPrintEnv -> Type v a -> SyntaxText
formatPrettyType PrettyPrintEnv
ppe Type v a
typ = Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty (PrettyPrintEnv
-> Type v a
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall v a.
Var v =>
PrettyPrintEnv
-> Type v a
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
TypePrinter.prettySyntax PrettyPrintEnv
ppe Type v a
typ)
source :: Term v () -> SyntaxText
source :: Term v () -> SyntaxText
source Term v ()
tm = Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty (Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText)
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
forall a b. (a -> b) -> a -> b
$ Bool
-> PrettyPrintEnv
-> Term v ()
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall v a.
Var v =>
Bool
-> PrettyPrintEnv
-> Term v a
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
TermPrinter.prettyBlock' Bool
True (PrettyPrintEnvDecl -> PrettyPrintEnv
PPE.suffixifiedPPE PrettyPrintEnvDecl
pped) Term v ()
tm
goSignatures :: [(Referent, Type v ())] -> [P.Pretty SSyntaxText]
goSignatures :: [(Referent, Type v ())]
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
goSignatures [(Referent, Type v ())]
types =
(Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> Pretty (AnnotatedText (Element (Reference' Text Hash))))
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall s. Pretty s -> Pretty s
P.group ([Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))])
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
forall a b. (a -> b) -> a -> b
$
PrettyPrintEnv
-> [(Referent, HashQualified Name, Type v ())]
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
forall v a.
Var v =>
PrettyPrintEnv
-> [(Referent, HashQualified Name, Type v a)]
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
TypePrinter.prettySignaturesST
(PrettyPrintEnvDecl -> PrettyPrintEnv
PPE.suffixifiedPPE PrettyPrintEnvDecl
pped)
[(Referent
r, PrettyPrintEnv -> Referent -> HashQualified Name
PPE.termName (PrettyPrintEnvDecl -> PrettyPrintEnv
PPE.suffixifiedPPE PrettyPrintEnvDecl
pped) Referent
r, Type v ()
ty) | (Referent
r, Type v ()
ty) <- [(Referent, Type v ())]
types]
renderSpecial :: EvaluatedSpecialForm v -> RenderedSpecialForm
renderSpecial :: EvaluatedSpecialForm v -> RenderedSpecialForm
renderSpecial = \case
ESource [EvaluatedSrc v]
srcs -> [SrcRefs] -> RenderedSpecialForm
Source ([EvaluatedSrc v] -> [SrcRefs]
renderSrc [EvaluatedSrc v]
srcs)
EFoldedSource [EvaluatedSrc v]
srcs -> [SrcRefs] -> RenderedSpecialForm
FoldedSource ([EvaluatedSrc v] -> [SrcRefs]
renderSrc [EvaluatedSrc v]
srcs)
EExample Term v ()
trm -> SyntaxText -> RenderedSpecialForm
Example (Term v () -> SyntaxText
source Term v ()
trm)
EExampleBlock Term v ()
trm -> SyntaxText -> RenderedSpecialForm
ExampleBlock (Term v () -> SyntaxText
source Term v ()
trm)
ELink Either (Term v ()) LabeledDependency
ref ->
let ppe :: PrettyPrintEnv
ppe = PrettyPrintEnvDecl -> PrettyPrintEnv
PPE.suffixifiedPPE PrettyPrintEnvDecl
pped
tm :: Referent -> P.Pretty SSyntaxText
tm :: Referent -> Pretty (AnnotatedText (Element (Reference' Text Hash)))
tm Referent
r = ((Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> Pretty (AnnotatedText (Element (Reference' Text Hash))))
-> HashQualified Name
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
NP.styleHashQualified'' (Element (Reference' Text Hash)
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall r.
Element r -> Pretty (SyntaxText' r) -> Pretty (SyntaxText' r)
NP.fmt (Referent -> Element (Reference' Text Hash)
forall r. Referent' r -> Element r
S.TermReference Referent
r)) (HashQualified Name
-> Pretty (AnnotatedText (Element (Reference' Text Hash))))
-> (Referent -> HashQualified Name)
-> Referent
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PrettyPrintEnv -> Referent -> HashQualified Name
PPE.termName PrettyPrintEnv
ppe) Referent
r
ty :: Reference -> P.Pretty SSyntaxText
ty :: Reference' Text Hash
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
ty Reference' Text Hash
r = ((Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> Pretty (AnnotatedText (Element (Reference' Text Hash))))
-> HashQualified Name
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
NP.styleHashQualified'' (Element (Reference' Text Hash)
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall r.
Element r -> Pretty (SyntaxText' r) -> Pretty (SyntaxText' r)
NP.fmt (Reference' Text Hash -> Element (Reference' Text Hash)
forall r. r -> Element r
S.TypeReference Reference' Text Hash
r)) (HashQualified Name
-> Pretty (AnnotatedText (Element (Reference' Text Hash))))
-> (Reference' Text Hash -> HashQualified Name)
-> Reference' Text Hash
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PrettyPrintEnv -> Reference' Text Hash -> HashQualified Name
PPE.typeName PrettyPrintEnv
ppe) Reference' Text Hash
r
in SyntaxText -> RenderedSpecialForm
Link (SyntaxText -> RenderedSpecialForm)
-> SyntaxText -> RenderedSpecialForm
forall a b. (a -> b) -> a -> b
$ case Either (Term v ()) LabeledDependency
ref of
Left Term v ()
trm -> Term v () -> SyntaxText
source Term v ()
trm
Right LabeledDependency
ld -> case LabeledDependency
ld of
LD.TermReferent Referent
r -> (Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty (Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText)
-> (Referent
-> Pretty (AnnotatedText (Element (Reference' Text Hash))))
-> Referent
-> SyntaxText
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Referent -> Pretty (AnnotatedText (Element (Reference' Text Hash)))
tm) Referent
r
LD.TypeReference Reference' Text Hash
r -> (Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty (Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText)
-> (Reference' Text Hash
-> Pretty (AnnotatedText (Element (Reference' Text Hash))))
-> Reference' Text Hash
-> SyntaxText
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Reference' Text Hash
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
ty) Reference' Text Hash
r
ESignature [(Referent, Type v ())]
rs -> [SyntaxText] -> RenderedSpecialForm
Signature ((Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText)
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> [SyntaxText]
forall a b. (a -> b) -> [a] -> [b]
map Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty ([Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> [SyntaxText])
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> [SyntaxText]
forall a b. (a -> b) -> a -> b
$ [(Referent, Type v ())]
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
goSignatures [(Referent, Type v ())]
rs)
ESignatureInline (Referent, Type v ())
r -> SyntaxText -> RenderedSpecialForm
SignatureInline (Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty ([Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall (f :: * -> *) s.
(Foldable f, IsString s) =>
f (Pretty s) -> Pretty s
P.lines ([Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> Pretty (AnnotatedText (Element (Reference' Text Hash))))
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall a b. (a -> b) -> a -> b
$ [(Referent, Type v ())]
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
goSignatures [(Referent, Type v ())
r]))
EEval Term v ()
trm Maybe (Term v ())
result ->
let renderedTrm :: SyntaxText
renderedTrm = Term v () -> SyntaxText
source Term v ()
trm
in case Maybe (Term v ())
result of
Maybe (Term v ())
Nothing -> SyntaxText -> SyntaxText -> RenderedSpecialForm
Eval SyntaxText
renderedTrm SyntaxText
evalErrMsg
Just Term v ()
renderedResult -> SyntaxText -> SyntaxText -> RenderedSpecialForm
Eval SyntaxText
renderedTrm (Term v () -> SyntaxText
source Term v ()
renderedResult)
EEvalInline Term v ()
trm Maybe (Term v ())
result ->
let renderedTrm :: SyntaxText
renderedTrm = Term v () -> SyntaxText
source Term v ()
trm
in case Maybe (Term v ())
result of
Maybe (Term v ())
Nothing -> SyntaxText -> SyntaxText -> RenderedSpecialForm
EvalInline SyntaxText
renderedTrm SyntaxText
evalErrMsg
Just Term v ()
renderedResult -> SyntaxText -> SyntaxText -> RenderedSpecialForm
EvalInline SyntaxText
renderedTrm (Term v () -> SyntaxText
source Term v ()
renderedResult)
EEmbed Term v ()
any -> SyntaxText -> RenderedSpecialForm
Embed (SyntaxText
"{{ embed {{" SyntaxText -> SyntaxText -> SyntaxText
forall a. Semigroup a => a -> a -> a
<> Term v () -> SyntaxText
source Term v ()
any SyntaxText -> SyntaxText -> SyntaxText
forall a. Semigroup a => a -> a -> a
<> SyntaxText
"}} }}")
EEmbedInline Term v ()
any -> SyntaxText -> RenderedSpecialForm
EmbedInline (SyntaxText
"{{ embed {{" SyntaxText -> SyntaxText -> SyntaxText
forall a. Semigroup a => a -> a -> a
<> Term v () -> SyntaxText
source Term v ()
any SyntaxText -> SyntaxText -> SyntaxText
forall a. Semigroup a => a -> a -> a
<> SyntaxText
"}} }}")
EVideo [MediaSource]
sources Map Text Text
config -> [MediaSource] -> Map Text Text -> RenderedSpecialForm
Video [MediaSource]
sources Map Text Text
config
EFrontMatter Map Text [Text]
frontMatter -> Map Text [Text] -> RenderedSpecialForm
FrontMatter Map Text [Text]
frontMatter
ELaTeXInline Text
latex -> Text -> RenderedSpecialForm
LaTeXInline Text
latex
ESvg Text
svg -> Text -> RenderedSpecialForm
Svg Text
svg
ERenderError (InvalidTerm Term v ()
tm) -> SyntaxText -> RenderedSpecialForm
Embed (SyntaxText
"🆘 unable to render " SyntaxText -> SyntaxText -> SyntaxText
forall a. Semigroup a => a -> a -> a
<> Term v () -> SyntaxText
source Term v ()
tm)
evalErrMsg :: SyntaxText
evalErrMsg :: SyntaxText
evalErrMsg = SyntaxText
"🆘 An error occured during evaluation"
renderSrc :: [EvaluatedSrc v] -> [Ref (UnisonHash, DisplayObject SyntaxText Src)]
renderSrc :: [EvaluatedSrc v] -> [SrcRefs]
renderSrc [EvaluatedSrc v]
srcs =
[EvaluatedSrc v]
srcs [EvaluatedSrc v] -> ([EvaluatedSrc v] -> [SrcRefs]) -> [SrcRefs]
forall a b. a -> (a -> b) -> b
& (EvaluatedSrc v -> [SrcRefs]) -> [EvaluatedSrc v] -> [SrcRefs]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap \case
EvaluatedSrcDecl EvaluatedDecl v
srcDecl -> case EvaluatedDecl v
srcDecl of
MissingDecl Reference' Text Hash
r -> [(Text, DisplayObject SyntaxText Src) -> SrcRefs
forall a. a -> Ref a
Type (Reference' Text Hash -> Text
Reference.toText Reference' Text Hash
r, ShortHash -> DisplayObject SyntaxText Src
forall b a. ShortHash -> DisplayObject b a
DO.MissingObject (Reference' Text Hash -> ShortHash
Reference.toShortHash Reference' Text Hash
r))]
BuiltinDecl Reference' Text Hash
r ->
let name :: SyntaxText
name =
Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty
(Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText)
-> (Reference' Text Hash
-> Pretty (AnnotatedText (Element (Reference' Text Hash))))
-> Reference' Text Hash
-> SyntaxText
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> Pretty (AnnotatedText (Element (Reference' Text Hash))))
-> HashQualified Name
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall s.
IsString s =>
(Pretty s -> Pretty s) -> HashQualified Name -> Pretty s
NP.styleHashQualified (Element (Reference' Text Hash)
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall r.
Element r -> Pretty (SyntaxText' r) -> Pretty (SyntaxText' r)
NP.fmt (Reference' Text Hash -> Element (Reference' Text Hash)
forall r. r -> Element r
S.TypeReference Reference' Text Hash
r))
(HashQualified Name
-> Pretty (AnnotatedText (Element (Reference' Text Hash))))
-> (Reference' Text Hash -> HashQualified Name)
-> Reference' Text Hash
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PrettyPrintEnv -> Reference' Text Hash -> HashQualified Name
PPE.typeName PrettyPrintEnv
suffixifiedPPE
(Reference' Text Hash -> SyntaxText)
-> Reference' Text Hash -> SyntaxText
forall a b. (a -> b) -> a -> b
$ Reference' Text Hash
r
in [(Text, DisplayObject SyntaxText Src) -> SrcRefs
forall a. a -> Ref a
Type (Reference' Text Hash -> Text
Reference.toText Reference' Text Hash
r, SyntaxText -> DisplayObject SyntaxText Src
forall b a. b -> DisplayObject b a
DO.BuiltinObject SyntaxText
name)]
FoundDecl Reference' Text Hash
r Decl v ()
decl -> [(Text, DisplayObject SyntaxText Src) -> SrcRefs
forall a. a -> Ref a
Type (Reference' Text Hash -> Text
Reference.toText Reference' Text Hash
r, Src -> DisplayObject SyntaxText Src
forall b a. a -> DisplayObject b a
DO.UserObject (SyntaxText -> SyntaxText -> Src
Src SyntaxText
folded SyntaxText
full))]
where
full :: SyntaxText
full = Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty (PrettyPrintEnvDecl
-> Reference' Text Hash
-> HashQualified Name
-> Decl v ()
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall v a.
Var v =>
PrettyPrintEnvDecl
-> Reference' Text Hash
-> HashQualified Name
-> Decl v a
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
DeclPrinter.prettyDecl PrettyPrintEnvDecl
pped Reference' Text Hash
r (PrettyPrintEnv -> Reference' Text Hash -> HashQualified Name
PPE.typeName PrettyPrintEnv
suffixifiedPPE Reference' Text Hash
r) Decl v ()
decl)
folded :: SyntaxText
folded = Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty (HashQualified Name
-> Decl v ()
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall v a.
Var v =>
HashQualified Name
-> Either (EffectDeclaration v a) (DataDeclaration v a)
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
DeclPrinter.prettyDeclHeader (PrettyPrintEnv -> Reference' Text Hash -> HashQualified Name
PPE.typeName PrettyPrintEnv
suffixifiedPPE Reference' Text Hash
r) Decl v ()
decl)
EvaluatedSrcTerm EvaluatedTerm v
srcTerm -> case EvaluatedTerm v
srcTerm of
MissingBuiltinTypeSig Reference' Text Hash
r -> [((Text, DisplayObject SyntaxText Src) -> SrcRefs
forall a. a -> Ref a
Type (Reference' Text Hash -> Text
Reference.toText Reference' Text Hash
r, SyntaxText -> DisplayObject SyntaxText Src
forall b a. b -> DisplayObject b a
DO.BuiltinObject SyntaxText
"🆘 missing type signature"))]
BuiltinTypeSig Reference' Text Hash
r Type v ()
typ -> [(Text, DisplayObject SyntaxText Src) -> SrcRefs
forall a. a -> Ref a
Type (Reference' Text Hash -> Text
Reference.toText Reference' Text Hash
r, SyntaxText -> DisplayObject SyntaxText Src
forall b a. b -> DisplayObject b a
DO.BuiltinObject (PrettyPrintEnv -> Type v () -> SyntaxText
forall a. PrettyPrintEnv -> Type v a -> SyntaxText
formatPrettyType PrettyPrintEnv
suffixifiedPPE Type v ()
typ))]
MissingTerm Reference' Text Hash
r -> [(Text, DisplayObject SyntaxText Src) -> SrcRefs
forall a. a -> Ref a
Term (Reference' Text Hash -> Text
Reference.toText Reference' Text Hash
r, ShortHash -> DisplayObject SyntaxText Src
forall b a. ShortHash -> DisplayObject b a
DO.MissingObject (Reference' Text Hash -> ShortHash
Reference.toShortHash Reference' Text Hash
r))]
FoundTerm Reference' Text Hash
ref Type v ()
typ Term v ()
tm ->
let name :: HashQualified Name
name = PrettyPrintEnv -> Referent -> HashQualified Name
PPE.termName PrettyPrintEnv
suffixifiedPPE (Reference' Text Hash -> Referent
Referent.Ref Reference' Text Hash
ref)
folded :: SyntaxText
folded =
Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty (Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText)
-> ([Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> Pretty (AnnotatedText (Element (Reference' Text Hash))))
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> SyntaxText
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall (f :: * -> *) s.
(Foldable f, IsString s) =>
f (Pretty s) -> Pretty s
P.lines ([Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> SyntaxText)
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
-> SyntaxText
forall a b. (a -> b) -> a -> b
$
PrettyPrintEnv
-> [(Referent, HashQualified Name, Type v ())]
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
forall v a.
Var v =>
PrettyPrintEnv
-> [(Referent, HashQualified Name, Type v a)]
-> [Pretty (AnnotatedText (Element (Reference' Text Hash)))]
TypePrinter.prettySignaturesST PrettyPrintEnv
suffixifiedPPE [(Reference' Text Hash -> Referent
Referent.Ref Reference' Text Hash
ref, HashQualified Name
name, Type v ()
typ)]
full :: Term v () -> Type v () -> SyntaxText
full tm :: Term v ()
tm@(Term.Ann' Term v ()
_ Type v ()
_) Type v ()
_ =
Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty (PrettyPrintEnv
-> HashQualified Name
-> Term v ()
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall v at ap a.
Var v =>
PrettyPrintEnv
-> HashQualified Name
-> Term2 v at ap v a
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
TermPrinter.prettyBinding PrettyPrintEnv
suffixifiedPPE HashQualified Name
name Term v ()
tm)
full Term v ()
tm Type v ()
typ =
Pretty (AnnotatedText (Element (Reference' Text Hash)))
-> SyntaxText
formatPretty (PrettyPrintEnv
-> HashQualified Name
-> Term v ()
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
forall v at ap a.
Var v =>
PrettyPrintEnv
-> HashQualified Name
-> Term2 v at ap v a
-> Pretty (AnnotatedText (Element (Reference' Text Hash)))
TermPrinter.prettyBinding PrettyPrintEnv
suffixifiedPPE HashQualified Name
name (() -> Term v () -> Type v () -> Term v ()
forall v a vt at ap.
Ord v =>
a -> Term2 vt at ap v a -> Type vt at -> Term2 vt at ap v a
Term.ann () Term v ()
tm Type v ()
typ))
in [(Text, DisplayObject SyntaxText Src) -> SrcRefs
forall a. a -> Ref a
Term (Reference' Text Hash -> Text
Reference.toText Reference' Text Hash
ref, Src -> DisplayObject SyntaxText Src
forall b a. a -> DisplayObject b a
DO.UserObject (SyntaxText -> SyntaxText -> Src
Src SyntaxText
folded (Term v () -> Type v () -> SyntaxText
full Term v ()
tm Type v ()
typ)))]
evalDoc ::
forall v m.
(Var v, Monad m) =>
(Reference -> m (Maybe (Term v ()))) ->
(Referent -> m (Maybe (Type v ()))) ->
(Term v () -> m (Maybe (Term v ()))) ->
(Reference -> m (Maybe (DD.Decl v ()))) ->
Term v () ->
m (EvaluatedDoc v)
evalDoc :: forall v (m :: * -> *).
(Var v, Monad m) =>
(Reference' Text Hash -> m (Maybe (Term v ())))
-> (Referent -> m (Maybe (Type v ())))
-> (Term v () -> m (Maybe (Term v ())))
-> (Reference' Text Hash -> m (Maybe (Decl v ())))
-> Term v ()
-> m (EvaluatedDoc v)
evalDoc Reference' Text Hash -> m (Maybe (Term v ()))
terms Referent -> m (Maybe (Type v ()))
typeOf Term v () -> m (Maybe (Term v ()))
eval Reference' Text Hash -> m (Maybe (Decl v ()))
types Term v ()
tm =
Term v () -> m (Maybe (Term v ()))
eval Term v ()
tm m (Maybe (Term v ()))
-> (Maybe (Term v ()) -> m (EvaluatedDoc v)) -> m (EvaluatedDoc v)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe (Term v ())
Nothing -> EvaluatedDoc v -> m (EvaluatedDoc v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedDoc v -> m (EvaluatedDoc v))
-> EvaluatedDoc v -> m (EvaluatedDoc v)
forall a b. (a -> b) -> a -> b
$ Text -> EvaluatedDoc v
forall specialForm. Text -> DocG specialForm
Word Text
"🆘 doc rendering failed during evaluation"
Just Term v ()
tm -> Term v () -> m (EvaluatedDoc v)
go Term v ()
tm
where
go :: Term v () -> m (EvaluatedDoc v)
go :: Term v () -> m (EvaluatedDoc v)
go = \case
DD.Doc2Word Text
txt -> EvaluatedDoc v -> m (EvaluatedDoc v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedDoc v -> m (EvaluatedDoc v))
-> EvaluatedDoc v -> m (EvaluatedDoc v)
forall a b. (a -> b) -> a -> b
$ Text -> EvaluatedDoc v
forall specialForm. Text -> DocG specialForm
Word Text
txt
DD.Doc2Code Term v ()
d -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm. DocG specialForm -> DocG specialForm
Code (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d
DD.Doc2CodeBlock Text
lang Term v ()
d -> Text -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm. Text -> DocG specialForm -> DocG specialForm
CodeBlock Text
lang (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d
DD.Doc2Bold Term v ()
d -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm. DocG specialForm -> DocG specialForm
Bold (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d
DD.Doc2Italic Term v ()
d -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm. DocG specialForm -> DocG specialForm
Italic (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d
DD.Doc2Strikethrough Term v ()
d -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm. DocG specialForm -> DocG specialForm
Strikethrough (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d
DD.Doc2Style Text
s Term v ()
d -> Text -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm. Text -> DocG specialForm -> DocG specialForm
Style Text
s (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d
DD.Doc2Anchor Text
id Term v ()
d -> Text -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm. Text -> DocG specialForm -> DocG specialForm
Anchor Text
id (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d
DD.Doc2Blockquote Term v ()
d -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm. DocG specialForm -> DocG specialForm
Blockquote (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d
Term v ()
DD.Doc2Blankline -> EvaluatedDoc v -> m (EvaluatedDoc v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure EvaluatedDoc v
forall specialForm. DocG specialForm
Blankline
Term v ()
DD.Doc2Linebreak -> EvaluatedDoc v -> m (EvaluatedDoc v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure EvaluatedDoc v
forall specialForm. DocG specialForm
Linebreak
Term v ()
DD.Doc2SectionBreak -> EvaluatedDoc v -> m (EvaluatedDoc v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure EvaluatedDoc v
forall specialForm. DocG specialForm
SectionBreak
DD.Doc2Tooltip Term v ()
d1 Term v ()
d2 -> EvaluatedDoc v -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm.
DocG specialForm -> DocG specialForm -> DocG specialForm
Tooltip (EvaluatedDoc v -> EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v -> EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d1 m (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Term v () -> m (EvaluatedDoc v)
go Term v ()
d2
DD.Doc2Aside Term v ()
d -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm. DocG specialForm -> DocG specialForm
Aside (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d
DD.Doc2Callout Term v ()
Decls.OptionalNone' Term v ()
d -> Maybe (EvaluatedDoc v) -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm.
Maybe (DocG specialForm) -> DocG specialForm -> DocG specialForm
Callout Maybe (EvaluatedDoc v)
forall a. Maybe a
Nothing (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d
DD.Doc2Callout (Decls.OptionalSome' Term v ()
icon) Term v ()
d -> Maybe (EvaluatedDoc v) -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm.
Maybe (DocG specialForm) -> DocG specialForm -> DocG specialForm
Callout (Maybe (EvaluatedDoc v) -> EvaluatedDoc v -> EvaluatedDoc v)
-> m (Maybe (EvaluatedDoc v))
-> m (EvaluatedDoc v -> EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (EvaluatedDoc v -> Maybe (EvaluatedDoc v)
forall a. a -> Maybe a
Just (EvaluatedDoc v -> Maybe (EvaluatedDoc v))
-> m (EvaluatedDoc v) -> m (Maybe (EvaluatedDoc v))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
icon) m (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Term v () -> m (EvaluatedDoc v)
go Term v ()
d
DD.Doc2Table [Term v ()]
rows -> [[EvaluatedDoc v]] -> EvaluatedDoc v
forall specialForm. [[DocG specialForm]] -> DocG specialForm
Table ([[EvaluatedDoc v]] -> EvaluatedDoc v)
-> m [[EvaluatedDoc v]] -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Term v () -> m [EvaluatedDoc v])
-> [Term v ()] -> m [[EvaluatedDoc v]]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse Term v () -> m [EvaluatedDoc v]
r [Term v ()]
rows
where
r :: Term v () -> m [EvaluatedDoc v]
r (Term.List' Seq (Term v ())
ds) = (Term v () -> m (EvaluatedDoc v))
-> [Term v ()] -> m [EvaluatedDoc v]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse Term v () -> m (EvaluatedDoc v)
go (Seq (Term v ()) -> [Term v ()]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList Seq (Term v ())
ds)
r Term v ()
_ = [EvaluatedDoc v] -> m [EvaluatedDoc v]
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [Text -> EvaluatedDoc v
forall specialForm. Text -> DocG specialForm
Word Text
"🆘 invalid table"]
DD.Doc2Folded Bool
isFolded Term v ()
d Term v ()
d2 -> Bool -> EvaluatedDoc v -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm.
Bool -> DocG specialForm -> DocG specialForm -> DocG specialForm
Folded Bool
isFolded (EvaluatedDoc v -> EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v -> EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d m (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Term v () -> m (EvaluatedDoc v)
go Term v ()
d2
DD.Doc2Paragraph [Term v ()]
ds -> [EvaluatedDoc v] -> EvaluatedDoc v
forall specialForm. [DocG specialForm] -> DocG specialForm
Paragraph ([EvaluatedDoc v] -> EvaluatedDoc v)
-> m [EvaluatedDoc v] -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Term v () -> m (EvaluatedDoc v))
-> [Term v ()] -> m [EvaluatedDoc v]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse Term v () -> m (EvaluatedDoc v)
go [Term v ()]
ds
DD.Doc2BulletedList [Term v ()]
ds -> [EvaluatedDoc v] -> EvaluatedDoc v
forall specialForm. [DocG specialForm] -> DocG specialForm
BulletedList ([EvaluatedDoc v] -> EvaluatedDoc v)
-> m [EvaluatedDoc v] -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Term v () -> m (EvaluatedDoc v))
-> [Term v ()] -> m [EvaluatedDoc v]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse Term v () -> m (EvaluatedDoc v)
go [Term v ()]
ds
DD.Doc2NumberedList Nat
n [Term v ()]
ds -> Nat -> [EvaluatedDoc v] -> EvaluatedDoc v
forall specialForm. Nat -> [DocG specialForm] -> DocG specialForm
NumberedList Nat
n ([EvaluatedDoc v] -> EvaluatedDoc v)
-> m [EvaluatedDoc v] -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Term v () -> m (EvaluatedDoc v))
-> [Term v ()] -> m [EvaluatedDoc v]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse Term v () -> m (EvaluatedDoc v)
go [Term v ()]
ds
DD.Doc2Section Term v ()
title [Term v ()]
ds -> EvaluatedDoc v -> [EvaluatedDoc v] -> EvaluatedDoc v
forall specialForm.
DocG specialForm -> [DocG specialForm] -> DocG specialForm
Section (EvaluatedDoc v -> [EvaluatedDoc v] -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m ([EvaluatedDoc v] -> EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
title m ([EvaluatedDoc v] -> EvaluatedDoc v)
-> m [EvaluatedDoc v] -> m (EvaluatedDoc v)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Term v () -> m (EvaluatedDoc v))
-> [Term v ()] -> m [EvaluatedDoc v]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse Term v () -> m (EvaluatedDoc v)
go [Term v ()]
ds
DD.Doc2NamedLink Term v ()
d1 Term v ()
d2 -> EvaluatedDoc v -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm.
DocG specialForm -> DocG specialForm -> DocG specialForm
NamedLink (EvaluatedDoc v -> EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v -> EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d1 m (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Term v () -> m (EvaluatedDoc v)
go Term v ()
d2
DD.Doc2Image Term v ()
d1 Term v ()
d2 Term v ()
Decls.OptionalNone' -> EvaluatedDoc v
-> EvaluatedDoc v -> Maybe (EvaluatedDoc v) -> EvaluatedDoc v
forall specialForm.
DocG specialForm
-> DocG specialForm -> Maybe (DocG specialForm) -> DocG specialForm
Image (EvaluatedDoc v
-> EvaluatedDoc v -> Maybe (EvaluatedDoc v) -> EvaluatedDoc v)
-> m (EvaluatedDoc v)
-> m (EvaluatedDoc v -> Maybe (EvaluatedDoc v) -> EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d1 m (EvaluatedDoc v -> Maybe (EvaluatedDoc v) -> EvaluatedDoc v)
-> m (EvaluatedDoc v)
-> m (Maybe (EvaluatedDoc v) -> EvaluatedDoc v)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Term v () -> m (EvaluatedDoc v)
go Term v ()
d2 m (Maybe (EvaluatedDoc v) -> EvaluatedDoc v)
-> m (Maybe (EvaluatedDoc v)) -> m (EvaluatedDoc v)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Maybe (EvaluatedDoc v) -> m (Maybe (EvaluatedDoc v))
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe (EvaluatedDoc v)
forall a. Maybe a
Nothing
DD.Doc2Image Term v ()
d1 Term v ()
d2 (Decls.OptionalSome' Term v ()
d) -> EvaluatedDoc v
-> EvaluatedDoc v -> Maybe (EvaluatedDoc v) -> EvaluatedDoc v
forall specialForm.
DocG specialForm
-> DocG specialForm -> Maybe (DocG specialForm) -> DocG specialForm
Image (EvaluatedDoc v
-> EvaluatedDoc v -> Maybe (EvaluatedDoc v) -> EvaluatedDoc v)
-> m (EvaluatedDoc v)
-> m (EvaluatedDoc v -> Maybe (EvaluatedDoc v) -> EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d1 m (EvaluatedDoc v -> Maybe (EvaluatedDoc v) -> EvaluatedDoc v)
-> m (EvaluatedDoc v)
-> m (Maybe (EvaluatedDoc v) -> EvaluatedDoc v)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Term v () -> m (EvaluatedDoc v)
go Term v ()
d2 m (Maybe (EvaluatedDoc v) -> EvaluatedDoc v)
-> m (Maybe (EvaluatedDoc v)) -> m (EvaluatedDoc v)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (EvaluatedDoc v -> Maybe (EvaluatedDoc v)
forall a. a -> Maybe a
Just (EvaluatedDoc v -> Maybe (EvaluatedDoc v))
-> m (EvaluatedDoc v) -> m (Maybe (EvaluatedDoc v))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d)
DD.Doc2Special Term v ()
sf -> EvaluatedSpecialForm v -> EvaluatedDoc v
forall specialForm. specialForm -> DocG specialForm
Special (EvaluatedSpecialForm v -> EvaluatedDoc v)
-> m (EvaluatedSpecialForm v) -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedSpecialForm v)
goSpecial Term v ()
sf
DD.Doc2Join [Term v ()]
ds -> [EvaluatedDoc v] -> EvaluatedDoc v
forall specialForm. [DocG specialForm] -> DocG specialForm
Join ([EvaluatedDoc v] -> EvaluatedDoc v)
-> m [EvaluatedDoc v] -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Term v () -> m (EvaluatedDoc v))
-> [Term v ()] -> m [EvaluatedDoc v]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse Term v () -> m (EvaluatedDoc v)
go [Term v ()]
ds
DD.Doc2UntitledSection [Term v ()]
ds -> [EvaluatedDoc v] -> EvaluatedDoc v
forall specialForm. [DocG specialForm] -> DocG specialForm
UntitledSection ([EvaluatedDoc v] -> EvaluatedDoc v)
-> m [EvaluatedDoc v] -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Term v () -> m (EvaluatedDoc v))
-> [Term v ()] -> m [EvaluatedDoc v]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse Term v () -> m (EvaluatedDoc v)
go [Term v ()]
ds
DD.Doc2Column [Term v ()]
ds -> [EvaluatedDoc v] -> EvaluatedDoc v
forall specialForm. [DocG specialForm] -> DocG specialForm
Column ([EvaluatedDoc v] -> EvaluatedDoc v)
-> m [EvaluatedDoc v] -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Term v () -> m (EvaluatedDoc v))
-> [Term v ()] -> m [EvaluatedDoc v]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse Term v () -> m (EvaluatedDoc v)
go [Term v ()]
ds
DD.Doc2Group Term v ()
d -> EvaluatedDoc v -> EvaluatedDoc v
forall specialForm. DocG specialForm -> DocG specialForm
Group (EvaluatedDoc v -> EvaluatedDoc v)
-> m (EvaluatedDoc v) -> m (EvaluatedDoc v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term v () -> m (EvaluatedDoc v)
go Term v ()
d
Term v ()
wat -> EvaluatedDoc v -> m (EvaluatedDoc v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedDoc v -> m (EvaluatedDoc v))
-> EvaluatedDoc v -> m (EvaluatedDoc v)
forall a b. (a -> b) -> a -> b
$ EvaluatedSpecialForm v -> EvaluatedDoc v
forall specialForm. specialForm -> DocG specialForm
Special (EvaluatedSpecialForm v -> EvaluatedDoc v)
-> EvaluatedSpecialForm v -> EvaluatedDoc v
forall a b. (a -> b) -> a -> b
$ RenderError (Term v ()) -> EvaluatedSpecialForm v
forall v. RenderError (Term v ()) -> EvaluatedSpecialForm v
ERenderError (Term v () -> RenderError (Term v ())
forall trm. trm -> RenderError trm
InvalidTerm Term v ()
wat)
goSignatures :: [Referent] -> m [(Referent, Type v ())]
goSignatures :: [Referent] -> m [(Referent, Type v ())]
goSignatures [Referent]
rs =
MaybeT m [Type v ()] -> m (Maybe [Type v ()])
forall (m :: * -> *) a. MaybeT m a -> m (Maybe a)
runMaybeT ((Referent -> MaybeT m (Type v ()))
-> [Referent] -> MaybeT m [Type v ()]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse (m (Maybe (Type v ())) -> MaybeT m (Type v ())
forall (m :: * -> *) a. m (Maybe a) -> MaybeT m a
MaybeT (m (Maybe (Type v ())) -> MaybeT m (Type v ()))
-> (Referent -> m (Maybe (Type v ())))
-> Referent
-> MaybeT m (Type v ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Referent -> m (Maybe (Type v ()))
typeOf) [Referent]
rs) m (Maybe [Type v ()])
-> (Maybe [Type v ()] -> m [(Referent, Type v ())])
-> m [(Referent, Type v ())]
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe [Type v ()]
Nothing -> String -> m [(Referent, Type v ())]
forall a. HasCallStack => String -> a
error String
"🆘 codebase is missing type signature for these definitions"
Just [Type v ()]
types -> [(Referent, Type v ())] -> m [(Referent, Type v ())]
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Referent] -> [Type v ()] -> [(Referent, Type v ())]
forall a b. [a] -> [b] -> [(a, b)]
zip [Referent]
rs [Type v ()]
types)
goSpecial :: Term v () -> m (EvaluatedSpecialForm v)
goSpecial :: Term v () -> m (EvaluatedSpecialForm v)
goSpecial = \case
DD.Doc2SpecialFormFoldedSource (Term.List' Seq (Term v ())
es) -> [EvaluatedSrc v] -> EvaluatedSpecialForm v
forall v. [EvaluatedSrc v] -> EvaluatedSpecialForm v
EFoldedSource ([EvaluatedSrc v] -> EvaluatedSpecialForm v)
-> m [EvaluatedSrc v] -> m (EvaluatedSpecialForm v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Term v ()] -> m [EvaluatedSrc v]
goSrc (Seq (Term v ()) -> [Term v ()]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList Seq (Term v ())
es)
DD.Doc2SpecialFormSource (Term.List' Seq (Term v ())
es) -> [EvaluatedSrc v] -> EvaluatedSpecialForm v
forall v. [EvaluatedSrc v] -> EvaluatedSpecialForm v
ESource ([EvaluatedSrc v] -> EvaluatedSpecialForm v)
-> m [EvaluatedSrc v] -> m (EvaluatedSpecialForm v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Term v ()] -> m [EvaluatedSrc v]
goSrc (Seq (Term v ()) -> [Term v ()]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList Seq (Term v ())
es)
DD.Doc2SpecialFormExample Nat
n (DD.Doc2Example [v]
vs Term v ()
body) ->
EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v))
-> EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a b. (a -> b) -> a -> b
$ Term v () -> EvaluatedSpecialForm v
forall v. Term v () -> EvaluatedSpecialForm v
EExample Term v ()
ex
where
annotatedVs :: [((), v)]
annotatedVs = ((),) (v -> ((), v)) -> [v] -> [((), v)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [v]
vs
ex :: Term v ()
ex = () -> [((), v)] -> Term v () -> Term v ()
forall v a vt at ap.
Ord v =>
a -> [(a, v)] -> Term2 vt at ap v a -> Term2 vt at ap v a
Term.lam' (Term v () -> ()
forall (f :: * -> *) v a. Term f v a -> a
ABT.annotation Term v ()
body) (Int -> [((), v)] -> [((), v)]
forall a. Int -> [a] -> [a]
drop (Nat -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Nat
n) [((), v)]
annotatedVs) Term v ()
body
DD.Doc2SpecialFormExampleBlock Nat
n (DD.Doc2Example [v]
vs Term v ()
body) ->
EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v))
-> EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a b. (a -> b) -> a -> b
$ Term v () -> EvaluatedSpecialForm v
forall v. Term v () -> EvaluatedSpecialForm v
EExampleBlock Term v ()
ex
where
annotatedVs :: [((), v)]
annotatedVs = ((),) (v -> ((), v)) -> [v] -> [((), v)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [v]
vs
ex :: Term v ()
ex = () -> [((), v)] -> Term v () -> Term v ()
forall v a vt at ap.
Ord v =>
a -> [(a, v)] -> Term2 vt at ap v a -> Term2 vt at ap v a
Term.lam' (Term v () -> ()
forall (f :: * -> *) v a. Term f v a -> a
ABT.annotation Term v ()
body) (Int -> [((), v)] -> [((), v)]
forall a. Int -> [a] -> [a]
drop (Nat -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Nat
n) [((), v)]
annotatedVs) Term v ()
body
DD.Doc2SpecialFormLink Term v ()
e ->
let tm :: Referent -> (Either a LD.LabeledDependency)
tm :: forall a. Referent -> Either a LabeledDependency
tm Referent
r = LabeledDependency -> Either a LabeledDependency
forall a b. b -> Either a b
Right (LabeledDependency -> Either a LabeledDependency)
-> LabeledDependency -> Either a LabeledDependency
forall a b. (a -> b) -> a -> b
$ Referent -> LabeledDependency
LD.TermReferent Referent
r
ty :: Reference -> (Either a LD.LabeledDependency)
ty :: forall a. Reference' Text Hash -> Either a LabeledDependency
ty Reference' Text Hash
r = LabeledDependency -> Either a LabeledDependency
forall a b. b -> Either a b
Right (LabeledDependency -> Either a LabeledDependency)
-> LabeledDependency -> Either a LabeledDependency
forall a b. (a -> b) -> a -> b
$ Reference' Text Hash -> LabeledDependency
LD.TypeReference Reference' Text Hash
r
in Either (Term v ()) LabeledDependency -> EvaluatedSpecialForm v
forall v.
Either (Term v ()) LabeledDependency -> EvaluatedSpecialForm v
ELink (Either (Term v ()) LabeledDependency -> EvaluatedSpecialForm v)
-> m (Either (Term v ()) LabeledDependency)
-> m (EvaluatedSpecialForm v)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> case Term v ()
e of
DD.EitherLeft' (Term.TypeLink' Reference' Text Hash
r) -> Either (Term v ()) LabeledDependency
-> m (Either (Term v ()) LabeledDependency)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Either (Term v ()) LabeledDependency
-> m (Either (Term v ()) LabeledDependency))
-> Either (Term v ()) LabeledDependency
-> m (Either (Term v ()) LabeledDependency)
forall a b. (a -> b) -> a -> b
$ Reference' Text Hash -> Either (Term v ()) LabeledDependency
forall a. Reference' Text Hash -> Either a LabeledDependency
ty Reference' Text Hash
r
DD.EitherRight' (DD.Doc2Term Term v ()
t) ->
case Term v () -> Term v ()
forall v. Ord v => Term0 v -> Term0 v
Term.etaNormalForm Term v ()
t of
Term.Referent' Referent
r -> Either (Term v ()) LabeledDependency
-> m (Either (Term v ()) LabeledDependency)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Either (Term v ()) LabeledDependency
-> m (Either (Term v ()) LabeledDependency))
-> Either (Term v ()) LabeledDependency
-> m (Either (Term v ()) LabeledDependency)
forall a b. (a -> b) -> a -> b
$ Referent -> Either (Term v ()) LabeledDependency
forall a. Referent -> Either a LabeledDependency
tm Referent
r
Term v ()
x -> Either (Term v ()) LabeledDependency
-> m (Either (Term v ()) LabeledDependency)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Either (Term v ()) LabeledDependency
-> m (Either (Term v ()) LabeledDependency))
-> Either (Term v ()) LabeledDependency
-> m (Either (Term v ()) LabeledDependency)
forall a b. (a -> b) -> a -> b
$ Term v () -> Either (Term v ()) LabeledDependency
forall a b. a -> Either a b
Left Term v ()
x
Term v ()
_ -> Either (Term v ()) LabeledDependency
-> m (Either (Term v ()) LabeledDependency)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Either (Term v ()) LabeledDependency
-> m (Either (Term v ()) LabeledDependency))
-> Either (Term v ()) LabeledDependency
-> m (Either (Term v ()) LabeledDependency)
forall a b. (a -> b) -> a -> b
$ Term v () -> Either (Term v ()) LabeledDependency
forall a b. a -> Either a b
Left Term v ()
e
DD.Doc2SpecialFormSignature (Term.List' Seq (Term v ())
tms) ->
let rs :: [Referent]
rs = [Referent
r | DD.Doc2Term (Term.Referent' Referent
r) <- Seq (Term v ()) -> [Term v ()]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList Seq (Term v ())
tms]
in [Referent] -> m [(Referent, Type v ())]
goSignatures [Referent]
rs m [(Referent, Type v ())]
-> ([(Referent, Type v ())] -> EvaluatedSpecialForm v)
-> m (EvaluatedSpecialForm v)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \[(Referent, Type v ())]
s -> [(Referent, Type v ())] -> EvaluatedSpecialForm v
forall v. [(Referent, Type v ())] -> EvaluatedSpecialForm v
ESignature [(Referent, Type v ())]
s
DD.Doc2SpecialFormSignatureInline (DD.Doc2Term (Term.Referent' Referent
r)) ->
[Referent] -> m [(Referent, Type v ())]
goSignatures [Referent
r] m [(Referent, Type v ())]
-> ([(Referent, Type v ())] -> EvaluatedSpecialForm v)
-> m (EvaluatedSpecialForm v)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \case
[(Referent, Type v ())
s] -> (Referent, Type v ()) -> EvaluatedSpecialForm v
forall v. (Referent, Type v ()) -> EvaluatedSpecialForm v
ESignatureInline (Referent, Type v ())
s
[(Referent, Type v ())]
_ -> String -> EvaluatedSpecialForm v
forall a. HasCallStack => String -> a
error String
"impossible error: evalDoc: expected exactly one signature"
DD.Doc2SpecialFormEval (DD.Doc2Term Term v ()
tm) -> do
Maybe (Term v ())
result <- Term v () -> m (Maybe (Term v ()))
eval Term v ()
tm
EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v))
-> EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a b. (a -> b) -> a -> b
$ Term v () -> Maybe (Term v ()) -> EvaluatedSpecialForm v
forall v. Term v () -> Maybe (Term v ()) -> EvaluatedSpecialForm v
EEval Term v ()
tm Maybe (Term v ())
result
DD.Doc2SpecialFormEvalInline (DD.Doc2Term Term v ()
tm) -> do
Maybe (Term v ())
result <- Term v () -> m (Maybe (Term v ()))
eval Term v ()
tm
EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v))
-> EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a b. (a -> b) -> a -> b
$ Term v () -> Maybe (Term v ()) -> EvaluatedSpecialForm v
forall v. Term v () -> Maybe (Term v ()) -> EvaluatedSpecialForm v
EEvalInline Term v ()
tm Maybe (Term v ())
result
DD.Doc2SpecialFormEmbedVideo [Term v ()]
sources [Term v ()]
config ->
EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v))
-> EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a b. (a -> b) -> a -> b
$ [MediaSource] -> Map Text Text -> EvaluatedSpecialForm v
forall v. [MediaSource] -> Map Text Text -> EvaluatedSpecialForm v
EVideo [MediaSource]
sources' Map Text Text
config'
where
sources' :: [MediaSource]
sources' = [Text -> Maybe Text -> MediaSource
MediaSource Text
url Maybe Text
mimeType | DD.Doc2MediaSource (Term.Text' Text
url) (Term v () -> Maybe Text
forall {typeVar} {typeAnn} {patternAnn} {v} {a}.
Term (F typeVar typeAnn patternAnn) v a -> Maybe Text
maybeText -> Maybe Text
mimeType) <- [Term v ()]
sources]
config' :: Map Text Text
config' = [(Text, Text)] -> Map Text Text
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(Text
k, Text
v) | Decls.TupleTerm' [Term.Text' Text
k, Term.Text' Text
v] <- [Term v ()]
config]
maybeText :: Term (F typeVar typeAnn patternAnn) v a -> Maybe Text
maybeText (Term.App' Term (F typeVar typeAnn patternAnn) v a
_ (Term.Text' Text
a)) = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
a
maybeText Term (F typeVar typeAnn patternAnn) v a
_ = Maybe Text
forall a. Maybe a
Nothing
DD.Doc2SpecialFormEmbedFrontMatter [Term v ()]
frontMatter ->
EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v))
-> EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a b. (a -> b) -> a -> b
$ Map Text [Text] -> EvaluatedSpecialForm v
forall v. Map Text [Text] -> EvaluatedSpecialForm v
EFrontMatter Map Text [Text]
frontMatter'
where
frontMatter' :: Map Text [Text]
frontMatter' = [(Text, Text)] -> Map Text [Text]
forall (f :: * -> *) k v.
(Foldable f, Ord k) =>
f (k, v) -> Map k [v]
List.multimap [(Text
k, Text
v) | Decls.TupleTerm' [Term.Text' Text
k, Term.Text' Text
v] <- [Term v ()]
frontMatter]
DD.Doc2SpecialFormEmbedLaTeXInline Text
latex ->
EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v))
-> EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a b. (a -> b) -> a -> b
$ Text -> EvaluatedSpecialForm v
forall v. Text -> EvaluatedSpecialForm v
ELaTeXInline Text
latex
DD.Doc2SpecialFormEmbedSvg Text
svg ->
EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v))
-> EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a b. (a -> b) -> a -> b
$ Text -> EvaluatedSpecialForm v
forall v. Text -> EvaluatedSpecialForm v
ESvg Text
svg
DD.Doc2SpecialFormEmbed (Term.App' Term v ()
_ Term v ()
any) ->
EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v))
-> EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a b. (a -> b) -> a -> b
$ Term v () -> EvaluatedSpecialForm v
forall v. Term v () -> EvaluatedSpecialForm v
EEmbed Term v ()
any
DD.Doc2SpecialFormEmbedInline Term v ()
any ->
EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v))
-> EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a b. (a -> b) -> a -> b
$ Term v () -> EvaluatedSpecialForm v
forall v. Term v () -> EvaluatedSpecialForm v
EEmbedInline Term v ()
any
Term v ()
tm -> EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v))
-> EvaluatedSpecialForm v -> m (EvaluatedSpecialForm v)
forall a b. (a -> b) -> a -> b
$ RenderError (Term v ()) -> EvaluatedSpecialForm v
forall v. RenderError (Term v ()) -> EvaluatedSpecialForm v
ERenderError (Term v () -> RenderError (Term v ())
forall trm. trm -> RenderError trm
InvalidTerm Term v ()
tm)
goSrc :: [Term v ()] -> m [EvaluatedSrc v]
goSrc :: [Term v ()] -> m [EvaluatedSrc v]
goSrc [Term v ()]
es = do
let toRef :: Term (F typeVar typeAnn patternAnn) v a
-> Set (Reference' Text Hash)
toRef (Term.Ref' Reference' Text Hash
r) = Reference' Text Hash -> Set (Reference' Text Hash)
forall a. a -> Set a
Set.singleton Reference' Text Hash
r
toRef (Term.RequestOrCtor' GConstructorReference (Reference' Text Hash)
r) = Reference' Text Hash -> Set (Reference' Text Hash)
forall a. a -> Set a
Set.singleton (GConstructorReference (Reference' Text Hash)
r GConstructorReference (Reference' Text Hash)
-> Getting
(Reference' Text Hash)
(GConstructorReference (Reference' Text Hash))
(Reference' Text Hash)
-> Reference' Text Hash
forall s a. s -> Getting a s a -> a
^. Getting
(Reference' Text Hash)
(GConstructorReference (Reference' Text Hash))
(Reference' Text Hash)
forall r s (f :: * -> *).
Functor f =>
(r -> f s)
-> GConstructorReference r -> f (GConstructorReference s)
ConstructorReference.reference_)
toRef Term (F typeVar typeAnn patternAnn) v a
_ = Set (Reference' Text Hash)
forall a. Monoid a => a
mempty
goType :: Reference -> m (EvaluatedSrc v)
goType :: Reference' Text Hash -> m (EvaluatedSrc v)
goType r :: Reference' Text Hash
r@(Reference.Builtin Text
_builtin) =
EvaluatedSrc v -> m (EvaluatedSrc v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedDecl v -> EvaluatedSrc v
forall v. EvaluatedDecl v -> EvaluatedSrc v
EvaluatedSrcDecl (Reference' Text Hash -> EvaluatedDecl v
forall v. Reference' Text Hash -> EvaluatedDecl v
BuiltinDecl Reference' Text Hash
r))
goType Reference' Text Hash
r = do
Maybe (Decl v ())
d <- Reference' Text Hash -> m (Maybe (Decl v ()))
types Reference' Text Hash
r
case Maybe (Decl v ())
d of
Maybe (Decl v ())
Nothing -> EvaluatedSrc v -> m (EvaluatedSrc v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedDecl v -> EvaluatedSrc v
forall v. EvaluatedDecl v -> EvaluatedSrc v
EvaluatedSrcDecl (EvaluatedDecl v -> EvaluatedSrc v)
-> EvaluatedDecl v -> EvaluatedSrc v
forall a b. (a -> b) -> a -> b
$ Reference' Text Hash -> EvaluatedDecl v
forall v. Reference' Text Hash -> EvaluatedDecl v
MissingDecl Reference' Text Hash
r)
Just Decl v ()
decl ->
EvaluatedSrc v -> m (EvaluatedSrc v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSrc v -> m (EvaluatedSrc v))
-> EvaluatedSrc v -> m (EvaluatedSrc v)
forall a b. (a -> b) -> a -> b
$ EvaluatedDecl v -> EvaluatedSrc v
forall v. EvaluatedDecl v -> EvaluatedSrc v
EvaluatedSrcDecl (Reference' Text Hash -> Decl v () -> EvaluatedDecl v
forall v. Reference' Text Hash -> Decl v () -> EvaluatedDecl v
FoundDecl Reference' Text Hash
r Decl v ()
decl)
go ::
(Set.Set Reference, [EvaluatedSrc v]) ->
Term v () ->
m (Set.Set Reference, [EvaluatedSrc v])
go :: (Set (Reference' Text Hash), [EvaluatedSrc v])
-> Term v () -> m (Set (Reference' Text Hash), [EvaluatedSrc v])
go s1 :: (Set (Reference' Text Hash), [EvaluatedSrc v])
s1@(!Set (Reference' Text Hash)
seen, ![EvaluatedSrc v]
acc) = \case
DD.TupleTerm' [DD.EitherRight' (DD.Doc2Term Term v ()
tm), Term v ()
_anns] ->
(Set (Reference' Text Hash)
seen Set (Reference' Text Hash)
-> Set (Reference' Text Hash) -> Set (Reference' Text Hash)
forall a. Semigroup a => a -> a -> a
<> Term v () -> Set (Reference' Text Hash)
forall {typeVar} {typeAnn} {patternAnn} {v} {a}.
Term (F typeVar typeAnn patternAnn) v a
-> Set (Reference' Text Hash)
toRef Term v ()
tm,) ([EvaluatedSrc v]
-> (Set (Reference' Text Hash), [EvaluatedSrc v]))
-> m [EvaluatedSrc v]
-> m (Set (Reference' Text Hash), [EvaluatedSrc v])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m [EvaluatedSrc v]
acc'
where
acc' :: m [EvaluatedSrc v]
acc' = case Term v ()
tm of
Term.Ref' Reference' Text Hash
r
| Reference' Text Hash -> Set (Reference' Text Hash) -> Bool
forall a. Ord a => a -> Set a -> Bool
Set.notMember Reference' Text Hash
r Set (Reference' Text Hash)
seen ->
(EvaluatedSrc v -> [EvaluatedSrc v] -> [EvaluatedSrc v]
forall a. a -> [a] -> [a]
: [EvaluatedSrc v]
acc) (EvaluatedSrc v -> [EvaluatedSrc v])
-> m (EvaluatedSrc v) -> m [EvaluatedSrc v]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> case Reference' Text Hash
r of
Reference.Builtin Text
_ ->
Referent -> m (Maybe (Type v ()))
typeOf (Reference' Text Hash -> Referent
Referent.Ref Reference' Text Hash
r) m (Maybe (Type v ()))
-> (Maybe (Type v ()) -> EvaluatedSrc v) -> m (EvaluatedSrc v)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \case
Maybe (Type v ())
Nothing -> EvaluatedTerm v -> EvaluatedSrc v
forall v. EvaluatedTerm v -> EvaluatedSrc v
EvaluatedSrcTerm (Reference' Text Hash -> EvaluatedTerm v
forall v. Reference' Text Hash -> EvaluatedTerm v
MissingBuiltinTypeSig Reference' Text Hash
r)
Just Type v ()
ty -> EvaluatedTerm v -> EvaluatedSrc v
forall v. EvaluatedTerm v -> EvaluatedSrc v
EvaluatedSrcTerm (Reference' Text Hash -> Type v () -> EvaluatedTerm v
forall v. Reference' Text Hash -> Type v () -> EvaluatedTerm v
BuiltinTypeSig Reference' Text Hash
r Type v ()
ty)
Reference' Text Hash
ref ->
Reference' Text Hash -> m (Maybe (Term v ()))
terms Reference' Text Hash
ref m (Maybe (Term v ()))
-> (Maybe (Term v ()) -> m (EvaluatedSrc v)) -> m (EvaluatedSrc v)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe (Term v ())
Nothing -> EvaluatedSrc v -> m (EvaluatedSrc v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSrc v -> m (EvaluatedSrc v))
-> (Reference' Text Hash -> EvaluatedSrc v)
-> Reference' Text Hash
-> m (EvaluatedSrc v)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EvaluatedTerm v -> EvaluatedSrc v
forall v. EvaluatedTerm v -> EvaluatedSrc v
EvaluatedSrcTerm (EvaluatedTerm v -> EvaluatedSrc v)
-> (Reference' Text Hash -> EvaluatedTerm v)
-> Reference' Text Hash
-> EvaluatedSrc v
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Reference' Text Hash -> EvaluatedTerm v
forall v. Reference' Text Hash -> EvaluatedTerm v
MissingTerm (Reference' Text Hash -> m (EvaluatedSrc v))
-> Reference' Text Hash -> m (EvaluatedSrc v)
forall a b. (a -> b) -> a -> b
$ Reference' Text Hash
ref
Just Term v ()
tm -> do
Type v ()
typ <- Type v () -> Maybe (Type v ()) -> Type v ()
forall a. a -> Maybe a -> a
fromMaybe (() -> Text -> Type v ()
forall v a. Ord v => a -> Text -> Type v a
Type.builtin () Text
"unknown") (Maybe (Type v ()) -> Type v ())
-> m (Maybe (Type v ())) -> m (Type v ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Referent -> m (Maybe (Type v ()))
typeOf (Reference' Text Hash -> Referent
Referent.Ref Reference' Text Hash
ref)
EvaluatedSrc v -> m (EvaluatedSrc v)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EvaluatedSrc v -> m (EvaluatedSrc v))
-> EvaluatedSrc v -> m (EvaluatedSrc v)
forall a b. (a -> b) -> a -> b
$ EvaluatedTerm v -> EvaluatedSrc v
forall v. EvaluatedTerm v -> EvaluatedSrc v
EvaluatedSrcTerm (Reference' Text Hash -> Type v () -> Term v () -> EvaluatedTerm v
forall v.
Reference' Text Hash -> Type v () -> Term v () -> EvaluatedTerm v
FoundTerm Reference' Text Hash
ref Type v ()
typ Term v ()
tm)
Term.RequestOrCtor' (Getting
(Reference' Text Hash)
(GConstructorReference (Reference' Text Hash))
(Reference' Text Hash)
-> GConstructorReference (Reference' Text Hash)
-> Reference' Text Hash
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting
(Reference' Text Hash)
(GConstructorReference (Reference' Text Hash))
(Reference' Text Hash)
forall r s (f :: * -> *).
Functor f =>
(r -> f s)
-> GConstructorReference r -> f (GConstructorReference s)
ConstructorReference.reference_ -> Reference' Text Hash
r) | Reference' Text Hash -> Set (Reference' Text Hash) -> Bool
forall a. Ord a => a -> Set a -> Bool
Set.notMember Reference' Text Hash
r Set (Reference' Text Hash)
seen -> (EvaluatedSrc v -> [EvaluatedSrc v] -> [EvaluatedSrc v]
forall a. a -> [a] -> [a]
: [EvaluatedSrc v]
acc) (EvaluatedSrc v -> [EvaluatedSrc v])
-> m (EvaluatedSrc v) -> m [EvaluatedSrc v]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Reference' Text Hash -> m (EvaluatedSrc v)
goType Reference' Text Hash
r
Term v ()
_ -> [EvaluatedSrc v] -> m [EvaluatedSrc v]
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [EvaluatedSrc v]
acc
DD.TupleTerm' [DD.EitherLeft' (Term.TypeLink' Reference' Text Hash
ref), Term v ()
_anns]
| Reference' Text Hash -> Set (Reference' Text Hash) -> Bool
forall a. Ord a => a -> Set a -> Bool
Set.notMember Reference' Text Hash
ref Set (Reference' Text Hash)
seen ->
(Reference' Text Hash
-> Set (Reference' Text Hash) -> Set (Reference' Text Hash)
forall a. Ord a => a -> Set a -> Set a
Set.insert Reference' Text Hash
ref Set (Reference' Text Hash)
seen,) ([EvaluatedSrc v]
-> (Set (Reference' Text Hash), [EvaluatedSrc v]))
-> (EvaluatedSrc v -> [EvaluatedSrc v])
-> EvaluatedSrc v
-> (Set (Reference' Text Hash), [EvaluatedSrc v])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (EvaluatedSrc v -> [EvaluatedSrc v] -> [EvaluatedSrc v]
forall a. a -> [a] -> [a]
: [EvaluatedSrc v]
acc) (EvaluatedSrc v -> (Set (Reference' Text Hash), [EvaluatedSrc v]))
-> m (EvaluatedSrc v)
-> m (Set (Reference' Text Hash), [EvaluatedSrc v])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Reference' Text Hash -> m (EvaluatedSrc v)
goType Reference' Text Hash
ref
Term v ()
_ -> (Set (Reference' Text Hash), [EvaluatedSrc v])
-> m (Set (Reference' Text Hash), [EvaluatedSrc v])
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Set (Reference' Text Hash), [EvaluatedSrc v])
s1
[EvaluatedSrc v] -> [EvaluatedSrc v]
forall a. [a] -> [a]
reverse ([EvaluatedSrc v] -> [EvaluatedSrc v])
-> ((Set (Reference' Text Hash), [EvaluatedSrc v])
-> [EvaluatedSrc v])
-> (Set (Reference' Text Hash), [EvaluatedSrc v])
-> [EvaluatedSrc v]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Set (Reference' Text Hash), [EvaluatedSrc v]) -> [EvaluatedSrc v]
forall a b. (a, b) -> b
snd ((Set (Reference' Text Hash), [EvaluatedSrc v])
-> [EvaluatedSrc v])
-> m (Set (Reference' Text Hash), [EvaluatedSrc v])
-> m [EvaluatedSrc v]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Set (Reference' Text Hash), [EvaluatedSrc v])
-> Term v () -> m (Set (Reference' Text Hash), [EvaluatedSrc v]))
-> (Set (Reference' Text Hash), [EvaluatedSrc v])
-> [Term v ()]
-> m (Set (Reference' Text Hash), [EvaluatedSrc v])
forall (t :: * -> *) (m :: * -> *) b a.
(Foldable t, Monad m) =>
(b -> a -> m b) -> b -> t a -> m b
foldM (Set (Reference' Text Hash), [EvaluatedSrc v])
-> Term v () -> m (Set (Reference' Text Hash), [EvaluatedSrc v])
go (Set (Reference' Text Hash), [EvaluatedSrc v])
forall a. Monoid a => a
mempty [Term v ()]
es
data RenderError trm
= InvalidTerm trm
deriving stock (RenderError trm -> RenderError trm -> Bool
(RenderError trm -> RenderError trm -> Bool)
-> (RenderError trm -> RenderError trm -> Bool)
-> Eq (RenderError trm)
forall trm. Eq trm => RenderError trm -> RenderError trm -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall trm. Eq trm => RenderError trm -> RenderError trm -> Bool
== :: RenderError trm -> RenderError trm -> Bool
$c/= :: forall trm. Eq trm => RenderError trm -> RenderError trm -> Bool
/= :: RenderError trm -> RenderError trm -> Bool
Eq, Eq (RenderError trm)
Eq (RenderError trm) =>
(RenderError trm -> RenderError trm -> Ordering)
-> (RenderError trm -> RenderError trm -> Bool)
-> (RenderError trm -> RenderError trm -> Bool)
-> (RenderError trm -> RenderError trm -> Bool)
-> (RenderError trm -> RenderError trm -> Bool)
-> (RenderError trm -> RenderError trm -> RenderError trm)
-> (RenderError trm -> RenderError trm -> RenderError trm)
-> Ord (RenderError trm)
RenderError trm -> RenderError trm -> Bool
RenderError trm -> RenderError trm -> Ordering
RenderError trm -> RenderError trm -> RenderError trm
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 trm. Ord trm => Eq (RenderError trm)
forall trm. Ord trm => RenderError trm -> RenderError trm -> Bool
forall trm.
Ord trm =>
RenderError trm -> RenderError trm -> Ordering
forall trm.
Ord trm =>
RenderError trm -> RenderError trm -> RenderError trm
$ccompare :: forall trm.
Ord trm =>
RenderError trm -> RenderError trm -> Ordering
compare :: RenderError trm -> RenderError trm -> Ordering
$c< :: forall trm. Ord trm => RenderError trm -> RenderError trm -> Bool
< :: RenderError trm -> RenderError trm -> Bool
$c<= :: forall trm. Ord trm => RenderError trm -> RenderError trm -> Bool
<= :: RenderError trm -> RenderError trm -> Bool
$c> :: forall trm. Ord trm => RenderError trm -> RenderError trm -> Bool
> :: RenderError trm -> RenderError trm -> Bool
$c>= :: forall trm. Ord trm => RenderError trm -> RenderError trm -> Bool
>= :: RenderError trm -> RenderError trm -> Bool
$cmax :: forall trm.
Ord trm =>
RenderError trm -> RenderError trm -> RenderError trm
max :: RenderError trm -> RenderError trm -> RenderError trm
$cmin :: forall trm.
Ord trm =>
RenderError trm -> RenderError trm -> RenderError trm
min :: RenderError trm -> RenderError trm -> RenderError trm
Ord, Int -> RenderError trm -> ShowS
[RenderError trm] -> ShowS
RenderError trm -> String
(Int -> RenderError trm -> ShowS)
-> (RenderError trm -> String)
-> ([RenderError trm] -> ShowS)
-> Show (RenderError trm)
forall trm. Show trm => Int -> RenderError trm -> ShowS
forall trm. Show trm => [RenderError trm] -> ShowS
forall trm. Show trm => RenderError trm -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall trm. Show trm => Int -> RenderError trm -> ShowS
showsPrec :: Int -> RenderError trm -> ShowS
$cshow :: forall trm. Show trm => RenderError trm -> String
show :: RenderError trm -> String
$cshowList :: forall trm. Show trm => [RenderError trm] -> ShowS
showList :: [RenderError trm] -> ShowS
Show, (forall x. RenderError trm -> Rep (RenderError trm) x)
-> (forall x. Rep (RenderError trm) x -> RenderError trm)
-> Generic (RenderError trm)
forall x. Rep (RenderError trm) x -> RenderError trm
forall x. RenderError trm -> Rep (RenderError trm) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall trm x. Rep (RenderError trm) x -> RenderError trm
forall trm x. RenderError trm -> Rep (RenderError trm) x
$cfrom :: forall trm x. RenderError trm -> Rep (RenderError trm) x
from :: forall x. RenderError trm -> Rep (RenderError trm) x
$cto :: forall trm x. Rep (RenderError trm) x -> RenderError trm
to :: forall x. Rep (RenderError trm) x -> RenderError trm
Generic)
deriving anyclass ([RenderError trm] -> Value
[RenderError trm] -> Encoding
RenderError trm -> Value
RenderError trm -> Encoding
(RenderError trm -> Value)
-> (RenderError trm -> Encoding)
-> ([RenderError trm] -> Value)
-> ([RenderError trm] -> Encoding)
-> ToJSON (RenderError trm)
forall trm. ToJSON trm => [RenderError trm] -> Value
forall trm. ToJSON trm => [RenderError trm] -> Encoding
forall trm. ToJSON trm => RenderError trm -> Value
forall trm. ToJSON trm => RenderError trm -> Encoding
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: forall trm. ToJSON trm => RenderError trm -> Value
toJSON :: RenderError trm -> Value
$ctoEncoding :: forall trm. ToJSON trm => RenderError trm -> Encoding
toEncoding :: RenderError trm -> Encoding
$ctoJSONList :: forall trm. ToJSON trm => [RenderError trm] -> Value
toJSONList :: [RenderError trm] -> Value
$ctoEncodingList :: forall trm. ToJSON trm => [RenderError trm] -> Encoding
toEncodingList :: [RenderError trm] -> Encoding
ToJSON)
deriving anyclass instance (ToSchema trm) => ToSchema (RenderError trm)
data EvaluatedSrc v
= EvaluatedSrcDecl (EvaluatedDecl v)
| EvaluatedSrcTerm (EvaluatedTerm v)
deriving stock (Int -> EvaluatedSrc v -> ShowS
[EvaluatedSrc v] -> ShowS
EvaluatedSrc v -> String
(Int -> EvaluatedSrc v -> ShowS)
-> (EvaluatedSrc v -> String)
-> ([EvaluatedSrc v] -> ShowS)
-> Show (EvaluatedSrc v)
forall v. Show v => Int -> EvaluatedSrc v -> ShowS
forall v. Show v => [EvaluatedSrc v] -> ShowS
forall v. Show v => EvaluatedSrc v -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall v. Show v => Int -> EvaluatedSrc v -> ShowS
showsPrec :: Int -> EvaluatedSrc v -> ShowS
$cshow :: forall v. Show v => EvaluatedSrc v -> String
show :: EvaluatedSrc v -> String
$cshowList :: forall v. Show v => [EvaluatedSrc v] -> ShowS
showList :: [EvaluatedSrc v] -> ShowS
Show, Eq (EvaluatedSrc v)
Eq (EvaluatedSrc v) =>
(EvaluatedSrc v -> EvaluatedSrc v -> Ordering)
-> (EvaluatedSrc v -> EvaluatedSrc v -> Bool)
-> (EvaluatedSrc v -> EvaluatedSrc v -> Bool)
-> (EvaluatedSrc v -> EvaluatedSrc v -> Bool)
-> (EvaluatedSrc v -> EvaluatedSrc v -> Bool)
-> (EvaluatedSrc v -> EvaluatedSrc v -> EvaluatedSrc v)
-> (EvaluatedSrc v -> EvaluatedSrc v -> EvaluatedSrc v)
-> Ord (EvaluatedSrc v)
EvaluatedSrc v -> EvaluatedSrc v -> Bool
EvaluatedSrc v -> EvaluatedSrc v -> Ordering
EvaluatedSrc v -> EvaluatedSrc v -> EvaluatedSrc v
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 v. Var v => Eq (EvaluatedSrc v)
forall v. Var v => EvaluatedSrc v -> EvaluatedSrc v -> Bool
forall v. Var v => EvaluatedSrc v -> EvaluatedSrc v -> Ordering
forall v.
Var v =>
EvaluatedSrc v -> EvaluatedSrc v -> EvaluatedSrc v
$ccompare :: forall v. Var v => EvaluatedSrc v -> EvaluatedSrc v -> Ordering
compare :: EvaluatedSrc v -> EvaluatedSrc v -> Ordering
$c< :: forall v. Var v => EvaluatedSrc v -> EvaluatedSrc v -> Bool
< :: EvaluatedSrc v -> EvaluatedSrc v -> Bool
$c<= :: forall v. Var v => EvaluatedSrc v -> EvaluatedSrc v -> Bool
<= :: EvaluatedSrc v -> EvaluatedSrc v -> Bool
$c> :: forall v. Var v => EvaluatedSrc v -> EvaluatedSrc v -> Bool
> :: EvaluatedSrc v -> EvaluatedSrc v -> Bool
$c>= :: forall v. Var v => EvaluatedSrc v -> EvaluatedSrc v -> Bool
>= :: EvaluatedSrc v -> EvaluatedSrc v -> Bool
$cmax :: forall v.
Var v =>
EvaluatedSrc v -> EvaluatedSrc v -> EvaluatedSrc v
max :: EvaluatedSrc v -> EvaluatedSrc v -> EvaluatedSrc v
$cmin :: forall v.
Var v =>
EvaluatedSrc v -> EvaluatedSrc v -> EvaluatedSrc v
min :: EvaluatedSrc v -> EvaluatedSrc v -> EvaluatedSrc v
Ord, EvaluatedSrc v -> EvaluatedSrc v -> Bool
(EvaluatedSrc v -> EvaluatedSrc v -> Bool)
-> (EvaluatedSrc v -> EvaluatedSrc v -> Bool)
-> Eq (EvaluatedSrc v)
forall v. Var v => EvaluatedSrc v -> EvaluatedSrc v -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall v. Var v => EvaluatedSrc v -> EvaluatedSrc v -> Bool
== :: EvaluatedSrc v -> EvaluatedSrc v -> Bool
$c/= :: forall v. Var v => EvaluatedSrc v -> EvaluatedSrc v -> Bool
/= :: EvaluatedSrc v -> EvaluatedSrc v -> Bool
Eq, (forall x. EvaluatedSrc v -> Rep (EvaluatedSrc v) x)
-> (forall x. Rep (EvaluatedSrc v) x -> EvaluatedSrc v)
-> Generic (EvaluatedSrc v)
forall x. Rep (EvaluatedSrc v) x -> EvaluatedSrc v
forall x. EvaluatedSrc v -> Rep (EvaluatedSrc v) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall v x. Rep (EvaluatedSrc v) x -> EvaluatedSrc v
forall v x. EvaluatedSrc v -> Rep (EvaluatedSrc v) x
$cfrom :: forall v x. EvaluatedSrc v -> Rep (EvaluatedSrc v) x
from :: forall x. EvaluatedSrc v -> Rep (EvaluatedSrc v) x
$cto :: forall v x. Rep (EvaluatedSrc v) x -> EvaluatedSrc v
to :: forall x. Rep (EvaluatedSrc v) x -> EvaluatedSrc v
Generic)
data EvaluatedDecl v
= MissingDecl Reference
| BuiltinDecl Reference
| FoundDecl Reference (DD.Decl v ())
deriving stock (Int -> EvaluatedDecl v -> ShowS
[EvaluatedDecl v] -> ShowS
EvaluatedDecl v -> String
(Int -> EvaluatedDecl v -> ShowS)
-> (EvaluatedDecl v -> String)
-> ([EvaluatedDecl v] -> ShowS)
-> Show (EvaluatedDecl v)
forall v. Show v => Int -> EvaluatedDecl v -> ShowS
forall v. Show v => [EvaluatedDecl v] -> ShowS
forall v. Show v => EvaluatedDecl v -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall v. Show v => Int -> EvaluatedDecl v -> ShowS
showsPrec :: Int -> EvaluatedDecl v -> ShowS
$cshow :: forall v. Show v => EvaluatedDecl v -> String
show :: EvaluatedDecl v -> String
$cshowList :: forall v. Show v => [EvaluatedDecl v] -> ShowS
showList :: [EvaluatedDecl v] -> ShowS
Show, Eq (EvaluatedDecl v)
Eq (EvaluatedDecl v) =>
(EvaluatedDecl v -> EvaluatedDecl v -> Ordering)
-> (EvaluatedDecl v -> EvaluatedDecl v -> Bool)
-> (EvaluatedDecl v -> EvaluatedDecl v -> Bool)
-> (EvaluatedDecl v -> EvaluatedDecl v -> Bool)
-> (EvaluatedDecl v -> EvaluatedDecl v -> Bool)
-> (EvaluatedDecl v -> EvaluatedDecl v -> EvaluatedDecl v)
-> (EvaluatedDecl v -> EvaluatedDecl v -> EvaluatedDecl v)
-> Ord (EvaluatedDecl v)
EvaluatedDecl v -> EvaluatedDecl v -> Bool
EvaluatedDecl v -> EvaluatedDecl v -> Ordering
EvaluatedDecl v -> EvaluatedDecl v -> EvaluatedDecl v
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 v. Var v => Eq (EvaluatedDecl v)
forall v. Var v => EvaluatedDecl v -> EvaluatedDecl v -> Bool
forall v. Var v => EvaluatedDecl v -> EvaluatedDecl v -> Ordering
forall v.
Var v =>
EvaluatedDecl v -> EvaluatedDecl v -> EvaluatedDecl v
$ccompare :: forall v. Var v => EvaluatedDecl v -> EvaluatedDecl v -> Ordering
compare :: EvaluatedDecl v -> EvaluatedDecl v -> Ordering
$c< :: forall v. Var v => EvaluatedDecl v -> EvaluatedDecl v -> Bool
< :: EvaluatedDecl v -> EvaluatedDecl v -> Bool
$c<= :: forall v. Var v => EvaluatedDecl v -> EvaluatedDecl v -> Bool
<= :: EvaluatedDecl v -> EvaluatedDecl v -> Bool
$c> :: forall v. Var v => EvaluatedDecl v -> EvaluatedDecl v -> Bool
> :: EvaluatedDecl v -> EvaluatedDecl v -> Bool
$c>= :: forall v. Var v => EvaluatedDecl v -> EvaluatedDecl v -> Bool
>= :: EvaluatedDecl v -> EvaluatedDecl v -> Bool
$cmax :: forall v.
Var v =>
EvaluatedDecl v -> EvaluatedDecl v -> EvaluatedDecl v
max :: EvaluatedDecl v -> EvaluatedDecl v -> EvaluatedDecl v
$cmin :: forall v.
Var v =>
EvaluatedDecl v -> EvaluatedDecl v -> EvaluatedDecl v
min :: EvaluatedDecl v -> EvaluatedDecl v -> EvaluatedDecl v
Ord, EvaluatedDecl v -> EvaluatedDecl v -> Bool
(EvaluatedDecl v -> EvaluatedDecl v -> Bool)
-> (EvaluatedDecl v -> EvaluatedDecl v -> Bool)
-> Eq (EvaluatedDecl v)
forall v. Var v => EvaluatedDecl v -> EvaluatedDecl v -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall v. Var v => EvaluatedDecl v -> EvaluatedDecl v -> Bool
== :: EvaluatedDecl v -> EvaluatedDecl v -> Bool
$c/= :: forall v. Var v => EvaluatedDecl v -> EvaluatedDecl v -> Bool
/= :: EvaluatedDecl v -> EvaluatedDecl v -> Bool
Eq, (forall x. EvaluatedDecl v -> Rep (EvaluatedDecl v) x)
-> (forall x. Rep (EvaluatedDecl v) x -> EvaluatedDecl v)
-> Generic (EvaluatedDecl v)
forall x. Rep (EvaluatedDecl v) x -> EvaluatedDecl v
forall x. EvaluatedDecl v -> Rep (EvaluatedDecl v) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall v x. Rep (EvaluatedDecl v) x -> EvaluatedDecl v
forall v x. EvaluatedDecl v -> Rep (EvaluatedDecl v) x
$cfrom :: forall v x. EvaluatedDecl v -> Rep (EvaluatedDecl v) x
from :: forall x. EvaluatedDecl v -> Rep (EvaluatedDecl v) x
$cto :: forall v x. Rep (EvaluatedDecl v) x -> EvaluatedDecl v
to :: forall x. Rep (EvaluatedDecl v) x -> EvaluatedDecl v
Generic)
data EvaluatedTerm v
= MissingTerm Reference
| BuiltinTypeSig Reference (Type v ())
| MissingBuiltinTypeSig Reference
| FoundTerm Reference (Type v ()) (Term v ())
deriving stock (Int -> EvaluatedTerm v -> ShowS
[EvaluatedTerm v] -> ShowS
EvaluatedTerm v -> String
(Int -> EvaluatedTerm v -> ShowS)
-> (EvaluatedTerm v -> String)
-> ([EvaluatedTerm v] -> ShowS)
-> Show (EvaluatedTerm v)
forall v. Show v => Int -> EvaluatedTerm v -> ShowS
forall v. Show v => [EvaluatedTerm v] -> ShowS
forall v. Show v => EvaluatedTerm v -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall v. Show v => Int -> EvaluatedTerm v -> ShowS
showsPrec :: Int -> EvaluatedTerm v -> ShowS
$cshow :: forall v. Show v => EvaluatedTerm v -> String
show :: EvaluatedTerm v -> String
$cshowList :: forall v. Show v => [EvaluatedTerm v] -> ShowS
showList :: [EvaluatedTerm v] -> ShowS
Show, EvaluatedTerm v -> EvaluatedTerm v -> Bool
(EvaluatedTerm v -> EvaluatedTerm v -> Bool)
-> (EvaluatedTerm v -> EvaluatedTerm v -> Bool)
-> Eq (EvaluatedTerm v)
forall v. Var v => EvaluatedTerm v -> EvaluatedTerm v -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall v. Var v => EvaluatedTerm v -> EvaluatedTerm v -> Bool
== :: EvaluatedTerm v -> EvaluatedTerm v -> Bool
$c/= :: forall v. Var v => EvaluatedTerm v -> EvaluatedTerm v -> Bool
/= :: EvaluatedTerm v -> EvaluatedTerm v -> Bool
Eq, Eq (EvaluatedTerm v)
Eq (EvaluatedTerm v) =>
(EvaluatedTerm v -> EvaluatedTerm v -> Ordering)
-> (EvaluatedTerm v -> EvaluatedTerm v -> Bool)
-> (EvaluatedTerm v -> EvaluatedTerm v -> Bool)
-> (EvaluatedTerm v -> EvaluatedTerm v -> Bool)
-> (EvaluatedTerm v -> EvaluatedTerm v -> Bool)
-> (EvaluatedTerm v -> EvaluatedTerm v -> EvaluatedTerm v)
-> (EvaluatedTerm v -> EvaluatedTerm v -> EvaluatedTerm v)
-> Ord (EvaluatedTerm v)
EvaluatedTerm v -> EvaluatedTerm v -> Bool
EvaluatedTerm v -> EvaluatedTerm v -> Ordering
EvaluatedTerm v -> EvaluatedTerm v -> EvaluatedTerm v
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 v. Var v => Eq (EvaluatedTerm v)
forall v. Var v => EvaluatedTerm v -> EvaluatedTerm v -> Bool
forall v. Var v => EvaluatedTerm v -> EvaluatedTerm v -> Ordering
forall v.
Var v =>
EvaluatedTerm v -> EvaluatedTerm v -> EvaluatedTerm v
$ccompare :: forall v. Var v => EvaluatedTerm v -> EvaluatedTerm v -> Ordering
compare :: EvaluatedTerm v -> EvaluatedTerm v -> Ordering
$c< :: forall v. Var v => EvaluatedTerm v -> EvaluatedTerm v -> Bool
< :: EvaluatedTerm v -> EvaluatedTerm v -> Bool
$c<= :: forall v. Var v => EvaluatedTerm v -> EvaluatedTerm v -> Bool
<= :: EvaluatedTerm v -> EvaluatedTerm v -> Bool
$c> :: forall v. Var v => EvaluatedTerm v -> EvaluatedTerm v -> Bool
> :: EvaluatedTerm v -> EvaluatedTerm v -> Bool
$c>= :: forall v. Var v => EvaluatedTerm v -> EvaluatedTerm v -> Bool
>= :: EvaluatedTerm v -> EvaluatedTerm v -> Bool
$cmax :: forall v.
Var v =>
EvaluatedTerm v -> EvaluatedTerm v -> EvaluatedTerm v
max :: EvaluatedTerm v -> EvaluatedTerm v -> EvaluatedTerm v
$cmin :: forall v.
Var v =>
EvaluatedTerm v -> EvaluatedTerm v -> EvaluatedTerm v
min :: EvaluatedTerm v -> EvaluatedTerm v -> EvaluatedTerm v
Ord, (forall x. EvaluatedTerm v -> Rep (EvaluatedTerm v) x)
-> (forall x. Rep (EvaluatedTerm v) x -> EvaluatedTerm v)
-> Generic (EvaluatedTerm v)
forall x. Rep (EvaluatedTerm v) x -> EvaluatedTerm v
forall x. EvaluatedTerm v -> Rep (EvaluatedTerm v) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall v x. Rep (EvaluatedTerm v) x -> EvaluatedTerm v
forall v x. EvaluatedTerm v -> Rep (EvaluatedTerm v) x
$cfrom :: forall v x. EvaluatedTerm v -> Rep (EvaluatedTerm v) x
from :: forall x. EvaluatedTerm v -> Rep (EvaluatedTerm v) x
$cto :: forall v x. Rep (EvaluatedTerm v) x -> EvaluatedTerm v
to :: forall x. Rep (EvaluatedTerm v) x -> EvaluatedTerm v
Generic)
dependencies :: (Ord v) => EvaluatedDoc v -> Set LD.LabeledDependency
dependencies :: forall v. Ord v => EvaluatedDoc v -> Set LabeledDependency
dependencies = (EvaluatedSpecialForm v -> Set LabeledDependency)
-> DocG (EvaluatedSpecialForm v) -> Set LabeledDependency
forall m a. Monoid m => (a -> m) -> DocG a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap EvaluatedSpecialForm v -> Set LabeledDependency
forall v. Ord v => EvaluatedSpecialForm v -> Set LabeledDependency
dependenciesSpecial
dependenciesSpecial :: forall v. (Ord v) => EvaluatedSpecialForm v -> Set LD.LabeledDependency
dependenciesSpecial :: forall v. Ord v => EvaluatedSpecialForm v -> Set LabeledDependency
dependenciesSpecial = \case
ESource [EvaluatedSrc v]
srcs -> [EvaluatedSrc v] -> Set LabeledDependency
srcDeps [EvaluatedSrc v]
srcs
EFoldedSource [EvaluatedSrc v]
srcs -> [EvaluatedSrc v] -> Set LabeledDependency
srcDeps [EvaluatedSrc v]
srcs
EExample Term v ()
trm -> Term v () -> Set LabeledDependency
forall v vt at ap a.
(Ord v, Ord vt) =>
Term2 vt at ap v a -> Set LabeledDependency
Term.labeledDependencies Term v ()
trm
EExampleBlock Term v ()
trm -> Term v () -> Set LabeledDependency
forall v vt at ap a.
(Ord v, Ord vt) =>
Term2 vt at ap v a -> Set LabeledDependency
Term.labeledDependencies Term v ()
trm
ELink Either (Term v ()) LabeledDependency
ref -> (Term v () -> Set LabeledDependency)
-> (LabeledDependency -> Set LabeledDependency)
-> Either (Term v ()) LabeledDependency
-> Set LabeledDependency
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either Term v () -> Set LabeledDependency
forall v vt at ap a.
(Ord v, Ord vt) =>
Term2 vt at ap v a -> Set LabeledDependency
Term.labeledDependencies LabeledDependency -> Set LabeledDependency
forall a. a -> Set a
Set.singleton Either (Term v ()) LabeledDependency
ref
ESignature [(Referent, Type v ())]
sigtyps -> [(Referent, Type v ())] -> Set LabeledDependency
forall a. [(Referent, Type v a)] -> Set LabeledDependency
sigtypDeps [(Referent, Type v ())]
sigtyps
ESignatureInline (Referent, Type v ())
sig -> [(Referent, Type v ())] -> Set LabeledDependency
forall a. [(Referent, Type v a)] -> Set LabeledDependency
sigtypDeps [(Referent, Type v ())
sig]
EEval Term v ()
trm Maybe (Term v ())
mayTrm -> Term v () -> Set LabeledDependency
forall v vt at ap a.
(Ord v, Ord vt) =>
Term2 vt at ap v a -> Set LabeledDependency
Term.labeledDependencies Term v ()
trm Set LabeledDependency
-> Set LabeledDependency -> Set LabeledDependency
forall a. Semigroup a => a -> a -> a
<> (Term v () -> Set LabeledDependency)
-> Maybe (Term v ()) -> Set LabeledDependency
forall m a. Monoid m => (a -> m) -> Maybe a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term v () -> Set LabeledDependency
forall v vt at ap a.
(Ord v, Ord vt) =>
Term2 vt at ap v a -> Set LabeledDependency
Term.labeledDependencies Maybe (Term v ())
mayTrm
EEvalInline Term v ()
trm Maybe (Term v ())
mayTrm -> Term v () -> Set LabeledDependency
forall v vt at ap a.
(Ord v, Ord vt) =>
Term2 vt at ap v a -> Set LabeledDependency
Term.labeledDependencies Term v ()
trm Set LabeledDependency
-> Set LabeledDependency -> Set LabeledDependency
forall a. Semigroup a => a -> a -> a
<> (Term v () -> Set LabeledDependency)
-> Maybe (Term v ()) -> Set LabeledDependency
forall m a. Monoid m => (a -> m) -> Maybe a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term v () -> Set LabeledDependency
forall v vt at ap a.
(Ord v, Ord vt) =>
Term2 vt at ap v a -> Set LabeledDependency
Term.labeledDependencies Maybe (Term v ())
mayTrm
EEmbed Term v ()
trm -> Term v () -> Set LabeledDependency
forall v vt at ap a.
(Ord v, Ord vt) =>
Term2 vt at ap v a -> Set LabeledDependency
Term.labeledDependencies Term v ()
trm
EEmbedInline Term v ()
trm -> Term v () -> Set LabeledDependency
forall v vt at ap a.
(Ord v, Ord vt) =>
Term2 vt at ap v a -> Set LabeledDependency
Term.labeledDependencies Term v ()
trm
EVideo {} -> Set LabeledDependency
forall a. Monoid a => a
mempty
EFrontMatter {} -> Set LabeledDependency
forall a. Monoid a => a
mempty
ELaTeXInline {} -> Set LabeledDependency
forall a. Monoid a => a
mempty
ESvg {} -> Set LabeledDependency
forall a. Monoid a => a
mempty
ERenderError (InvalidTerm Term v ()
trm) -> Term v () -> Set LabeledDependency
forall v vt at ap a.
(Ord v, Ord vt) =>
Term2 vt at ap v a -> Set LabeledDependency
Term.labeledDependencies Term v ()
trm
where
sigtypDeps :: [(Referent, Type v a)] -> Set LD.LabeledDependency
sigtypDeps :: forall a. [(Referent, Type v a)] -> Set LabeledDependency
sigtypDeps [(Referent, Type v a)]
sigtyps =
[(Referent, Type v a)]
sigtyps [(Referent, Type v a)]
-> ([(Referent, Type v a)] -> Set LabeledDependency)
-> Set LabeledDependency
forall a b. a -> (a -> b) -> b
& ((Referent, Type v a) -> Set LabeledDependency)
-> [(Referent, Type v a)] -> Set LabeledDependency
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap \(Referent
ref, Type v a
typ) ->
LabeledDependency -> Set LabeledDependency
forall a. a -> Set a
Set.singleton (Referent -> LabeledDependency
LD.TermReferent Referent
ref) Set LabeledDependency
-> Set LabeledDependency -> Set LabeledDependency
forall a. Semigroup a => a -> a -> a
<> Type v a -> Set LabeledDependency
forall v a. Ord v => Type v a -> Set LabeledDependency
Type.labeledDependencies Type v a
typ
srcDeps :: [EvaluatedSrc v] -> Set LD.LabeledDependency
srcDeps :: [EvaluatedSrc v] -> Set LabeledDependency
srcDeps [EvaluatedSrc v]
srcs =
[EvaluatedSrc v]
srcs [EvaluatedSrc v]
-> ([EvaluatedSrc v] -> Set LabeledDependency)
-> Set LabeledDependency
forall a b. a -> (a -> b) -> b
& (EvaluatedSrc v -> Set LabeledDependency)
-> [EvaluatedSrc v] -> Set LabeledDependency
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap \case
EvaluatedSrcDecl EvaluatedDecl v
srcDecl -> case EvaluatedDecl v
srcDecl of
MissingDecl Reference' Text Hash
ref -> LabeledDependency -> Set LabeledDependency
forall a. a -> Set a
Set.singleton (Reference' Text Hash -> LabeledDependency
LD.TypeReference Reference' Text Hash
ref)
BuiltinDecl Reference' Text Hash
ref -> LabeledDependency -> Set LabeledDependency
forall a. a -> Set a
Set.singleton (Reference' Text Hash -> LabeledDependency
LD.TypeReference Reference' Text Hash
ref)
FoundDecl Reference' Text Hash
ref Decl v ()
decl -> LabeledDependency -> Set LabeledDependency
forall a. a -> Set a
Set.singleton (Reference' Text Hash -> LabeledDependency
LD.TypeReference Reference' Text Hash
ref) Set LabeledDependency
-> Set LabeledDependency -> Set LabeledDependency
forall a. Semigroup a => a -> a -> a
<> Reference' Text Hash -> Decl v () -> Set LabeledDependency
forall v a.
Ord v =>
Reference' Text Hash -> Decl v a -> Set LabeledDependency
DD.labeledDeclDependenciesIncludingSelf Reference' Text Hash
ref Decl v ()
decl
EvaluatedSrcTerm EvaluatedTerm v
srcTerm -> case EvaluatedTerm v
srcTerm of
MissingTerm Reference' Text Hash
ref -> LabeledDependency -> Set LabeledDependency
forall a. a -> Set a
Set.singleton (Reference' Text Hash -> LabeledDependency
LD.TermReference Reference' Text Hash
ref)
BuiltinTypeSig Reference' Text Hash
ref Type v ()
_ -> LabeledDependency -> Set LabeledDependency
forall a. a -> Set a
Set.singleton (Reference' Text Hash -> LabeledDependency
LD.TermReference Reference' Text Hash
ref)
MissingBuiltinTypeSig Reference' Text Hash
ref -> LabeledDependency -> Set LabeledDependency
forall a. a -> Set a
Set.singleton (Reference' Text Hash -> LabeledDependency
LD.TermReference Reference' Text Hash
ref)
FoundTerm Reference' Text Hash
ref Type v ()
typ Term v ()
trm -> LabeledDependency -> Set LabeledDependency
forall a. a -> Set a
Set.singleton (Reference' Text Hash -> LabeledDependency
LD.TermReference Reference' Text Hash
ref) Set LabeledDependency
-> Set LabeledDependency -> Set LabeledDependency
forall a. Semigroup a => a -> a -> a
<> Type v () -> Set LabeledDependency
forall v a. Ord v => Type v a -> Set LabeledDependency
Type.labeledDependencies Type v ()
typ Set LabeledDependency
-> Set LabeledDependency -> Set LabeledDependency
forall a. Semigroup a => a -> a -> a
<> Term v () -> Set LabeledDependency
forall v vt at ap a.
(Ord v, Ord vt) =>
Term2 vt at ap v a -> Set LabeledDependency
Term.labeledDependencies Term v ()
trm