mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 10:35:57 +03:00
⅄ trunk → 22-12-14-tidy-up-hashing-package
This commit is contained in:
commit
6e99914c77
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
@ -161,6 +161,8 @@ jobs:
|
||||
run: stack --no-terminal build --fast --test unison-syntax
|
||||
- name: unison-util-bytes tests
|
||||
run: stack --no-terminal build --fast --test unison-util-bytes
|
||||
- name: unison-util-cache tests
|
||||
run: stack --no-terminal build --fast --test unison-util-cache
|
||||
- name: unison-util-relation tests
|
||||
run: stack --no-terminal build --fast --test unison-util-relation
|
||||
- name: transcripts
|
||||
|
@ -19,7 +19,6 @@ dependencies:
|
||||
- unison-hashing-v2
|
||||
- unison-prelude
|
||||
- unison-sqlite
|
||||
- unison-util
|
||||
- unison-util-base32hex
|
||||
- unison-util-term
|
||||
- vector
|
||||
|
@ -63,7 +63,6 @@ library
|
||||
, unison-hashing-v2
|
||||
, unison-prelude
|
||||
, unison-sqlite
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-term
|
||||
, vector
|
||||
|
@ -270,17 +270,17 @@ import qualified U.Codebase.Term as C.Term
|
||||
import qualified U.Codebase.Type as C.Type
|
||||
import U.Codebase.WatchKind (WatchKind)
|
||||
import qualified U.Core.ABT as ABT
|
||||
import qualified U.Util.Alternative as Alternative
|
||||
import U.Util.Hash (Hash)
|
||||
import qualified U.Util.Hash as Hash
|
||||
import U.Util.Hash32 (Hash32)
|
||||
import qualified U.Util.Hash32 as Hash32
|
||||
import U.Util.Hash32.Orphans.Sqlite ()
|
||||
import qualified U.Util.Lens as Lens
|
||||
import qualified U.Util.Serialization as S
|
||||
import qualified U.Util.Term as TermUtil
|
||||
import Unison.Prelude
|
||||
import Unison.Sqlite
|
||||
import qualified Unison.Util.Alternative as Alternative
|
||||
import qualified Unison.Util.Lens as Lens
|
||||
|
||||
-- * main squeeze
|
||||
|
||||
|
@ -46,9 +46,9 @@ import qualified U.Core.ABT as ABT
|
||||
import qualified U.Util.Base32Hex as Base32Hex
|
||||
import U.Util.Hash32 (Hash32)
|
||||
import qualified U.Util.Hash32 as Hash32
|
||||
import qualified U.Util.Monoid as Monoid
|
||||
import U.Util.Serialization hiding (debug)
|
||||
import Unison.Prelude
|
||||
import qualified Unison.Util.Monoid as Monoid
|
||||
import Prelude hiding (getChar, putChar)
|
||||
|
||||
debug :: Bool
|
||||
|
@ -38,10 +38,10 @@ import qualified U.Codebase.Sqlite.Term.Format as TermFormat
|
||||
import U.Codebase.Sync (Sync (Sync), TrySyncResult)
|
||||
import qualified U.Codebase.Sync as Sync
|
||||
import qualified U.Codebase.WatchKind as WK
|
||||
import U.Util.Cache (Cache)
|
||||
import qualified U.Util.Cache as Cache
|
||||
import Unison.Prelude
|
||||
import Unison.Sqlite (Transaction)
|
||||
import Unison.Util.Cache (Cache)
|
||||
import qualified Unison.Util.Cache as Cache
|
||||
|
||||
data Entity
|
||||
= O ObjectId
|
||||
|
@ -33,8 +33,8 @@ dependencies:
|
||||
- unison-hash-orphans-sqlite
|
||||
- unison-prelude
|
||||
- unison-sqlite
|
||||
- unison-util
|
||||
- unison-util-base32hex
|
||||
- unison-util-cache
|
||||
- unison-util-serialization
|
||||
- unison-util-term
|
||||
- unliftio
|
||||
|
@ -110,8 +110,8 @@ library
|
||||
, unison-hash-orphans-sqlite
|
||||
, unison-prelude
|
||||
, unison-sqlite
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-cache
|
||||
, unison-util-serialization
|
||||
, unison-util-term
|
||||
, unliftio
|
||||
|
@ -33,7 +33,6 @@ dependencies:
|
||||
- text
|
||||
- unison-core
|
||||
- unison-hash
|
||||
- unison-util
|
||||
- unison-util-base32hex
|
||||
- unison-prelude
|
||||
- time
|
||||
|
@ -58,6 +58,5 @@ library
|
||||
, unison-core
|
||||
, unison-hash
|
||||
, unison-prelude
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
default-language: Haskell2010
|
||||
|
@ -15,7 +15,6 @@ dependencies:
|
||||
- vector
|
||||
- unison-hash
|
||||
- unison-prelude
|
||||
- unison-util
|
||||
- unison-util-base32hex
|
||||
|
||||
default-extensions:
|
||||
|
@ -56,7 +56,6 @@ library
|
||||
, text
|
||||
, unison-hash
|
||||
, unison-prelude
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, vector
|
||||
default-language: Haskell2010
|
||||
|
@ -1,40 +0,0 @@
|
||||
module Main where
|
||||
|
||||
import qualified Codec.Binary.Base32Hex as Sandi
|
||||
import Criterion
|
||||
import Criterion.Main
|
||||
import Data.ByteString (ByteString)
|
||||
import Data.Coerce (coerce)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as Text
|
||||
import qualified Data.Text.Encoding as Text
|
||||
import qualified U.Util.Base32Hex as U.Base32Hex
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
let textual = U.Base32Hex.UnsafeFromText "kccnret7m1895ta8ncs3ct5pqmguqntvjlcsr270ug8mbqvkh07v983i12obpgsii0gbga2esk1423t6evr03f62hkkfllrrj7iil30"
|
||||
let binary = "\163\EM}\187\167\176P\146\245H\187\&86t\185\213\161\237_\191\157Y\205\136\224\244\DC1e\235\244\136\SI\244\160r\b\176\188\195\146\144 \184(N\229\STXA\SI\166w\246\SOH\188\194\141(\250\215{\153\229*\140"
|
||||
|
||||
defaultMain
|
||||
[ bench "base32 fromByteString" (nf (coerce @_ @(ByteString -> Text) U.Base32Hex.fromByteString) binary),
|
||||
bench "sandi fromByteString" (nf sandi_fromByteString binary),
|
||||
bench "base32 toByteString" (nf U.Base32Hex.toByteString textual),
|
||||
bench "sandi toByteString" (nf sandi_toByteString textual)
|
||||
]
|
||||
|
||||
-- The old implementation of `fromByteString` which used `sandi`
|
||||
sandi_fromByteString :: ByteString -> Text
|
||||
sandi_fromByteString bs =
|
||||
Text.toLower (Text.dropWhileEnd (== '=') (Text.decodeUtf8 (Sandi.encode bs)))
|
||||
|
||||
-- The old implementation of `toByteString` which used `sandi`
|
||||
sandi_toByteString :: U.Base32Hex.Base32Hex -> ByteString
|
||||
sandi_toByteString (U.Base32Hex.UnsafeFromText txt) =
|
||||
case Sandi.decode (Text.encodeUtf8 (Text.toUpper txt <> paddingChars)) of
|
||||
Left (_, _rem) -> error ("not base32: " <> Text.unpack txt)
|
||||
Right h -> h
|
||||
where
|
||||
paddingChars :: Text
|
||||
paddingChars = case Text.length txt `mod` 8 of
|
||||
0 -> ""
|
||||
n -> Text.replicate (8 - n) "="
|
@ -1,55 +0,0 @@
|
||||
name: unison-util
|
||||
github: unisonweb/unison
|
||||
|
||||
library:
|
||||
source-dirs: src
|
||||
when:
|
||||
- condition: false
|
||||
other-modules: Paths_unison_util
|
||||
|
||||
benchmarks:
|
||||
bench:
|
||||
when:
|
||||
- condition: false
|
||||
other-modules: Paths_unison_util
|
||||
dependencies:
|
||||
- criterion
|
||||
- sandi
|
||||
- unison-util
|
||||
- unison-util-base32hex
|
||||
main: Main.hs
|
||||
source-dirs: bench
|
||||
|
||||
dependencies:
|
||||
- base
|
||||
- base32
|
||||
- bytestring
|
||||
- containers
|
||||
- cryptonite
|
||||
- extra
|
||||
- lens
|
||||
- memory
|
||||
- safe
|
||||
- text
|
||||
- time
|
||||
- unison-prelude
|
||||
- unison-util-relation
|
||||
- unliftio
|
||||
- vector
|
||||
|
||||
default-extensions:
|
||||
- ApplicativeDo
|
||||
- BlockArguments
|
||||
- DeriveFunctor
|
||||
- DerivingStrategies
|
||||
- DoAndIfThenElse
|
||||
- FlexibleContexts
|
||||
- FlexibleInstances
|
||||
- LambdaCase
|
||||
- MultiParamTypeClasses
|
||||
- NamedFieldPuns
|
||||
- OverloadedStrings
|
||||
- PatternSynonyms
|
||||
- ScopedTypeVariables
|
||||
- TupleSections
|
||||
- TypeApplications
|
@ -1,8 +0,0 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
|
||||
module U.Util.Alternative where
|
||||
|
||||
import Control.Applicative (Alternative (empty))
|
||||
|
||||
whenM :: (Monad m, Alternative m) => m Bool -> a -> m a
|
||||
whenM m a = do b <- m; if b then pure a else empty
|
@ -1,49 +0,0 @@
|
||||
module U.Util.Components where
|
||||
|
||||
import qualified Data.Graph as Graph
|
||||
import qualified Data.Map as Map
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Set (Set)
|
||||
import qualified Data.Set as Set
|
||||
|
||||
-- | Order bindings by dependencies and group into components.
|
||||
-- Each component consists of > 1 bindings, each of which depends
|
||||
-- transitively on all other bindings in the component.
|
||||
--
|
||||
-- 1-element components may or may not depend on themselves.
|
||||
--
|
||||
-- The order is such that a component at index i will not depend
|
||||
-- on components and indexes > i. But a component at index i does not
|
||||
-- _necessarily_ depend on any components at earlier indices.
|
||||
--
|
||||
-- Example:
|
||||
--
|
||||
-- let rec
|
||||
-- ping n = pong (n + 1);
|
||||
-- pong n = ping (n + 1);
|
||||
-- g = id 42;
|
||||
-- y = id "hi"
|
||||
-- id x = x;
|
||||
-- in ping g
|
||||
--
|
||||
-- `components` would produce `[[ping,pong], [id], [g], [y]]`
|
||||
-- Notice that `id` comes before `g` and `y` in the output, since
|
||||
-- both `g` and `y` depend on `id`.
|
||||
--
|
||||
-- Uses Tarjan's algorithm:
|
||||
-- https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm
|
||||
components :: Ord v => (t -> Set v) -> [(v, t)] -> [[(v, t)]]
|
||||
components freeVars bs =
|
||||
let varIds =
|
||||
Map.fromList (map fst bs `zip` reverse [(1 :: Int) .. length bs])
|
||||
-- something horribly wrong if this bombs
|
||||
varId v = fromMaybe msg $ Map.lookup v varIds
|
||||
where
|
||||
msg = error "Components.components bug"
|
||||
|
||||
-- use ints as keys for graph to preserve original source order as much as
|
||||
-- possible
|
||||
graph = [((v, b), varId v, deps b) | (v, b) <- bs]
|
||||
vars = Set.fromList (map fst bs)
|
||||
deps b = varId <$> Set.toList (Set.intersection vars (freeVars b))
|
||||
in Graph.flattenSCC <$> Graph.stronglyConnComp graph
|
@ -1,31 +0,0 @@
|
||||
module U.Util.Monoid where
|
||||
|
||||
import Control.Monad (foldM)
|
||||
import Control.Monad.Extra ((>=>))
|
||||
import Data.Foldable (toList)
|
||||
import Data.List (intersperse)
|
||||
|
||||
-- List.intercalate extended to any monoid
|
||||
-- "The type that intercalate should have had to begin with."
|
||||
intercalateMap :: (Foldable t, Monoid a) => a -> (b -> a) -> t b -> a
|
||||
intercalateMap separator renderer elements =
|
||||
mconcat $ intersperse separator (renderer <$> toList elements)
|
||||
|
||||
intercalateMapM :: (Traversable t, Monad m, Monoid a) => a -> (b -> m a) -> t b -> m a
|
||||
intercalateMapM separator renderer = traverse renderer >=> return . intercalateMap separator id
|
||||
|
||||
fromMaybe :: Monoid a => Maybe a -> a
|
||||
fromMaybe Nothing = mempty
|
||||
fromMaybe (Just a) = a
|
||||
|
||||
whenM, unlessM :: Monoid a => Bool -> a -> a
|
||||
whenM True a = a
|
||||
whenM False _ = mempty
|
||||
unlessM = whenM . not
|
||||
|
||||
isEmpty, nonEmpty :: (Eq a, Monoid a) => a -> Bool
|
||||
isEmpty a = a == mempty
|
||||
nonEmpty = not . isEmpty
|
||||
|
||||
foldMapM :: (Monad m, Foldable f, Monoid b) => (a -> m b) -> f a -> m b
|
||||
foldMapM f = foldM (\b a -> fmap (b <>) (f a)) mempty
|
@ -1,7 +0,0 @@
|
||||
module U.Util.String where
|
||||
|
||||
import qualified Data.Text as Text
|
||||
import qualified U.Util.Text as Text
|
||||
|
||||
stripMargin :: String -> String
|
||||
stripMargin = Text.unpack . Text.stripMargin . Text.pack
|
12
hie.yaml
12
hie.yaml
@ -15,12 +15,6 @@ cradle:
|
||||
- path: "codebase2/core/./"
|
||||
component: "unison-core:lib"
|
||||
|
||||
- path: "codebase2/util/src"
|
||||
component: "unison-util:lib"
|
||||
|
||||
- path: "codebase2/util/bench/Main.hs"
|
||||
component: "unison-util:bench:bench"
|
||||
|
||||
- path: "codebase2/util-serialization/./"
|
||||
component: "unison-util-serialization:lib"
|
||||
|
||||
@ -63,6 +57,12 @@ cradle:
|
||||
- path: "lib/unison-util-bytes/test"
|
||||
component: "unison-util-bytes:test:util-bytes-tests"
|
||||
|
||||
- path: "lib/unison-util-cache/src"
|
||||
component: "unison-util-cache:lib"
|
||||
|
||||
- path: "lib/unison-util-cache/test"
|
||||
component: "unison-util-cache:test:util-cache-tests"
|
||||
|
||||
- path: "lib/unison-util-relation/src"
|
||||
component: "unison-util-relation:lib"
|
||||
|
||||
|
@ -14,14 +14,15 @@ dependencies:
|
||||
- containers
|
||||
- either
|
||||
- extra
|
||||
- lens
|
||||
- mtl
|
||||
- pretty-simple
|
||||
- safe
|
||||
- text
|
||||
- time
|
||||
- transformers
|
||||
- lens
|
||||
- vector
|
||||
- unliftio
|
||||
- pretty-simple
|
||||
- vector
|
||||
- witherable
|
||||
|
||||
ghc-options:
|
||||
@ -29,7 +30,9 @@ ghc-options:
|
||||
|
||||
default-extensions:
|
||||
- ApplicativeDo
|
||||
- BangPatterns
|
||||
- BlockArguments
|
||||
- ConstraintKinds
|
||||
- DeriveFunctor
|
||||
- DerivingStrategies
|
||||
- DoAndIfThenElse
|
||||
|
@ -1,9 +1,7 @@
|
||||
{-# LANGUAGE BlockArguments #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module U.Util.Text where
|
||||
module U.Util.Text
|
||||
( stripMargin,
|
||||
)
|
||||
where
|
||||
|
||||
import qualified Data.Char as Char
|
||||
import Data.Maybe (fromMaybe)
|
11
lib/unison-prelude/src/Unison/Util/Alternative.hs
Normal file
11
lib/unison-prelude/src/Unison/Util/Alternative.hs
Normal file
@ -0,0 +1,11 @@
|
||||
module Unison.Util.Alternative
|
||||
( whenM
|
||||
) where
|
||||
|
||||
import Control.Applicative (Alternative (empty))
|
||||
|
||||
whenM :: (Monad m, Alternative m) => m Bool -> a -> m a
|
||||
whenM m a = do
|
||||
b <- m
|
||||
if b then pure a else empty
|
||||
|
@ -1,6 +1,10 @@
|
||||
{-# LANGUAGE ConstraintKinds #-}
|
||||
|
||||
module U.Util.Lens where
|
||||
module Unison.Util.Lens
|
||||
( Field1',
|
||||
Field2',
|
||||
Field3',
|
||||
Field4',
|
||||
)
|
||||
where
|
||||
|
||||
import qualified Control.Lens as Lens
|
||||
|
@ -1,4 +1,14 @@
|
||||
module Unison.Util.Monoid where
|
||||
module Unison.Util.Monoid
|
||||
( foldMapM,
|
||||
Unison.Util.Monoid.fromMaybe,
|
||||
intercalateMap,
|
||||
intercalateMapM,
|
||||
isEmpty,
|
||||
nonEmpty,
|
||||
Unison.Util.Monoid.unlessM,
|
||||
whenM,
|
||||
)
|
||||
where
|
||||
|
||||
import Data.List (intersperse)
|
||||
import Unison.Prelude hiding (whenM)
|
||||
@ -9,6 +19,9 @@ intercalateMap :: (Foldable t, Monoid a) => a -> (b -> a) -> t b -> a
|
||||
intercalateMap separator renderer elements =
|
||||
mconcat $ intersperse separator (renderer <$> toList elements)
|
||||
|
||||
intercalateMapM :: (Traversable t, Monad m, Monoid a) => a -> (b -> m a) -> t b -> m a
|
||||
intercalateMapM separator renderer = traverse renderer >=> return . intercalateMap separator id
|
||||
|
||||
fromMaybe :: Monoid a => Maybe a -> a
|
||||
fromMaybe Nothing = mempty
|
||||
fromMaybe (Just a) = a
|
||||
|
@ -1,6 +1,8 @@
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
|
||||
module U.Util.Timing where
|
||||
module Unison.Util.Timing
|
||||
( time,
|
||||
unsafeTime,
|
||||
)
|
||||
where
|
||||
|
||||
import Data.Time.Clock (picosecondsToDiffTime)
|
||||
import Data.Time.Clock.System (getSystemTime, systemToTAITime)
|
||||
@ -26,6 +28,7 @@ time label ma =
|
||||
pure a
|
||||
else ma
|
||||
|
||||
-- Mitchell says: this function doesn't look like it would work at all; let's just delete it
|
||||
unsafeTime :: Monad m => String -> m a -> m a
|
||||
unsafeTime label ma =
|
||||
if Debug.shouldDebug Debug.Timing
|
@ -17,16 +17,22 @@ source-repository head
|
||||
|
||||
library
|
||||
exposed-modules:
|
||||
U.Util.Text
|
||||
Unison.Debug
|
||||
Unison.Prelude
|
||||
Unison.Util.Alternative
|
||||
Unison.Util.Lens
|
||||
Unison.Util.Map
|
||||
Unison.Util.Monoid
|
||||
Unison.Util.Set
|
||||
Unison.Util.Timing
|
||||
hs-source-dirs:
|
||||
src
|
||||
default-extensions:
|
||||
ApplicativeDo
|
||||
BangPatterns
|
||||
BlockArguments
|
||||
ConstraintKinds
|
||||
DeriveFunctor
|
||||
DerivingStrategies
|
||||
DoAndIfThenElse
|
||||
@ -50,6 +56,7 @@ library
|
||||
, pretty-simple
|
||||
, safe
|
||||
, text
|
||||
, time
|
||||
, transformers
|
||||
, unliftio
|
||||
, vector
|
||||
|
60
lib/unison-util-cache/package.yaml
Normal file
60
lib/unison-util-cache/package.yaml
Normal file
@ -0,0 +1,60 @@
|
||||
name: unison-util-cache
|
||||
github: unisonweb/unison
|
||||
copyright: Copyright (C) 2013-2022 Unison Computing, PBC and contributors
|
||||
|
||||
ghc-options: -Wall
|
||||
|
||||
dependencies:
|
||||
- base
|
||||
- containers
|
||||
- unliftio
|
||||
|
||||
library:
|
||||
source-dirs: src
|
||||
when:
|
||||
- condition: false
|
||||
other-modules: Paths_unison_util_cache
|
||||
|
||||
tests:
|
||||
util-cache-tests:
|
||||
when:
|
||||
- condition: false
|
||||
other-modules: Paths_unison_util_cache
|
||||
dependencies:
|
||||
- async
|
||||
- code-page
|
||||
- easytest
|
||||
- stm
|
||||
- unison-util-cache
|
||||
main: Main.hs
|
||||
source-dirs: test
|
||||
|
||||
default-extensions:
|
||||
- ApplicativeDo
|
||||
- BangPatterns
|
||||
- BlockArguments
|
||||
- DeriveAnyClass
|
||||
- DeriveFoldable
|
||||
- DeriveFunctor
|
||||
- DeriveGeneric
|
||||
- DeriveTraversable
|
||||
- DerivingStrategies
|
||||
- DerivingVia
|
||||
- DoAndIfThenElse
|
||||
- DuplicateRecordFields
|
||||
- FlexibleContexts
|
||||
- FlexibleInstances
|
||||
- FunctionalDependencies
|
||||
- GeneralizedNewtypeDeriving
|
||||
- LambdaCase
|
||||
- MultiParamTypeClasses
|
||||
- NamedFieldPuns
|
||||
- OverloadedStrings
|
||||
- PatternSynonyms
|
||||
- RankNTypes
|
||||
- ScopedTypeVariables
|
||||
- StandaloneDeriving
|
||||
- TupleSections
|
||||
- TypeApplications
|
||||
- TypeFamilies
|
||||
- ViewPatterns
|
@ -1,8 +1,13 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
|
||||
module U.Util.Cache where
|
||||
module Unison.Util.Cache
|
||||
( Cache
|
||||
, cache
|
||||
, nullCache
|
||||
, semispaceCache
|
||||
, lookup
|
||||
, insert
|
||||
, apply
|
||||
, applyDefined
|
||||
) where
|
||||
|
||||
import Control.Monad (when)
|
||||
import Control.Monad.IO.Class (liftIO)
|
@ -1,22 +1,26 @@
|
||||
module Unison.Test.Cache where
|
||||
module Main (main) where
|
||||
|
||||
import Control.Concurrent.Async
|
||||
import Control.Concurrent.STM
|
||||
import Control.Monad
|
||||
import EasyTest
|
||||
import qualified U.Util.Cache as Cache
|
||||
import System.IO.CodePage (withCP65001)
|
||||
import qualified Unison.Util.Cache as Cache
|
||||
|
||||
main :: IO ()
|
||||
main =
|
||||
withCP65001 (run (scope "util.cache" test))
|
||||
|
||||
test :: Test ()
|
||||
test =
|
||||
scope "util.cache" $
|
||||
tests
|
||||
[ scope "ex1" $ fits Cache.cache,
|
||||
scope "ex2" $ fits (Cache.semispaceCache n),
|
||||
scope "ex3" $ doesn'tFit (Cache.semispaceCache n),
|
||||
scope "ex4" $ do
|
||||
replicateM_ 10 $ concurrent (Cache.semispaceCache n)
|
||||
ok
|
||||
]
|
||||
tests
|
||||
[ scope "ex1" $ fits Cache.cache,
|
||||
scope "ex2" $ fits (Cache.semispaceCache n),
|
||||
scope "ex3" $ doesn'tFit (Cache.semispaceCache n),
|
||||
scope "ex4" $ do
|
||||
replicateM_ 10 $ concurrent (Cache.semispaceCache n)
|
||||
ok
|
||||
]
|
||||
where
|
||||
n :: Word
|
||||
n = 1000
|
@ -4,10 +4,11 @@ cabal-version: 1.12
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
|
||||
name: unison-util
|
||||
name: unison-util-cache
|
||||
version: 0.0.0
|
||||
homepage: https://github.com/unisonweb/unison#readme
|
||||
bug-reports: https://github.com/unisonweb/unison/issues
|
||||
copyright: Copyright (C) 2013-2022 Unison Computing, PBC and contributors
|
||||
build-type: Simple
|
||||
|
||||
source-repository head
|
||||
@ -16,89 +17,87 @@ source-repository head
|
||||
|
||||
library
|
||||
exposed-modules:
|
||||
U.Util.Alternative
|
||||
U.Util.Cache
|
||||
U.Util.Components
|
||||
U.Util.Lens
|
||||
U.Util.Monoid
|
||||
U.Util.String
|
||||
U.Util.Text
|
||||
U.Util.Timing
|
||||
Unison.Util.Cache
|
||||
hs-source-dirs:
|
||||
src
|
||||
default-extensions:
|
||||
ApplicativeDo
|
||||
BangPatterns
|
||||
BlockArguments
|
||||
DeriveAnyClass
|
||||
DeriveFoldable
|
||||
DeriveFunctor
|
||||
DeriveGeneric
|
||||
DeriveTraversable
|
||||
DerivingStrategies
|
||||
DerivingVia
|
||||
DoAndIfThenElse
|
||||
DuplicateRecordFields
|
||||
FlexibleContexts
|
||||
FlexibleInstances
|
||||
FunctionalDependencies
|
||||
GeneralizedNewtypeDeriving
|
||||
LambdaCase
|
||||
MultiParamTypeClasses
|
||||
NamedFieldPuns
|
||||
OverloadedStrings
|
||||
PatternSynonyms
|
||||
RankNTypes
|
||||
ScopedTypeVariables
|
||||
StandaloneDeriving
|
||||
TupleSections
|
||||
TypeApplications
|
||||
TypeFamilies
|
||||
ViewPatterns
|
||||
ghc-options: -Wall
|
||||
build-depends:
|
||||
base
|
||||
, base32
|
||||
, bytestring
|
||||
, containers
|
||||
, cryptonite
|
||||
, extra
|
||||
, lens
|
||||
, memory
|
||||
, safe
|
||||
, text
|
||||
, time
|
||||
, unison-prelude
|
||||
, unison-util-relation
|
||||
, unliftio
|
||||
, vector
|
||||
default-language: Haskell2010
|
||||
|
||||
benchmark bench
|
||||
test-suite util-cache-tests
|
||||
type: exitcode-stdio-1.0
|
||||
main-is: Main.hs
|
||||
hs-source-dirs:
|
||||
bench
|
||||
test
|
||||
default-extensions:
|
||||
ApplicativeDo
|
||||
BangPatterns
|
||||
BlockArguments
|
||||
DeriveAnyClass
|
||||
DeriveFoldable
|
||||
DeriveFunctor
|
||||
DeriveGeneric
|
||||
DeriveTraversable
|
||||
DerivingStrategies
|
||||
DerivingVia
|
||||
DoAndIfThenElse
|
||||
DuplicateRecordFields
|
||||
FlexibleContexts
|
||||
FlexibleInstances
|
||||
FunctionalDependencies
|
||||
GeneralizedNewtypeDeriving
|
||||
LambdaCase
|
||||
MultiParamTypeClasses
|
||||
NamedFieldPuns
|
||||
OverloadedStrings
|
||||
PatternSynonyms
|
||||
RankNTypes
|
||||
ScopedTypeVariables
|
||||
StandaloneDeriving
|
||||
TupleSections
|
||||
TypeApplications
|
||||
TypeFamilies
|
||||
ViewPatterns
|
||||
ghc-options: -Wall
|
||||
build-depends:
|
||||
base
|
||||
, base32
|
||||
, bytestring
|
||||
async
|
||||
, base
|
||||
, code-page
|
||||
, containers
|
||||
, criterion
|
||||
, cryptonite
|
||||
, extra
|
||||
, lens
|
||||
, memory
|
||||
, safe
|
||||
, sandi
|
||||
, text
|
||||
, time
|
||||
, unison-prelude
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, easytest
|
||||
, stm
|
||||
, unison-util-cache
|
||||
, unliftio
|
||||
, vector
|
||||
default-language: Haskell2010
|
@ -114,9 +114,9 @@ dependencies:
|
||||
- unison-pretty-printer
|
||||
- unison-sqlite
|
||||
- unison-syntax
|
||||
- unison-util
|
||||
- unison-util-base32hex
|
||||
- unison-util-bytes
|
||||
- unison-util-cache
|
||||
- unison-util-relation
|
||||
- unison-util-rope
|
||||
- unison-util-serialization
|
||||
|
@ -122,7 +122,6 @@ import U.Codebase.HashTags (CausalHash)
|
||||
import qualified U.Codebase.Referent as V2
|
||||
import qualified U.Codebase.Sqlite.Operations as Operations
|
||||
import qualified U.Codebase.Sqlite.Queries as Queries
|
||||
import U.Util.Timing (time)
|
||||
import qualified Unison.Builtin as Builtin
|
||||
import qualified Unison.Builtin.Terms as Builtin
|
||||
import Unison.Codebase.Branch (Branch)
|
||||
@ -166,6 +165,7 @@ import Unison.Typechecker.TypeLookup (TypeLookup (TypeLookup))
|
||||
import qualified Unison.Typechecker.TypeLookup as TL
|
||||
import qualified Unison.UnisonFile as UF
|
||||
import qualified Unison.Util.Relation as Rel
|
||||
import Unison.Util.Timing (time)
|
||||
import Unison.Var (Var)
|
||||
import qualified Unison.WatchKind as WK
|
||||
|
||||
|
@ -8,13 +8,13 @@ module Unison.Codebase.Editor.RemoteRepo where
|
||||
import Control.Lens (Lens')
|
||||
import qualified Control.Lens as Lens
|
||||
import qualified Data.Text as Text
|
||||
import qualified U.Util.Monoid as Monoid
|
||||
import Unison.Codebase.Path (Path)
|
||||
import qualified Unison.Codebase.Path as Path
|
||||
import Unison.Codebase.ShortCausalHash (ShortCausalHash)
|
||||
import qualified Unison.Codebase.ShortCausalHash as SCH
|
||||
import Unison.Prelude
|
||||
import Unison.Share.Types
|
||||
import qualified Unison.Util.Monoid as Monoid
|
||||
|
||||
data ReadRepo
|
||||
= ReadRepoGit ReadGitRepo
|
||||
|
@ -34,7 +34,6 @@ import qualified U.Codebase.Sqlite.Queries as Q
|
||||
import qualified U.Codebase.Sqlite.Sync22 as Sync22
|
||||
import U.Codebase.Sqlite.V2.HashHandle (v2HashHandle)
|
||||
import qualified U.Codebase.Sync as Sync
|
||||
import U.Util.Timing (time)
|
||||
import Unison.Codebase (Codebase, CodebasePath)
|
||||
import qualified Unison.Codebase as Codebase1
|
||||
import Unison.Codebase.Branch (Branch (..))
|
||||
@ -78,6 +77,7 @@ import qualified Unison.Sqlite as Sqlite
|
||||
import Unison.Symbol (Symbol)
|
||||
import Unison.Term (Term)
|
||||
import Unison.Type (Type)
|
||||
import Unison.Util.Timing (time)
|
||||
import qualified Unison.WatchKind as UF
|
||||
import UnliftIO (UnliftIO (..), finally, throwIO, try)
|
||||
import UnliftIO.Directory (createDirectoryIfMissing, doesDirectoryExist, doesFileExist)
|
||||
|
@ -53,7 +53,6 @@ import U.Codebase.Sync (Sync (Sync))
|
||||
import qualified U.Codebase.Sync as Sync
|
||||
import U.Codebase.WatchKind (WatchKind)
|
||||
import qualified U.Codebase.WatchKind as WK
|
||||
import U.Util.Monoid (foldMapM)
|
||||
import qualified Unison.ABT as ABT
|
||||
import qualified Unison.Codebase.SqliteCodebase.Conversions as Cv
|
||||
import qualified Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema1To2.DbHelpers as Hashing
|
||||
@ -78,6 +77,7 @@ import Unison.Symbol (Symbol)
|
||||
import qualified Unison.Term as Term
|
||||
import Unison.Type (Type)
|
||||
import qualified Unison.Type as Type
|
||||
import Unison.Util.Monoid (foldMapM)
|
||||
import qualified Unison.Util.Set as Set
|
||||
import Prelude hiding (log)
|
||||
|
||||
|
@ -30,7 +30,6 @@ import U.Codebase.Sqlite.Operations (NamesByPath (..))
|
||||
import qualified U.Codebase.Sqlite.Operations as Ops
|
||||
import qualified U.Codebase.Sqlite.Queries as Q
|
||||
import U.Codebase.Sqlite.V2.HashHandle (v2HashHandle)
|
||||
import qualified U.Util.Cache as Cache
|
||||
import qualified U.Util.Hash as H2
|
||||
import qualified Unison.Builtin as Builtins
|
||||
import Unison.Codebase.Branch (Branch (..))
|
||||
@ -70,6 +69,7 @@ import Unison.Term (Term)
|
||||
import qualified Unison.Term as Term
|
||||
import Unison.Type (Type)
|
||||
import qualified Unison.Type as Type
|
||||
import qualified Unison.Util.Cache as Cache
|
||||
import qualified Unison.Util.Relation as Rel
|
||||
import qualified Unison.Util.Set as Set
|
||||
import qualified Unison.WatchKind as UF
|
||||
|
@ -10,7 +10,6 @@ import Data.Text (unpack)
|
||||
import qualified Data.Text as Text
|
||||
import Data.Vector ()
|
||||
import qualified Text.Show.Unicode as U
|
||||
import U.Util.Monoid (foldMapM, intercalateMapM)
|
||||
import Unison.ABT (annotation, reannotateUp, pattern AbsN')
|
||||
import qualified Unison.ABT as ABT
|
||||
import qualified Unison.Blank as Blank
|
||||
@ -43,7 +42,7 @@ import Unison.Term
|
||||
import Unison.Type (Type, pattern ForallsNamed')
|
||||
import qualified Unison.Type as Type
|
||||
import qualified Unison.Util.Bytes as Bytes
|
||||
import Unison.Util.Monoid (intercalateMap)
|
||||
import Unison.Util.Monoid (foldMapM, intercalateMap, intercalateMapM)
|
||||
import Unison.Util.Pretty (ColorText, Pretty, Width)
|
||||
import qualified Unison.Util.Pretty as PP
|
||||
import qualified Unison.Util.SyntaxText as S
|
||||
|
@ -10,7 +10,6 @@ import System.IO.CodePage (withCP65001)
|
||||
import qualified Unison.Core.Test.Name as Name
|
||||
import qualified Unison.Test.ABT as ABT
|
||||
import qualified Unison.Test.ANF as ANF
|
||||
import qualified Unison.Test.Cache as Cache
|
||||
import qualified Unison.Test.Codebase.Branch as Branch
|
||||
import qualified Unison.Test.Codebase.Causal as Causal
|
||||
import qualified Unison.Test.Codebase.Path as Path
|
||||
@ -36,8 +35,7 @@ import qualified Unison.Test.Var as Var
|
||||
test :: Test ()
|
||||
test =
|
||||
tests
|
||||
[ Cache.test,
|
||||
Term.test,
|
||||
[ Term.test,
|
||||
TermParser.test,
|
||||
TermPrinter.test,
|
||||
Type.test,
|
||||
|
@ -283,9 +283,9 @@ library
|
||||
, unison-pretty-printer
|
||||
, unison-sqlite
|
||||
, unison-syntax
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-bytes
|
||||
, unison-util-cache
|
||||
, unison-util-relation
|
||||
, unison-util-rope
|
||||
, unison-util-serialization
|
||||
@ -311,7 +311,6 @@ test-suite parser-typechecker-tests
|
||||
Unison.Core.Test.Name
|
||||
Unison.Test.ABT
|
||||
Unison.Test.ANF
|
||||
Unison.Test.Cache
|
||||
Unison.Test.Codebase.Branch
|
||||
Unison.Test.Codebase.Causal
|
||||
Unison.Test.Codebase.Path
|
||||
@ -472,9 +471,9 @@ test-suite parser-typechecker-tests
|
||||
, unison-pretty-printer
|
||||
, unison-sqlite
|
||||
, unison-syntax
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-bytes
|
||||
, unison-util-cache
|
||||
, unison-util-relation
|
||||
, unison-util-rope
|
||||
, unison-util-serialization
|
||||
|
@ -22,7 +22,6 @@ packages:
|
||||
- codebase2/codebase-sqlite-hashing-v2
|
||||
- codebase2/codebase-sync
|
||||
- codebase2/core
|
||||
- codebase2/util
|
||||
- codebase2/util-serialization
|
||||
- codebase2/util-term
|
||||
- lib/unison-hash
|
||||
@ -33,6 +32,7 @@ packages:
|
||||
- lib/unison-sqlite
|
||||
- lib/unison-util-base32hex
|
||||
- lib/unison-util-bytes
|
||||
- lib/unison-util-cache
|
||||
- lib/unison-util-relation
|
||||
- lib/unison-util-rope
|
||||
- lib/unison-pretty-printer
|
||||
|
@ -79,7 +79,6 @@ dependencies:
|
||||
- unison-share-api
|
||||
- unison-sqlite
|
||||
- unison-syntax
|
||||
- unison-util
|
||||
- unison-util-base32hex
|
||||
- unison-util-relation
|
||||
- unliftio
|
||||
|
@ -41,7 +41,6 @@ import qualified U.Codebase.Branch as V2Branch
|
||||
import qualified U.Codebase.Causal as V2Causal
|
||||
import qualified U.Codebase.Reference as Reference
|
||||
import qualified U.Codebase.Referent as Referent
|
||||
import qualified U.Util.Monoid as Monoid
|
||||
import Unison.Auth.HTTPClient (AuthenticatedHttpClient (..))
|
||||
import Unison.Codebase (Codebase)
|
||||
import qualified Unison.Codebase as Codebase
|
||||
@ -58,6 +57,7 @@ import qualified Unison.Server.Types as Server
|
||||
import qualified Unison.Share.Codeserver as Codeserver
|
||||
import qualified Unison.Share.Types as Share
|
||||
import qualified Unison.Sqlite as Sqlite
|
||||
import qualified Unison.Util.Monoid as Monoid
|
||||
import qualified Unison.Util.Pretty as P
|
||||
import qualified UnliftIO
|
||||
import Prelude hiding (readFile, writeFile)
|
||||
|
@ -45,7 +45,6 @@ import qualified U.Util.Base32Hex as Base32Hex
|
||||
import qualified U.Util.Hash as Hash
|
||||
import U.Util.Hash32 (Hash32)
|
||||
import qualified U.Util.Hash32 as Hash32
|
||||
import qualified U.Util.Monoid as Monoid
|
||||
import qualified Unison.ABT as ABT
|
||||
import qualified Unison.Auth.Types as Auth
|
||||
import qualified Unison.Builtin.Decls as DD
|
||||
@ -151,6 +150,7 @@ import Unison.Type (Type)
|
||||
import qualified Unison.UnisonFile as UF
|
||||
import qualified Unison.Util.List as List
|
||||
import Unison.Util.Monoid (intercalateMap)
|
||||
import qualified Unison.Util.Monoid as Monoid
|
||||
import qualified Unison.Util.Pretty as P
|
||||
import qualified Unison.Util.Relation as R
|
||||
import Unison.Var (Var)
|
||||
|
@ -18,7 +18,7 @@ import Control.Monad (when)
|
||||
import qualified Data.Text as Text
|
||||
import System.Directory (removeDirectoryRecursive)
|
||||
import qualified System.IO.Temp as Temp
|
||||
import U.Util.String (stripMargin)
|
||||
import U.Util.Text (stripMargin)
|
||||
import Unison.Codebase (CodebasePath)
|
||||
import qualified Unison.Codebase as Codebase
|
||||
import qualified Unison.Codebase.Init as Codebase.Init
|
||||
@ -68,7 +68,7 @@ runTranscript (Codebase codebasePath fmt) transcript = do
|
||||
TR.withTranscriptRunner "Unison.Test.Ucm.runTranscript Invalid Version String" configFile $ \runner -> do
|
||||
result <- Codebase.Init.withOpenCodebase cbInit "transcript" codebasePath SC.DoLock SC.DontMigrate \codebase -> do
|
||||
Codebase.runTransaction codebase (Codebase.installUcmDependencies codebase)
|
||||
let transcriptSrc = Text.pack . stripMargin $ unTranscript transcript
|
||||
let transcriptSrc = stripMargin . Text.pack $ unTranscript transcript
|
||||
output <- either err Text.unpack <$> runner "transcript" transcriptSrc (codebasePath, codebase)
|
||||
when debugTranscriptOutput $ traceM output
|
||||
pure output
|
||||
|
@ -193,7 +193,6 @@ library
|
||||
, unison-share-api
|
||||
, unison-sqlite
|
||||
, unison-syntax
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, unliftio
|
||||
@ -321,7 +320,6 @@ executable cli-integration-tests
|
||||
, unison-share-api
|
||||
, unison-sqlite
|
||||
, unison-syntax
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, unliftio
|
||||
@ -443,7 +441,6 @@ executable transcripts
|
||||
, unison-share-api
|
||||
, unison-sqlite
|
||||
, unison-syntax
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, unliftio
|
||||
@ -572,7 +569,6 @@ executable unison
|
||||
, unison-share-api
|
||||
, unison-sqlite
|
||||
, unison-syntax
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, unliftio
|
||||
@ -704,7 +700,6 @@ test-suite cli-tests
|
||||
, unison-share-api
|
||||
, unison-sqlite
|
||||
, unison-syntax
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, unliftio
|
||||
|
@ -28,7 +28,6 @@ library:
|
||||
- unison-core
|
||||
- unison-hash
|
||||
- unison-prelude
|
||||
- unison-util
|
||||
- unison-util-base32hex
|
||||
- unison-util-relation
|
||||
- vector
|
||||
|
@ -103,7 +103,6 @@ library
|
||||
, unison-core
|
||||
, unison-hash
|
||||
, unison-prelude
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, vector
|
||||
|
@ -17,7 +17,6 @@ dependencies:
|
||||
- unison-hash
|
||||
- unison-hashing
|
||||
- unison-prelude
|
||||
- unison-util
|
||||
- unison-util-base32hex
|
||||
- unison-util-relation
|
||||
|
||||
|
@ -77,7 +77,6 @@ library
|
||||
, unison-hash
|
||||
, unison-hashing
|
||||
, unison-prelude
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
default-language: Haskell2010
|
||||
|
@ -49,7 +49,6 @@ dependencies:
|
||||
- unison-parser-typechecker
|
||||
- unison-prelude
|
||||
- unison-pretty-printer
|
||||
- unison-util
|
||||
- unison-util-base32hex
|
||||
- unison-util-relation
|
||||
- unison-sqlite
|
||||
|
@ -110,7 +110,6 @@ library
|
||||
, unison-pretty-printer
|
||||
, unison-sqlite
|
||||
, unison-syntax
|
||||
, unison-util
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, unliftio
|
||||
|
96
unison-src/transcripts/api-doc-rendering.md
Normal file
96
unison-src/transcripts/api-doc-rendering.md
Normal file
@ -0,0 +1,96 @@
|
||||
# Doc rendering
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
```
|
||||
|
||||
```unison:hide
|
||||
structural type Maybe a = Nothing | Just a
|
||||
otherTerm = "text"
|
||||
|
||||
otherDoc : (Text -> Doc2) -> Doc2
|
||||
otherDoc mkMsg = {{
|
||||
This doc should be embedded.
|
||||
|
||||
{{mkMsg "message"}}
|
||||
|
||||
}}
|
||||
|
||||
{{
|
||||
# Heading
|
||||
|
||||
## Heading 2
|
||||
|
||||
Term Link: {otherTerm}
|
||||
|
||||
Type Link: {type Maybe}
|
||||
|
||||
Term source:
|
||||
|
||||
@source{term}
|
||||
|
||||
Term signature:
|
||||
|
||||
@signature{term}
|
||||
|
||||
* List item
|
||||
|
||||
1. Numbered list item
|
||||
|
||||
> Block quote
|
||||
|
||||
Code block
|
||||
|
||||
Inline code:
|
||||
|
||||
`` 1 + 2 ``
|
||||
|
||||
`
|
||||
"doesn't typecheck" + 1
|
||||
`
|
||||
|
||||
[Link](https://unison-lang.org)
|
||||
|
||||
![Image](https://share-next.unison-lang.org/static/unison-logo-circle.png)
|
||||
|
||||
**Bold**
|
||||
|
||||
*Italic*
|
||||
|
||||
~~Strikethrough~~
|
||||
|
||||
Horizontal rule
|
||||
|
||||
---
|
||||
|
||||
Table
|
||||
|
||||
| Header 1 | Header 2 |
|
||||
| -------- | -------- |
|
||||
| Cell 1 | Cell 2 |
|
||||
| Cell 3 | Cell 4 |
|
||||
|
||||
|
||||
Video
|
||||
|
||||
{{ Special (Embed (Any (Video [(MediaSource "test.mp4" None)] [("poster", "test.png")]))) }}
|
||||
|
||||
Transclusion/evaluation:
|
||||
|
||||
{{otherDoc (a -> Word a )}}
|
||||
|
||||
}}
|
||||
term = 42
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> display term.doc
|
||||
```
|
||||
|
||||
```api
|
||||
GET /api/getDefinition?names=term
|
||||
```
|
962
unison-src/transcripts/api-doc-rendering.output.md
Normal file
962
unison-src/transcripts/api-doc-rendering.output.md
Normal file
@ -0,0 +1,962 @@
|
||||
# Doc rendering
|
||||
|
||||
```unison
|
||||
structural type Maybe a = Nothing | Just a
|
||||
otherTerm = "text"
|
||||
|
||||
otherDoc : (Text -> Doc2) -> Doc2
|
||||
otherDoc mkMsg = {{
|
||||
This doc should be embedded.
|
||||
|
||||
{{mkMsg "message"}}
|
||||
|
||||
}}
|
||||
|
||||
{{
|
||||
# Heading
|
||||
|
||||
## Heading 2
|
||||
|
||||
Term Link: {otherTerm}
|
||||
|
||||
Type Link: {type Maybe}
|
||||
|
||||
Term source:
|
||||
|
||||
@source{term}
|
||||
|
||||
Term signature:
|
||||
|
||||
@signature{term}
|
||||
|
||||
* List item
|
||||
|
||||
1. Numbered list item
|
||||
|
||||
> Block quote
|
||||
|
||||
Code block
|
||||
|
||||
Inline code:
|
||||
|
||||
`` 1 + 2 ``
|
||||
|
||||
`
|
||||
"doesn't typecheck" + 1
|
||||
`
|
||||
|
||||
[Link](https://unison-lang.org)
|
||||
|
||||
![Image](https://share-next.unison-lang.org/static/unison-logo-circle.png)
|
||||
|
||||
**Bold**
|
||||
|
||||
*Italic*
|
||||
|
||||
~~Strikethrough~~
|
||||
|
||||
Horizontal rule
|
||||
|
||||
---
|
||||
|
||||
Table
|
||||
|
||||
| Header 1 | Header 2 |
|
||||
| -------- | -------- |
|
||||
| Cell 1 | Cell 2 |
|
||||
| Cell 3 | Cell 4 |
|
||||
|
||||
|
||||
Video
|
||||
|
||||
{{ Special (Embed (Any (Video [(MediaSource "test.mp4" None)] [("poster", "test.png")]))) }}
|
||||
|
||||
Transclusion/evaluation:
|
||||
|
||||
{{otherDoc (a -> Word a )}}
|
||||
|
||||
}}
|
||||
term = 42
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> display term.doc
|
||||
|
||||
# Heading
|
||||
|
||||
# Heading 2
|
||||
|
||||
Term Link: otherTerm
|
||||
|
||||
Type Link: Maybe
|
||||
|
||||
Term source:
|
||||
|
||||
term : Nat
|
||||
term = 42
|
||||
|
||||
Term signature:
|
||||
|
||||
term : Nat
|
||||
|
||||
* List item
|
||||
|
||||
1. Numbered list item
|
||||
|
||||
> Block quote
|
||||
|
||||
Code block
|
||||
|
||||
Inline code:
|
||||
|
||||
`1 Nat.+ 2`
|
||||
|
||||
` "doesn't typecheck" + 1 `
|
||||
|
||||
Link
|
||||
|
||||
![Image](https://share-next.unison-lang.org/static/unison-logo-circle.png)
|
||||
|
||||
Bold
|
||||
|
||||
Italic
|
||||
|
||||
~~Strikethrough~~
|
||||
|
||||
Horizontal rule
|
||||
|
||||
---
|
||||
|
||||
Table
|
||||
|
||||
| Header 1 | Header 2 | | -------- | -------- | | Cell 1 |
|
||||
Cell 2 | | Cell 3 | Cell 4 |
|
||||
|
||||
Video
|
||||
|
||||
|
||||
{{ embed {{
|
||||
Video
|
||||
[MediaSource "test.mp4" Nothing]
|
||||
[("poster", "test.png")] }} }}
|
||||
|
||||
|
||||
Transclusion/evaluation:
|
||||
|
||||
This doc should be embedded.
|
||||
|
||||
message
|
||||
|
||||
```
|
||||
```api
|
||||
GET /api/getDefinition?names=term
|
||||
{
|
||||
"missingDefinitions": [],
|
||||
"termDefinitions": {
|
||||
"#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8": {
|
||||
"bestTermName": "term",
|
||||
"defnTermTag": "Plain",
|
||||
"signature": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat",
|
||||
"tag": "TypeReference"
|
||||
},
|
||||
"segment": "Nat"
|
||||
}
|
||||
],
|
||||
"termDefinition": {
|
||||
"contents": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "term",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "term"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "TypeAscriptionColon"
|
||||
},
|
||||
"segment": " :"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat",
|
||||
"tag": "TypeReference"
|
||||
},
|
||||
"segment": "Nat"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": "\n"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "term",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "term"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "BindingEquals"
|
||||
},
|
||||
"segment": " ="
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "NumericLiteral"
|
||||
},
|
||||
"segment": "42"
|
||||
}
|
||||
],
|
||||
"tag": "UserObject"
|
||||
},
|
||||
"termDocs": [
|
||||
[
|
||||
"doc",
|
||||
"#343l8ugvo7vgp7d1fp4rlnf272k3ea8111m2f97ckuovkutulvmac6jej39kk95s0fdpma0vkhtios6ihh9jo968gb9c5cde0spa9co",
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Heading",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
[
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Heading",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "2",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
[
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Term",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Link:",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "#k5gpql9cbdfau6lf1aja24joc3sfctvjor8esu8bemn0in3l148otb0t3vebgqrt6qml302h62bbfeftg65gec1v8ouin5m6v2969d8",
|
||||
"tag": "TermReference"
|
||||
},
|
||||
"segment": "otherTerm"
|
||||
}
|
||||
],
|
||||
"tag": "Link"
|
||||
},
|
||||
"tag": "Special"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Type",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Link:",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "#nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg",
|
||||
"tag": "TypeReference"
|
||||
},
|
||||
"segment": "Maybe"
|
||||
}
|
||||
],
|
||||
"tag": "Link"
|
||||
},
|
||||
"tag": "Special"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Term",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "source:",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
"#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8",
|
||||
{
|
||||
"contents": [
|
||||
[
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8",
|
||||
"tag": "TermReference"
|
||||
},
|
||||
"segment": "term"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "TypeAscriptionColon"
|
||||
},
|
||||
"segment": ": "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat",
|
||||
"tag": "TypeReference"
|
||||
},
|
||||
"segment": "Nat"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "term",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "term"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "TypeAscriptionColon"
|
||||
},
|
||||
"segment": " :"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat",
|
||||
"tag": "TypeReference"
|
||||
},
|
||||
"segment": "Nat"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": "\n"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "term",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "term"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "BindingEquals"
|
||||
},
|
||||
"segment": " ="
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "NumericLiteral"
|
||||
},
|
||||
"segment": "42"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tag": "UserObject"
|
||||
}
|
||||
],
|
||||
"tag": "Term"
|
||||
}
|
||||
],
|
||||
"tag": "Source"
|
||||
},
|
||||
"tag": "Special"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Term",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "signature:",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
[
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8",
|
||||
"tag": "TermReference"
|
||||
},
|
||||
"segment": "term"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "TypeAscriptionColon"
|
||||
},
|
||||
"segment": ": "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat",
|
||||
"tag": "TypeReference"
|
||||
},
|
||||
"segment": "Nat"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tag": "Signature"
|
||||
},
|
||||
"tag": "Special"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "List",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "item",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
}
|
||||
],
|
||||
"tag": "BulletedList"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
1,
|
||||
[
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Numbered",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "list",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "item",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tag": "NumberedList"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": ">",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Block",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "quote",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Code",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "block",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Inline",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "code:",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "NumericLiteral"
|
||||
},
|
||||
"segment": "1"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat.+",
|
||||
"tag": "TermReference"
|
||||
},
|
||||
"segment": "Nat.+"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "NumericLiteral"
|
||||
},
|
||||
"segment": "2"
|
||||
}
|
||||
],
|
||||
"tag": "Example"
|
||||
},
|
||||
"tag": "Special"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "`",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "\"doesn't",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "typecheck\"",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "+",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "1",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "`",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Link",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": {
|
||||
"contents": "https://unison-lang.org",
|
||||
"tag": "Word"
|
||||
},
|
||||
"tag": "Group"
|
||||
}
|
||||
],
|
||||
"tag": "NamedLink"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "![Image](https://share-next.unison-lang.org/static/unison-logo-circle.png)",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Bold",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
"tag": "Bold"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Italic",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
"tag": "Bold"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Strikethrough",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
"tag": "Strikethrough"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Horizontal",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "rule",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "---",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Table",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Header",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "1",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Header",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "2",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "--------",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "--------",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Cell",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "1",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Cell",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "2",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Cell",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "3",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Cell",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "4",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Video",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
[
|
||||
{
|
||||
"mediaSourceMimeType": null,
|
||||
"mediaSourceUrl": "test.mp4"
|
||||
}
|
||||
],
|
||||
{
|
||||
"poster": "test.png"
|
||||
}
|
||||
],
|
||||
"tag": "Video"
|
||||
},
|
||||
"tag": "Special"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Transclusion/evaluation:",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "This",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "doc",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "should",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "be",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "embedded.",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "message",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
}
|
||||
],
|
||||
"tag": "UntitledSection"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tag": "Section"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tag": "Section"
|
||||
}
|
||||
]
|
||||
],
|
||||
"termNames": [
|
||||
"term"
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeDefinitions": {}
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user