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
src/Control/Proxy/Trans/Parse.hs:138:30: | |
Could not deduce (e ~ ReadParserError) | |
from the context (Read b) | |
bound by the instance declaration | |
at src/Control/Proxy/Trans/Parse.hs:132:10-41 | |
`e' is a rigid type variable bound by | |
the type signature for parse :: ReadParser b -> a -> Result e a b1 | |
at src/Control/Proxy/Trans/Parse.hs:137:3 | |
In the second argument of `Fail', namely `e' | |
In the expression: Fail a' e |
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 GeneralizedNewtypeDeriving #-} | |
module Control.Proxy.Trans.Parse ( | |
-- * ParseP | |
ParseP(..), | |
runParseP, | |
runParseK | |
) where | |
import Control.Applicative (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
{ # LANGUAGE OverloadedStrings #-} | |
module Main where | |
import qualified RFC2616 | |
import Control.Applicative | |
import Control.Monad | |
import Control.Proxy ((>->), request, respond, lift) | |
import qualified Control.Proxy as P | |
import qualified Control.Proxy.Attoparsec as PA |
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 NoMonomorphismRestriction #-} | |
module Main where | |
import Control.Applicative | |
import Control.Proxy | |
import qualified Data.ByteString.Internal as BS | |
import qualified Data.ByteString.Lazy as BL | |
import qualified Data.ByteString.Lazy as BLI | |
import qualified Control.Proxy.Attoparsec as PA |
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.Monad.Instances | |
import Control.Monad.Reader | |
data Env = Env Int Int | |
foo :: Int -> Env -> Int | |
foo a (Env x _) = a + x |
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
- switch (state) { | |
+ switch (state) { /** Finit tillståndsmaskinen från helvete **/ |
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
typedef struct { | |
int a; | |
const int b; | |
} thing_t; | |
int main(int argc, char *argv[]) | |
{ | |
thing_t t1 = { .a = 1, .b = 2 }; | |
t1.a = 90; | |
// t1.b = 90; // NO! |
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 Tony20 ( | |
Fluffy, | |
furry, | |
EitherLeft(..), | |
EitherRight(..), | |
Misty, | |
banana, | |
unicorn, | |
jellybean, | |
apple |
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
ghci> "Hello World" =~ "W.rld" :: Bool | |
True | |
ghci> "Hello World" =~ "W.rld" :: Int | |
1 | |
ghci> "Hello World" =~ "W.rld" :: String | |
"World" | |
ghci> "Hello World" =~ "W.rld" :: (Int, Int) | |
(6,5) |
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
-- My (untested) implementation of Data.List.groupBy | |
groupBy' :: (a -> a -> Bool) -> [a] -> [[a]] | |
groupBy' f xs = foldr step [] xs | |
where step x acc@(yy@(y:ys):yys) | |
| f x y = (x:yy):yys | |
| otherwise = [x]:acc | |
step x [] = [[x]] |