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
| import Control.Applicative | |
| import Control.Monad | |
| import Data.Monoid | |
| import Control.Monad.Trans.Except | |
| data Exception | |
| = IOException String | |
| | NoSuchElementException | |
| deriving Show |
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
| import Prelude hiding (sum) | |
| data L1 | |
| = F { ($$) :: L1 -> L1 } | |
| | V { unV :: Int } | |
| infixl 1 $$ | |
| instance Show L1 where |
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 TemplateHaskell #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| module Model where | |
| import Data.Int (Int32) | |
| import Data.Time |
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 FlexibleContexts #-} | |
| module FirstClassWhere where | |
| import Control.Applicative ((<$>)) | |
| import Database.Relational.Query | |
| import Data.Int | |
| import Data.Time |
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 TemplateHaskell, MultiParamTypeClasses, FlexibleInstances #-} | |
| > | |
| > import Data.Int | |
| > | |
| > import Database.Relational.Query | |
| > import Database.Relational.Query.TH | |
| > | |
| > | |
| > $(defineTableDefault defaultConfig | |
| > "PUBLIC" "my_table" |
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 FlexibleContexts #-} | |
| module ArrowQuery ( | |
| module Database.Relational.Query, | |
| query, queryMaybe, query', queryMaybe', wheres, having, groupBy, placeholder, | |
| relation, relation', aggregateRelation, aggregateRelation', | |
| QuerySimple, QueryAggregate, |
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
| foo :: Kleisli QuerySimple () (Projection Flat (Ex1, Maybe Ex1)) | |
| foo = proc () -> do | |
| x <- query -< ex1 | |
| y <- queryMaybe -< ex1 | |
| wheres -< just (x ! eid') .=. y ?! eid' | |
| returnA -< x >< y |
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
| import Data.Int (Int32) | |
| import Database.Record.Instances () | |
| import Database.Relational.Query | |
| hello :: Relation () (Int32, String) | |
| hello = relation $ return (value 0 >< value "Hello") | |
| world :: Relation () (Int32, String) | |
| world = relation $ return (value 0 >< value "World!") |
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
| Inductive Mod3' : nat -> Prop := | |
| | zero' : forall n k, n = 3 * k -> Mod3' n | |
| | one' : forall n k, n = 3 * k + 1 -> Mod3' n | |
| | two' : forall n k, n = 3 * k + 2 -> Mod3' n | |
| . | |
| Lemma nat_mod3' : forall n, Mod3' n. | |
| Proof. | |
| induction n as [| n1 IHn ]. |
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 (:|:) f g a = L (f a) | |
| | R (g a) | |
| instance (Functor f, Functor g) => Functor (f :|: g) where | |
| fmap = undefined | |
| instance (Monad f, Monad g) => Monad (f :|: g) where | |
| return = undefined | |
| (>>=) = undefined |