Skip to content

Instantly share code, notes, and snippets.

View sirlensalot's full-sized avatar

Stuart Popejoy sirlensalot

View GitHub Profile
.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/bench/bench compile
Array [String "Write succeeded"]
Array [String "Write succeeded"]
Array [String "Write succeeded"]
benchmarking compile/longStr 10
time 382.8 ns (378.4 ns .. 387.5 ns)
0.999 R² (0.998 R² .. 1.000 R²)
mean 379.9 ns (375.0 ns .. 384.1 ns)
std dev 14.38 ns (11.65 ns .. 20.19 ns)
variance introduced by outliers: 55% (severely inflated)
[68 of 83] Compiling Pact.Compile ( src/Pact/Compile.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Pact/Compile.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-apple-darwin):
Simplifier ticks exhausted
When trying UnfoldingDone $fFunctorIdentity_$cfmap
To increase the limit, use -fsimpl-tick-factor=N (default 100)
If you need to do this, let GHC HQ know, and what factor you needed
To see detailed counts use -ddump-simpl-stats
Total ticks: 202840
@sirlensalot
sirlensalot / LensGuidelines.md
Last active June 15, 2018 02:44
Kadena Lens Guidelines

Lens Usage Guidelines for Kadena Code

The purpose of this is to enforce regularity around usage of the lens library. Lens gets a decent amount of flak for (a) horrific type errors (not much we can do with that) and (b) illegible squigglies. My issue with the squigglies is they cause OO- (or OCAML?)-style left-to-right evaluation. Thus, I'm not offended by some of the state-monad operators, as they slot into where <- would go in do notation.

But in the end, the ones I object to are really because their wordy counterparts are reasonably short. The big advantage of the squigglies in the end is not having to put parens around lens compositions,

@sirlensalot
sirlensalot / Kadena-demo.md
Created May 17, 2018 06:24
Privacy demo on Kadena

Sample Usage: Running the payments demo with private functionality

Refer to "Entity Configuration" below for general notes on privacy configurations. This demo requires that there be 4 entities configured by the genconfs tool, which will name them "Alice", "Bob", "Carol" and "Dinesh". These would correspond to business entities on the blockchain, communicating with private messages over the blockchain. Confirm this setup with the server command.

Launch the cluster, and load the demo.yaml file.

node3> load demo/demo.yaml
status: success
data: TableCreated
@sirlensalot
sirlensalot / main.pact
Created November 5, 2017 15:23
web pact test
(+ 1 2)
@sirlensalot
sirlensalot / debug-flycheck.md
Last active August 23, 2016 23:02
debug flycheck commands

in flycheck-start-command-checker, add (message "%s %s" checker args)

@sirlensalot
sirlensalot / TwoNatsExistential.hs
Created May 16, 2016 20:59
Index a type with two nats using existential constraints/proxy args
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs, DataKinds #-}
module Foo where
import GHC.TypeLits
import Data.Type.Equality
import Data.Proxy
data Foo (a :: Nat) (b :: Nat) :: * where
@sirlensalot
sirlensalot / TwoNatsPseudoProxy.hs
Created May 16, 2016 20:48
Index a type with two Nats with "restricted proxy"
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs, DataKinds, PolyKinds, ScopedTypeVariables #-}
module Foo where
import GHC.TypeLits
import Data.Proxy
data Foo (a :: Nat) (b :: Nat) :: * where Foo :: Foo a b
instance (KnownNat a, KnownNat b) => Show (Foo a b) where
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
module Juno.DSL
where
import qualified Data.ByteString as BS
import Control.Monad.Identity
data SigNonce nonce ident cmd = SigNonce {
_nIdent :: ident
@sirlensalot
sirlensalot / recover-cons.hs
Created April 14, 2016 00:30
Recover Cons in a newtype
newtype Ledger a = Ledger { _lEntries :: Seq a }
deriving (Eq,Show,Generic,Monoid)
makeLenses ''Ledger
instance Cons (Ledger a) (Ledger a) a a where
_Cons = prism (\(a,s) -> over lEntries (review _Cons . (a,)) s) $
\s -> case firstOf _Cons (view lEntries s) of
Nothing -> Left mempty
(Just (a,as)) -> Right (a,set lEntries as s)