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 #-} | |
import Prelude hiding (id, (.)) | |
import Control.Category (Category(..)) | |
import Data.Monoid (Monoid(..)) | |
newtype F a b = F (a -> b) deriving Category | |
instance Monoid (F a a) where |
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 #-} | |
import Prelude hiding (id, (.)) | |
import qualified Prelude | |
import Control.Category (Category(..)) | |
import Data.Monoid (Monoid(..)) | |
newtype F a b = F (a -> b) | |
instance Category F where |
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 #-} | |
import Prelude hiding (id, (.)) | |
import Control.Category (Category(..)) | |
import Data.Monoid (Monoid(..)) | |
instance Category cat => Monoid (cat a a) where | |
mempty = id | |
mappend = (.) |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/mman.h> | |
int | |
main (int argc, char *argv[]) { | |
char buf[1048576]; | |
char obuf[1048576]; | |
int i; |
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 Data.List (isPrefixOf) | |
import Data.Set (Set) | |
import qualified Data.Set as Set | |
data K' = K0 | K1 | |
deriving (Show, Eq, Ord) | |
data K = Unit K' | |
| Str !String | |
deriving Show |
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 MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE IncoherentInstances #-} | |
module X where | |
data P a = P | |
flattenMaybe :: P (Maybe (Maybe a)) -> P (Maybe 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 FlexibleInstances, MultiParamTypeClasses, TypeOperators #-} | |
module Monoid where | |
import Data.Monoid (Monoid, Sum, Product) | |
import qualified Data.Monoid as M | |
import Control.Category | |
class Category (-->) => CategoricalMonoid (-->) m where | |
mempty :: m |
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 GADTs #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
data WithZero | |
data WithoutZero | |
data Exp a where | |
ExpZero :: Exp WithZero | |
ExpOne :: Exp WithoutZero |
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 TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, OverloadedStrings #-} | |
import Data.Int (Int64) | |
import Database.HDBC.PostgreSQL (connectPostgreSQL) | |
import Database.HDBC.Schema.PostgreSQL (driverPostgreSQL) | |
import Database.HDBC.Query.TH (defineTableFromDB) | |
import Database.Relational.Query | |
$(defineTableFromDB | |
(connectPostgreSQL "dbname=testdb") |
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 MyTuple | |
import Control.Applicative | |
import Database.Record | |
import Database.Record.ToSql | |
import Database.Relational.Query | |
import Database.HDBC (SqlValue) | |
import Database.HDBC.Query.TH | |
instance ProductConstructor (a -> b -> c -> MyTuple a b c) where |
OlderNewer