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
module Main where | |
import Data.Monoid | |
import Control.Monad | |
import Criterion.Main | |
import Data.IORef | |
import Control.Concurrent.Async | |
import Control.Concurrent.STM | |
import Control.Concurrent.MVar |
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
data FormUrlEncoded deriving Typeable | |
class ToFormUrlEncoded a where | |
toFormUrlEncoded :: a -> [(ByteString, ByteString)] | |
class FromFormUrlEncoded a where | |
fromFormUrlEncoded :: [(ByteString, ByteString)] -> Either String a | |
instance ToFormUrlEncoded [(ByteString, ByteString)] where | |
toFormUrlEncoded = id |
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
-- | Request must contain a valid token including at least the specified scope. | |
data TokenScope (scope :: Symbol) | |
-- | All we can do for now is say that AUTHORIZATION is looked at. | |
-- | |
-- TODO: Add Note to API sum type so tha we can add documentation notes for | |
-- this kind of thing. | |
instance (KnownSymbol scope, HasDocs sublayout) | |
=> HasDocs (TokenScope scope :> sublayout) where | |
docsFor Proxy (endpoint, action) = | |
docsFor sub (endpoint, action & headers %~ (|> "AUTHORIZATION")) |
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
checkCredentials | |
:: Text -- ^ UserName | |
-> Text -- ^ Password | |
-> m (Either String ()) | |
lookupUser :: Text -> m (Either String [Text]) |
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
-- | Request (via POST method) "Access Token" using Resource Owner Password Credentials Grant. | |
-- | |
-- | |
fetchAccessTokenPass :: Manager -- ^ HTTP connection manager | |
-> OAuth2 -- ^ OAuth Data | |
-> BS.ByteString -- ^ username | |
-> BS.ByteString -- ^ password | |
-> IO (OAuth2Result AccessToken) -- ^ Access Token | |
fetchAccessTokenPass manager oa username password = doJSONPostRequest manager oa uri body | |
where (uri, body) = accessTokenUrlPass oa username password |
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 DeriveGeneric #-} | |
{-# LANGUAGE DeriveDataTypeable #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE RankNTypes #-} | |
module Main 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
set 10: 4.98707s | |
delete 10: 4.750214s | |
delete 10: 5.021166s | |
set 10: 5.073635s | |
delete 10: 5.090525s | |
delete 10: 5.106929s | |
set 10: 5.145212s | |
set 10: 5.283383s | |
set 10: 5.077518s | |
delete 10: 5.175202s |
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
set 100: 0.893666s | |
children: 14551 | |
set 100: 0.894641s | |
children: 14451 | |
set 100: 0.897937s | |
children: 14351 | |
set 100: 0.903344s | |
children: 14251 | |
delete 100: 0.903555s | |
delete 100: 0.903288s |
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
; ModuleID = 'dotp.c' | |
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" | |
target triple = "x86_64-unknown-linux-gnu" | |
; Function Attrs: nounwind readonly uwtable | |
define float @dotp(float* nocapture %a, float* nocapture %b, i32 %count) #0 { | |
%1 = icmp sgt i32 %count, 0 | |
br i1 %1, label %.lr.ph, label %._crit_edge | |
.lr.ph: ; preds = %0, %.lr.ph |