Skip to content

Instantly share code, notes, and snippets.

@nomeata
nomeata / main.mo.md
Created Sep 15, 2021
Certified Assets from Motoko (PoC/Tutorial)
View main.mo.md

Every now and then someone asks whether Motoko canisters can use certified variables, or whether they can serve HTTP requests with certification, and I always responded that yes, Motoko can do that, all that’s missing are a few libraries. But I figured I should put my hand where my mouth is, and actually demonstrate that it’s possible.

So here we go. If you go to https://ce7vw-haaaa-aaaai-aanva-cai.ic0.app/ you will see that

To prove the latter claim, here is the commented code; you can also browse the full repository.

main.mo

View dfx canisters
$ sha256sum $(nix-build -E '(import (builtins.fetchGit { url = "git@github.com:dfinity/sdk"; ref = "refs/tags/0.7.0";} + "/distributed-canisters.nix") {})')/*/*.wasm
2664385b7ad001123d8cea1f7147fad005d012116139787d9054b2f3a62718ec /nix/store/0s2iplbgj08d32xdyjcwwyajhhg9fgzs-distributed-canisters/assetstorage/assetstorage.wasm
d6e9f851519a6dc419e3281448a84e4866fbb5011258868e2b5dda31d529bdcf /nix/store/0s2iplbgj08d32xdyjcwwyajhhg9fgzs-distributed-canisters/ui/ui.wasm
a609400f2576d1d6df72ce868b359fd08e1d68e58454ef17db2361d2f1c242a1 /nix/store/0s2iplbgj08d32xdyjcwwyajhhg9fgzs-distributed-canisters/wallet/wallet.wasm
$ sha256sum $(nix-build -E '(import (builtins.fetchGit { url = "git@github.com:dfinity/sdk"; ref = "refs/tags/0.7.1";} + "/distributed-canisters.nix") {})')/*/*.wasm
2664385b7ad001123d8cea1f7147fad005d012116139787d9054b2f3a62718ec /nix/store/0s2iplbgj08d32xdyjcwwyajhhg9fgzs-distributed-canisters/assetstorage/assetstorage.wasm
d6e9f851519a6dc419e3281448a84e4866fbb5011258868e2b5dda31d529bdcf /nix/s
View Z.hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
module Z where
import Prelude hiding (zip)
zip :: forall a b. [a] -> [b] -> [(a,b)]
zip [] _ = []
zip _ [] = []
zip (x:xs) (y:ys) = (x,y) : zip xs ys
View GHC Extensions stats
0% 0% 0% ImplicitPrelude
0% 0% 0% NoMonoLocalBinds
0% 0% 0% NoRebindableSyntax
0% 0% 0% NoMagicHash
0% 0% 0% NoOverloadedLists
0% 0% 0% StarIsType
0% 1% 0% RelaxedPolyRec
0% 4% 0% ForeignFunctionInterface
0% 4% 0% DoAndIfThenElse
0% 12% 0% PatternGuards
@nomeata
nomeata / Foo.hs
Last active Nov 10, 2020
issue914 repo
View Foo.hs
{-# LANGUAGE TemplateHaskell #-}
module Foo where
import Language.Haskell.TH (Q,Exp)
import qualified Language.Haskell.TH.Syntax as TH
simpleVersion :: String -> Q Exp
simpleVersion version = [|$(TH.lift version)|]
@nomeata
nomeata / Tree.hs
Created Aug 6, 2020
Many faces of isOrderedTree – code to the talk (actually extended version)
View Tree.hs
{-# LANGUAGE GADTSyntax #-}
{-# LANGUAGE DeriveFoldable #-}
module Tree where
import Control.Monad
import Data.Maybe
import Data.Foldable
data T a = L | N (T a) a (T a) deriving (Show, Foldable)
@nomeata
nomeata / Tree.hs
Created Jul 31, 2020
Many faces of isOrderedTree – code to the talk (extended version)
View Tree.hs
-- Many faces of isOrderedTree
-- Code to the talk (extended version)
{-# LANGUAGE DeriveFoldable #-}
module Tree where
import Control.Monad
import Data.Maybe
import Data.Foldable
@nomeata
nomeata / .gitignore
Last active Jul 6, 2018
Type variables in patterns – figure source code
View .gitignore
tyvars-in-pats-haskell18.pdf
tyvars-in-pats-haskell18-*.pdf
## Richard's ott setup
tyvars-in-pats-haskell18.tex
tyvars-in-pats-haskell18-*.tex
tyvars-in-pats-haskell18.lhs
tyvars-in-pats-haskell18.hs
ott.tex
ottdump.pdf
View Glassery.md
title author
Glassery
Oleg Grenrus

After I have improved the raw performance of optika – a JavaScript optics library, it's time to make the library (feature-)complete and sound. Gathering and classifying all possible optic types, gives us a reference point

View ghc-proposal-stats.txt
┌────────────────┬────────────────┬───────┬──────────┐
│ From │ To │ Count │ Time │
╞════════════════╪════════════════╪═══════╪══════════╡
│ Accepted │ - │ 10 │ 150 days │
├────────────────┼────────────────┼───────┼──────────┤
│ Needs revision │ - │ 3 │ 241 days │
├────────────────┼────────────────┼───────┼──────────┤
│ Needs revision │ Pending │ 1 │ 8 days │
├────────────────┼────────────────┼───────┼──────────┤
│ Out-of-scope │ - │ 9 │ 312 days │