Skip to content

Instantly share code, notes, and snippets.

-- http://www.reddit.com/r/haskell/comments/2xmp9j/what_to_you_think_about_the_fsharp_piping/
(|>) :: a -> (a -> b) -> b
(|>) x f = f x
($>) :: Functor r => r a -> (a -> b) -> r b
($>) xs f = fmap f xs
(?>) :: [a] -> (a -> Bool) -> [a]
(?>) xs f = filter f xs
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import Control.Applicative
import Data.Maybe
import Data.Monoid
newtype X a = X { getX :: Maybe a } deriving (Eq, Ord, Read, Show, Functor, Applicative, Monad)
instance Monoid a => Monoid (X a) where
mempty = X (Just mempty)
@sshastry
sshastry / http4sApp.scala
Created November 20, 2014 09:31
http4s example
package org.app
import scalaz._
import Scalaz._
import scala.concurrent.{ExecutionContext, Future}
import org.http4s._ // v0.4.0
import org.http4s.dsl._
import org.http4s.server._
import org.http4s.server.blaze.BlazeBuilder
import org.slf4j.{Logger,LoggerFactory}