Search is not available for this dataset
repo_name string | path string | license string | full_code string | full_size int64 | uncommented_code string | uncommented_size int64 | function_only_code string | function_only_size int64 | is_commented bool | is_signatured bool | n_ast_errors int64 | ast_max_depth int64 | n_whitespaces int64 | n_ast_nodes int64 | n_ast_terminals int64 | n_ast_nonterminals int64 | loc int64 | cycloplexity int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sdiehl/ghc | compiler/deSugar/ExtractDocs.hs | bsd-3-clause | mkMaps :: [Name]
-> [(LHsDecl GhcRn, [HsDocString])]
-> (Map Name (HsDocString), Map Name (Map Int (HsDocString)))
mkMaps instances decls =
( f' (map (nubByName fst) decls')
, f (filterMapping (not . M.null) args)
)
where
(decls', args) = unzip (map mappings decls)
f :: (Ord a, Semigroup b) => [[(a, b)]] -> Map a b
f = M.fromListWith (<>) . concat
f' :: Ord a => [[(a, HsDocString)]] -> Map a HsDocString
f' = M.fromListWith appendDocs . concat
filterMapping :: (b -> Bool) -> [[(a, b)]] -> [[(a, b)]]
filterMapping p = map (filter (p . snd))
mappings :: (LHsDecl GhcRn, [HsDocString])
-> ( [(Name, HsDocString)]
, [(Name, Map Int (HsDocString))]
)
mappings (L l decl, docStrs) =
(dm, am)
where
doc = concatDocs docStrs
args = declTypeDocs decl
subs :: [(Name, [(HsDocString)], Map Int (HsDocString))]
subs = subordinates instanceMap decl
(subDocs, subArgs) =
unzip (map (\(_, strs, m) -> (concatDocs strs, m)) subs)
ns = names l decl
subNs = [ n | (n, _, _) <- subs ]
dm = [(n, d) | (n, Just d) <- zip ns (repeat doc) ++ zip subNs subDocs]
am = [(n, args) | n <- ns] ++ zip subNs subArgs
instanceMap :: Map SrcSpan Name
instanceMap = M.fromList [(getSrcSpan n, n) | n <- instances]
names :: SrcSpan -> HsDecl GhcRn -> [Name]
names l (InstD _ d) = maybeToList (M.lookup loc instanceMap) -- See
-- Note [1].
where loc = case d of
TyFamInstD _ _ -> l -- The CoAx's loc is the whole line, but only
-- for TFs
_ -> getInstLoc d
names l (DerivD {}) = maybeToList (M.lookup l instanceMap) -- See Note [1].
names _ decl = getMainDeclBinder decl
{-
Note [1]:
---------
We relate ClsInsts to InstDecls and DerivDecls using the SrcSpans buried
inside them. That should work for normal user-written instances (from
looking at GHC sources). We can assume that commented instances are
user-written. This lets us relate Names (from ClsInsts) to comments
(associated with InstDecls and DerivDecls).
-} | 2,265 | mkMaps :: [Name]
-> [(LHsDecl GhcRn, [HsDocString])]
-> (Map Name (HsDocString), Map Name (Map Int (HsDocString)))
mkMaps instances decls =
( f' (map (nubByName fst) decls')
, f (filterMapping (not . M.null) args)
)
where
(decls', args) = unzip (map mappings decls)
f :: (Ord a, Semigroup b) => [[(a, b)]] -> Map a b
f = M.fromListWith (<>) . concat
f' :: Ord a => [[(a, HsDocString)]] -> Map a HsDocString
f' = M.fromListWith appendDocs . concat
filterMapping :: (b -> Bool) -> [[(a, b)]] -> [[(a, b)]]
filterMapping p = map (filter (p . snd))
mappings :: (LHsDecl GhcRn, [HsDocString])
-> ( [(Name, HsDocString)]
, [(Name, Map Int (HsDocString))]
)
mappings (L l decl, docStrs) =
(dm, am)
where
doc = concatDocs docStrs
args = declTypeDocs decl
subs :: [(Name, [(HsDocString)], Map Int (HsDocString))]
subs = subordinates instanceMap decl
(subDocs, subArgs) =
unzip (map (\(_, strs, m) -> (concatDocs strs, m)) subs)
ns = names l decl
subNs = [ n | (n, _, _) <- subs ]
dm = [(n, d) | (n, Just d) <- zip ns (repeat doc) ++ zip subNs subDocs]
am = [(n, args) | n <- ns] ++ zip subNs subArgs
instanceMap :: Map SrcSpan Name
instanceMap = M.fromList [(getSrcSpan n, n) | n <- instances]
names :: SrcSpan -> HsDecl GhcRn -> [Name]
names l (InstD _ d) = maybeToList (M.lookup loc instanceMap) -- See
-- Note [1].
where loc = case d of
TyFamInstD _ _ -> l -- The CoAx's loc is the whole line, but only
-- for TFs
_ -> getInstLoc d
names l (DerivD {}) = maybeToList (M.lookup l instanceMap) -- See Note [1].
names _ decl = getMainDeclBinder decl
{-
Note [1]:
---------
We relate ClsInsts to InstDecls and DerivDecls using the SrcSpans buried
inside them. That should work for normal user-written instances (from
looking at GHC sources). We can assume that commented instances are
user-written. This lets us relate Names (from ClsInsts) to comments
(associated with InstDecls and DerivDecls).
-} | 2,265 | mkMaps instances decls =
( f' (map (nubByName fst) decls')
, f (filterMapping (not . M.null) args)
)
where
(decls', args) = unzip (map mappings decls)
f :: (Ord a, Semigroup b) => [[(a, b)]] -> Map a b
f = M.fromListWith (<>) . concat
f' :: Ord a => [[(a, HsDocString)]] -> Map a HsDocString
f' = M.fromListWith appendDocs . concat
filterMapping :: (b -> Bool) -> [[(a, b)]] -> [[(a, b)]]
filterMapping p = map (filter (p . snd))
mappings :: (LHsDecl GhcRn, [HsDocString])
-> ( [(Name, HsDocString)]
, [(Name, Map Int (HsDocString))]
)
mappings (L l decl, docStrs) =
(dm, am)
where
doc = concatDocs docStrs
args = declTypeDocs decl
subs :: [(Name, [(HsDocString)], Map Int (HsDocString))]
subs = subordinates instanceMap decl
(subDocs, subArgs) =
unzip (map (\(_, strs, m) -> (concatDocs strs, m)) subs)
ns = names l decl
subNs = [ n | (n, _, _) <- subs ]
dm = [(n, d) | (n, Just d) <- zip ns (repeat doc) ++ zip subNs subDocs]
am = [(n, args) | n <- ns] ++ zip subNs subArgs
instanceMap :: Map SrcSpan Name
instanceMap = M.fromList [(getSrcSpan n, n) | n <- instances]
names :: SrcSpan -> HsDecl GhcRn -> [Name]
names l (InstD _ d) = maybeToList (M.lookup loc instanceMap) -- See
-- Note [1].
where loc = case d of
TyFamInstD _ _ -> l -- The CoAx's loc is the whole line, but only
-- for TFs
_ -> getInstLoc d
names l (DerivD {}) = maybeToList (M.lookup l instanceMap) -- See Note [1].
names _ decl = getMainDeclBinder decl
{-
Note [1]:
---------
We relate ClsInsts to InstDecls and DerivDecls using the SrcSpans buried
inside them. That should work for normal user-written instances (from
looking at GHC sources). We can assume that commented instances are
user-written. This lets us relate Names (from ClsInsts) to comments
(associated with InstDecls and DerivDecls).
-} | 2,136 | false | true | 32 | 14 | 712 | 771 | 421 | 350 | null | null |
mrshannon/trees | src/Logic/Controls/Move.hs | gpl-2.0 | -- Handle w and s keys.
handleForwardBackward :: A.App -> A.App
handleForwardBackward app@(A.App { A.keyboard = (K.Keyboard { K.keys = k }) })
| K.wKey k <= K.KeyDown = move (delta app) 0.0 0.0 app
| K.sKey k <= K.KeyDown = move (negate . delta $ app) 0.0 0.0 app
| otherwise = app | 319 | handleForwardBackward :: A.App -> A.App
handleForwardBackward app@(A.App { A.keyboard = (K.Keyboard { K.keys = k }) })
| K.wKey k <= K.KeyDown = move (delta app) 0.0 0.0 app
| K.sKey k <= K.KeyDown = move (negate . delta $ app) 0.0 0.0 app
| otherwise = app | 295 | handleForwardBackward app@(A.App { A.keyboard = (K.Keyboard { K.keys = k }) })
| K.wKey k <= K.KeyDown = move (delta app) 0.0 0.0 app
| K.sKey k <= K.KeyDown = move (negate . delta $ app) 0.0 0.0 app
| otherwise = app | 255 | true | true | 3 | 10 | 91 | 140 | 70 | 70 | null | null |
paradoja/scheme.hs | scheme.hs | gpl-3.0 | digitsFor :: Integer -> String
digitsFor 2 = "01" | 50 | digitsFor :: Integer -> String
digitsFor 2 = "01" | 50 | digitsFor 2 = "01" | 19 | false | true | 0 | 5 | 9 | 18 | 9 | 9 | null | null |
kawamuray/ganeti | src/Ganeti/Locking/Locks.hs | gpl-2.0 | lockLevelName LevelInstance = "instance" | 40 | lockLevelName LevelInstance = "instance" | 40 | lockLevelName LevelInstance = "instance" | 40 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
gibiansky/jupyter-haskell | examples/calculator/Main.hs | mit | runInstall :: IO ()
runInstall =
installKernel InstallLocal calculatorKernelspec >>= handleInstallResult
where
-- A basic kernelspec with limited info.
calculatorKernelspec :: Kernelspec
calculatorKernelspec =
simpleKernelspec "Calculator" "calculator" $ \exe connect -> [exe, "kernel", connect]
-- Print an error message and exit with non-zero exit code if the install failed.
handleInstallResult :: InstallResult -> IO ()
handleInstallResult installResult =
case installResult of
InstallSuccessful -> return ()
InstallFailed reason -> do
T.hPutStrLn stderr reason
exitFailure
-- | Run the kernel on ports determined by parsing the connection file provided. | 738 | runInstall :: IO ()
runInstall =
installKernel InstallLocal calculatorKernelspec >>= handleInstallResult
where
-- A basic kernelspec with limited info.
calculatorKernelspec :: Kernelspec
calculatorKernelspec =
simpleKernelspec "Calculator" "calculator" $ \exe connect -> [exe, "kernel", connect]
-- Print an error message and exit with non-zero exit code if the install failed.
handleInstallResult :: InstallResult -> IO ()
handleInstallResult installResult =
case installResult of
InstallSuccessful -> return ()
InstallFailed reason -> do
T.hPutStrLn stderr reason
exitFailure
-- | Run the kernel on ports determined by parsing the connection file provided. | 738 | runInstall =
installKernel InstallLocal calculatorKernelspec >>= handleInstallResult
where
-- A basic kernelspec with limited info.
calculatorKernelspec :: Kernelspec
calculatorKernelspec =
simpleKernelspec "Calculator" "calculator" $ \exe connect -> [exe, "kernel", connect]
-- Print an error message and exit with non-zero exit code if the install failed.
handleInstallResult :: InstallResult -> IO ()
handleInstallResult installResult =
case installResult of
InstallSuccessful -> return ()
InstallFailed reason -> do
T.hPutStrLn stderr reason
exitFailure
-- | Run the kernel on ports determined by parsing the connection file provided. | 718 | false | true | 0 | 11 | 166 | 125 | 63 | 62 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F32.hs | bsd-3-clause | -- glVertexAttribs2hvNV --------------------------------------------------------
glVertexAttribs2hvNV
:: MonadIO m
=> GLuint -- ^ @index@.
-> GLsizei -- ^ @n@.
-> Ptr GLhalfNV -- ^ @v@ pointing to @n@ elements of type @Half16NV@.
-> m ()
glVertexAttribs2hvNV v1 v2 v3 = liftIO $ dyn930 ptr_glVertexAttribs2hvNV v1 v2 v3 | 330 | glVertexAttribs2hvNV
:: MonadIO m
=> GLuint -- ^ @index@.
-> GLsizei -- ^ @n@.
-> Ptr GLhalfNV -- ^ @v@ pointing to @n@ elements of type @Half16NV@.
-> m ()
glVertexAttribs2hvNV v1 v2 v3 = liftIO $ dyn930 ptr_glVertexAttribs2hvNV v1 v2 v3 | 248 | glVertexAttribs2hvNV v1 v2 v3 = liftIO $ dyn930 ptr_glVertexAttribs2hvNV v1 v2 v3 | 81 | true | true | 0 | 11 | 55 | 66 | 32 | 34 | null | null |
he9lin/Pong-hs | Main.hs | mit | handleKeys :: Event -> PongGame -> PongGame
-- For an 's' keypress, reset the ball to the center.
handleKeys (EventKey (Char 's') _ _ _) game =
game { ballloc = (0, 0) } | 172 | handleKeys :: Event -> PongGame -> PongGame
handleKeys (EventKey (Char 's') _ _ _) game =
game { ballloc = (0, 0) } | 117 | handleKeys (EventKey (Char 's') _ _ _) game =
game { ballloc = (0, 0) } | 73 | true | true | 0 | 9 | 36 | 57 | 31 | 26 | null | null |
spechub/Hets | LF/Sign.hs | gpl-2.0 | eqExp (Var x1) (Var x2) = x1 == x2 | 34 | eqExp (Var x1) (Var x2) = x1 == x2 | 34 | eqExp (Var x1) (Var x2) = x1 == x2 | 34 | false | false | 1 | 8 | 8 | 31 | 13 | 18 | null | null |
isomorphism/csound-expression | src/Csound/Air/Wav.hs | bsd-3-clause | - | Reads the wav file with the given speed (if speed is 1 it's a norma playback).
-- We can use negative speed to read file in reverse. Scales the tempo with first argument.
tempoReadWav :: Sig -> String -> (Sig, Sig)
tempoReadWav speed fileName = mapSig (scaleSpec (1 / abs speed)) $ diskin2 (text fileName) speed
| 316 | tempoReadWav :: Sig -> String -> (Sig, Sig)
tempoReadWav speed fileName = mapSig (scaleSpec (1 / abs speed)) $ diskin2 (text fileName) speed | 140 | tempoReadWav speed fileName = mapSig (scaleSpec (1 / abs speed)) $ diskin2 (text fileName) speed | 96 | true | true | 4 | 11 | 58 | 107 | 53 | 54 | null | null |
bgold-cosmos/Tidal | src/Sound/Tidal/Safe/Boot.hs | gpl-3.0 | unmute = streamUnmute | 21 | unmute = streamUnmute | 21 | unmute = streamUnmute | 21 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
Psirus/euler | src/euler021.hs | bsd-3-clause | result = sum $ amicable | 23 | result = sum $ amicable | 23 | result = sum $ amicable | 23 | false | false | 0 | 5 | 4 | 10 | 5 | 5 | null | null |
TravisWhitaker/BroScore-backend | BroScore/WebHandlers.hs | mit | authAction :: BroState -> BroAction -> ActionM ()
authAction bs ba = do
un <- param "username"
pw <- param "passowrd"
liftIO (checkAuth bs un pw) >>= \case Just s -> status s
Nothing -> ba bs | 245 | authAction :: BroState -> BroAction -> ActionM ()
authAction bs ba = do
un <- param "username"
pw <- param "passowrd"
liftIO (checkAuth bs un pw) >>= \case Just s -> status s
Nothing -> ba bs | 245 | authAction bs ba = do
un <- param "username"
pw <- param "passowrd"
liftIO (checkAuth bs un pw) >>= \case Just s -> status s
Nothing -> ba bs | 195 | false | true | 0 | 12 | 90 | 97 | 42 | 55 | null | null |
AlexanderPankiv/ghc | compiler/deSugar/Check.hs | bsd-3-clause | isConPatOut :: Pat Id -> Bool
isConPatOut ConPatOut{ pat_con = L _ RealDataCon{} } = True | 89 | isConPatOut :: Pat Id -> Bool
isConPatOut ConPatOut{ pat_con = L _ RealDataCon{} } = True | 89 | isConPatOut ConPatOut{ pat_con = L _ RealDataCon{} } = True | 59 | false | true | 4 | 5 | 15 | 38 | 20 | 18 | null | null |
xekoukou/idris-malfunction | src/IRTS/CodegenMalfunction.hs | mit | cgOp LStrTail [x] = S [A "apply", S [A "global", A "$String", A "$sub"], cgVar x, KInt 1,
S [A "-", cgOp LStrLen [x], KInt 1]] | 149 | cgOp LStrTail [x] = S [A "apply", S [A "global", A "$String", A "$sub"], cgVar x, KInt 1,
S [A "-", cgOp LStrLen [x], KInt 1]] | 149 | cgOp LStrTail [x] = S [A "apply", S [A "global", A "$String", A "$sub"], cgVar x, KInt 1,
S [A "-", cgOp LStrLen [x], KInt 1]] | 149 | false | false | 0 | 10 | 48 | 88 | 44 | 44 | null | null |
bixuanzju/fcore | lib/JavaEDSL.hs | bsd-2-clause | applyCall :: BlockStmt
applyCall = bStmt $ methodCall ["apply"] [] | 66 | applyCall :: BlockStmt
applyCall = bStmt $ methodCall ["apply"] [] | 66 | applyCall = bStmt $ methodCall ["apply"] [] | 43 | false | true | 2 | 6 | 9 | 34 | 14 | 20 | null | null |
DimaSamoz/mezzo | examples/src/FurElise/Episode4.hs | mit | -------------------------------------------------------------------------------
-- Fourth episode
-------------------------------------------------------------------------------
ep4Rh1 = tripletE a_ c e :|: tripletE a c' e' :|: tripletE d' c' b
:|: tripletE a c' e' :|: tripletE a' c'' e'' :|: tripletE d'' c'' b'
:|: tripletE a' c'' e'' :|: tripletE a'' c'3 e'3 :|: tripletE d'3 c'3 b''
:|: tripletE bf'' a'' gs'' | 430 | ep4Rh1 = tripletE a_ c e :|: tripletE a c' e' :|: tripletE d' c' b
:|: tripletE a c' e' :|: tripletE a' c'' e'' :|: tripletE d'' c'' b'
:|: tripletE a' c'' e'' :|: tripletE a'' c'3 e'3 :|: tripletE d'3 c'3 b''
:|: tripletE bf'' a'' gs'' | 251 | ep4Rh1 = tripletE a_ c e :|: tripletE a c' e' :|: tripletE d' c' b
:|: tripletE a c' e' :|: tripletE a' c'' e'' :|: tripletE d'' c'' b'
:|: tripletE a' c'' e'' :|: tripletE a'' c'3 e'3 :|: tripletE d'3 c'3 b''
:|: tripletE bf'' a'' gs'' | 251 | true | false | 9 | 7 | 71 | 124 | 60 | 64 | null | null |
lpeterse/koka | src/Lib/Printer.hs | apache-2.0 | withAnsiPrinter :: (AnsiPrinter -> IO a) -> IO a
withAnsiPrinter f
= do ansi <- newIORef ansiDefault
finally (f (Ansi ansi)) (do ansiEscapeIO seqReset
hFlush stdout) | 209 | withAnsiPrinter :: (AnsiPrinter -> IO a) -> IO a
withAnsiPrinter f
= do ansi <- newIORef ansiDefault
finally (f (Ansi ansi)) (do ansiEscapeIO seqReset
hFlush stdout) | 209 | withAnsiPrinter f
= do ansi <- newIORef ansiDefault
finally (f (Ansi ansi)) (do ansiEscapeIO seqReset
hFlush stdout) | 160 | false | true | 0 | 11 | 69 | 76 | 34 | 42 | null | null |
bitemyapp/hakaru | Examples/EasierRoadmap.hs | bsd-3-clause | easierRoadmapProg2
:: (Mochastic repr)
=> repr (HPair HReal HReal)
-> repr (HMeasure (HPair HProb HProb))
easierRoadmapProg2 = \m1m2 ->
-- lam $ \m1m2 ->
unpair m1m2 $ \m1 m2 ->
uniform 3 8 `bind` \noiseT' -> -- let_ (unsafeProb noiseT') $ \noiseT ->
uniform 1 4 `bind` \noiseE' -> -- let_ (unsafeProb noiseE') $ \noiseE ->
dirac (unsafeProb noiseT') `bind` \noiseT ->
dirac (unsafeProb noiseE') `bind` \noiseE ->
normal 0 noiseT `bind` \x1 ->
weight (undefined x1 noiseE m1) $ -- TODO by disintegration
normal x1 noiseT `bind` \x2 ->
weight (undefined x2 noiseE m2) $ -- TODO by disintegration
dirac (pair noiseT noiseE) | 657 | easierRoadmapProg2
:: (Mochastic repr)
=> repr (HPair HReal HReal)
-> repr (HMeasure (HPair HProb HProb))
easierRoadmapProg2 = \m1m2 ->
-- lam $ \m1m2 ->
unpair m1m2 $ \m1 m2 ->
uniform 3 8 `bind` \noiseT' -> -- let_ (unsafeProb noiseT') $ \noiseT ->
uniform 1 4 `bind` \noiseE' -> -- let_ (unsafeProb noiseE') $ \noiseE ->
dirac (unsafeProb noiseT') `bind` \noiseT ->
dirac (unsafeProb noiseE') `bind` \noiseE ->
normal 0 noiseT `bind` \x1 ->
weight (undefined x1 noiseE m1) $ -- TODO by disintegration
normal x1 noiseT `bind` \x2 ->
weight (undefined x2 noiseE m2) $ -- TODO by disintegration
dirac (pair noiseT noiseE) | 657 | easierRoadmapProg2 = \m1m2 ->
-- lam $ \m1m2 ->
unpair m1m2 $ \m1 m2 ->
uniform 3 8 `bind` \noiseT' -> -- let_ (unsafeProb noiseT') $ \noiseT ->
uniform 1 4 `bind` \noiseE' -> -- let_ (unsafeProb noiseE') $ \noiseE ->
dirac (unsafeProb noiseT') `bind` \noiseT ->
dirac (unsafeProb noiseE') `bind` \noiseE ->
normal 0 noiseT `bind` \x1 ->
weight (undefined x1 noiseE m1) $ -- TODO by disintegration
normal x1 noiseT `bind` \x2 ->
weight (undefined x2 noiseE m2) $ -- TODO by disintegration
dirac (pair noiseT noiseE) | 539 | false | true | 2 | 12 | 139 | 242 | 123 | 119 | null | null |
snapframework/snap-core | test/Snap/Util/Proxy/Tests.hs | bsd-3-clause | ------------------------------------------------------------------------------
xForwardedFor :: [ByteString]
-> RequestBuilder IO ()
xForwardedFor = forwardedFor' "X-Forwarded-For" | 193 | xForwardedFor :: [ByteString]
-> RequestBuilder IO ()
xForwardedFor = forwardedFor' "X-Forwarded-For" | 114 | xForwardedFor = forwardedFor' "X-Forwarded-For" | 47 | true | true | 0 | 7 | 24 | 29 | 15 | 14 | null | null |
osa1/Idris-dev | src/Idris/WhoCalls.hs | bsd-3-clause | names (Bind _ b sc) = namesBinder b ++ names sc | 47 | names (Bind _ b sc) = namesBinder b ++ names sc | 47 | names (Bind _ b sc) = namesBinder b ++ names sc | 47 | false | false | 0 | 7 | 10 | 29 | 13 | 16 | null | null |
gandro/mackerel-standalone | src/Main.hs | mit | nullCompiler :: String -> String -> Dev.Rec -> String
nullCompiler _ _ _ = "" | 77 | nullCompiler :: String -> String -> Dev.Rec -> String
nullCompiler _ _ _ = "" | 77 | nullCompiler _ _ _ = "" | 23 | false | true | 0 | 8 | 14 | 32 | 16 | 16 | null | null |
bgold-cosmos/Tidal | src/Sound/Tidal/Utils.hs | gpl-3.0 | (!!!) :: [a] -> Int -> a
(!!!) xs n = xs !! (n `mod` length xs) | 63 | (!!!) :: [a] -> Int -> a
(!!!) xs n = xs !! (n `mod` length xs) | 63 | (!!!) xs n = xs !! (n `mod` length xs) | 38 | false | true | 0 | 9 | 16 | 52 | 28 | 24 | null | null |
ciderpunx/57-exercises-for-programmers | test/P11CurrencySpec.hs | gpl-3.0 | spec = do
describe "getDollars" $ do
prop "has the property of showing twice any number when the rateTo is 200 (i.e. 200%)" $
\x -> getDollars x 200 `shouldBe` printf "%0.2f" (2*x)
prop "has the property of showing half any number when the rateTo is 50" $
\x -> getDollars x 50 `shouldBe` printf "%0.2f" (0.5*x)
describe "rateTo" $ do
prop "has the property of of converting any amount of euros valued at $200 to the equivalent exchange rate" $
\x -> rateTo "200" x `shouldBe` (x/200) * 100 | 524 | spec = do
describe "getDollars" $ do
prop "has the property of showing twice any number when the rateTo is 200 (i.e. 200%)" $
\x -> getDollars x 200 `shouldBe` printf "%0.2f" (2*x)
prop "has the property of showing half any number when the rateTo is 50" $
\x -> getDollars x 50 `shouldBe` printf "%0.2f" (0.5*x)
describe "rateTo" $ do
prop "has the property of of converting any amount of euros valued at $200 to the equivalent exchange rate" $
\x -> rateTo "200" x `shouldBe` (x/200) * 100 | 524 | spec = do
describe "getDollars" $ do
prop "has the property of showing twice any number when the rateTo is 200 (i.e. 200%)" $
\x -> getDollars x 200 `shouldBe` printf "%0.2f" (2*x)
prop "has the property of showing half any number when the rateTo is 50" $
\x -> getDollars x 50 `shouldBe` printf "%0.2f" (0.5*x)
describe "rateTo" $ do
prop "has the property of of converting any amount of euros valued at $200 to the equivalent exchange rate" $
\x -> rateTo "200" x `shouldBe` (x/200) * 100 | 524 | false | false | 1 | 15 | 123 | 143 | 68 | 75 | null | null |
karianna/jdk8_tl | jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs | gpl-2.0 | ffitype _ Nulonglong = UINT64 | 29 | ffitype _ Nulonglong = UINT64 | 29 | ffitype _ Nulonglong = UINT64 | 29 | false | false | 1 | 5 | 4 | 13 | 5 | 8 | null | null |
alphalambda/codeworld | codeworld-auth/src/CodeWorld/Auth/LocalAuth.hs | apache-2.0 | generateTokenJson :: AuthConfig -> UserId -> UTCTime -> Snap ()
generateTokenJson (AuthConfig signer store) userId now = withSnapExcept $ do
-- 1. Generate new token ID
mbNewTokenId <- liftIO $ incrementTokenId store userId
newTokenId <- hoistMaybe
(finishWith internalServerError500)
mbNewTokenId
-- 2. Generate new access and refresh tokens
let at = accessToken codeWorldIssuer now userId
atJson <- hoistMaybe
(finishWith internalServerError500)
(renderAccessToken signer at)
let rt = refreshToken codeWorldIssuer now userId newTokenId
rtJson <- hoistMaybe
(finishWith internalServerError500)
(renderRefreshToken signer rt)
-- 7. HTTP 200 response with tokens
lift $ ok200Json $ m
[ ("accessToken", Text.unpack atJson)
, ("refreshToken", Text.unpack rtJson)
] | 931 | generateTokenJson :: AuthConfig -> UserId -> UTCTime -> Snap ()
generateTokenJson (AuthConfig signer store) userId now = withSnapExcept $ do
-- 1. Generate new token ID
mbNewTokenId <- liftIO $ incrementTokenId store userId
newTokenId <- hoistMaybe
(finishWith internalServerError500)
mbNewTokenId
-- 2. Generate new access and refresh tokens
let at = accessToken codeWorldIssuer now userId
atJson <- hoistMaybe
(finishWith internalServerError500)
(renderAccessToken signer at)
let rt = refreshToken codeWorldIssuer now userId newTokenId
rtJson <- hoistMaybe
(finishWith internalServerError500)
(renderRefreshToken signer rt)
-- 7. HTTP 200 response with tokens
lift $ ok200Json $ m
[ ("accessToken", Text.unpack atJson)
, ("refreshToken", Text.unpack rtJson)
] | 931 | generateTokenJson (AuthConfig signer store) userId now = withSnapExcept $ do
-- 1. Generate new token ID
mbNewTokenId <- liftIO $ incrementTokenId store userId
newTokenId <- hoistMaybe
(finishWith internalServerError500)
mbNewTokenId
-- 2. Generate new access and refresh tokens
let at = accessToken codeWorldIssuer now userId
atJson <- hoistMaybe
(finishWith internalServerError500)
(renderAccessToken signer at)
let rt = refreshToken codeWorldIssuer now userId newTokenId
rtJson <- hoistMaybe
(finishWith internalServerError500)
(renderRefreshToken signer rt)
-- 7. HTTP 200 response with tokens
lift $ ok200Json $ m
[ ("accessToken", Text.unpack atJson)
, ("refreshToken", Text.unpack rtJson)
] | 867 | false | true | 0 | 13 | 268 | 212 | 102 | 110 | null | null |
rueshyna/gogol | gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs | mpl-2.0 | -- | URL of this directory site.
dsURL :: Lens' DirectorySite (Maybe Text)
dsURL = lens _dsURL (\ s a -> s{_dsURL = a}) | 119 | dsURL :: Lens' DirectorySite (Maybe Text)
dsURL = lens _dsURL (\ s a -> s{_dsURL = a}) | 86 | dsURL = lens _dsURL (\ s a -> s{_dsURL = a}) | 44 | true | true | 1 | 9 | 23 | 51 | 25 | 26 | null | null |
yliu120/K3 | src/Language/K3/Parser/DataTypes.hs | apache-2.0 | modifyTypeAliasEnv :: (TypeAliasEnv -> Either String (TypeAliasEnv, a)) -> ParserState -> Either String (ParserState, a)
modifyTypeAliasEnv f st = either Left (\(nta,r) -> Right (st {pTaEnv = nta},r)) $ f $ pTaEnv st | 216 | modifyTypeAliasEnv :: (TypeAliasEnv -> Either String (TypeAliasEnv, a)) -> ParserState -> Either String (ParserState, a)
modifyTypeAliasEnv f st = either Left (\(nta,r) -> Right (st {pTaEnv = nta},r)) $ f $ pTaEnv st | 216 | modifyTypeAliasEnv f st = either Left (\(nta,r) -> Right (st {pTaEnv = nta},r)) $ f $ pTaEnv st | 95 | false | true | 0 | 13 | 32 | 104 | 55 | 49 | null | null |
diagrams/diagrams-input | src/Diagrams/SVG/Tree.hs | bsd-3-clause | insertRefs (maps,viewbox) (SubTree False _ _ _ _ _ _) = mempty | 62 | insertRefs (maps,viewbox) (SubTree False _ _ _ _ _ _) = mempty | 62 | insertRefs (maps,viewbox) (SubTree False _ _ _ _ _ _) = mempty | 62 | false | false | 1 | 7 | 11 | 38 | 18 | 20 | null | null |
facebookincubator/duckling | Duckling/Testing/Types.hs | bsd-3-clause | refTime :: Datetime -> Int -> DucklingTime
refTime datetime offset = fromZonedTime $ zTime datetime offset | 106 | refTime :: Datetime -> Int -> DucklingTime
refTime datetime offset = fromZonedTime $ zTime datetime offset | 106 | refTime datetime offset = fromZonedTime $ zTime datetime offset | 63 | false | true | 0 | 8 | 15 | 38 | 17 | 21 | null | null |
trskop/cabal | Cabal/Distribution/PackageDescription/Parse.hs | bsd-3-clause | benchmarkFieldDescrs :: [FieldDescr BenchmarkStanza]
benchmarkFieldDescrs =
[ simpleField "type"
(maybe empty disp) (fmap Just parse)
benchmarkStanzaBenchmarkType
(\x suite -> suite { benchmarkStanzaBenchmarkType = x })
, simpleField "main-is"
(maybe empty showFilePath) (fmap Just parseFilePathQ)
benchmarkStanzaMainIs
(\x suite -> suite { benchmarkStanzaMainIs = x })
]
++ map biToBenchmark binfoFieldDescrs
where
biToBenchmark = liftField benchmarkStanzaBuildInfo
(\bi suite -> suite { benchmarkStanzaBuildInfo = bi }) | 615 | benchmarkFieldDescrs :: [FieldDescr BenchmarkStanza]
benchmarkFieldDescrs =
[ simpleField "type"
(maybe empty disp) (fmap Just parse)
benchmarkStanzaBenchmarkType
(\x suite -> suite { benchmarkStanzaBenchmarkType = x })
, simpleField "main-is"
(maybe empty showFilePath) (fmap Just parseFilePathQ)
benchmarkStanzaMainIs
(\x suite -> suite { benchmarkStanzaMainIs = x })
]
++ map biToBenchmark binfoFieldDescrs
where
biToBenchmark = liftField benchmarkStanzaBuildInfo
(\bi suite -> suite { benchmarkStanzaBuildInfo = bi }) | 615 | benchmarkFieldDescrs =
[ simpleField "type"
(maybe empty disp) (fmap Just parse)
benchmarkStanzaBenchmarkType
(\x suite -> suite { benchmarkStanzaBenchmarkType = x })
, simpleField "main-is"
(maybe empty showFilePath) (fmap Just parseFilePathQ)
benchmarkStanzaMainIs
(\x suite -> suite { benchmarkStanzaMainIs = x })
]
++ map biToBenchmark binfoFieldDescrs
where
biToBenchmark = liftField benchmarkStanzaBuildInfo
(\bi suite -> suite { benchmarkStanzaBuildInfo = bi }) | 562 | false | true | 3 | 10 | 156 | 166 | 83 | 83 | null | null |
sarahn/ganeti | test/hs/Test/Ganeti/HTools/Instance.hs | gpl-2.0 | prop_setSec :: Instance.Instance -> Types.Ndx -> Property
prop_setSec inst sdx =
Instance.sNode (Instance.setSec inst sdx) ==? sdx | 132 | prop_setSec :: Instance.Instance -> Types.Ndx -> Property
prop_setSec inst sdx =
Instance.sNode (Instance.setSec inst sdx) ==? sdx | 132 | prop_setSec inst sdx =
Instance.sNode (Instance.setSec inst sdx) ==? sdx | 74 | false | true | 0 | 9 | 18 | 47 | 23 | 24 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/playpen/parsers/atto/PA.hs | unlicense | pNamed :: Parser a -> Parser (Named a)
pNamed p
= Named <$> option Nothing (Just <$> (ident <* symbol "<-"))
<*> p | 126 | pNamed :: Parser a -> Parser (Named a)
pNamed p
= Named <$> option Nothing (Just <$> (ident <* symbol "<-"))
<*> p | 126 | pNamed p
= Named <$> option Nothing (Just <$> (ident <* symbol "<-"))
<*> p | 87 | false | true | 0 | 12 | 34 | 65 | 30 | 35 | null | null |
felixgb/calc2latex | src/Parser.hs | bsd-3-clause | lambda :: Parser Expr
lambda = do
reservedOp "\\"
args <- many identifier
reservedOp "."
body <- expr
return $ foldr Lam body args | 150 | lambda :: Parser Expr
lambda = do
reservedOp "\\"
args <- many identifier
reservedOp "."
body <- expr
return $ foldr Lam body args | 150 | lambda = do
reservedOp "\\"
args <- many identifier
reservedOp "."
body <- expr
return $ foldr Lam body args | 128 | false | true | 0 | 8 | 43 | 57 | 24 | 33 | null | null |
julienschmaltz/madl | src/Parser/ASTTranslator.hs | mit | --------------------------------------------------------------------------------
-- Expression evaluations
--------------------------------------------------------------------------------
-- | Given a context, returns the value represented by an integer-expression
evaluateIntegerExpression :: Context -> IntegerExpression -> Int
evaluateIntegerExpression _ (IntegerNumber n) = fromIntegral n | 393 | evaluateIntegerExpression :: Context -> IntegerExpression -> Int
evaluateIntegerExpression _ (IntegerNumber n) = fromIntegral n | 127 | evaluateIntegerExpression _ (IntegerNumber n) = fromIntegral n | 62 | true | true | 0 | 7 | 31 | 37 | 20 | 17 | null | null |
rueshyna/gogol | gogol-dataflow/gen/Network/Google/Resource/Dataflow/Projects/Locations/Jobs/Create.hs | mpl-2.0 | -- | The level of information requested in response.
pljcView :: Lens' ProjectsLocationsJobsCreate (Maybe Text)
pljcView = lens _pljcView (\ s a -> s{_pljcView = a}) | 165 | pljcView :: Lens' ProjectsLocationsJobsCreate (Maybe Text)
pljcView = lens _pljcView (\ s a -> s{_pljcView = a}) | 112 | pljcView = lens _pljcView (\ s a -> s{_pljcView = a}) | 53 | true | true | 1 | 9 | 25 | 52 | 25 | 27 | null | null |
rickardlindberg/frp-arduino-old | src/Arduino/Internal/DSL.hs | gpl-3.0 | isEven :: Expression Int -> Expression Bool
isEven = Expression . DAG.Even . unExpression | 89 | isEven :: Expression Int -> Expression Bool
isEven = Expression . DAG.Even . unExpression | 89 | isEven = Expression . DAG.Even . unExpression | 45 | false | true | 1 | 7 | 13 | 37 | 16 | 21 | null | null |
PeterPiggyDevelopment/TitaniumCloud | src/DataBase.hs | gpl-3.0 | pDB :: CharParser () [(String, String, String)]
pDB = pDBThree `sepBy` char '\n' | 80 | pDB :: CharParser () [(String, String, String)]
pDB = pDBThree `sepBy` char '\n' | 80 | pDB = pDBThree `sepBy` char '\n' | 32 | false | true | 0 | 8 | 12 | 47 | 24 | 23 | null | null |
cmc-haskell-2016/nonogram | src/Solver.hs | bsd-3-clause | lookForRowAccordance :: Task -> Field -> Field
lookForRowAccordance [] b = b | 76 | lookForRowAccordance :: Task -> Field -> Field
lookForRowAccordance [] b = b | 76 | lookForRowAccordance [] b = b | 29 | false | true | 0 | 6 | 11 | 26 | 13 | 13 | null | null |
sampou-org/pfad | Code/Code04.hs | bsd-3-clause | aX100000 = aX 100000 | 20 | aX100000 = aX 100000 | 20 | aX100000 = aX 100000 | 20 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
dmjio/aeson | src/Data/Aeson/Encoding/Builder.hs | bsd-3-clause | -- | Encode a JSON number.
scientific :: Scientific -> Builder
scientific s
| e < 0 || e > 1024 = scientificBuilder s
| otherwise = B.integerDec (coefficient s * 10 ^ e)
where
e = base10Exponent s | 210 | scientific :: Scientific -> Builder
scientific s
| e < 0 || e > 1024 = scientificBuilder s
| otherwise = B.integerDec (coefficient s * 10 ^ e)
where
e = base10Exponent s | 183 | scientific s
| e < 0 || e > 1024 = scientificBuilder s
| otherwise = B.integerDec (coefficient s * 10 ^ e)
where
e = base10Exponent s | 147 | true | true | 2 | 10 | 52 | 80 | 37 | 43 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Query/Unit.hs | mit | sightRange SpecialKhaydarinCrystalForm = 10 | 43 | sightRange SpecialKhaydarinCrystalForm = 10 | 43 | sightRange SpecialKhaydarinCrystalForm = 10 | 43 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Lepovirta/Crystallize | src/Formalize/Internal/Mailer.hs | bsd-3-clause | addPdf :: PDF -> Mail -> Mail
addPdf = addAttachmentBS "application/pdf" "Kiteyttaja.pdf" . LB.fromStrict | 105 | addPdf :: PDF -> Mail -> Mail
addPdf = addAttachmentBS "application/pdf" "Kiteyttaja.pdf" . LB.fromStrict | 105 | addPdf = addAttachmentBS "application/pdf" "Kiteyttaja.pdf" . LB.fromStrict | 75 | false | true | 0 | 6 | 13 | 30 | 15 | 15 | null | null |
pasberth/LeatherScript-prototype | Language/LeatherScript/LeatherShield.hs | mit | forceMkType (AST.OrderedPair x y) e = PairTy (forceMkType x e) (forceMkType y e) | 80 | forceMkType (AST.OrderedPair x y) e = PairTy (forceMkType x e) (forceMkType y e) | 80 | forceMkType (AST.OrderedPair x y) e = PairTy (forceMkType x e) (forceMkType y e) | 80 | false | false | 0 | 8 | 12 | 42 | 20 | 22 | null | null |
romanb/amazonka | amazonka-iam/gen/Network/AWS/IAM/Types.hs | mpl-2.0 | -- | 'Role' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'rArn' @::@ 'Text'
--
-- * 'rAssumeRolePolicyDocument' @::@ 'Maybe' 'Text'
--
-- * 'rCreateDate' @::@ 'UTCTime'
--
-- * 'rPath' @::@ 'Text'
--
-- * 'rRoleId' @::@ 'Text'
--
-- * 'rRoleName' @::@ 'Text'
--
role :: Text -- ^ 'rPath'
-> Text -- ^ 'rRoleName'
-> Text -- ^ 'rRoleId'
-> Text -- ^ 'rArn'
-> UTCTime -- ^ 'rCreateDate'
-> Role
role p1 p2 p3 p4 p5 = Role
{ _rPath = p1
, _rRoleName = p2
, _rRoleId = p3
, _rArn = p4
, _rCreateDate = withIso _Time (const id) p5
, _rAssumeRolePolicyDocument = Nothing
} | 747 | role :: Text -- ^ 'rPath'
-> Text -- ^ 'rRoleName'
-> Text -- ^ 'rRoleId'
-> Text -- ^ 'rArn'
-> UTCTime -- ^ 'rCreateDate'
-> Role
role p1 p2 p3 p4 p5 = Role
{ _rPath = p1
, _rRoleName = p2
, _rRoleId = p3
, _rArn = p4
, _rCreateDate = withIso _Time (const id) p5
, _rAssumeRolePolicyDocument = Nothing
} | 447 | role p1 p2 p3 p4 p5 = Role
{ _rPath = p1
, _rRoleName = p2
, _rRoleId = p3
, _rArn = p4
, _rCreateDate = withIso _Time (const id) p5
, _rAssumeRolePolicyDocument = Nothing
} | 290 | true | true | 0 | 11 | 257 | 123 | 75 | 48 | null | null |
akegalj/snowdrift | Application.hs | agpl-3.0 | makeFoundation :: AppConfig DefaultEnv Extra -> IO App
makeFoundation conf = do
manager <- newManager
s <- staticSite
dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf)
Database.Persist.loadConfig >>=
Database.Persist.applyEnv
pool <- Database.Persist.createPoolConfig dbconf
loggerSet' <- newStdoutLoggerSet defaultBufSize
(getter, updater) <- clockDateCacher
-- If the Yesod logger (as opposed to the request logger middleware) is
-- used less than once a second on average, you may prefer to omit this
-- thread and use "(updater >> getter)" in place of "getter" below. That
-- would update the cache every time it is used, instead of every second.
let updateLoop = forever $ do
threadDelay 1000000
updater
flushLogStr loggerSet'
updateLoop
void $ forkIO updateLoop
event_chan <- newTChanIO
let logger = Yesod.Core.Types.Logger loggerSet' getter
foundation = App
navbar
conf
s
pool
manager
dbconf
logger
event_chan
snowdriftEventHandlers
-- Perform database migration using our application's logging settings.
case appEnv conf of
Testing -> withEnv "PGDATABASE" "template1"
(applyEnv $ persistConfig foundation) >>= \dbconf' -> do
options <- maybe [] L.words <$> lookupEnv
"SNOWDRIFT_TESTING_OPTIONS"
unless
(elem "nodrop" options)
(runStderrLoggingT $
runResourceT $
withPostgresqlConn (pgConnStr dbconf') $
runReaderT $ do
liftIO $ putStrLn "dropping database..."
runSql "DROP DATABASE IF EXISTS snowdrift_test;"
liftIO $ putStrLn "creating database..."
runSql $ "CREATE DATABASE snowdrift_test "
<> "WITH TEMPLATE snowdrift_test_template;"
liftIO $ putStrLn "ready.")
_ -> return ()
let migration = runSqlPool
(doManualMigration >> runMigration migrateAll >> migrateTriggers)
pool
void $ runLoggingT
migration
(messageLoggerSource foundation logger)
now <- getCurrentTime
let (base, diff) = version
runLoggingT
(Database.Persist.runPool
dbconf
(insert_ $ Build now base diff)
pool)
(messageLoggerSource foundation logger)
forkEventHandler foundation
return foundation
-- for yesod devel | 2,957 | makeFoundation :: AppConfig DefaultEnv Extra -> IO App
makeFoundation conf = do
manager <- newManager
s <- staticSite
dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf)
Database.Persist.loadConfig >>=
Database.Persist.applyEnv
pool <- Database.Persist.createPoolConfig dbconf
loggerSet' <- newStdoutLoggerSet defaultBufSize
(getter, updater) <- clockDateCacher
-- If the Yesod logger (as opposed to the request logger middleware) is
-- used less than once a second on average, you may prefer to omit this
-- thread and use "(updater >> getter)" in place of "getter" below. That
-- would update the cache every time it is used, instead of every second.
let updateLoop = forever $ do
threadDelay 1000000
updater
flushLogStr loggerSet'
updateLoop
void $ forkIO updateLoop
event_chan <- newTChanIO
let logger = Yesod.Core.Types.Logger loggerSet' getter
foundation = App
navbar
conf
s
pool
manager
dbconf
logger
event_chan
snowdriftEventHandlers
-- Perform database migration using our application's logging settings.
case appEnv conf of
Testing -> withEnv "PGDATABASE" "template1"
(applyEnv $ persistConfig foundation) >>= \dbconf' -> do
options <- maybe [] L.words <$> lookupEnv
"SNOWDRIFT_TESTING_OPTIONS"
unless
(elem "nodrop" options)
(runStderrLoggingT $
runResourceT $
withPostgresqlConn (pgConnStr dbconf') $
runReaderT $ do
liftIO $ putStrLn "dropping database..."
runSql "DROP DATABASE IF EXISTS snowdrift_test;"
liftIO $ putStrLn "creating database..."
runSql $ "CREATE DATABASE snowdrift_test "
<> "WITH TEMPLATE snowdrift_test_template;"
liftIO $ putStrLn "ready.")
_ -> return ()
let migration = runSqlPool
(doManualMigration >> runMigration migrateAll >> migrateTriggers)
pool
void $ runLoggingT
migration
(messageLoggerSource foundation logger)
now <- getCurrentTime
let (base, diff) = version
runLoggingT
(Database.Persist.runPool
dbconf
(insert_ $ Build now base diff)
pool)
(messageLoggerSource foundation logger)
forkEventHandler foundation
return foundation
-- for yesod devel | 2,957 | makeFoundation conf = do
manager <- newManager
s <- staticSite
dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf)
Database.Persist.loadConfig >>=
Database.Persist.applyEnv
pool <- Database.Persist.createPoolConfig dbconf
loggerSet' <- newStdoutLoggerSet defaultBufSize
(getter, updater) <- clockDateCacher
-- If the Yesod logger (as opposed to the request logger middleware) is
-- used less than once a second on average, you may prefer to omit this
-- thread and use "(updater >> getter)" in place of "getter" below. That
-- would update the cache every time it is used, instead of every second.
let updateLoop = forever $ do
threadDelay 1000000
updater
flushLogStr loggerSet'
updateLoop
void $ forkIO updateLoop
event_chan <- newTChanIO
let logger = Yesod.Core.Types.Logger loggerSet' getter
foundation = App
navbar
conf
s
pool
manager
dbconf
logger
event_chan
snowdriftEventHandlers
-- Perform database migration using our application's logging settings.
case appEnv conf of
Testing -> withEnv "PGDATABASE" "template1"
(applyEnv $ persistConfig foundation) >>= \dbconf' -> do
options <- maybe [] L.words <$> lookupEnv
"SNOWDRIFT_TESTING_OPTIONS"
unless
(elem "nodrop" options)
(runStderrLoggingT $
runResourceT $
withPostgresqlConn (pgConnStr dbconf') $
runReaderT $ do
liftIO $ putStrLn "dropping database..."
runSql "DROP DATABASE IF EXISTS snowdrift_test;"
liftIO $ putStrLn "creating database..."
runSql $ "CREATE DATABASE snowdrift_test "
<> "WITH TEMPLATE snowdrift_test_template;"
liftIO $ putStrLn "ready.")
_ -> return ()
let migration = runSqlPool
(doManualMigration >> runMigration migrateAll >> migrateTriggers)
pool
void $ runLoggingT
migration
(messageLoggerSource foundation logger)
now <- getCurrentTime
let (base, diff) = version
runLoggingT
(Database.Persist.runPool
dbconf
(insert_ $ Build now base diff)
pool)
(messageLoggerSource foundation logger)
forkEventHandler foundation
return foundation
-- for yesod devel | 2,902 | false | true | 0 | 27 | 1,208 | 496 | 229 | 267 | null | null |
TomMD/DRBG | Test/KAT.hs | bsd-3-clause | deleteF k lst = deleteBy (const $ (==) k . fst) undefined lst | 61 | deleteF k lst = deleteBy (const $ (==) k . fst) undefined lst | 61 | deleteF k lst = deleteBy (const $ (==) k . fst) undefined lst | 61 | false | false | 1 | 9 | 12 | 38 | 17 | 21 | null | null |
tjakway/ghcjvm | compiler/prelude/TysWiredIn.hs | bsd-3-clause | floatDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "F#") floatDataConKey floatDataCon | 109 | floatDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "F#") floatDataConKey floatDataCon | 109 | floatDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "F#") floatDataConKey floatDataCon | 109 | false | false | 1 | 7 | 15 | 26 | 11 | 15 | null | null |
asayers/attendancebot | src/AtnBot/Schedule.hs | mit | ppSchedule :: BotSchedule -> T.Text
ppSchedule = T.unlines . map ppJob
where
ppJob (name, Job sched _) = T.pack (show sched) <> ": " <> name | 146 | ppSchedule :: BotSchedule -> T.Text
ppSchedule = T.unlines . map ppJob
where
ppJob (name, Job sched _) = T.pack (show sched) <> ": " <> name | 146 | ppSchedule = T.unlines . map ppJob
where
ppJob (name, Job sched _) = T.pack (show sched) <> ": " <> name | 110 | false | true | 0 | 9 | 31 | 66 | 33 | 33 | null | null |
ak1211/tractor | test/SBIsecCoJp/ScraperSpec.hs | agpl-3.0 | --
-- 買付余力ページ
--
test01AccPurchaseMarginListPage = "https%3A%2F%2Fk.sbisec.co.jp%2Fbsite%2Fmember%2Facc%2FpurchaseMarginList.do.utf8.html" | 138 | test01AccPurchaseMarginListPage = "https%3A%2F%2Fk.sbisec.co.jp%2Fbsite%2Fmember%2Facc%2FpurchaseMarginList.do.utf8.html" | 121 | test01AccPurchaseMarginListPage = "https%3A%2F%2Fk.sbisec.co.jp%2Fbsite%2Fmember%2Facc%2FpurchaseMarginList.do.utf8.html" | 121 | true | false | 0 | 4 | 6 | 9 | 6 | 3 | null | null |
daleooo/barrelfish | tools/flounder/THCBackend.hs | mit | thc_export_info_t ifn = C.Struct $ thc_export_info_struct_name ifn | 66 | thc_export_info_t ifn = C.Struct $ thc_export_info_struct_name ifn | 66 | thc_export_info_t ifn = C.Struct $ thc_export_info_struct_name ifn | 66 | false | false | 1 | 6 | 6 | 21 | 8 | 13 | null | null |
spell-music/data-fix-cse | test/Impl.hs | bsd-3-clause | -----------------------------------------------
-- expression
expr = mulT (2^20) 2 | 83 | expr = mulT (2^20) 2 | 20 | expr = mulT (2^20) 2 | 20 | true | false | 0 | 7 | 8 | 20 | 11 | 9 | null | null |
danidiaz/lens | benchmarks/unsafe.hs | bsd-3-clause | mappedS :: ASetter [a] [b] a b
mappedS f = Mutator . map (runMutator . f) | 73 | mappedS :: ASetter [a] [b] a b
mappedS f = Mutator . map (runMutator . f) | 73 | mappedS f = Mutator . map (runMutator . f) | 42 | false | true | 0 | 8 | 15 | 43 | 22 | 21 | null | null |
kolmodin/spdy | Network/SPDY/Frame.hs | bsd-3-clause | ourSPDYVersion :: Word16
ourSPDYVersion = 2 | 43 | ourSPDYVersion :: Word16
ourSPDYVersion = 2 | 43 | ourSPDYVersion = 2 | 18 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
anchor/haskell-opensrs | lib/Data/OpenSRS.hs | bsd-3-clause | md5Wrap :: String -> String -> String
md5Wrap pk content = md5pack (md5pack (content <> pk) <> pk)
where
md5pack = md5s . Str
-- | Debug an XML string. | 158 | md5Wrap :: String -> String -> String
md5Wrap pk content = md5pack (md5pack (content <> pk) <> pk)
where
md5pack = md5s . Str
-- | Debug an XML string. | 158 | md5Wrap pk content = md5pack (md5pack (content <> pk) <> pk)
where
md5pack = md5s . Str
-- | Debug an XML string. | 120 | false | true | 0 | 10 | 36 | 57 | 29 | 28 | null | null |
nushio3/ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | ppr_expr (HsTcBracketOut e ps) = ppr e $$ text "pending(tc)" <+> ppr ps | 71 | ppr_expr (HsTcBracketOut e ps) = ppr e $$ text "pending(tc)" <+> ppr ps | 71 | ppr_expr (HsTcBracketOut e ps) = ppr e $$ text "pending(tc)" <+> ppr ps | 71 | false | false | 0 | 7 | 12 | 34 | 15 | 19 | null | null |
dorchard/ypnos | testsuite/Testing/Ypnos/CUDA/Expr/Combinators.hs | bsd-2-clause | lower l = all (\ x -> x >= l) | 29 | lower l = all (\ x -> x >= l) | 29 | lower l = all (\ x -> x >= l) | 29 | false | false | 0 | 8 | 9 | 24 | 12 | 12 | null | null |
akamaus/gcodec | src/CNC/FanucMacro.hs | bsd-3-clause | fopGen :: FOperator -> Comment -> FopGen Builder
fopGen (FOps ops (Comment int_cmt_str)) (Comment ext_cmt_str) = do
let cmt_str = if int_cmt_str == "" then ext_cmt_str else int_cmt_str
comment = Comment cmt_str
let size = length ops
let comment_lines = case () of
() | size <= 1 -> repeat comment
| otherwise -> commentPrepend "START " comment : replicate (size-2) "" ++ [commentPrepend "END " comment]
cs <- zipWithM fopGen ops comment_lines
return $ mconcat cs | 497 | fopGen :: FOperator -> Comment -> FopGen Builder
fopGen (FOps ops (Comment int_cmt_str)) (Comment ext_cmt_str) = do
let cmt_str = if int_cmt_str == "" then ext_cmt_str else int_cmt_str
comment = Comment cmt_str
let size = length ops
let comment_lines = case () of
() | size <= 1 -> repeat comment
| otherwise -> commentPrepend "START " comment : replicate (size-2) "" ++ [commentPrepend "END " comment]
cs <- zipWithM fopGen ops comment_lines
return $ mconcat cs | 497 | fopGen (FOps ops (Comment int_cmt_str)) (Comment ext_cmt_str) = do
let cmt_str = if int_cmt_str == "" then ext_cmt_str else int_cmt_str
comment = Comment cmt_str
let size = length ops
let comment_lines = case () of
() | size <= 1 -> repeat comment
| otherwise -> commentPrepend "START " comment : replicate (size-2) "" ++ [commentPrepend "END " comment]
cs <- zipWithM fopGen ops comment_lines
return $ mconcat cs | 448 | false | true | 4 | 14 | 111 | 183 | 89 | 94 | null | null |
agrafix/typed-wire | src/TW/Parser.hs | mit | parseCapitalized :: Parser T.Text
parseCapitalized =
do first <- satisfy isUpper
rest <- many (alphaNum <|> char '_')
return $ T.pack (first : rest) | 166 | parseCapitalized :: Parser T.Text
parseCapitalized =
do first <- satisfy isUpper
rest <- many (alphaNum <|> char '_')
return $ T.pack (first : rest) | 166 | parseCapitalized =
do first <- satisfy isUpper
rest <- many (alphaNum <|> char '_')
return $ T.pack (first : rest) | 132 | false | true | 0 | 11 | 41 | 65 | 30 | 35 | null | null |
keera-studios/hsQt | Qtc/ClassTypes/Core.hs | bsd-2-clause | withQDateTimeResult :: IO (Ptr (TQDateTime a)) -> IO (QDateTime a)
withQDateTimeResult f
= withObjectResult qtc_QDateTime_getFinalizer f | 138 | withQDateTimeResult :: IO (Ptr (TQDateTime a)) -> IO (QDateTime a)
withQDateTimeResult f
= withObjectResult qtc_QDateTime_getFinalizer f | 138 | withQDateTimeResult f
= withObjectResult qtc_QDateTime_getFinalizer f | 71 | false | true | 0 | 10 | 17 | 47 | 22 | 25 | null | null |
rueshyna/gogol | gogol-civicinfo/gen/Network/Google/CivicInfo/Types/Product.hs | mpl-2.0 | -- | The services provided by this early vote site or drop off location. This
-- field is not populated for polling locations.
plVoterServices :: Lens' PollingLocation (Maybe Text)
plVoterServices
= lens _plVoterServices
(\ s a -> s{_plVoterServices = a}) | 263 | plVoterServices :: Lens' PollingLocation (Maybe Text)
plVoterServices
= lens _plVoterServices
(\ s a -> s{_plVoterServices = a}) | 136 | plVoterServices
= lens _plVoterServices
(\ s a -> s{_plVoterServices = a}) | 82 | true | true | 0 | 8 | 47 | 50 | 26 | 24 | null | null |
hsinhuang/codebase | h99/H13.hs | gpl-2.0 | encodeDirect (x:xs) = encodeDirectWith xs x 1 | 45 | encodeDirect (x:xs) = encodeDirectWith xs x 1 | 45 | encodeDirect (x:xs) = encodeDirectWith xs x 1 | 45 | false | false | 0 | 7 | 6 | 23 | 11 | 12 | null | null |
uduki/hsQt | Qtc/Gui/QTextCharFormat.hs | bsd-2-clause | fontStrikeOut :: QTextCharFormat a -> (()) -> IO (Bool)
fontStrikeOut x0 ()
= withBoolResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTextCharFormat_fontStrikeOut cobj_x0 | 177 | fontStrikeOut :: QTextCharFormat a -> (()) -> IO (Bool)
fontStrikeOut x0 ()
= withBoolResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTextCharFormat_fontStrikeOut cobj_x0 | 177 | fontStrikeOut x0 ()
= withBoolResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTextCharFormat_fontStrikeOut cobj_x0 | 121 | false | true | 0 | 8 | 31 | 59 | 29 | 30 | null | null |
MostAwesomeDude/lollerskates | Lol/Constraints.hs | bsd-2-clause | magicResist :: Comparator
magicResist = csMagicResist . iCoreStats | 66 | magicResist :: Comparator
magicResist = csMagicResist . iCoreStats | 66 | magicResist = csMagicResist . iCoreStats | 40 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
cyclohexanamine/haskbot | src/Main.hs | bsd-3-clause | -- | Parse the command line arguments, returning @Right config@ if there's a
-- config file location specified, or @Left err@ with an error message otherwise.
parseCmdArgs :: IO (Either String String)
parseCmdArgs = do
args <- getArgs
let (argL, _, errs) = getOpt Permute flags args
let configs = [s | Config s <- argL]
if not (null errs) || Help `elem` argL || null configs
then return . Left $ (concat errs ++ usageInfo header flags)
else return . Right . head $ configs
where header = "Usage: haskbot -c configfile [-h]"
-- | Set handles to transliterate Unicode characters instead of writing them out
-- to console and potentially causing an error. | 684 | parseCmdArgs :: IO (Either String String)
parseCmdArgs = do
args <- getArgs
let (argL, _, errs) = getOpt Permute flags args
let configs = [s | Config s <- argL]
if not (null errs) || Help `elem` argL || null configs
then return . Left $ (concat errs ++ usageInfo header flags)
else return . Right . head $ configs
where header = "Usage: haskbot -c configfile [-h]"
-- | Set handles to transliterate Unicode characters instead of writing them out
-- to console and potentially causing an error. | 525 | parseCmdArgs = do
args <- getArgs
let (argL, _, errs) = getOpt Permute flags args
let configs = [s | Config s <- argL]
if not (null errs) || Help `elem` argL || null configs
then return . Left $ (concat errs ++ usageInfo header flags)
else return . Right . head $ configs
where header = "Usage: haskbot -c configfile [-h]"
-- | Set handles to transliterate Unicode characters instead of writing them out
-- to console and potentially causing an error. | 483 | true | true | 3 | 13 | 146 | 172 | 82 | 90 | null | null |
jgm/citeproc | src/Citeproc/Types.hs | bsd-2-clause | variableType "performer" = NameVariable | 39 | variableType "performer" = NameVariable | 39 | variableType "performer" = NameVariable | 39 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
sukhmel/experiments.haskell | Reactive/Banana/Windows/WX.hs | mit | onText :: WX.Event (WXCore.Control a) (IO ())
onText = WX.newEvent "onText" WXCore.controlGetOnText WXCore.controlOnText | 120 | onText :: WX.Event (WXCore.Control a) (IO ())
onText = WX.newEvent "onText" WXCore.controlGetOnText WXCore.controlOnText | 120 | onText = WX.newEvent "onText" WXCore.controlGetOnText WXCore.controlOnText | 74 | false | true | 0 | 8 | 12 | 47 | 23 | 24 | null | null |
brendanhay/text-manipulate | src/Data/Text/Manipulate/Internal/Fusion.hs | mpl-2.0 | yield, upper, lower :: forall s. Char -> s -> Step (CC s) Char
yield !c s = Yield c (CC s '\0' '\0') | 100 | yield, upper, lower :: forall s. Char -> s -> Step (CC s) Char
yield !c s = Yield c (CC s '\0' '\0') | 100 | yield !c s = Yield c (CC s '\0' '\0') | 37 | false | true | 3 | 10 | 23 | 64 | 31 | 33 | null | null |
OS2World/DEV-UTIL-HUGS | oldlib/JoinList.hs | bsd-3-clause | take = takeUsingLview | 21 | take = takeUsingLview | 21 | take = takeUsingLview | 21 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
sdiehl/ghc | compiler/GHC/Stg/FVs.hs | bsd-3-clause | binding env body_fv (StgRec pairs) = (StgRec pairs', fvs)
where
-- See Note [Tracking local binders]
bndrs = map fst pairs
(rhss, rhs_fvss) = mapAndUnzip (rhs env . snd) pairs
pairs' = zip bndrs rhss
fvs = delDVarSetList (unionDVarSets (body_fv:rhs_fvss)) bndrs | 283 | binding env body_fv (StgRec pairs) = (StgRec pairs', fvs)
where
-- See Note [Tracking local binders]
bndrs = map fst pairs
(rhss, rhs_fvss) = mapAndUnzip (rhs env . snd) pairs
pairs' = zip bndrs rhss
fvs = delDVarSetList (unionDVarSets (body_fv:rhs_fvss)) bndrs | 283 | binding env body_fv (StgRec pairs) = (StgRec pairs', fvs)
where
-- See Note [Tracking local binders]
bndrs = map fst pairs
(rhss, rhs_fvss) = mapAndUnzip (rhs env . snd) pairs
pairs' = zip bndrs rhss
fvs = delDVarSetList (unionDVarSets (body_fv:rhs_fvss)) bndrs | 283 | false | false | 0 | 9 | 62 | 102 | 52 | 50 | null | null |
brendanhay/gogol | gogol-cloudasset/gen/Network/Google/CloudAsset/Types/Product.hs | mpl-2.0 | -- | Please also refer to the [access level user
-- guide](https:\/\/cloud.google.com\/access-context-manager\/docs\/overview#access-levels).
gcavaAccessLevel :: Lens' GoogleCloudAssetV1p7beta1Asset (Maybe GoogleIdentityAccesscontextManagerV1AccessLevel)
gcavaAccessLevel
= lens _gcavaAccessLevel
(\ s a -> s{_gcavaAccessLevel = a}) | 340 | gcavaAccessLevel :: Lens' GoogleCloudAssetV1p7beta1Asset (Maybe GoogleIdentityAccesscontextManagerV1AccessLevel)
gcavaAccessLevel
= lens _gcavaAccessLevel
(\ s a -> s{_gcavaAccessLevel = a}) | 198 | gcavaAccessLevel
= lens _gcavaAccessLevel
(\ s a -> s{_gcavaAccessLevel = a}) | 85 | true | true | 0 | 8 | 36 | 50 | 26 | 24 | null | null |
ComputationWithBoundedResources/tct-its | src/Tct/Its/Processor/TransitionPredicateAbstraction.hs | bsd-3-clause | gte, gt :: Ord v => AIPoly v -> AIPoly v -> AAtom v
gte = Gte | 63 | gte, gt :: Ord v => AIPoly v -> AIPoly v -> AAtom v
gte = Gte | 63 | gte = Gte | 11 | false | true | 0 | 8 | 18 | 37 | 18 | 19 | null | null |
rleshchinskiy/vector | Data/Vector/Unboxed.hs | bsd-3-clause | copy = G.copy | 13 | copy = G.copy | 13 | copy = G.copy | 13 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
d0kt0r0/Tidal | src/Sound/Tidal/old/Scales.hs | gpl-3.0 | hexDorian :: Num a => [a]
hexDorian = [0,2,3,5,7,10] | 52 | hexDorian :: Num a => [a]
hexDorian = [0,2,3,5,7,10] | 52 | hexDorian = [0,2,3,5,7,10] | 26 | false | true | 0 | 6 | 8 | 39 | 23 | 16 | null | null |
gorkinovich/Haskell | Checkers/src/Game/Logic.hs | mit | getTreeMoves::Board -> PColor -> TreeMoves
getTreeMoves board color = TMRoot (getNodePiece board color positions)
where positions = getPiecesPositions board color
-- ---------------------------------------------------------------------------------
-- Function: getNodeTotalMoves
-- Description: Gets the total number of moves from a NodePiece.
-- --------------------------------------------------------------------------------- | 433 | getTreeMoves::Board -> PColor -> TreeMoves
getTreeMoves board color = TMRoot (getNodePiece board color positions)
where positions = getPiecesPositions board color
-- ---------------------------------------------------------------------------------
-- Function: getNodeTotalMoves
-- Description: Gets the total number of moves from a NodePiece.
-- --------------------------------------------------------------------------------- | 433 | getTreeMoves board color = TMRoot (getNodePiece board color positions)
where positions = getPiecesPositions board color
-- ---------------------------------------------------------------------------------
-- Function: getNodeTotalMoves
-- Description: Gets the total number of moves from a NodePiece.
-- --------------------------------------------------------------------------------- | 390 | false | true | 0 | 7 | 42 | 53 | 28 | 25 | null | null |
silky/csound-expression | src/Csound/Air/Wave.hs | bsd-3-clause | -- | An oscillator with user provided waveform with initial phase (the second argiment).
oscBy' :: Tab -> D -> Sig -> Sig
oscBy' tb phase cps = oscil3 1 cps tb `withD` phase | 173 | oscBy' :: Tab -> D -> Sig -> Sig
oscBy' tb phase cps = oscil3 1 cps tb `withD` phase | 84 | oscBy' tb phase cps = oscil3 1 cps tb `withD` phase | 51 | true | true | 0 | 7 | 33 | 44 | 23 | 21 | null | null |
prowdsponsor/mangopay | mangopay/src/Web/MangoPay/Types.hs | bsd-3-clause | incomeBounds IncomeRange2 = (kEuros 18,kEuros 30) | 49 | incomeBounds IncomeRange2 = (kEuros 18,kEuros 30) | 49 | incomeBounds IncomeRange2 = (kEuros 18,kEuros 30) | 49 | false | false | 0 | 6 | 5 | 21 | 10 | 11 | null | null |
utky/openflow | src/Network/OpenFlow/Parser/OfpMessage.hs | bsd-3-clause | -- EchoRequest
ofpPayload 2 = EchoRequest <$> Echo.ofpEchoRequest | 66 | ofpPayload 2 = EchoRequest <$> Echo.ofpEchoRequest | 51 | ofpPayload 2 = EchoRequest <$> Echo.ofpEchoRequest | 51 | true | false | 0 | 6 | 8 | 16 | 8 | 8 | null | null |
rueshyna/gogol | gogol-script/gen/Network/Google/Script/Types/Product.hs | mpl-2.0 | -- | If a \`run\` call succeeds but the script function (or Apps Script
-- itself) throws an exception, this field will contain a \`Status\`
-- object. The \`Status\` object\'s \`details\` field will contain an array
-- with a single \`ExecutionError\` object that provides information about
-- the nature of the error.
oError :: Lens' Operation (Maybe Status)
oError = lens _oError (\ s a -> s{_oError = a}) | 408 | oError :: Lens' Operation (Maybe Status)
oError = lens _oError (\ s a -> s{_oError = a}) | 88 | oError = lens _oError (\ s a -> s{_oError = a}) | 47 | true | true | 1 | 9 | 68 | 56 | 29 | 27 | null | null |
sopvop/snap | src/Snap/Snaplet/Internal/Types.hs | bsd-3-clause | ------------------------------------------------------------------------------
-- | Sets the route pattern that matched for the handler. Use this when to
-- override the default pattern which is the key to the alist passed to
-- addRoutes.
setRoutePattern :: ByteString -> Handler b v ()
setRoutePattern p = withTop' id $
modifySnapletState (set (snapletConfig . scRoutePattern) (Just p)) | 393 | setRoutePattern :: ByteString -> Handler b v ()
setRoutePattern p = withTop' id $
modifySnapletState (set (snapletConfig . scRoutePattern) (Just p)) | 152 | setRoutePattern p = withTop' id $
modifySnapletState (set (snapletConfig . scRoutePattern) (Just p)) | 104 | true | true | 0 | 10 | 57 | 62 | 32 | 30 | null | null |
raventid/coursera_learning | haskell/will_kurt/15.11_xor_bool.hs | mit | maxBits :: Int
maxBits = length (intToBits' maxBound) | 53 | maxBits :: Int
maxBits = length (intToBits' maxBound) | 53 | maxBits = length (intToBits' maxBound) | 38 | false | true | 0 | 7 | 7 | 20 | 10 | 10 | null | null |
vikraman/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | pprCtO (IPOccOrigin name) = hsep [text "a use of implicit parameter", quotes (ppr name)] | 91 | pprCtO (IPOccOrigin name) = hsep [text "a use of implicit parameter", quotes (ppr name)] | 91 | pprCtO (IPOccOrigin name) = hsep [text "a use of implicit parameter", quotes (ppr name)] | 91 | false | false | 0 | 9 | 16 | 37 | 17 | 20 | null | null |
justanotherdot/advent-linguist | 2016/Haskell/AdventOfCode/src/Day08.hs | mit | rotCol :: Integer -> Integer -> State LCDScreen ()
rotCol colNo qty = modify (\lcd -> V.update lcd $ rotColIxs lcd colNo qty)
where
rotColIxs :: LCDScreen -> Integer -> Integer -> Vector (Int, Bool)
rotColIxs vec col amt
| col >= 50 || col < 0 = V.empty
| otherwise = V.zip ixs vec'
where
col' = fromIntegral col :: Int
amt' = fromIntegral (amt `mod` 6) :: Int
ixs = V.enumFromStepN col' 50 6
colVec = V.map (vec !) ixs
vec' = rotateRight amt' 6 colVec | 533 | rotCol :: Integer -> Integer -> State LCDScreen ()
rotCol colNo qty = modify (\lcd -> V.update lcd $ rotColIxs lcd colNo qty)
where
rotColIxs :: LCDScreen -> Integer -> Integer -> Vector (Int, Bool)
rotColIxs vec col amt
| col >= 50 || col < 0 = V.empty
| otherwise = V.zip ixs vec'
where
col' = fromIntegral col :: Int
amt' = fromIntegral (amt `mod` 6) :: Int
ixs = V.enumFromStepN col' 50 6
colVec = V.map (vec !) ixs
vec' = rotateRight amt' 6 colVec | 533 | rotCol colNo qty = modify (\lcd -> V.update lcd $ rotColIxs lcd colNo qty)
where
rotColIxs :: LCDScreen -> Integer -> Integer -> Vector (Int, Bool)
rotColIxs vec col amt
| col >= 50 || col < 0 = V.empty
| otherwise = V.zip ixs vec'
where
col' = fromIntegral col :: Int
amt' = fromIntegral (amt `mod` 6) :: Int
ixs = V.enumFromStepN col' 50 6
colVec = V.map (vec !) ixs
vec' = rotateRight amt' 6 colVec | 482 | false | true | 4 | 10 | 168 | 241 | 109 | 132 | null | null |
hesiod/OpenGL | src/Graphics/Rendering/OpenGL/GL/StringQueries.hs | bsd-3-clause | i2cps :: GLint -> [ContextProfile']
i2cps bitfield =
[ c | c <- [ CoreProfile', CompatibilityProfile' ]
, (fromIntegral bitfield .&. marshalContextProfile' c) /= 0 ] | 175 | i2cps :: GLint -> [ContextProfile']
i2cps bitfield =
[ c | c <- [ CoreProfile', CompatibilityProfile' ]
, (fromIntegral bitfield .&. marshalContextProfile' c) /= 0 ] | 175 | i2cps bitfield =
[ c | c <- [ CoreProfile', CompatibilityProfile' ]
, (fromIntegral bitfield .&. marshalContextProfile' c) /= 0 ] | 139 | false | true | 0 | 10 | 35 | 59 | 31 | 28 | null | null |
phischu/fragnix | builtins/ghc-prim/GHC.PrimopWrappers.hs | bsd-3-clause | readInt32OffAddr# :: Addr# -> Int# -> State# s -> (# State# s,Int# #)
readInt32OffAddr# a1 a2 a3 = (GHC.Prim.readInt32OffAddr#) a1 a2 a3 | 136 | readInt32OffAddr# :: Addr# -> Int# -> State# s -> (# State# s,Int# #)
readInt32OffAddr# a1 a2 a3 = (GHC.Prim.readInt32OffAddr#) a1 a2 a3 | 136 | readInt32OffAddr# a1 a2 a3 = (GHC.Prim.readInt32OffAddr#) a1 a2 a3 | 66 | false | true | 0 | 9 | 21 | 54 | 27 | 27 | null | null |
hesselink/haskell-opaleye | src/Opaleye/Internal/PackMap.hs | bsd-3-clause | extractAttrPE :: (primExpr -> String -> String) -> T.Tag -> primExpr
-> PM [(HPQ.Symbol, primExpr)] HPQ.PrimExpr
extractAttrPE mkName t pe = do
i <- new
let s = HPQ.Symbol (mkName pe i) t
write (s, pe)
return (HPQ.AttrExpr s)
-- | As 'extractAttrPE' but ignores the 'primExpr' when making the
-- fresh column name and just uses the supplied 'String' and 'T.Tag'. | 386 | extractAttrPE :: (primExpr -> String -> String) -> T.Tag -> primExpr
-> PM [(HPQ.Symbol, primExpr)] HPQ.PrimExpr
extractAttrPE mkName t pe = do
i <- new
let s = HPQ.Symbol (mkName pe i) t
write (s, pe)
return (HPQ.AttrExpr s)
-- | As 'extractAttrPE' but ignores the 'primExpr' when making the
-- fresh column name and just uses the supplied 'String' and 'T.Tag'. | 386 | extractAttrPE mkName t pe = do
i <- new
let s = HPQ.Symbol (mkName pe i) t
write (s, pe)
return (HPQ.AttrExpr s)
-- | As 'extractAttrPE' but ignores the 'primExpr' when making the
-- fresh column name and just uses the supplied 'String' and 'T.Tag'. | 258 | false | true | 0 | 12 | 85 | 120 | 60 | 60 | null | null |
christiaanb/clash-tryout | src/CLaSH/Driver/Tools.hs | bsd-3-clause | addGlobalBind ::
(State.MonadState s m)
=> (s :-> Map CoreSyn.CoreBndr CoreSyn.CoreExpr)
-> CoreSyn.CoreBndr
-> CoreSyn.CoreExpr
-> m ()
addGlobalBind globalsLens bndr expr =
Label.modify globalsLens (Map.insert bndr expr) | 234 | addGlobalBind ::
(State.MonadState s m)
=> (s :-> Map CoreSyn.CoreBndr CoreSyn.CoreExpr)
-> CoreSyn.CoreBndr
-> CoreSyn.CoreExpr
-> m ()
addGlobalBind globalsLens bndr expr =
Label.modify globalsLens (Map.insert bndr expr) | 234 | addGlobalBind globalsLens bndr expr =
Label.modify globalsLens (Map.insert bndr expr) | 87 | false | true | 0 | 11 | 39 | 91 | 43 | 48 | null | null |
mightymoose/liquidhaskell | benchmarks/containers-0.5.0.0/Data/Sequence.hs | bsd-3-clause | -- | /O(min(n1,n2,n3))/. 'zipWith3' takes a function which combines
-- three elements, as well as three sequences and returns a sequence of
-- their point-wise combinations, analogous to 'zipWith'.
zipWith3 :: (a -> b -> c -> d) -> Seq a -> Seq b -> Seq c -> Seq d
zipWith3 f s1 s2 s3 = zipWith ($) (zipWith f s1 s2) s3 | 320 | zipWith3 :: (a -> b -> c -> d) -> Seq a -> Seq b -> Seq c -> Seq d
zipWith3 f s1 s2 s3 = zipWith ($) (zipWith f s1 s2) s3 | 121 | zipWith3 f s1 s2 s3 = zipWith ($) (zipWith f s1 s2) s3 | 54 | true | true | 0 | 10 | 63 | 89 | 44 | 45 | null | null |
michalkonecny/aern | aern-realfn/src/Numeric/AERN/RmToRn/RefinementOrderRounding/BernsteinPoly.hs | bsd-3-clause | bernsteinOut ::
(HasDomainBox f, HasOne f,
ArithInOut.RoundedRing f,
ArithInOut.RoundedMixedMultiply f (Domain f),
ArithInOut.RoundedReal (Domain f),
Show f, Show (Domain f))
=>
(ArithInOut.RingOpsEffortIndicator f,
ArithInOut.RoundedRealEffortIndicator (Domain f),
ArithInOut.MixedMultEffortIndicator f (Domain f))
{-^ Effort indicators to guide the effort used for approximately computing the Bernstein polynomial -} ->
f {-^ @x@ - a function to substitute in the Bernstein polynomial -} ->
Int {-^ @n@ - the degree of the Bernstein polynomial -} ->
Int {-^ @p@ - the index of the Bernstein polynomial -} ->
f {-^ @b_{p,n}(x)@ - The Bernstein polynomial of degree @n@ and index @p@ -}
bernsteinOut (effRingF, effRealD, effMultFD) x n p =
-- trace
-- (
-- "bernsteinOut:"
-- ++ "\n x = " ++ show x
-- ++ "\n n = " ++ show n
-- ++ "\n p = " ++ show p
-- ++ "\n (n p) = " ++ show binomialOut
-- ++ "\n result = " ++ show result
-- )
result
where
result =
(binomialOut) .<*>~
((x ~<^> p) ~<*>~ ((c1 ~<->~ x) ~<^> (n-p)))
binomialOut
| 0 <= p && p <= n =
productNdownP .</>. factorialP
| otherwise =
error $
"bernsteinOut called with illegal parameters:"
++ "\n n = " ++ show n
++ "\n p = " ++ show p
where
factorialP =
foldl (.<*>|) (one sampleD) [2..p]
productNdownP =
foldl (.<*>|) (one sampleD) [(n-p+1)..n]
c1 = (one sampleF)
sampleF = x
sampleD = getSampleDomValue sampleF
-- (~<+>~) = ArithInOut.addOutEff effAddF
(~<->~) = ArithInOut.subtrOutEff effAddF
(~<*>~) = ArithInOut.multOutEff effMultF
(~<^>) = ArithInOut.powerToNonnegIntOutEff effPowF
(.<*>~) = flip $ ArithInOut.mixedMultOutEff effMultFD
(.</>.) = ArithInOut.divOutEff effDivD
(.<*>|) = ArithInOut.mixedMultOutEff effMultIntD
effAddF = ArithInOut.ringEffortAdd sampleF effRingF
effMultF = ArithInOut.ringEffortMult sampleF effRingF
effPowF = ArithInOut.ringEffortPow sampleF effRingF
effDivD =
ArithInOut.fldEffortDiv sampleD $
ArithInOut.rrEffortField sampleD effRealD
effMultIntD =
ArithInOut.mxfldEffortMult sampleD (1::Int) $
ArithInOut.rrEffortIntMixedField sampleD effRealD | 2,453 | bernsteinOut ::
(HasDomainBox f, HasOne f,
ArithInOut.RoundedRing f,
ArithInOut.RoundedMixedMultiply f (Domain f),
ArithInOut.RoundedReal (Domain f),
Show f, Show (Domain f))
=>
(ArithInOut.RingOpsEffortIndicator f,
ArithInOut.RoundedRealEffortIndicator (Domain f),
ArithInOut.MixedMultEffortIndicator f (Domain f))
{-^ Effort indicators to guide the effort used for approximately computing the Bernstein polynomial -} ->
f {-^ @x@ - a function to substitute in the Bernstein polynomial -} ->
Int {-^ @n@ - the degree of the Bernstein polynomial -} ->
Int {-^ @p@ - the index of the Bernstein polynomial -} ->
f
bernsteinOut (effRingF, effRealD, effMultFD) x n p =
-- trace
-- (
-- "bernsteinOut:"
-- ++ "\n x = " ++ show x
-- ++ "\n n = " ++ show n
-- ++ "\n p = " ++ show p
-- ++ "\n (n p) = " ++ show binomialOut
-- ++ "\n result = " ++ show result
-- )
result
where
result =
(binomialOut) .<*>~
((x ~<^> p) ~<*>~ ((c1 ~<->~ x) ~<^> (n-p)))
binomialOut
| 0 <= p && p <= n =
productNdownP .</>. factorialP
| otherwise =
error $
"bernsteinOut called with illegal parameters:"
++ "\n n = " ++ show n
++ "\n p = " ++ show p
where
factorialP =
foldl (.<*>|) (one sampleD) [2..p]
productNdownP =
foldl (.<*>|) (one sampleD) [(n-p+1)..n]
c1 = (one sampleF)
sampleF = x
sampleD = getSampleDomValue sampleF
-- (~<+>~) = ArithInOut.addOutEff effAddF
(~<->~) = ArithInOut.subtrOutEff effAddF
(~<*>~) = ArithInOut.multOutEff effMultF
(~<^>) = ArithInOut.powerToNonnegIntOutEff effPowF
(.<*>~) = flip $ ArithInOut.mixedMultOutEff effMultFD
(.</>.) = ArithInOut.divOutEff effDivD
(.<*>|) = ArithInOut.mixedMultOutEff effMultIntD
effAddF = ArithInOut.ringEffortAdd sampleF effRingF
effMultF = ArithInOut.ringEffortMult sampleF effRingF
effPowF = ArithInOut.ringEffortPow sampleF effRingF
effDivD =
ArithInOut.fldEffortDiv sampleD $
ArithInOut.rrEffortField sampleD effRealD
effMultIntD =
ArithInOut.mxfldEffortMult sampleD (1::Int) $
ArithInOut.rrEffortIntMixedField sampleD effRealD | 2,378 | bernsteinOut (effRingF, effRealD, effMultFD) x n p =
-- trace
-- (
-- "bernsteinOut:"
-- ++ "\n x = " ++ show x
-- ++ "\n n = " ++ show n
-- ++ "\n p = " ++ show p
-- ++ "\n (n p) = " ++ show binomialOut
-- ++ "\n result = " ++ show result
-- )
result
where
result =
(binomialOut) .<*>~
((x ~<^> p) ~<*>~ ((c1 ~<->~ x) ~<^> (n-p)))
binomialOut
| 0 <= p && p <= n =
productNdownP .</>. factorialP
| otherwise =
error $
"bernsteinOut called with illegal parameters:"
++ "\n n = " ++ show n
++ "\n p = " ++ show p
where
factorialP =
foldl (.<*>|) (one sampleD) [2..p]
productNdownP =
foldl (.<*>|) (one sampleD) [(n-p+1)..n]
c1 = (one sampleF)
sampleF = x
sampleD = getSampleDomValue sampleF
-- (~<+>~) = ArithInOut.addOutEff effAddF
(~<->~) = ArithInOut.subtrOutEff effAddF
(~<*>~) = ArithInOut.multOutEff effMultF
(~<^>) = ArithInOut.powerToNonnegIntOutEff effPowF
(.<*>~) = flip $ ArithInOut.mixedMultOutEff effMultFD
(.</>.) = ArithInOut.divOutEff effDivD
(.<*>|) = ArithInOut.mixedMultOutEff effMultIntD
effAddF = ArithInOut.ringEffortAdd sampleF effRingF
effMultF = ArithInOut.ringEffortMult sampleF effRingF
effPowF = ArithInOut.ringEffortPow sampleF effRingF
effDivD =
ArithInOut.fldEffortDiv sampleD $
ArithInOut.rrEffortField sampleD effRealD
effMultIntD =
ArithInOut.mxfldEffortMult sampleD (1::Int) $
ArithInOut.rrEffortIntMixedField sampleD effRealD | 1,698 | true | true | 0 | 11 | 709 | 530 | 286 | 244 | null | null |
m15k/hs-dtd-text | Data/XML/DTD/Render.hs | bsd-3-clause | buildAttType AttIDRefType = fromText "IDREF" | 52 | buildAttType AttIDRefType = fromText "IDREF" | 52 | buildAttType AttIDRefType = fromText "IDREF" | 52 | false | false | 0 | 5 | 12 | 12 | 5 | 7 | null | null |
emwap/feldspar-compiler | lib/Feldspar/Compiler/Imperative/FromCore.hs | bsd-3-clause | compileProg env (Just loc) (In (App (Ut.Call f name) _ es)) = do
es' <- mapM (compileExpr env) es
let args = nub $ map exprToVar es' ++ fv loc
tellProg [iVarInitCond f (AddrOf loc)]
tellProg [spawn f name args] | 218 | compileProg env (Just loc) (In (App (Ut.Call f name) _ es)) = do
es' <- mapM (compileExpr env) es
let args = nub $ map exprToVar es' ++ fv loc
tellProg [iVarInitCond f (AddrOf loc)]
tellProg [spawn f name args] | 218 | compileProg env (Just loc) (In (App (Ut.Call f name) _ es)) = do
es' <- mapM (compileExpr env) es
let args = nub $ map exprToVar es' ++ fv loc
tellProg [iVarInitCond f (AddrOf loc)]
tellProg [spawn f name args] | 218 | false | false | 0 | 12 | 47 | 124 | 57 | 67 | null | null |
sheganinans/plugins | src/System/Plugins/Load.hs | lgpl-2.1 | --
-- | 'load' is the basic interface to the dynamic loader. A call to
-- 'load' imports a single object file into the caller's address space,
-- returning the value associated with the symbol requested. Libraries
-- and modules that the requested module depends upon are loaded and
-- linked in turn.
--
-- The first argument is the path to the object file to load, the second
-- argument is a list of directories to search for dependent modules.
-- The third argument is a list of paths to user-defined, but
-- unregistered, /package.conf/ files. The 'Symbol' argument is the
-- symbol name of the value you with to retrieve.
--
-- The value returned must be given an explicit type signature, or
-- provided with appropriate type constraints such that Haskell compiler
-- can determine the expected type returned by 'load', as the return
-- type is notionally polymorphic.
--
-- Example:
--
-- > do mv <- load "Plugin.o" ["api"] [] "resource"
-- > case mv of
-- > LoadFailure msg -> print msg
-- > LoadSuccess _ v -> return v
--
load :: FilePath -- ^ object file
-> [FilePath] -- ^ any include paths
-> [PackageConf] -- ^ list of package.conf paths
-> Symbol -- ^ symbol to find
-> IO (LoadStatus a)
load obj incpaths pkgconfs sym = do
initLinker
-- load extra package information
mapM_ addPkgConf pkgconfs
(hif,moduleDeps) <- loadDepends obj incpaths
-- why is this the package name?
#if DEBUG
putStr (' ':(decode $ ifaceModuleName hif)) >> hFlush stdout
#endif
m' <- loadObject obj . Object . ifaceModuleName $ hif
let m = m' { iface = hif }
resolveObjs (mapM_ unloadAll (m:moduleDeps))
#if DEBUG
putStrLn " ... done" >> hFlush stdout
#endif
addModuleDeps m' moduleDeps
v <- loadFunction m sym
return $ case v of
Nothing -> LoadFailure ["load: couldn't find symbol <<"++sym++">>"]
Just a -> LoadSuccess m a
--
-- | Like load, but doesn't want a package.conf arg (they are rarely used)
-- | 2,058 | load :: FilePath -- ^ object file
-> [FilePath] -- ^ any include paths
-> [PackageConf] -- ^ list of package.conf paths
-> Symbol -- ^ symbol to find
-> IO (LoadStatus a)
load obj incpaths pkgconfs sym = do
initLinker
-- load extra package information
mapM_ addPkgConf pkgconfs
(hif,moduleDeps) <- loadDepends obj incpaths
-- why is this the package name?
#if DEBUG
putStr (' ':(decode $ ifaceModuleName hif)) >> hFlush stdout
#endif
m' <- loadObject obj . Object . ifaceModuleName $ hif
let m = m' { iface = hif }
resolveObjs (mapM_ unloadAll (m:moduleDeps))
#if DEBUG
putStrLn " ... done" >> hFlush stdout
#endif
addModuleDeps m' moduleDeps
v <- loadFunction m sym
return $ case v of
Nothing -> LoadFailure ["load: couldn't find symbol <<"++sym++">>"]
Just a -> LoadSuccess m a
--
-- | Like load, but doesn't want a package.conf arg (they are rarely used)
-- | 1,009 | load obj incpaths pkgconfs sym = do
initLinker
-- load extra package information
mapM_ addPkgConf pkgconfs
(hif,moduleDeps) <- loadDepends obj incpaths
-- why is this the package name?
#if DEBUG
putStr (' ':(decode $ ifaceModuleName hif)) >> hFlush stdout
#endif
m' <- loadObject obj . Object . ifaceModuleName $ hif
let m = m' { iface = hif }
resolveObjs (mapM_ unloadAll (m:moduleDeps))
#if DEBUG
putStrLn " ... done" >> hFlush stdout
#endif
addModuleDeps m' moduleDeps
v <- loadFunction m sym
return $ case v of
Nothing -> LoadFailure ["load: couldn't find symbol <<"++sym++">>"]
Just a -> LoadSuccess m a
--
-- | Like load, but doesn't want a package.conf arg (they are rarely used)
-- | 763 | true | true | 0 | 14 | 502 | 286 | 154 | 132 | null | null |
alanz/language-javascript | test/Test/Language/Javascript/Lexer.hs | bsd-3-clause | testLex :: String -> String
testLex str =
either id stringify $ alexTestTokeniser str
where
stringify xs = "[" ++ intercalate "," (map showToken xs) ++ "]"
showToken :: Token -> String
showToken (StringToken _ lit _) = "StringToken " ++ stringEscape lit
showToken (IdentifierToken _ lit _) = "IdentifierToken '" ++ stringEscape lit ++ "'"
showToken (DecimalToken _ lit _) = "DecimalToken " ++ lit
showToken (OctalToken _ lit _) = "OctalToken " ++ lit
showToken (HexIntegerToken _ lit _) = "HexIntegerToken " ++ lit
showToken token = takeWhile (/= ' ') $ show token
stringEscape [] = []
stringEscape (term:rest) =
let escapeTerm [] = []
escapeTerm [_] = [term]
escapeTerm (x:xs)
| term == x = "\\" ++ x : escapeTerm xs
| otherwise = x : escapeTerm xs
in term : escapeTerm rest | 895 | testLex :: String -> String
testLex str =
either id stringify $ alexTestTokeniser str
where
stringify xs = "[" ++ intercalate "," (map showToken xs) ++ "]"
showToken :: Token -> String
showToken (StringToken _ lit _) = "StringToken " ++ stringEscape lit
showToken (IdentifierToken _ lit _) = "IdentifierToken '" ++ stringEscape lit ++ "'"
showToken (DecimalToken _ lit _) = "DecimalToken " ++ lit
showToken (OctalToken _ lit _) = "OctalToken " ++ lit
showToken (HexIntegerToken _ lit _) = "HexIntegerToken " ++ lit
showToken token = takeWhile (/= ' ') $ show token
stringEscape [] = []
stringEscape (term:rest) =
let escapeTerm [] = []
escapeTerm [_] = [term]
escapeTerm (x:xs)
| term == x = "\\" ++ x : escapeTerm xs
| otherwise = x : escapeTerm xs
in term : escapeTerm rest | 895 | testLex str =
either id stringify $ alexTestTokeniser str
where
stringify xs = "[" ++ intercalate "," (map showToken xs) ++ "]"
showToken :: Token -> String
showToken (StringToken _ lit _) = "StringToken " ++ stringEscape lit
showToken (IdentifierToken _ lit _) = "IdentifierToken '" ++ stringEscape lit ++ "'"
showToken (DecimalToken _ lit _) = "DecimalToken " ++ lit
showToken (OctalToken _ lit _) = "OctalToken " ++ lit
showToken (HexIntegerToken _ lit _) = "HexIntegerToken " ++ lit
showToken token = takeWhile (/= ' ') $ show token
stringEscape [] = []
stringEscape (term:rest) =
let escapeTerm [] = []
escapeTerm [_] = [term]
escapeTerm (x:xs)
| term == x = "\\" ++ x : escapeTerm xs
| otherwise = x : escapeTerm xs
in term : escapeTerm rest | 867 | false | true | 8 | 12 | 256 | 353 | 163 | 190 | null | null |
rahulmutt/codec-jvm | src/Codec/JVM/ASM/Code.hs | apache-2.0 | lsub = binaryOp jlong OP.lsub | 29 | lsub = binaryOp jlong OP.lsub | 29 | lsub = binaryOp jlong OP.lsub | 29 | false | false | 1 | 6 | 4 | 18 | 6 | 12 | null | null |
green-haskell/ghc | compiler/coreSyn/CoreSyn.hs | bsd-3-clause | -- | Return @True@ if this source annotation compiles to some backend
-- code. Without this flag, the tickish is seen as a simple annotation
-- that does not have any associated evaluation code.
--
-- What this means that we are allowed to disregard the tick if doing
-- so means that we can skip generating any code in the first place. A
-- typical example is top-level bindings:
--
-- foo = tick<...> \y -> ...
-- ==>
-- foo = \y -> tick<...> ...
--
-- Here there is just no operational difference between the first and
-- the second version. Therefore code generation should simply
-- translate the code as if it found the latter.
tickishIsCode :: Tickish id -> Bool
tickishIsCode SourceNote{} = False | 712 | tickishIsCode :: Tickish id -> Bool
tickishIsCode SourceNote{} = False | 70 | tickishIsCode SourceNote{} = False | 34 | true | true | 0 | 6 | 136 | 40 | 27 | 13 | null | null |
OpenXT/manager | xenmgr/XenMgr/Errors.hs | gpl-2.0 | failNotGatheringDiagnostics :: (MonadError XmError m) => m a
failNotGatheringDiagnostics = throwError $ XError 216 "Currently not gathering diagnostic information" | 163 | failNotGatheringDiagnostics :: (MonadError XmError m) => m a
failNotGatheringDiagnostics = throwError $ XError 216 "Currently not gathering diagnostic information" | 163 | failNotGatheringDiagnostics = throwError $ XError 216 "Currently not gathering diagnostic information" | 102 | false | true | 0 | 7 | 18 | 39 | 18 | 21 | null | null |
jdnavarro/smallcheck-lens | Test/SmallCheck/Lens/Traversal.hs | bsd-3-clause | pure
:: forall m f s a. (Monad m, Show s, Applicative f, Eq (f s))
=> Proxy f -> Traversal' s a -> Series m s -> Property m
pure _ l ss = SC.over ss $ \s -> l Prelude.pure s == (Prelude.pure s :: f s) | 204 | pure
:: forall m f s a. (Monad m, Show s, Applicative f, Eq (f s))
=> Proxy f -> Traversal' s a -> Series m s -> Property m
pure _ l ss = SC.over ss $ \s -> l Prelude.pure s == (Prelude.pure s :: f s) | 204 | pure _ l ss = SC.over ss $ \s -> l Prelude.pure s == (Prelude.pure s :: f s) | 76 | false | true | 0 | 11 | 52 | 130 | 64 | 66 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 3817 = 3816 | 11 | 3817 = 3816 | 11 | 3817 = 3816 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
fjarri/wigner | test/TestOperators.hs | bsd-3-clause | b2 = D.operatorIx S.b [S.ix_2] | 30 | b2 = D.operatorIx S.b [S.ix_2] | 30 | b2 = D.operatorIx S.b [S.ix_2] | 30 | false | false | 0 | 7 | 4 | 20 | 10 | 10 | null | null |
unknownloner/calccomp | FORTH/Compiler.hs | mit | -- Optimizations that apply to most of the code.
optimizeAsm :: [A.Expr] -> [A.Expr]
optimizeAsm = multiple (pass1 . pass2 . pass3)
where pass1 = replace [asm|push hl \ pop hl|] []
pass2 = replace [asm|push hl \ pop de|] [asm|ld d,h \ ld e,l|]
pass3 = replace [asm|push de \ pop hl|] [asm|ld h,d \ ld l,e|]
multiple f = f . f . f -- Really really optimize it
-- Gets all defined strings and maps them to labels | 445 | optimizeAsm :: [A.Expr] -> [A.Expr]
optimizeAsm = multiple (pass1 . pass2 . pass3)
where pass1 = replace [asm|push hl \ pop hl|] []
pass2 = replace [asm|push hl \ pop de|] [asm|ld d,h \ ld e,l|]
pass3 = replace [asm|push de \ pop hl|] [asm|ld h,d \ ld l,e|]
multiple f = f . f . f -- Really really optimize it
-- Gets all defined strings and maps them to labels | 396 | optimizeAsm = multiple (pass1 . pass2 . pass3)
where pass1 = replace [asm|push hl \ pop hl|] []
pass2 = replace [asm|push hl \ pop de|] [asm|ld d,h \ ld e,l|]
pass3 = replace [asm|push de \ pop hl|] [asm|ld h,d \ ld l,e|]
multiple f = f . f . f -- Really really optimize it
-- Gets all defined strings and maps them to labels | 360 | true | true | 3 | 8 | 115 | 113 | 69 | 44 | null | null |
timstclair/experimental | haskell/99_problems/lists.hs | unlicense | encodeDirect [x] = [Single x] | 29 | encodeDirect [x] = [Single x] | 29 | encodeDirect [x] = [Single x] | 29 | false | false | 0 | 6 | 4 | 18 | 9 | 9 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.