Skip to content

Instantly share code, notes, and snippets.

View lenary's full-sized avatar

Sam Elliott lenary

View GitHub Profile
@lenary
lenary / 00-intro.md
Last active August 29, 2015 13:56
Guidance Notes for CRDT Performance Issues

I've had one question about subpar performance in Riak 2.0's CRDTs. I thought I'd write this so that people can more easily diagnose these issues, without the CRDT team having to step in every time.

An Example: A Client was having problems with the performance fetching and updating sets. The issue manifested itself with poor fetch performance.

So, how do you go about debugging/diagnosing this?

-- (constraints on k and v, defined somehow)
class Map (impl k v ~> constraints) where
new :: impl k v
insert :: (constraits) => k -> v -> impl k v -> impl k v
get :: (constraints) => k -> impl k v -> Maybe v
-- then somehow this
instance Map (HashMap k v ~> (Hash k, Eq k)) where
new = ...
insert = ...
@lenary
lenary / gist:2b84ae3a24ce0f557864
Last active August 29, 2015 14:01
Travelling

I'm going travelling this summer. Here's to where:

  • Washington DC (~ 3 nights)
  • Austin, TX (~ 3 nights)
  • San Diego (~ 3 nights)
  • San Francisco (~ 1 week)
  • Portland (~ 3 nights)
  • Seattle (~ 3 nights)
  • NYC (more than 3 nights, less than a week)
  • Boston (~ 1.5 weeks)
@lenary
lenary / gcounter.idr
Created June 25, 2014 14:31 — forked from mrb/cong.idr
module Main
import Prelude.Algebra
record GCounter : Type where
MkGCounter : (value : Int) -> GCounter
gcjoin : GCounter -> GCounter -> GCounter
gcjoin l r = (MkGCounter ((value l) + (value r)))
@lenary
lenary / Error
Last active August 29, 2015 14:03
Idris> :l VerifiedNatLattice.idr
Type checking ./VerifiedNatLattice.idr
VerifiedNatLattice.idr:6:10:
When elaborating type of Prelude.Algebra.Nat instance of Prelude.Algebra.VerifiedBoundedJoinSemilattice, method boundedJoinSemilatticeBottomIsBottom:
Can't resolve type class BoundedJoinSemilattice B
Metavariables: Nat instance of Prelude.Algebra.VerifiedBoundedJoinSemilattice
Resolving dependencies...
[1 of 1] Compiling Main ( /var/folders/kf/wlmqhdfs665cq2t28q42zx6m0000gn/T/idris-0.9.14.3-20303/idris-0.9.14.3/dist/setup/setup.hs, /var/folders/kf/wlmqhdfs665cq2t28q42zx6m0000gn/T/idris-0.9.1
4.3-20303/idris-0.9.14.3/dist/setup/Main.o )
Linking /var/folders/kf/wlmqhdfs665cq2t28q42zx6m0000gn/T/idris-0.9.14.3-20303/idris-0.9.14.3/dist/setup/setup ...
Configuring idris-0.9.14.3...
rm -f idris_rts.o idris_heap.o idris_gc.o idris_gmp.o idris_bitstring.o idris_opts.o idris_stats.o mini-gmp.o idris_stdfgn.o idris_net.o libidris_rts.a
fatal: Not a git repository (or any of the parent directories): .git
Generating dist/build/autogen/Version_idris.hs for release
Building idris-0.9.14.3...
Preprocessing library idris-0.9.14.3...
Preprocessing executable 'idris-erlang' for idris-0.9.14.2...
[2 of 2] Compiling Main ( codegen/idris-erlang/Main.hs, dist/build/idris-erlang/idris-erlang-tmp/Main.o )
Linking dist/build/idris-erlang/idris-erlang ...
@lenary
lenary / 00_Proposal.md
Last active August 29, 2015 14:08
RFC: Idris Primitives Changes

I'm currently writing an Erlang backend for the Idris compiler. Right now I've got to the internally "primitive" operations, and would like to see an increased reliance on compiling to these primitives in the Prelude rather than using the foreign function calls that are currently used.

This would probably be a breaking change for lots of backends, so I thought I'd propose it before making any major code changes.

I'm willing to do all these changes to the C and conventional backends, I'd just like to run the idea of them past a few set of eyes before I start.

Some background:

The list of current primitives (over 70) is in Lang.hs below. They cover a wide variety of functionality, most of which is mathematical operations, but there's some more important stuff about I/O: LPrintNum, LPrintStr, LReadStr, LStdIn, LStdOut, LStdErr.

%% So you have an aribtrary function, like so
f(A,B,C) ->
A + B + C.
%% We want something that can be more helpful for sectioning/partial application.
%% What about transforming that thing above to the following:
module Inflector
## Stolen From Rails. Thanks Guys!
def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
if first_letter_in_uppercase
lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
else
lower_case_and_underscored_word.first + camelize(lower_case_and_underscored_word)[1..-1]
end
end