This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(reduce (fn [a [k v]] | |
(if (a k) | |
(update-in a [k] conj v) | |
(assoc a k [v]))) | |
{} | |
...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Thunk | |
Creates a thunk representing the given closure. | |
Since we want automatic memoization of as many expressions as possible, we | |
use a JS object as a sort of tagged pointer, where the member x denotes the | |
object actually pointed to. If a "pointer" points to a thunk, it has a | |
member 't' which is set to true; if it points to a value, be it a function, | |
a value of an algebraic type of a primitive value, it has no member 't'. | |
When a thunk is evaluated, by reading the member 'x' of the "pointer," the | |
closure is evaluated and the getter removed, to be replaced with the value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main (main) where | |
{-| The main module | |
@docs main | |
-} | |
import Html exposing (Html, div, button, text) | |
import Html.Attributes as Html exposing (style) | |
import Html.Events exposing (onClick) | |
import StartApp as StartApp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Lens | |
import Data.Lens.Index | |
viewIndex :: forall m a b. (Index m a b) => m -> a -> b | |
viewIndex m a = view (ix a) m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var PurescriptWebpackPlugin = require('purescript-webpack-plugin'); | |
var src = ['bower_components/purescript-*/src/**/*.purs', 'src/**/*.purs']; | |
var ffi = ['bower_components/purescript-*/src/**/*.js', 'src/**/*.js']; | |
var modulesDirectories = [ | |
'node_modules', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DefaultSignatures #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeOperators #-} | |
module Database.Generic where | |
import Data.Proxy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
module Rs where | |
import Control.Monad.Free | |
import qualified Data.Map as M | |
data RsF m next = ∀ a. RsCheckpoint Int (m a) (a → next) | RsRewind Int |
I hereby claim:
- I am pkamenarsky on github.
- I am pkamenarsky (https://keybase.io/pkamenarsky) on keybase.
- I have a public key ASDnTmZ4WbKnCFcogH9dCldAvg8-4SiG-lwILvJK6RhNRwo
To claim this, I am signing this object:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Applicative where | |
-- A real-world example of Applicative. | |
-- | |
-- Imagine we have a `User` data structure (with all the usual fields) which | |
-- we must assemble from various data sources, like databases, files, external | |
-- services and so on. | |
-- | |
-- One thing our specs call for is that we must log error messages whenever | |
-- some external service fails or is otherwise unavailable. However, we'd like |
OlderNewer