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 ApplicativeDo #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
------------------------------------------------------------------------------- | |
import Control.Monad | |
import Data.ByteString (ByteString) | |
import Data.List.NonEmpty | |
import Data.Semigroup |
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
{-# OPTIONS_GHC -Wall -Werror #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
module Main | |
( main | |
) where | |
------------------------------------------------------------------------------- | |
import Control.Monad (void) |
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
import Control.Lens | |
-- from Control.Error | |
hush :: Either e a -> Maybe a | |
hush (Left _) = Nothing | |
hush (Right a) = Just a | |
------------------------------------------------------------------------------- | |
data Lossy e a b = Lossy { |
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 PerPage | |
( PerPage -- don't export the constructor, only constructable via smart constructor prism | |
, perPage | |
) where | |
import qualified Control.Lens as L | |
import qualified GHC.TypeLits as TL | |
import Data.Proxy (Proxy(..)) | |
-- Represents a per page parameter you may accept on a web server, API, etc for pagination. |
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
#!/bin/bash | |
# alias stack='~/stack.sh' | |
SUCCESS=${SUCCESS:=~/Dropbox/Music/YUH.wav} | |
FAILURE=${FAILURE:=~/Dropbox/Music/AUGH.wav} | |
stack "$@" | |
status=$? | |
if [[ $status -eq 0 ]] |
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
function OOPShim() { | |
} | |
function proxyMethods(names) { | |
for (var i = 0; i < names.length; i++) { | |
var name = names[i]; | |
OOPShim.prototype[name] = function(a) { | |
var args = Array.prototype.slice.call(arguments, 0); | |
args.unshift(this.state); | |
return FunctionalAPI[name].apply(this, args)(); |
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 FlexibleInstances #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
import Control.Applicative | |
import Data.Monoid | |
import Test.QuickCheck | |
data JoinList m a = Empty | |
| Single m a | |
| Append m (JoinList m a) (JoinList m a) |
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 OverloadedStrings #-} | |
data GUIEvent = KeyDownEvent { key_down__ctrl :: !Bool | |
, key_down__shift :: !Bool | |
, key_down__code :: !Int } | |
| MouseEvent { mouse__x :: !Int | |
, mouse__y ::!Int } | |
deriving (Show) | |
instance FromJSON GUIEvent where | |
parseJSON = withObject "GUIObject" parseGUIEvent |
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 FlexibleContexts #-} | |
module Main (main) where | |
import Control.Monad.Reader | |
type Year = Int | |
-- a person record has a birth year | |
data Person = Person { birthYear :: Year } |
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
compiling callback-2.c | |
make[2]: Leaving directory '/home/michael/.rvm/src/ruby-2.1.1/ext/date' | |
make[2]: Entering directory '/home/michael/.rvm/src/ruby-2.1.1/ext/mathn/complex' | |
compiling complex.c | |
installing default complex libraries | |
linking shared-object mathn/complex.so | |
make[2]: Leaving directory '/home/michael/.rvm/src/ruby-2.1.1/ext/mathn/complex' | |
compiling callback-3.c | |
installing default parser libraries | |
linking shared-object json/ext/parser.so |
NewerOlder