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 #-} | |
import Control.Applicative | |
import Data.Binary.Get | |
import qualified Data.ByteString as BS | |
import Data.Conduit | |
import Data.Conduit.Serialization.Binary | |
import Data.Word | |
query :: BS.ByteString |
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 #-} | |
import Data.Conduit | |
import qualified Data.Conduit.Binary as CB | |
import qualified Data.Conduit.List as CL | |
takeWhile' :: Monad m => (a -> Bool) -> Conduit a m a | |
takeWhile' f = do | |
mx <- await | |
case mx of | |
Nothing -> return () |
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.Either | |
import Control.Monad | |
failable :: Int -> Maybe Int | |
failable x = do | |
guard $ x /= 0 | |
guard $ x /= 10 | |
return $ x + 10 | |
doFailable :: Int -> IO () |
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
cancel e -> | |
e.preventDefault?() | |
e.returnValue ?= false |
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, TemplateHaskell, | |
OverloadedStrings, GADTs, FlexibleContexts #-} | |
import Data.Conduit (runResourceT) | |
import Database.Persist | |
import Database.Persist.Sqlite | |
import Database.Persist.TH | |
import Control.Monad.IO.Class (liftIO) | |
import Control.Monad.Logger (runStderrLoggingT) | |
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 QuasiQuotes, TypeFamilies, GeneralizedNewtypeDeriving, TemplateHaskell, | |
OverloadedStrings, GADTs, FlexibleContexts #-} | |
import Data.Conduit (runResourceT) | |
import Database.Persist | |
import Database.Persist.Sqlite | |
import Database.Persist.TH | |
import Control.Monad.Logger (runStderrLoggingT) | |
import Data.Time | |
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistUpperCase| |
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, TemplateHaskell, TypeFamilies, OverloadedStrings #-} | |
{-# LANGUAGE GADTs, FlexibleContexts #-} | |
import Data.Conduit (runResourceT) | |
import Database.Persist | |
import Database.Persist.Sqlite | |
import Database.Persist.TH | |
import Control.Monad.Logger (runStderrLoggingT) | |
import Control.Monad.IO.Class (liftIO) | |
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase| |
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, TypeFamilies, TemplateHaskell, | |
QuasiQuotes, MultiParamTypeClasses #-} | |
import Yesod | |
data UltDest = UltDest | |
mkYesod "UltDest" [parseRoutes| | |
/ RootR GET | |
/setname SetNameR GET POST | |
/sayhello SayHelloR GET |
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, TypeFamilies, TemplateHaskell, | |
QuasiQuotes, MultiParamTypeClasses #-} | |
import Yesod | |
data Messages = Messages | |
mkYesod "Messages" [parseRoutes| | |
/ RootR GET |
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, MultiParamTypeClasses, OverloadedStrings #-} | |
import Yesod | |
import Control.Applicative ((<$>), (<*>)) | |
import qualified Web.ClientSession as CS | |
data SessionExample = SessionExample | |
mkYesod "SessionExample" [parseRoutes| | |
/ Root GET POST | |
|] |