This file contains 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
#I @"C:\Tools\System.Reactive" | |
#r "System.Core.dll" | |
#r "System.Reactive.dll" | |
type observable<'a> = System.Collections.Generic.IObservable<'a> | |
type observer<'a> = System.Collections.Generic.IObserver<'a> | |
module Observable = | |
open System | |
open System.Linq |
This file contains 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 Monad = | |
type M<'T,'B when 'B :> Sig<'B>> = | |
interface end | |
and Sig<'B when 'B :> Sig<'B>> = | |
abstract member Return<'X> : 'X -> M<'X,'B> | |
abstract member Bind<'X,'Y> : | |
M<'X,'B> -> ('X -> M<'Y,'B>) -> M<'Y,'B> |
This file contains 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 GADTs #-} | |
> module Example where | |
> import qualified Data.Map as M | |
Let's assume that requests are simple |String|s. | |
> type Request = String | |
When running a web continuation, either the computation is completely finished, |
This file contains 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
In this gist we will first show that we can beat the arc challenge | |
(http://www.paulgraham.com/arcchallenge.html), and then build the library that | |
shows how we did it. This gist is Literate Haskell and is of course executable. The packages needed are happstack-server and applicative-extras, installable using cabal. | |
Let's start with some imports (for now, you can ignore these) | |
> {-# LANGUAGE GADTs, TypeSynonymInstances #-} | |
> module ArcChallenge where | |
> | |
> import Control.Applicative |
This file contains 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
This is a literate Haskell file that describes the sketch of a type-safe URL | |
handling system. It is not done (or anything near it), but is intended as | |
inspiration for a complete system. | |
First we will show some examples, and later we will implement the library. The | |
library uses the |regular| package for generic programming (cabal install regular). | |
> {-# LANGUAGE TemplateHaskell, TypeFamilies, EmptyDataDecls, | |
> TypeSynonymInstances, TypeOperators, ScopedTypeVariables #-} | |
> |
This file contains 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
Sete Atitudes para Hackear a Indústria de Software | |
By Klaus Wuestefeld | |
1) Torne-se excelente. | |
Seja realmente bom em alguma coisa. Não fique só choramingando ou | |
querendo progredir às custas dos outros. Não pense q pq vc sentou 4 | |
anos numa faculdade ouvindo um professor falar sobre software q vc | |
sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo |
This file contains 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
Digestive functors | |
================== | |
CE: Misschien iets over HTML forms genereren? Dit is wellicht iets te abstract. Ook dat je controle hebt over error-correction en dat het composable is? Misschien uitleggen dat het een alternatief voor formlets is dat strikt beter is? | |
Digestive functors is a library that provides an abstract interface towards | |
input consumption. The interface is based on applicative functors. | |
> {-# LANGUAGE OverloadedStrings #-} | |
> import Text.Digestive |
This file contains 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
/** | |
* Part Zero : 10:15 Saturday Night | |
* | |
* (In which we will see how to let the type system help you handle failure)... | |
* | |
* First let's define a domain. (All the following requires scala 2.9.x and scalaz 6.0) | |
*/ | |
import scalaz._ | |
import Scalaz._ |
This file contains 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
/// Converts structural encodings to proper FSCGI.* types. | |
module FSCGI.Structural.Converter | |
type private Encodings<'R,'W> = | |
('W -> Writer<'W>) * | |
('R -> Response<'R,'W>) | |
let private ConvertRequest (r : FSCGI.Request) : Request = | |
( | |
r.Headers, |
This file contains 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
trait Nat { | |
type IsZero <: Bool | |
type Prev <: Nat | |
type Divisable[A <: Nat] = DivisableImpl[A, A] | |
type DivisableImpl[A <: Nat, B <: Nat] <: Bool | |
} | |
trait Z extends Nat { | |
type IsZero = True | |
type Prev = Nothing |
OlderNewer