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
type AuthLookup = JWTClaimsSet -> Bool | |
data AuthProtected | |
protected :: AuthLookup -> server -> (AuthLookup, server) | |
protected look server = (look, server) | |
--instance (Enter typ arg ret) => Enter (AuthLookup, rest) where | |
--enter (al, rest) = enter rest |
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 #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module Serials.Route.Test where | |
import Control.Monad.Trans (lift) | |
import Control.Monad.Trans.Either |
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
server/Serials/Route/Test.hs:43:15: | |
Couldn't match type ‘IO’ with ‘EitherT ServantErr IO’ | |
Expected type: ServerT TestAPI (ReaderT Int IO) | |
Actual type: ReaderT Int (EitherT ServantErr IO) String | |
:<|> ReaderT Int (EitherT ServantErr IO) String | |
In the expression: test :<|> test | |
In an equation for ‘testServerT’: | |
testServerT | |
= test :<|> test | |
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
type AuthToken = Cookie "token" Text | |
type AuthAPI = "auth" :> AuthToken :> Get SecureUser | |
authServer :: Pool RethinkDBHandle -> Server AuthAPI | |
authServer h = current | |
where current mt = liftE $ checkAuth h mt | |
-- Auth code ------------------------------------------ | |
-- some stuff is hidden, do you need more context? |
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 #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Serials.Admin where | |
import Data.Text (Text) | |
import Control.Monad.Trans.Either | |
import Data.Aeson | |
import Data.Proxy |
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
chunks :: ([a] -> ([a], [a])) -> [a] -> [[a]] | |
chunks f [] = [] | |
chunks f xs = case c of | |
[] -> cs | |
ys -> ys : cs | |
where | |
(c, rest) = f xs | |
cs = chunks f rest |
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
findIncrementing :: URL -> IO [Link] | |
findIncrementing base = do | |
find <- newChan | |
done <- newChan | |
forkIO $ worker find done | |
let next links n = do | |
ml <- readChan done | |
case ml of |
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
<html> | |
<body> | |
<h1>Hello</h1> | |
<p>This is some text</p> | |
<p>This is <b>some</b> text</p> | |
<img style="width: 200px" src="http://deniseleeyohn.com/wp-content/uploads/2013/07/jeff-kelley.jpg" /> | |
<p>Click <a href="http://google.com">here</a> to go to google</p> | |
<p><input type="text" id="message"> Message</p> | |
<p><button onclick="printMessage()">click me</button></p> | |
<p id="lastMessage">EMPTY</p> |
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
type Searchy = { | |
index: string; | |
// type?: string; | |
} | |
type ServerSearch = { | |
type: string; | |
search: Searchy; | |
} |
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
interface CourseCursor extends Cursor<Course> { | |
rules: RulesCursor; | |
} | |
interface RulesCursor extends Cursor<Rules> { | |
... | |
} |