Skip to content

Instantly share code, notes, and snippets.

11:19 ~/unison (master)$ stack exec unison -- -codebase /tmp/885
_____ _
| | |___|_|___ ___ ___
| | | | |_ -| . | |
|_____|_|_|_|___|___|_|_|
Welcome to Unison!
I'm currently watching for changes to .u files under ~/unison

Abilities tutorial

Introducing abilities

Motivation

Why does Unison have abilities, when so many languages get by without them?

But wait, what /are/ abilities? What is an “effectful behavior”? Maybe define the term after the examples.

Note: I’d recommend numbering the “why”s, otherwise I find the section headings grammatically confusing.

hfsevents > configure
hfsevents > Configuring hfsevents-0.1.6...
hfsevents > build
hfsevents > Preprocessing library for hfsevents-0.1.6..
hfsevents > Building library for hfsevents-0.1.6..
hfsevents > [1 of 1] Compiling System.OSX.FSEvents
hfsevents >
hfsevents > /private/var/folders/mz/qg5255493sx8rjpd1t9fwll00000gq/T/stack-893b4ee60c20394e/hfsevents-0.1.6/In file included from cbits/c_fsevents.m:1:0: error:
hfsevents >
hfsevents > /private/var/folders/mz/qg5255493sx8rjpd1t9fwll00000gq/T/stack-893b4ee60c20394e/hfsevents-0.1.6/In file included from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:23:0: error:
@aryairani
aryairani / output.txt
Created August 2, 2019 03:12
update dependency of 3-segment definition
.foo> add
⍟ I've added these definitions:
x : .base.Nat
y.y.y : .base.Nat
.foo> find.verbose
1. -- #jk19sm5bf8idtedq2u4mmc6r9t4hrg07eqmaqsdh8gk17ofkmv9jh176opgrbllphvtbb4gi6247l3a7f3umfsbrr1ut9856dmn6thg
use Universal <
fibNaive n =
if n < 2 then 1
else fibNaive (n `drop` 1) + fibNaive (n `drop` 2)
use Optional None Some
namespace Sequence where
@aryairani
aryairani / effects.u
Last active April 19, 2019 20:06
Unison effects example
-- Inspired by https://github.com/etorreborre/effects
use State get put
use Writer tell
use Random randomNatRange
use Universal ==
> handle multiHandler 0 [] 0 in replicate 5 main
main = 'let

Hi Chris, this is great! My thoughts on your post below.

(1) Structural and beyond-structural types.

My thinking with structural types is that, between different types, the structure of the set of constructors is unique; and within a single type, the structure of individual constructors is unique. Specifically, I very much don't want the declared order of the constructors to matter for a type like Optional. And if the declared order of constructors doesn't matter, then how would you distinguish two nullary constructors, apart from by their (original) names.

Maybe Color / warm / Direction / longitudinal are a bad example / have a mistake in them because, looking at them, I can't see how warm and longitudinal are the same. And I exactly do want to the typechecker to notify me when I'm about to call a function on a value that it wasn't meant to understand.

(2) Nominal types w/ user-defined isomorphisms between t

{
"attachments": [
{
"text": "accelerated: Zojima",
"thumb_url": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/fd/fda870174e7b4de7960ae1fed65b995b2b18a992_medium.jpg",
"footer": "Turn ends",
"ts": 123456789
},
{
"text": "concerned: goods",
@aryairani
aryairani / GMR.sh
Last active October 15, 2017 19:02
#set -x
#trap read debug
if [ $# -ne 1 ];
then echo "usage: GMR.sh <game-id>"
fi
GAMENUM=$1
RCVDGAME=~/Downloads/"(GMR) Play this one!.Civ5Save"
SAVEDIR=~/Documents/Aspyr/"Sid Meier's Civilization 5"/Saves/Hotseat
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?>
<hotspot_log version="160 1" process="30051" time_ms="1506530120948">
<vm_version>
<name>
Java HotSpot(TM) 64-Bit Server VM
</name>
<release>
25.121-b13
</release>
<info>