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 Dog = Dog { name :: Text | |
, age :: Int | |
, likes :: Text | |
} deriving Show | |
instance ToJSON Dog where | |
toJSON = asObject [ name `as` "name" | |
, age `as` "age" | |
, likes `as` "likes" | |
] |
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
-- http://hackage.haskell.org/package/base-4.6.0.1/docs/src/GHC-Base.html#map | |
map :: (a -> b) -> [a] -> [b] | |
map _ [] = [] | |
map f (x:xs) = f x : map f xs |
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 GeneralizedNewtypeDeriving #-} | |
module Main where | |
import Data.Functor | |
import Control.Monad | |
import Control.Monad.State | |
import Control.Monad.Writer | |
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 where | |
import Data.Aeson hiding (Result) | |
import Data.Aeson.Encode.Pretty (encodePretty) | |
import Data.Attoparsec.ByteString | |
import Data.ByteString (ByteString) | |
import qualified Data.ByteString.Char8 as BS | |
import Data.ByteString.Lazy (toStrict) | |
import System.Console.ANSI |
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 OverloadedStrings #-} | |
module Main where | |
import Control.Concurrent (forkIO, ThreadId) | |
import Data.ByteString.Lazy (ByteString) | |
import Data.Text.Lazy (pack) | |
import Data.Text.Lazy.Encoding (encodeUtf8) | |
import Network.HTTP.Types (status200) | |
import Network.HTTP.Types.Header (hContentType) |
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
#!/usr/bin/env sh | |
browser=chromium-browser | |
package=${1-base} | |
ghc-pkg describe $package | \ | |
grep haddock-html | \ | |
awk '{ print $2 "/index.html" }' | \ | |
xargs $browser &> /dev/null |
OlderNewer