Lambda Jam 2014

Ed Kmett Keynote - Functionally Oblivious & Succinct Data Structures

Further information:

Manuel Chakravarty - FFI - inline Objective-C with TH

add n = [cfun| int addConstant(int x) { return x + $int:n;  } |]

Tim McGillgrist - Raft in Erlang

Declan Conlan - faster sorting ??

data Order t where
  TrivO :: Order t
  NatO  :: Int -> Order Int
  SumL  :: Order t1 -> Order t2 -> Order (Either (t1 t2)
  ProdL :: Order t1 -> order t2 -> order (t1, t2)
  MapO  :: (t1 -> t2) ...
  ListL :: 

-- Disc == Discriminator
type Disc k = forcall v. [(kv,)] -> [[v]

sort :: Order k -> Disc k
sort (NatO n) xs = discNat n xs

discNat :: Itnt -> Disc Int
discNat n xs = filter (not . null) (bdiscNat n update xs)

update :: [v] -> v -> [v]
update vs v = v : vs
OR
update = flip (:)

bdiscNat :: Int -> ([v] -> v -> [v]) -> [(Int, v)] -> [[v]])
bdiscNat (n :: Int) update xs =
  map reverse (elems (accumArray update [] (0, n-1) xs))

Haskell

Tony Morris - A modern history of lenses


data Lens target field =
  Lens f {
    run :: forall f. Functor f => 
      (field ->  f field) -> (target -> f target)
  }

Haskell


type Lens s t a b =
  Functor f => (a -> f b) -> s -> f t

-- Control.Lens.Prism
type Prism s t a b =
  (Applicative f, Choice f) =>
    (a -> f b) -> s -> f t

type Traversal s t a b =
  Applicative f =>
    (a -> f b) -> s -> f t

Haskell

Edward Kmett, cache oblivious sparse matrix multiplication


Z-order, Morton order, or Morton code is a function which maps
multidimensional data to one dimension while preserving locality of
the data points. It was introduced in 1966 by G. M. Morton.[1] The
z-value of a point in multidimensions is simply calculated by
interleaving the binary representations of its coordinate values. Once
the data are sorted into this ordering, any one-dimensional data
structure can be used such as binary search trees, B-trees, skip lists
or (with low significant bits truncated) hash tables. The resulting
ordering can equivalently be described as the order one would get from
a depth-first traversal of a quadtree; because of its close connection
with quadtrees, the Z-ordering can be used to efficiently construct
quadtrees and related higher-dimensional data structures.[2]