Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am purefn on github.
* I am purefn (https://keybase.io/purefn) on keybase.
* I have a public key ASBMbA3lKeGhcyrARt60F0LI24vmRhPnW2ukBfw2EKNBIAo
To claim this, I am signing this object:
import scalaz._
import Scalaz._
import scalaz.effect._
package object types {
type Bytes = String
type Path = String
}
import scalaz._
import scalaz.stream._
import scodec.bits._
type EntityBody[F] = Process[Free.FreeC[F, ?], ByteVector]
final case class Request[A]
( method: Method
, uri: Uri
, httpVersion: HttpVersion
final case class Request
( method: Method
, uri: Uri
, httpVersion: HttpVersion
, headers: CI[String] ==>> IList[String]
, body: EntityBody
)
final case class Response
( method: Method
import sbt._
import Keys._
case class Step[A](run: Def.Initialize[Task[A]]) {
def map[B](f: A => B): Step[B] =
Step[B](Def.taskDyn {
Def.task { f(run.value) }
})
def flatMap[B](f: A => Step[B]): Step[B] =
Step[B](Def.taskDyn {
page = doctypehtml_ $ do
head_ $ do
webResources Batched "/s/" [ aui, reactjs, pageResource ]
body_ "Hello world!"
-- or
page2 = withWebResources Separate "/s/" [ aui, reactjs, pageResource ] $ \links scripts ->
doctypehtml_ $ do
head_ $ do
@purefn
purefn / nix-hask
Created March 6, 2015 15:54
Nix Haskell dev shell
#!/usr/bin/env bash
TOOLS="ctags haskellngPackages.codex haskellngPackages.ghc-mod haskellngPackages.hasktags haskellngPackages.hlint haskellngPackages.hscope haskellngPackages.pointfree haskellngPackages.pointful haskellngPackages.stylish-haskell"
EXPR="with (import <nixpkgs> {}).pkgs; with (import <nixpkgs/pkgs/development/haskell-modules/lib.nix> { inherit pkgs; });"
if [ -e "shell.nix" ]
then
PKG="(import ./shell.nix)"
else
PKG="myHaskellProject"
data Foo = Foo { bar :: Maybe Bar }
data Bar = Bar { baz :: Text }
t :: Foo -> Text
t foo = foldMap id $ foo ^. bar ^? _Just baz
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell #-}
module Stack where
import Control.Applicative
import Control.Lens
import Control.Monad.State
{ mkDerivation, aeson, AesonBson, ansi-wl-pprint, base, bifunctors
, blaze-html, blaze-markup, bson, bytestring, case-insensitive
, cereal, clay, configurator, containers, either, errors
, exceptions, failure, hslogger, http-conduit, http-types, jwt
, lens, mongoDB, mtl, network, network-uri, optparse-applicative
, parsers, profunctors, pureMD5, QuickCheck, safe, scientific
, scotty, semigroups, SHA, stdenv, tasty, tasty-hunit
, tasty-quickcheck, text, time, transformers, trifecta
, unordered-containers, uri, utf8-string, validation, wai
, wai-extra, wai-middleware-static, warp, word8, zip-archive