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, QuasiQuotes #-} | |
{-# LANGUAGE TypeFamilies, GADTs, MultiParamTypeClasses #-} | |
{-# LANGUAGE OverloadedStrings, FlexibleContexts #-} | |
{-# LANGUAGE EmptyDataDecls #-} | |
import Database.Persist | |
import Database.Persist.TH | |
import Database.Persist.Sqlite | |
import Data.Text | |
import Control.Monad.IO.Class |
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 TypeFamilies, QuasiQuotes, TemplateHaskell #-} | |
{-# LANGUAGE MultiParamTypeClasses, OverloadedStrings #-} | |
{-# LANGUAGE GADTs, FlexibleContexts #-} | |
import Yesod | |
import Database.Persist | |
import Database.Persist.TH | |
import Database.Persist.Sqlite | |
import Control.Monad.IO.Class (liftIO) | |
import Control.Applicative ((<$>), (<*>)) |
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 TypeFamilies, QuasiQuotes, TemplateHaskell #-} | |
{-# LANGUAGE MultiParamTypeClasses, OverloadedStrings #-} | |
{-# LANGUAGE GADTs, FlexibleContexts #-} | |
import Yesod | |
import Database.Persist | |
import Database.Persist.Sqlite | |
import Database.Persist.TH | |
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 TypeFamilies, QuasiQuotes, TemplateHaskell #-} | |
{-# LANGUAGE MultiParamTypeClasses, OverloadedStrings #-} | |
import Yesod | |
import Control.Applicative ((<$>), (<*>)) | |
data SessionExample = SessionExample | |
mkYesod "SessionExample" [parseRoutes| | |
/ Root GET POST |
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 QuasiQuotes, TypeFamilies, GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE TemplateHaskell, OverloadedStrings, GADTs #-} | |
{-# LANGUAGE EmptyDataDecls #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE TypeSynonymInstances #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
import Database.Persist | |
import Database.Persist.TH | |
import Database.Persist.Sqlite |
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 DJBX33A where | |
import Data.Char (ord) | |
djbx33a :: String -> Int | |
djbx33a str = foldl (\a c -> a * 33 + ord c) 5381 str | |
djbx :: Int -> Int -> String -> Int | |
djbx times init str = foldl (\a c -> a * times + ord c) init str |
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 Numeric.Bisection where | |
bisection f a b eps | |
| abs (a - b) < eps = mid | |
| f mid == 0 = mid | |
| f a * f mid < 0 = bisection f a mid eps | |
| otherwise = bisection f mid b eps | |
where mid = (a + b) / 2 |
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 Recursive where | |
g :: Int -> Int -> Int | |
g 0 _ = 0 | |
g m n = g (m - 1) (2 * n) + n | |
f :: Int -> Int | |
f 0 = 1 | |
f n = n * f (div n 2) |
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 Arith where | |
import Prelude hiding (True, False) | |
data Arith = Zero | |
| True | |
| False | |
| If Arith Arith Arith | |
| Succ Arith | |
| Pred Arith |
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 Regex where | |
import GHC.Exts(IsString(..)) | |
data Regex | |
= Empty | |
| Concatention Regex Regex | |
| Alternation Regex Regex | |
| KleeneStar Regex |
NewerOlder