Skip to content

Instantly share code, notes, and snippets.

@aryairani
aryairani / benchmarks.md
Created May 17, 2020 22:49
confusing benchmarks

With -O2 accidentally

changes to SlimCopy..hs MB*s
no change 329.2
State.Strict 230.9
Writer.Strict 176.3
Writer.Strict + State.Strict 176.5
Index 386.9
Index + Map.Strict 321.7
Index + State.Strict 230.6
✔ ~/unison/pt/1408-numbered [pt/1408-numbered|…770]
12:57 $ cabal v2-run unison
Up to date
_____ _
| | |___|_|___ ___ ___
| | | | |_ -| . | |
|_____|_|_|_|___|___|_|_|
Welcome to Unison!
@aryairani
aryairani / log.txt
Created April 14, 2020 20:53
playing with git 1
ndnd:tmp arya$ git init --bare repo.git
Initialized empty Git repository in /private/tmp/repo.git/
ndnd:tmp arya$ git clone repo.git 1
Cloning into '1'...
warning: You appear to have cloned an empty repository.
done.
ndnd:tmp arya$ git clone repo.git 2
Cloning into '2'...
warning: You appear to have cloned an empty repository.
done.
@aryairani
aryairani / monads.u
Last active March 29, 2020 20:39 — forked from pchiusano/monads.u
Converting between algebraic effects and monads
-- This gist shows how we can use abilities to provide nicer syntax for any monad.
-- We can view abilities as "just" providing nicer syntax for working with the
-- free monad.
ability Monadic f where
eval : f a -> a
-- Here's a monad, encoded as a first-class value with
-- two polymorphic functions, `pure` and `bind`
type Monad f = Monad (forall a . a -> f a) (forall a b . f a -> (a -> f b) -> f b)

We were seeing an issue where (it seemed) that every namespace that was visited during a propagate would get a new history node, even when it didn't contain any dependents.

Example:

a = "a term"
X.foo = "a namespace"
.> add

Switching between namespaces / projects / branches / modules

Unison uses the same organizational element to represent directories, projects, sub-projects, forks, modules, etc.; currently called a "namespace".

Namespaces are trees that contain definitions of "types" and "terms", "patches", and other child namespaces.

We're still working out what a nice codebase layout might be (feel free to write up a blog post if you find one that works well for you), but in this example, we have these, along with their children (not shown):

.libs.base .libs.megaparser.master

.> push /Users/arya/unison4/repo.git/ temp.base ⚙ git clone --quiet --depth 1 /Users/arya/unison4/repo.git/ /Users/arya/.cache/unisonlanguage/gitfiles/0n0s3ge8sulpsnvicjd64fq6eg9hlb28ea4h6992a84scu5f17fj0dqjjilpup2c5v4moc4cunplk33n1cjvabr8k9rlfv0904di9m8/HEAD warning: --depth is ignored in local clones; use file:// instead. warning: You appear to have cloned an empty repository. ⚙ git -C /Users/arya/.cache/unisonlanguage/gitfiles/0n0s3ge8sulpsnvicjd64fq6eg9hlb28ea4h6992a84scu5f17fj0dqjjilpup2c5v4moc4cunplk33n1cjvabr8k9rlfv0904di9m8/HEAD rev-parse --git-dir .git ⚙ git clone --quiet --depth 1 /Users/arya/unison4/repo.git/ /Users/arya/.cache/unisonlanguage/gitfiles/0n0s3ge8sulpsnvicjd64fq6eg9hlb28ea4h6992a84scu5f17fj0dqjjilpup2c5v4moc4cunplk33n1cjvabr8k9rlfv0904di9m8/HEAD warning: --depth is ignored in local clones; use file:// instead. warning: You appear to have cloned an empty repository. ⚙ git -C /Users/arya/.cache/unisonlanguage/gitfiles/0n0s3ge8sulpsnvicjd64fq6eg9hlb28ea4h6992a84scu5f17fj0dqjjilpup2c5v

ability Stream e where
  emit : e ->{Stream e} ()
.tutorials.abilities> add
.tutorials.abilities> load
.> pull https://github.com/unisonweb/base .base
.> pull https://github.com/runarorama/unisonlibraries .runar

The name associated with definition 1 doesn't exist in the old branch, thus view 1 isn't going to work. Where did it come from?

.> diff.namespace .base .runar
.> debug.numberedArgs