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
Resolving dependencies... | |
Notice: installing into a sandbox located at | |
/Users/jroesch/OpenSource/sparse/.cabal-sandbox | |
Downloading dlist-0.6.0.1... | |
Configuring nats-0.1.2... | |
Configuring newtype-0.2... | |
Configuring parallel-3.2.0.4... | |
Configuring primitive-0.5.1.0... | |
Configuring tagged-0.7... | |
Configuring split-0.2.2... |
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
Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_21). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> :power | |
** Power User mode enabled - BEEP WHIR GYVE ** | |
** :phase has been set to 'typer'. ** | |
** scala.tools.nsc._ has been imported ** | |
** global._, definitions._ also imported ** | |
** Try :help, :vals, power.<tab> ** |
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 RankNTypes #-} | |
module SimpleLens where | |
import Data.Functor.Identity | |
import Data.Functor.Constant | |
type LensP s t a b = forall f. Functor f => (a -> f b) -> s -> f t | |
type Lens s a = LensP s s a a |
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 RankNTypes #-} | |
module IdExamples where | |
vanilla :: (a -> a) -> a -> a | |
vanilla f i = | |
let shouldWork = f (1 :: Int)-- won't actually work | |
in f i | |
rankNVersion :: (forall a. a -> a) -> b -> b | |
rankNVersion f i = |
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
package typefamily | |
import scala.language._ | |
/* From the paper: | |
* http://research.microsoft.com/en-us/um/people/simonpj/papers/assoc-types/fun-with-type-funs/typefun.pdf | |
* | |
* class Mutation m where | |
* type Ref m :: * -> * | |
* newRef :: a -> m (Ref m a) |
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
require 'formula' | |
class Ghc < Formula | |
homepage "http://haskell.org/ghc/" | |
url "https://www.haskell.org/ghc/dist/7.8.1/ghc-7.8.1-src.tar.bz2" | |
sha1 "7ddfd360be8d25a5d39f3e74573a2ade220511b2" | |
# bottle do | |
# revision 2 | |
# sha1 "a6ceeb3f1f9ba2cf0454dc9d45dce69f8a5ae736" => :mavericks |
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
type DDict v = Dict String (Dict String v) | |
nested : DDict v | |
nested = ... | |
-- Let's assume we want to update all inner fields | |
updateInner :: String -> v -> DDict v -> DDict v | |
updateInner s v d = Dict.fromList $ (keys d) (map (Dict.insert s v) $ values d) |
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 HList | |
data HList : List Type -> Type where | |
Nil : HList [] | |
(::) : {h: Type} -> {t: (List Type)} -> (head : h) -> (tail : HList t) -> HList (h :: t) | |
hlist : HList [Int, Int, Int] | |
hlist = [1, 2, 3] |
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
data Value = SelfV | Lit Literal | |
data Literal = IntLit Int | StringLit String | ect | |
top :: Interpreter (Maybe Value) | |
top = do | |
stack <- get | |
case stack of | |
[] -> return Nothing | |
(top:_) -> return $ Just top |
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
;; -*- coding: utf-8 -*- | |
(require 'package) | |
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") | |
("marmalade" . "http://marmalade-repo.org/packages/") | |
("melpa" . "http://melpa.milkbox.net/packages/"))) | |
(package-initialize) | |
; Remove the pesk + ugly toolbar |
OlderNewer