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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
enolan/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | mapPDeclFC f g (PSyntax fc syn) = PSyntax (f fc) $
case syn of
Rule syms tm ctxt -> Rule syms (mapPTermFC f g tm) ctxt
DeclRule syms decls -> DeclRule syms (map (mapPDeclFC f g) decls) | 296 | mapPDeclFC f g (PSyntax fc syn) = PSyntax (f fc) $
case syn of
Rule syms tm ctxt -> Rule syms (mapPTermFC f g tm) ctxt
DeclRule syms decls -> DeclRule syms (map (mapPDeclFC f g) decls) | 296 | mapPDeclFC f g (PSyntax fc syn) = PSyntax (f fc) $
case syn of
Rule syms tm ctxt -> Rule syms (mapPTermFC f g tm) ctxt
DeclRule syms decls -> DeclRule syms (map (mapPDeclFC f g) decls) | 296 | false | false | 0 | 13 | 148 | 103 | 47 | 56 | null | null |
shlevy/ghc | compiler/types/OptCoercion.hs | bsd-3-clause | -- See Note [Optimising coercion optimisation]
-- | Optimize a non-phantom coercion.
opt_co4, opt_co4_wrap :: LiftingContext -> SymFlag -> ReprFlag -> Role -> Coercion -> NormalCo
opt_co4_wrap = opt_co4 | 203 | opt_co4, opt_co4_wrap :: LiftingContext -> SymFlag -> ReprFlag -> Role -> Coercion -> NormalCo
opt_co4_wrap = opt_co4 | 117 | opt_co4_wrap = opt_co4 | 22 | true | true | 2 | 9 | 29 | 40 | 20 | 20 | null | null |
futufeld/eclogues | eclogues-impl/test/TestUtils.hs | bsd-3-clause | halfResources, fullResources, overResources :: Job.Resources
halfResources = mkResources 5000 1024 1 1 | 103 | halfResources, fullResources, overResources :: Job.Resources
halfResources = mkResources 5000 1024 1 1 | 103 | halfResources = mkResources 5000 1024 1 1 | 42 | false | true | 0 | 5 | 12 | 26 | 15 | 11 | null | null |
bvdelft/parac2 | src/Language/Java/Paragon/Compile.hs | bsd-3-clause | compileRefType :: RefType T -> RefType ()
compileRefType (ArrayType _ t mps) =
ArrayType () (compileType t) $ map (const Nothing) mps | 138 | compileRefType :: RefType T -> RefType ()
compileRefType (ArrayType _ t mps) =
ArrayType () (compileType t) $ map (const Nothing) mps | 138 | compileRefType (ArrayType _ t mps) =
ArrayType () (compileType t) $ map (const Nothing) mps | 96 | false | true | 0 | 8 | 26 | 64 | 30 | 34 | null | null |
alexander-at-github/eta | compiler/ETA/Utils/ExtsCompat46.hs | bsd-3-clause | (<##) :: Double# -> Double# -> Bool
(<##) a b = isTrue# (a E.<## b) | 68 | (<##) :: Double# -> Double# -> Bool
(<##) a b = isTrue# (a E.<## b) | 68 | (<##) a b = isTrue# (a E.<## b) | 31 | false | true | 0 | 8 | 15 | 46 | 23 | 23 | null | null |
graninas/The-Amoeba-World | src/Amoeba/GameLogic/Language/Translation/Actions.hs | gpl-3.0 | getObjectTemplate name = do
mbObjTemplate <- lookupObjectTemplate name
case mbObjTemplate of
Just x -> return x
Nothing -> left $ "Object template for object " ++ name ++ " not found."
-- TODO: too special and too unobvious functions. Maybe I can better?
-- TODO: hacks. I'd like to finish it right now. | 328 | getObjectTemplate name = do
mbObjTemplate <- lookupObjectTemplate name
case mbObjTemplate of
Just x -> return x
Nothing -> left $ "Object template for object " ++ name ++ " not found."
-- TODO: too special and too unobvious functions. Maybe I can better?
-- TODO: hacks. I'd like to finish it right now. | 328 | getObjectTemplate name = do
mbObjTemplate <- lookupObjectTemplate name
case mbObjTemplate of
Just x -> return x
Nothing -> left $ "Object template for object " ++ name ++ " not found."
-- TODO: too special and too unobvious functions. Maybe I can better?
-- TODO: hacks. I'd like to finish it right now. | 328 | false | false | 0 | 12 | 77 | 58 | 27 | 31 | null | null |
NorfairKing/the-notes | src/Titlepage.hs | gpl-2.0 | titlepageE :: Note -> Note
titlepageE = liftL $ TeXEnv "titlepage" [] | 69 | titlepageE :: Note -> Note
titlepageE = liftL $ TeXEnv "titlepage" [] | 69 | titlepageE = liftL $ TeXEnv "titlepage" [] | 42 | false | true | 2 | 7 | 11 | 35 | 14 | 21 | null | null |
jtcwang/HaskSplit | src/exe/HaskSplit/Conduit/Split.hs | mit | -- | Generate the output file paths from the original file name, output directory,
-- and the x value of each file
-- e.g. genOutputFileNames "input.txt" "./outputDir" [22, 55]
-- will give you ["./outputDir/input.txt.022", "./output/to/input.txt.055"]
genOutputFileNames :: FilePath -> FilePath -> [Int] -> [FilePath]
genOutputFileNames fileName outDir xs =
map (\fileNumb -> outDir </> fileName ++ (printf ".%03d" fileNumb)) xs | 440 | genOutputFileNames :: FilePath -> FilePath -> [Int] -> [FilePath]
genOutputFileNames fileName outDir xs =
map (\fileNumb -> outDir </> fileName ++ (printf ".%03d" fileNumb)) xs | 182 | genOutputFileNames fileName outDir xs =
map (\fileNumb -> outDir </> fileName ++ (printf ".%03d" fileNumb)) xs | 116 | true | true | 0 | 10 | 70 | 75 | 39 | 36 | null | null |
vladfi1/hs-misc | lib/Misc/VarArgs.hs | mit | uncurry2 :: (a -> b -> r) -> HList '[a, b] -> Identity r
--uncurry2 f (Identity a :& l) = uncurry1 (f a) l
uncurry2 = uncurryN s2 | 129 | uncurry2 :: (a -> b -> r) -> HList '[a, b] -> Identity r
uncurry2 = uncurryN s2 | 79 | uncurry2 = uncurryN s2 | 22 | true | true | 0 | 9 | 28 | 48 | 25 | 23 | null | null |
agentm/project-m36 | test/TutorialD/Interpreter/TestBase.hs | unlicense | eitherFail :: Either RelationalError a -> IO ()
eitherFail (Left err) = assertFailure (show err) | 96 | eitherFail :: Either RelationalError a -> IO ()
eitherFail (Left err) = assertFailure (show err) | 96 | eitherFail (Left err) = assertFailure (show err) | 48 | false | true | 0 | 7 | 14 | 43 | 20 | 23 | null | null |
nilcons/tag-game | src/Target.hs | apache-2.0 | drawTarget Goal{..} = translateP _tPos $ Color black $ thickCircle goalR goalW | 78 | drawTarget Goal{..} = translateP _tPos $ Color black $ thickCircle goalR goalW | 78 | drawTarget Goal{..} = translateP _tPos $ Color black $ thickCircle goalR goalW | 78 | false | false | 1 | 7 | 11 | 40 | 16 | 24 | null | null |
kmilner/tamarin-prover | lib/term/src/Term/UnitTests.hs | gpl-3.0 | ppLSubst :: LNSubst -> String
ppLSubst = render . prettyLNSubst | 63 | ppLSubst :: LNSubst -> String
ppLSubst = render . prettyLNSubst | 63 | ppLSubst = render . prettyLNSubst | 33 | false | true | 1 | 7 | 9 | 27 | 11 | 16 | null | null |
spechub/Hets | OWL2/Taxonomy.hs | gpl-2.0 | -- | Builder for all relations
relBuilder :: String
-> Result [Rel.Rel String]
relBuilder tr =
let ln = filter (not . null) $ lines tr in
if any (isPrefixOf "ERROR: ") ln || null ln then
fail "Classification via Pellet failed! Ontology might be inconsistent!"
else return $ map relBuild $ splitter $ map tail ln | 334 | relBuilder :: String
-> Result [Rel.Rel String]
relBuilder tr =
let ln = filter (not . null) $ lines tr in
if any (isPrefixOf "ERROR: ") ln || null ln then
fail "Classification via Pellet failed! Ontology might be inconsistent!"
else return $ map relBuild $ splitter $ map tail ln | 303 | relBuilder tr =
let ln = filter (not . null) $ lines tr in
if any (isPrefixOf "ERROR: ") ln || null ln then
fail "Classification via Pellet failed! Ontology might be inconsistent!"
else return $ map relBuild $ splitter $ map tail ln | 244 | true | true | 0 | 12 | 79 | 107 | 51 | 56 | null | null |
keithodulaigh/Hets | mini/Main.hs | gpl-2.0 | logicGraph = ([("L1", G_logic L1), ("L2", G_logic L2)],
[("T1", G_LTR t1)]) | 89 | logicGraph = ([("L1", G_logic L1), ("L2", G_logic L2)],
[("T1", G_LTR t1)]) | 89 | logicGraph = ([("L1", G_logic L1), ("L2", G_logic L2)],
[("T1", G_LTR t1)]) | 89 | false | false | 0 | 8 | 24 | 48 | 28 | 20 | null | null |
lukexi/ghc-7.8-arm64 | testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs | bsd-3-clause | foo4 = coerce $ one :: Down Int | 31 | foo4 = coerce $ one :: Down Int | 31 | foo4 = coerce $ one :: Down Int | 31 | false | false | 0 | 5 | 7 | 16 | 8 | 8 | null | null |
psibi/yesod | yesod-core/test/Hierarchy.hs | mit | getGet2 :: Handler site String; getGet2 = "get" | 49 | getGet2 :: Handler site String
getGet2 = "get" | 48 | getGet2 = "get" | 15 | false | true | 0 | 5 | 9 | 17 | 9 | 8 | null | null |
lachrist/kusasa-hs | semantic.hs | gpl-2.0 | applyFunction "?*" ((DNumber f1):(DNumber f2):[]) = DNumber $ f1*f2 | 68 | applyFunction "?*" ((DNumber f1):(DNumber f2):[]) = DNumber $ f1*f2 | 68 | applyFunction "?*" ((DNumber f1):(DNumber f2):[]) = DNumber $ f1*f2 | 68 | false | false | 0 | 10 | 9 | 44 | 22 | 22 | null | null |
dmvianna/haskellbook | src/Ch27-StrictTest1.hs | unlicense | twoEls = Cons 1 (Cons undefined Nil) | 36 | twoEls = Cons 1 (Cons undefined Nil) | 36 | twoEls = Cons 1 (Cons undefined Nil) | 36 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
mbakke/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | hvCdromImagePath :: String
hvCdromImagePath = "cdrom_image_path" | 64 | hvCdromImagePath :: String
hvCdromImagePath = "cdrom_image_path" | 64 | hvCdromImagePath = "cdrom_image_path" | 37 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
sharkspeed/dororis | languages/haskell/LYHGG/2-starting-out/2-lists-intro.hs | bsd-2-clause | boomBangs xs = [if x < 10 then "BOOM!" else "BANG!" | x <- xs, odd x] | 69 | boomBangs xs = [if x < 10 then "BOOM!" else "BANG!" | x <- xs, odd x] | 69 | boomBangs xs = [if x < 10 then "BOOM!" else "BANG!" | x <- xs, odd x] | 69 | false | false | 0 | 7 | 16 | 39 | 20 | 19 | null | null |
Helkafen/haddock | haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs | bsd-2-clause | isIdentifier _ = False | 22 | isIdentifier _ = False | 22 | isIdentifier _ = False | 22 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
kojiromike/Idris-dev | src/Idris/IdrisDoc.hs | bsd-3-clause | nbsp :: H.Html
nbsp = preEscapedToHtml (" " :: String) | 59 | nbsp :: H.Html
nbsp = preEscapedToHtml (" " :: String) | 59 | nbsp = preEscapedToHtml (" " :: String) | 44 | false | true | 0 | 7 | 8 | 28 | 13 | 15 | null | null |
mrakgr/futhark | src/Language/Futhark/Traversals.hs | bsd-3-clause | mapUserTypeM tv (UserArray t d loc) =
UserArray <$> mapUserTypeM tv t <*> mapDimDecl tv d <*> pure loc | 104 | mapUserTypeM tv (UserArray t d loc) =
UserArray <$> mapUserTypeM tv t <*> mapDimDecl tv d <*> pure loc | 104 | mapUserTypeM tv (UserArray t d loc) =
UserArray <$> mapUserTypeM tv t <*> mapDimDecl tv d <*> pure loc | 104 | false | false | 0 | 8 | 20 | 46 | 21 | 25 | null | null |
IreneKnapp/qmic | Haskell/Main.hs | mit | englishList [item1, item2] = item1 ++ " and " ++ item2 | 54 | englishList [item1, item2] = item1 ++ " and " ++ item2 | 54 | englishList [item1, item2] = item1 ++ " and " ++ item2 | 54 | false | false | 0 | 6 | 10 | 23 | 12 | 11 | null | null |
HIPERFIT/futhark | src/Futhark/Optimise/Simplify/Engine.hs | isc | hoistStms ::
SimplifiableRep rep =>
RuleBook (Wise rep) ->
BlockPred (Wise rep) ->
Stms (Wise rep) ->
SimpleM rep (a, UT.UsageTable) ->
SimpleM rep (a, Stms (Wise rep), Stms (Wise rep))
hoistStms rules block orig_stms final = do
(a, blocked, hoisted) <- simplifyStmsBottomUp orig_stms
unless (null hoisted) changed
pure (a, stmsFromList blocked, stmsFromList hoisted)
where
simplifyStmsBottomUp stms = do
opUsage <- asks $ opUsageS . fst
let usageInStm stm =
UT.usageInStm stm
<> case stmExp stm of
Op op -> opUsage op
_ -> mempty
(x, _, stms') <- hoistableStms usageInStm stms
-- We need to do a final pass to ensure that nothing is
-- hoisted past something that it depends on.
let (blocked, hoisted) = partitionEithers $ blockUnhoistedDeps stms'
pure (x, blocked, hoisted)
descend usageInStm stms m =
case stmsHead stms of
Nothing -> m
Just (stms_h, stms_t) -> localVtable (ST.insertStm stms_h) $ do
(x, usage, stms_t') <- descend usageInStm stms_t m
process usageInStm stms_h stms_t' usage x
process usageInStm stm stms usage x = do
vtable <- askVtable
res <- bottomUpSimplifyStm rules (vtable, usage) stm
case res of
Nothing -- Nothing to optimise - see if hoistable.
| block vtable usage stm ->
-- No, not hoistable.
pure
( x,
expandUsage usageInStm vtable usage stm
`UT.without` provides stm,
Left stm : stms
)
| otherwise ->
-- Yes, hoistable.
pure
( x,
expandUsage usageInStm vtable usage stm,
Right stm : stms
)
Just optimstms -> do
changed
descend usageInStm optimstms $ pure (x, usage, stms)
hoistableStms usageInStm stms =
case stmsHead stms of
Nothing -> do
(x, usage) <- final
pure (x, usage, mempty)
Just (stms_h, stms_t) -> do
stms_h' <- nonrecSimplifyStm stms_h
vtable <- askVtable
simplified <- topDownSimplifyStm rules vtable stms_h'
case simplified of
Just newstms -> do
changed
hoistableStms usageInStm (newstms <> stms_t)
Nothing -> do
(x, usage, stms_t') <-
localVtable (ST.insertStm stms_h') $
hoistableStms usageInStm stms_t
if not $ any (`UT.isUsedDirectly` usage) $ provides stms_h'
then -- Dead statement.
pure (x, usage, stms_t')
else do
(stms_h_stms, stms_h'') <- recSimplifyStm stms_h' usage
descend usageInStm stms_h_stms $
process usageInStm stms_h'' stms_t' usage x | 2,945 | hoistStms ::
SimplifiableRep rep =>
RuleBook (Wise rep) ->
BlockPred (Wise rep) ->
Stms (Wise rep) ->
SimpleM rep (a, UT.UsageTable) ->
SimpleM rep (a, Stms (Wise rep), Stms (Wise rep))
hoistStms rules block orig_stms final = do
(a, blocked, hoisted) <- simplifyStmsBottomUp orig_stms
unless (null hoisted) changed
pure (a, stmsFromList blocked, stmsFromList hoisted)
where
simplifyStmsBottomUp stms = do
opUsage <- asks $ opUsageS . fst
let usageInStm stm =
UT.usageInStm stm
<> case stmExp stm of
Op op -> opUsage op
_ -> mempty
(x, _, stms') <- hoistableStms usageInStm stms
-- We need to do a final pass to ensure that nothing is
-- hoisted past something that it depends on.
let (blocked, hoisted) = partitionEithers $ blockUnhoistedDeps stms'
pure (x, blocked, hoisted)
descend usageInStm stms m =
case stmsHead stms of
Nothing -> m
Just (stms_h, stms_t) -> localVtable (ST.insertStm stms_h) $ do
(x, usage, stms_t') <- descend usageInStm stms_t m
process usageInStm stms_h stms_t' usage x
process usageInStm stm stms usage x = do
vtable <- askVtable
res <- bottomUpSimplifyStm rules (vtable, usage) stm
case res of
Nothing -- Nothing to optimise - see if hoistable.
| block vtable usage stm ->
-- No, not hoistable.
pure
( x,
expandUsage usageInStm vtable usage stm
`UT.without` provides stm,
Left stm : stms
)
| otherwise ->
-- Yes, hoistable.
pure
( x,
expandUsage usageInStm vtable usage stm,
Right stm : stms
)
Just optimstms -> do
changed
descend usageInStm optimstms $ pure (x, usage, stms)
hoistableStms usageInStm stms =
case stmsHead stms of
Nothing -> do
(x, usage) <- final
pure (x, usage, mempty)
Just (stms_h, stms_t) -> do
stms_h' <- nonrecSimplifyStm stms_h
vtable <- askVtable
simplified <- topDownSimplifyStm rules vtable stms_h'
case simplified of
Just newstms -> do
changed
hoistableStms usageInStm (newstms <> stms_t)
Nothing -> do
(x, usage, stms_t') <-
localVtable (ST.insertStm stms_h') $
hoistableStms usageInStm stms_t
if not $ any (`UT.isUsedDirectly` usage) $ provides stms_h'
then -- Dead statement.
pure (x, usage, stms_t')
else do
(stms_h_stms, stms_h'') <- recSimplifyStm stms_h' usage
descend usageInStm stms_h_stms $
process usageInStm stms_h'' stms_t' usage x | 2,945 | hoistStms rules block orig_stms final = do
(a, blocked, hoisted) <- simplifyStmsBottomUp orig_stms
unless (null hoisted) changed
pure (a, stmsFromList blocked, stmsFromList hoisted)
where
simplifyStmsBottomUp stms = do
opUsage <- asks $ opUsageS . fst
let usageInStm stm =
UT.usageInStm stm
<> case stmExp stm of
Op op -> opUsage op
_ -> mempty
(x, _, stms') <- hoistableStms usageInStm stms
-- We need to do a final pass to ensure that nothing is
-- hoisted past something that it depends on.
let (blocked, hoisted) = partitionEithers $ blockUnhoistedDeps stms'
pure (x, blocked, hoisted)
descend usageInStm stms m =
case stmsHead stms of
Nothing -> m
Just (stms_h, stms_t) -> localVtable (ST.insertStm stms_h) $ do
(x, usage, stms_t') <- descend usageInStm stms_t m
process usageInStm stms_h stms_t' usage x
process usageInStm stm stms usage x = do
vtable <- askVtable
res <- bottomUpSimplifyStm rules (vtable, usage) stm
case res of
Nothing -- Nothing to optimise - see if hoistable.
| block vtable usage stm ->
-- No, not hoistable.
pure
( x,
expandUsage usageInStm vtable usage stm
`UT.without` provides stm,
Left stm : stms
)
| otherwise ->
-- Yes, hoistable.
pure
( x,
expandUsage usageInStm vtable usage stm,
Right stm : stms
)
Just optimstms -> do
changed
descend usageInStm optimstms $ pure (x, usage, stms)
hoistableStms usageInStm stms =
case stmsHead stms of
Nothing -> do
(x, usage) <- final
pure (x, usage, mempty)
Just (stms_h, stms_t) -> do
stms_h' <- nonrecSimplifyStm stms_h
vtable <- askVtable
simplified <- topDownSimplifyStm rules vtable stms_h'
case simplified of
Just newstms -> do
changed
hoistableStms usageInStm (newstms <> stms_t)
Nothing -> do
(x, usage, stms_t') <-
localVtable (ST.insertStm stms_h') $
hoistableStms usageInStm stms_t
if not $ any (`UT.isUsedDirectly` usage) $ provides stms_h'
then -- Dead statement.
pure (x, usage, stms_t')
else do
(stms_h_stms, stms_h'') <- recSimplifyStm stms_h' usage
descend usageInStm stms_h_stms $
process usageInStm stms_h'' stms_t' usage x | 2,747 | false | true | 3 | 21 | 1,091 | 827 | 403 | 424 | null | null |
romanb/amazonka | amazonka-ec2/gen/Network/AWS/EC2/AttachClassicLinkVpc.hs | mpl-2.0 | -- | 'AttachClassicLinkVpcResponse' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'aclvrReturn' @::@ 'Maybe' 'Bool'
--
attachClassicLinkVpcResponse :: AttachClassicLinkVpcResponse
attachClassicLinkVpcResponse = AttachClassicLinkVpcResponse
{ _aclvrReturn = Nothing
} | 311 | attachClassicLinkVpcResponse :: AttachClassicLinkVpcResponse
attachClassicLinkVpcResponse = AttachClassicLinkVpcResponse
{ _aclvrReturn = Nothing
} | 155 | attachClassicLinkVpcResponse = AttachClassicLinkVpcResponse
{ _aclvrReturn = Nothing
} | 94 | true | true | 0 | 6 | 39 | 25 | 17 | 8 | null | null |
shockkolate/lambdircd | src/IRCD/Helper.hs | apache-2.0 | checkClient :: Int -> State Env (Maybe Client)
checkClient uid' = do
uids <- gets (byUid . envClients)
return (IM.lookup uid' uids) | 139 | checkClient :: Int -> State Env (Maybe Client)
checkClient uid' = do
uids <- gets (byUid . envClients)
return (IM.lookup uid' uids) | 139 | checkClient uid' = do
uids <- gets (byUid . envClients)
return (IM.lookup uid' uids) | 92 | false | true | 0 | 10 | 29 | 62 | 29 | 33 | null | null |
troydm/edda | src/EDDA/Data/Cache.hs | mit | newCache :: Int64 -> IO (Cache a)
newCache t = newMVar (t, Nothing) | 67 | newCache :: Int64 -> IO (Cache a)
newCache t = newMVar (t, Nothing) | 67 | newCache t = newMVar (t, Nothing) | 33 | false | true | 0 | 8 | 12 | 36 | 18 | 18 | null | null |
nyson/haste-compiler | build-release.hs | bsd-3-clause | bootPortable = do
-- Build libs
run_ "haste-compiler/bin/haste-boot" ["--force", "--initial"] ""
-- Remove unnecessary binaries
case os of
"mingw32" -> do
-- windows
rm "haste-compiler\\bin\\haste-boot.exe"
_ -> do
-- linux/darwin
rm "haste-compiler/bin/haste-boot"
forEachFile "haste-compiler" $ \f -> do
when ((f `hasExt` ".o") || (f `hasExt` ".a")) $ rm f
where
f `hasExt` e = takeExtension f == e | 477 | bootPortable = do
-- Build libs
run_ "haste-compiler/bin/haste-boot" ["--force", "--initial"] ""
-- Remove unnecessary binaries
case os of
"mingw32" -> do
-- windows
rm "haste-compiler\\bin\\haste-boot.exe"
_ -> do
-- linux/darwin
rm "haste-compiler/bin/haste-boot"
forEachFile "haste-compiler" $ \f -> do
when ((f `hasExt` ".o") || (f `hasExt` ".a")) $ rm f
where
f `hasExt` e = takeExtension f == e | 477 | bootPortable = do
-- Build libs
run_ "haste-compiler/bin/haste-boot" ["--force", "--initial"] ""
-- Remove unnecessary binaries
case os of
"mingw32" -> do
-- windows
rm "haste-compiler\\bin\\haste-boot.exe"
_ -> do
-- linux/darwin
rm "haste-compiler/bin/haste-boot"
forEachFile "haste-compiler" $ \f -> do
when ((f `hasExt` ".o") || (f `hasExt` ".a")) $ rm f
where
f `hasExt` e = takeExtension f == e | 477 | false | false | 1 | 16 | 134 | 134 | 67 | 67 | null | null |
atsukotakahashi/wi | src/library/Yi/Verifier/JavaScript.hs | gpl-2.0 | say :: MonadWriter (D.DList a) m => a -> m ()
say = tell . D.singleton | 70 | say :: MonadWriter (D.DList a) m => a -> m ()
say = tell . D.singleton | 70 | say = tell . D.singleton | 24 | false | true | 1 | 10 | 15 | 50 | 22 | 28 | null | null |
michiexile/hplex | pershom/src/Math/Simplicial/GradedChain.hs | bsd-3-clause | -- | 'trimCoefficients' takes a chain in map form and removes zero entries. O(n).
trimCoefficients :: (Ord a, R.Ring b) => Map.Map (Nat.N, S.Simplex a) b -> Map.Map (Nat.N, S.Simplex a) b
trimCoefficients = Map.filterWithKey (\ (_, s) c -> not (S.isNullSimplex s || c == M.nil)) | 278 | trimCoefficients :: (Ord a, R.Ring b) => Map.Map (Nat.N, S.Simplex a) b -> Map.Map (Nat.N, S.Simplex a) b
trimCoefficients = Map.filterWithKey (\ (_, s) c -> not (S.isNullSimplex s || c == M.nil)) | 196 | trimCoefficients = Map.filterWithKey (\ (_, s) c -> not (S.isNullSimplex s || c == M.nil)) | 90 | true | true | 0 | 13 | 46 | 120 | 61 | 59 | null | null |
ajscholl/primitive-simd | Generator.hs | bsd-3-clause | getUnderlyingPrimType t = t ++ "#" | 41 | getUnderlyingPrimType t = t ++ "#" | 41 | getUnderlyingPrimType t = t ++ "#" | 41 | false | false | 0 | 5 | 12 | 13 | 6 | 7 | null | null |
elieux/ghc | compiler/hsSyn/HsUtils.hs | bsd-3-clause | ----------------- Patterns --------------------------
collectPatBinders :: LPat a -> [a]
collectPatBinders pat = collect_lpat pat [] | 132 | collectPatBinders :: LPat a -> [a]
collectPatBinders pat = collect_lpat pat [] | 78 | collectPatBinders pat = collect_lpat pat [] | 43 | true | true | 0 | 8 | 14 | 37 | 17 | 20 | null | null |
penteract/HigherOrderHornRefinement | HOCHC/ExecLib.hs | bsd-3-clause | mkUsage opts fn handle = getProgName >>= hPutStrLn handle . flip usageInfo opts . fn | 84 | mkUsage opts fn handle = getProgName >>= hPutStrLn handle . flip usageInfo opts . fn | 84 | mkUsage opts fn handle = getProgName >>= hPutStrLn handle . flip usageInfo opts . fn | 84 | false | false | 0 | 8 | 14 | 33 | 15 | 18 | null | null |
joelwilliamson/validator | CheckFile.hs | agpl-3.0 | stripBoM input = if BS.length input < 3
then input
else case BS.take 3 input of
"\xef\xbb\xbf" → BS.drop 3 input
_ → input | 194 | stripBoM input = if BS.length input < 3
then input
else case BS.take 3 input of
"\xef\xbb\xbf" → BS.drop 3 input
_ → input | 194 | stripBoM input = if BS.length input < 3
then input
else case BS.take 3 input of
"\xef\xbb\xbf" → BS.drop 3 input
_ → input | 194 | false | false | 0 | 10 | 95 | 56 | 27 | 29 | null | null |
alpheccar/diagrams-pdf | src/Diagrams/Backend/Pdf.hs | bsd-3-clause | setShading :: PdfShadingData -> DrawS ()
setShading (PdfAxialShadingData pa pb ca cb) = do
let (ra,ga,ba,_) = colorToSRGBA ca
(rb,gb,bb,_) = colorToSRGBA cb
colora = Rgb ra ga ba
colorb = Rgb rb gb bb
(xa,ya) = unp2 pa
(xb,yb) = unp2 pb
setShadingData $ Just (AxialShading xa ya xb yb colora colorb) | 338 | setShading :: PdfShadingData -> DrawS ()
setShading (PdfAxialShadingData pa pb ca cb) = do
let (ra,ga,ba,_) = colorToSRGBA ca
(rb,gb,bb,_) = colorToSRGBA cb
colora = Rgb ra ga ba
colorb = Rgb rb gb bb
(xa,ya) = unp2 pa
(xb,yb) = unp2 pb
setShadingData $ Just (AxialShading xa ya xb yb colora colorb) | 338 | setShading (PdfAxialShadingData pa pb ca cb) = do
let (ra,ga,ba,_) = colorToSRGBA ca
(rb,gb,bb,_) = colorToSRGBA cb
colora = Rgb ra ga ba
colorb = Rgb rb gb bb
(xa,ya) = unp2 pa
(xb,yb) = unp2 pb
setShadingData $ Just (AxialShading xa ya xb yb colora colorb) | 297 | false | true | 0 | 10 | 91 | 165 | 83 | 82 | null | null |
dbp/misc | misc.hs | isc | invModBrute :: Integer -> Integer -> [(Integer,Integer)]
invModBrute n m = filter (\(_,b) -> b == 1) $ map (\x -> (x, n * x `mod` m)) [1..m-1] | 142 | invModBrute :: Integer -> Integer -> [(Integer,Integer)]
invModBrute n m = filter (\(_,b) -> b == 1) $ map (\x -> (x, n * x `mod` m)) [1..m-1] | 142 | invModBrute n m = filter (\(_,b) -> b == 1) $ map (\x -> (x, n * x `mod` m)) [1..m-1] | 85 | false | true | 0 | 11 | 27 | 96 | 54 | 42 | null | null |
hsyl20/ViperVM | haskus-system/src/lib/Haskus/System/Linux/Internals/FileSystem.hs | bsd-3-clause | -- | BLKRAGET get current read ahead setting
ioctlGetReadAhead :: MonadInIO m => Handle -> FlowT '[ErrorCode] m CLong
ioctlGetReadAhead = ioctlReadCmd (ioctlCommand None 0x12 99 0) | 180 | ioctlGetReadAhead :: MonadInIO m => Handle -> FlowT '[ErrorCode] m CLong
ioctlGetReadAhead = ioctlReadCmd (ioctlCommand None 0x12 99 0) | 135 | ioctlGetReadAhead = ioctlReadCmd (ioctlCommand None 0x12 99 0) | 62 | true | true | 0 | 9 | 26 | 50 | 25 | 25 | null | null |
chengzh2008/hpffp | src/ch21-Traversable/simplifyCode.hs | bsd-3-clause | decodeFn :: String -> Either Err SomeObj
decodeFn = undefined | 61 | decodeFn :: String -> Either Err SomeObj
decodeFn = undefined | 61 | decodeFn = undefined | 20 | false | true | 0 | 6 | 9 | 20 | 10 | 10 | null | null |
Tim-Tom/scratch | single-substitution-cipher/single-substitution.hs | unlicense | solveRec :: State -> [Char] -> [Map.Map Char Char] -> [Map.Map Char Char]
solveRec s [] solutions =
-- Lazy here. I should put better error messages in for debug
-- assert (all character lists have one element)
-- assert (all words have one possibilitiy)
(Map.map (\(e:[]) -> e) (characters s)) : solutions | 314 | solveRec :: State -> [Char] -> [Map.Map Char Char] -> [Map.Map Char Char]
solveRec s [] solutions =
-- Lazy here. I should put better error messages in for debug
-- assert (all character lists have one element)
-- assert (all words have one possibilitiy)
(Map.map (\(e:[]) -> e) (characters s)) : solutions | 314 | solveRec s [] solutions =
-- Lazy here. I should put better error messages in for debug
-- assert (all character lists have one element)
-- assert (all words have one possibilitiy)
(Map.map (\(e:[]) -> e) (characters s)) : solutions | 240 | false | true | 0 | 12 | 60 | 95 | 51 | 44 | null | null |
dorchard/gram_lang | repl/app/Language/Granule/Main.hs | bsd-3-clause | processFilesREPL :: [FilePath] -> (FilePath -> REPLStateIO a) -> REPLStateIO [[a]]
processFilesREPL globPatterns f = forM globPatterns (\p -> do
filePaths <- liftIO $ glob p
case filePaths of
[] -> lift $ Ex.throwError (FilePathError p)
_ -> forM filePaths f) | 279 | processFilesREPL :: [FilePath] -> (FilePath -> REPLStateIO a) -> REPLStateIO [[a]]
processFilesREPL globPatterns f = forM globPatterns (\p -> do
filePaths <- liftIO $ glob p
case filePaths of
[] -> lift $ Ex.throwError (FilePathError p)
_ -> forM filePaths f) | 279 | processFilesREPL globPatterns f = forM globPatterns (\p -> do
filePaths <- liftIO $ glob p
case filePaths of
[] -> lift $ Ex.throwError (FilePathError p)
_ -> forM filePaths f) | 196 | false | true | 0 | 16 | 60 | 114 | 56 | 58 | null | null |
fmapfmapfmap/amazonka | amazonka-opsworks/gen/Network/AWS/OpsWorks/Types/Product.hs | mpl-2.0 | -- | The instance
-- <http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html Elastic IP address>.
iElasticIP :: Lens' Instance (Maybe Text)
iElasticIP = lens _iElasticIP (\ s a -> s{_iElasticIP = a}) | 225 | iElasticIP :: Lens' Instance (Maybe Text)
iElasticIP = lens _iElasticIP (\ s a -> s{_iElasticIP = a}) | 101 | iElasticIP = lens _iElasticIP (\ s a -> s{_iElasticIP = a}) | 59 | true | true | 0 | 9 | 25 | 47 | 26 | 21 | null | null |
vladfi1/game-ai | lib/Tree.hs | mit | fromVector :: Monoid a => Vector a -> RangeTree a
fromVector vector =
if len == 1 then Leaf $ Vector.head vector else
let (leftVector, rightVector) = Vector.splitAt (quot len 2) vector
left = fromVector leftVector
right = fromVector rightVector
in Node {
size = len,
val = val left <> val right,
left = left,
right = right
}
where len = Vector.length vector | 414 | fromVector :: Monoid a => Vector a -> RangeTree a
fromVector vector =
if len == 1 then Leaf $ Vector.head vector else
let (leftVector, rightVector) = Vector.splitAt (quot len 2) vector
left = fromVector leftVector
right = fromVector rightVector
in Node {
size = len,
val = val left <> val right,
left = left,
right = right
}
where len = Vector.length vector | 414 | fromVector vector =
if len == 1 then Leaf $ Vector.head vector else
let (leftVector, rightVector) = Vector.splitAt (quot len 2) vector
left = fromVector leftVector
right = fromVector rightVector
in Node {
size = len,
val = val left <> val right,
left = left,
right = right
}
where len = Vector.length vector | 364 | false | true | 0 | 12 | 121 | 150 | 76 | 74 | null | null |
MichaeGon/java | ClassFileParser.hs | mit | acodearray :: Int -> Parser [Instruction]
acodearray n
| n == 0 = return []
| n > 0 = parseInst >>= app
| otherwise = error "acodearray: internal error"
where
app (i, l) = (i :) <$> acodearray l
parseInst = u1 >>= retval
retval t = (,) <$> inst <*> return (n - m - 1)
where
inst = Instruction t s <$> sptake
(s, m) = opcodes ! t
sptake
| t == 0xc4 = u1 >>= wideCheck -- wide
| otherwise = take m
wideCheck x
| x `elem` pack (0xa9 : [0x15..0x19] ++ [0x36..0x3a]) = cons x <$> take 2 -- <x>load, <x>store, ret
| otherwise = cons x <$> take 4
-- end | 743 | acodearray :: Int -> Parser [Instruction]
acodearray n
| n == 0 = return []
| n > 0 = parseInst >>= app
| otherwise = error "acodearray: internal error"
where
app (i, l) = (i :) <$> acodearray l
parseInst = u1 >>= retval
retval t = (,) <$> inst <*> return (n - m - 1)
where
inst = Instruction t s <$> sptake
(s, m) = opcodes ! t
sptake
| t == 0xc4 = u1 >>= wideCheck -- wide
| otherwise = take m
wideCheck x
| x `elem` pack (0xa9 : [0x15..0x19] ++ [0x36..0x3a]) = cons x <$> take 2 -- <x>load, <x>store, ret
| otherwise = cons x <$> take 4
-- end | 743 | acodearray n
| n == 0 = return []
| n > 0 = parseInst >>= app
| otherwise = error "acodearray: internal error"
where
app (i, l) = (i :) <$> acodearray l
parseInst = u1 >>= retval
retval t = (,) <$> inst <*> return (n - m - 1)
where
inst = Instruction t s <$> sptake
(s, m) = opcodes ! t
sptake
| t == 0xc4 = u1 >>= wideCheck -- wide
| otherwise = take m
wideCheck x
| x `elem` pack (0xa9 : [0x15..0x19] ++ [0x36..0x3a]) = cons x <$> take 2 -- <x>load, <x>store, ret
| otherwise = cons x <$> take 4
-- end | 701 | false | true | 1 | 15 | 315 | 277 | 138 | 139 | null | null |
rueshyna/gogol | gogol-proximitybeacon/gen/Network/Google/Resource/ProximityBeacon/Beacons/Attachments/BatchDelete.hs | mpl-2.0 | -- | OAuth bearer token.
babdBearerToken :: Lens' BeaconsAttachmentsBatchDelete (Maybe Text)
babdBearerToken
= lens _babdBearerToken
(\ s a -> s{_babdBearerToken = a}) | 175 | babdBearerToken :: Lens' BeaconsAttachmentsBatchDelete (Maybe Text)
babdBearerToken
= lens _babdBearerToken
(\ s a -> s{_babdBearerToken = a}) | 150 | babdBearerToken
= lens _babdBearerToken
(\ s a -> s{_babdBearerToken = a}) | 82 | true | true | 0 | 9 | 29 | 48 | 25 | 23 | null | null |
vTurbine/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | complementIntegerIdKey = mkPreludeMiscIdUnique 94 | 56 | complementIntegerIdKey = mkPreludeMiscIdUnique 94 | 56 | complementIntegerIdKey = mkPreludeMiscIdUnique 94 | 56 | false | false | 0 | 5 | 10 | 9 | 4 | 5 | null | null |
mrakgr/futhark | src/Futhark/Interpreter.hs | bsd-3-clause | arrayVal :: [Value] -> PrimType -> [Int] -> Value
arrayVal vs bt shape =
ArrayVal (listArray (0,product shape-1) vs') bt shape
where vs' = concatMap flatten vs
flatten (PrimVal bv) = [bv]
flatten (ArrayVal arr _ _) = elems arr | 251 | arrayVal :: [Value] -> PrimType -> [Int] -> Value
arrayVal vs bt shape =
ArrayVal (listArray (0,product shape-1) vs') bt shape
where vs' = concatMap flatten vs
flatten (PrimVal bv) = [bv]
flatten (ArrayVal arr _ _) = elems arr | 251 | arrayVal vs bt shape =
ArrayVal (listArray (0,product shape-1) vs') bt shape
where vs' = concatMap flatten vs
flatten (PrimVal bv) = [bv]
flatten (ArrayVal arr _ _) = elems arr | 201 | false | true | 2 | 10 | 64 | 114 | 58 | 56 | null | null |
rumuki/rumuki-server | src/Handler/Extension.hs | gpl-3.0 | -- | Syntatic sugar, alias for @Just@
whitelist :: [Text] -> Maybe [Text]
whitelist = Just | 90 | whitelist :: [Text] -> Maybe [Text]
whitelist = Just | 52 | whitelist = Just | 16 | true | true | 0 | 8 | 15 | 31 | 15 | 16 | null | null |
xu-hao/QueryArrow | QueryArrow-db-filesystem/src/QueryArrow/FileSystem/Query.hs | bsd-3-clause | fsTranslateQuery _ ret (FAtomic2 _ (Atom (FileSizePredName _) [arg1, arg2])) env = do
o <- evalRef arg1
absp <- fileObjectPath o
s <- fssize absp
a <- evalInteger arg2
unless (s == a) stop | 204 | fsTranslateQuery _ ret (FAtomic2 _ (Atom (FileSizePredName _) [arg1, arg2])) env = do
o <- evalRef arg1
absp <- fileObjectPath o
s <- fssize absp
a <- evalInteger arg2
unless (s == a) stop | 204 | fsTranslateQuery _ ret (FAtomic2 _ (Atom (FileSizePredName _) [arg1, arg2])) env = do
o <- evalRef arg1
absp <- fileObjectPath o
s <- fssize absp
a <- evalInteger arg2
unless (s == a) stop | 204 | false | false | 2 | 10 | 49 | 101 | 45 | 56 | null | null |
Mahdi89/eTeak | src/GuiSupport.hs | bsd-3-clause | violet :: Colour
violet = (0.85, 0.51, 0.93) | 48 | violet :: Colour
violet = (0.85, 0.51, 0.93) | 44 | violet = (0.85, 0.51, 0.93) | 27 | false | true | 1 | 6 | 11 | 24 | 12 | 12 | null | null |
zmactep/less-wrong | src/LessWrong/COC/Parser.hs | bsd-3-clause | applicationTerm :: Parser Term
applicationTerm = do alg <- naturalTerm
dat <- some nonArrowTerm
pure $ foldl App alg dat | 162 | applicationTerm :: Parser Term
applicationTerm = do alg <- naturalTerm
dat <- some nonArrowTerm
pure $ foldl App alg dat | 162 | applicationTerm = do alg <- naturalTerm
dat <- some nonArrowTerm
pure $ foldl App alg dat | 131 | false | true | 0 | 8 | 61 | 45 | 20 | 25 | null | null |
pbrisbin/drync | main.hs | mit | scopes :: [OAuth2Scope]
scopes = ["https://www.googleapis.com/auth/drive"] | 74 | scopes :: [OAuth2Scope]
scopes = ["https://www.googleapis.com/auth/drive"] | 74 | scopes = ["https://www.googleapis.com/auth/drive"] | 50 | false | true | 0 | 5 | 5 | 17 | 10 | 7 | null | null |
NerdGGuy/wai-middleware-session-stateless | example/POSIXTime.hs | mit | --------------------------------------------------
login :: BSC8.ByteString -> Middleware
login email app req sendResponse = do
nonce <- liftIO setSessionNOncePOSIXTimeNow
setSession (SetSessionConfig [("email", email)] nonce "HMAC" getKey) app req sendResponse | 271 | login :: BSC8.ByteString -> Middleware
login email app req sendResponse = do
nonce <- liftIO setSessionNOncePOSIXTimeNow
setSession (SetSessionConfig [("email", email)] nonce "HMAC" getKey) app req sendResponse | 219 | login email app req sendResponse = do
nonce <- liftIO setSessionNOncePOSIXTimeNow
setSession (SetSessionConfig [("email", email)] nonce "HMAC" getKey) app req sendResponse | 180 | true | true | 0 | 11 | 36 | 70 | 35 | 35 | null | null |
ethercrow/docopt.hs | System/Console/Docopt/QQ.hs | mit | docoptFile :: QuasiQuoter
docoptFile = quoteFile docopt | 55 | docoptFile :: QuasiQuoter
docoptFile = quoteFile docopt | 55 | docoptFile = quoteFile docopt | 29 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
sherwoodwang/wxHaskell | wx/src/Graphics/UI/WX/Window.hs | lgpl-2.1 | initialBorder cont props style
= case filterProperty border props of
(PropValue x, ps) -> cont ps (setBitMask x style)
(PropModify f, ps) -> cont ps (setBitMask (f (fromBitMask style)) style)
(PropNone, ps) -> cont ps style
{--------------------------------------------------------------------------------
Events
--------------------------------------------------------------------------------} | 423 | initialBorder cont props style
= case filterProperty border props of
(PropValue x, ps) -> cont ps (setBitMask x style)
(PropModify f, ps) -> cont ps (setBitMask (f (fromBitMask style)) style)
(PropNone, ps) -> cont ps style
{--------------------------------------------------------------------------------
Events
--------------------------------------------------------------------------------} | 423 | initialBorder cont props style
= case filterProperty border props of
(PropValue x, ps) -> cont ps (setBitMask x style)
(PropModify f, ps) -> cont ps (setBitMask (f (fromBitMask style)) style)
(PropNone, ps) -> cont ps style
{--------------------------------------------------------------------------------
Events
--------------------------------------------------------------------------------} | 423 | false | false | 0 | 14 | 67 | 108 | 54 | 54 | null | null |
thomie/vector | Data/Vector/Storable.hs | bsd-3-clause | any = G.any | 11 | any = G.any | 11 | any = G.any | 11 | false | false | 1 | 6 | 2 | 12 | 4 | 8 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/THNames.hs | bsd-3-clause | forImpDName = libFun (fsLit "forImpD") forImpDIdKey | 93 | forImpDName = libFun (fsLit "forImpD") forImpDIdKey | 93 | forImpDName = libFun (fsLit "forImpD") forImpDIdKey | 93 | false | false | 0 | 7 | 47 | 17 | 8 | 9 | null | null |
hvr/lzma | src/Codec/Compression/Lzma.hs | bsd-3-clause | -- | Incremental compression in the 'IO' monad.
compressIO :: CompressParams -> IO (CompressStream IO)
compressIO parms = (stToIO $ newEncodeLzmaStream parms) >>= either throwIO go
where
bUFSIZ = 32752
go :: LzmaStream -> IO (CompressStream IO)
go ls = return inputRequired
where
inputRequired = CompressInputRequired goFlush (withChunk goFinish goInput)
goInput :: ByteString -> IO (CompressStream IO)
goInput chunk = do
(rc, used, obuf) <- stToIO $ runLzmaStream ls chunk LzmaRun bUFSIZ
let chunk' = BS.drop used chunk
case rc of
LzmaRetOK
| BS.null obuf -> do
unless (used > 0) $
fail "compressIO: input chunk not consumed"
withChunk (return inputRequired) goInput chunk'
| otherwise -> return (CompressOutputAvailable obuf
(withChunk (return inputRequired) goInput chunk'))
_ -> throwIO rc
goFlush, goFinish :: IO (CompressStream IO)
goFlush = goSync LzmaSyncFlush (return inputRequired)
goFinish = goSync LzmaFinish retStreamEnd
-- drain encoder till LzmaRetStreamEnd is reported
goSync :: LzmaAction -> IO (CompressStream IO) -> IO (CompressStream IO)
goSync LzmaRun _ = fail "goSync called with invalid argument"
goSync action next = goSync'
where
goSync' = do
(rc, 0, obuf) <- stToIO $ runLzmaStream ls BS.empty action bUFSIZ
case rc of
LzmaRetOK
| BS.null obuf -> fail ("compressIO: empty output chunk during " ++ show action)
| otherwise -> return (CompressOutputAvailable obuf goSync')
LzmaRetStreamEnd
| BS.null obuf -> next
| otherwise -> return (CompressOutputAvailable obuf next)
_ -> throwIO rc
retStreamEnd = do
!() <- stToIO (endLzmaStream ls)
return CompressStreamEnd
-- | Incremental compression in the lazy 'ST' monad. | 2,218 | compressIO :: CompressParams -> IO (CompressStream IO)
compressIO parms = (stToIO $ newEncodeLzmaStream parms) >>= either throwIO go
where
bUFSIZ = 32752
go :: LzmaStream -> IO (CompressStream IO)
go ls = return inputRequired
where
inputRequired = CompressInputRequired goFlush (withChunk goFinish goInput)
goInput :: ByteString -> IO (CompressStream IO)
goInput chunk = do
(rc, used, obuf) <- stToIO $ runLzmaStream ls chunk LzmaRun bUFSIZ
let chunk' = BS.drop used chunk
case rc of
LzmaRetOK
| BS.null obuf -> do
unless (used > 0) $
fail "compressIO: input chunk not consumed"
withChunk (return inputRequired) goInput chunk'
| otherwise -> return (CompressOutputAvailable obuf
(withChunk (return inputRequired) goInput chunk'))
_ -> throwIO rc
goFlush, goFinish :: IO (CompressStream IO)
goFlush = goSync LzmaSyncFlush (return inputRequired)
goFinish = goSync LzmaFinish retStreamEnd
-- drain encoder till LzmaRetStreamEnd is reported
goSync :: LzmaAction -> IO (CompressStream IO) -> IO (CompressStream IO)
goSync LzmaRun _ = fail "goSync called with invalid argument"
goSync action next = goSync'
where
goSync' = do
(rc, 0, obuf) <- stToIO $ runLzmaStream ls BS.empty action bUFSIZ
case rc of
LzmaRetOK
| BS.null obuf -> fail ("compressIO: empty output chunk during " ++ show action)
| otherwise -> return (CompressOutputAvailable obuf goSync')
LzmaRetStreamEnd
| BS.null obuf -> next
| otherwise -> return (CompressOutputAvailable obuf next)
_ -> throwIO rc
retStreamEnd = do
!() <- stToIO (endLzmaStream ls)
return CompressStreamEnd
-- | Incremental compression in the lazy 'ST' monad. | 2,170 | compressIO parms = (stToIO $ newEncodeLzmaStream parms) >>= either throwIO go
where
bUFSIZ = 32752
go :: LzmaStream -> IO (CompressStream IO)
go ls = return inputRequired
where
inputRequired = CompressInputRequired goFlush (withChunk goFinish goInput)
goInput :: ByteString -> IO (CompressStream IO)
goInput chunk = do
(rc, used, obuf) <- stToIO $ runLzmaStream ls chunk LzmaRun bUFSIZ
let chunk' = BS.drop used chunk
case rc of
LzmaRetOK
| BS.null obuf -> do
unless (used > 0) $
fail "compressIO: input chunk not consumed"
withChunk (return inputRequired) goInput chunk'
| otherwise -> return (CompressOutputAvailable obuf
(withChunk (return inputRequired) goInput chunk'))
_ -> throwIO rc
goFlush, goFinish :: IO (CompressStream IO)
goFlush = goSync LzmaSyncFlush (return inputRequired)
goFinish = goSync LzmaFinish retStreamEnd
-- drain encoder till LzmaRetStreamEnd is reported
goSync :: LzmaAction -> IO (CompressStream IO) -> IO (CompressStream IO)
goSync LzmaRun _ = fail "goSync called with invalid argument"
goSync action next = goSync'
where
goSync' = do
(rc, 0, obuf) <- stToIO $ runLzmaStream ls BS.empty action bUFSIZ
case rc of
LzmaRetOK
| BS.null obuf -> fail ("compressIO: empty output chunk during " ++ show action)
| otherwise -> return (CompressOutputAvailable obuf goSync')
LzmaRetStreamEnd
| BS.null obuf -> next
| otherwise -> return (CompressOutputAvailable obuf next)
_ -> throwIO rc
retStreamEnd = do
!() <- stToIO (endLzmaStream ls)
return CompressStreamEnd
-- | Incremental compression in the lazy 'ST' monad. | 2,115 | true | true | 7 | 17 | 822 | 591 | 265 | 326 | null | null |
truls/almique | src/Almique/Analyzer.hs | gpl-3.0 | mapAssignOp MinusAssign {assignOp_annot = an} = return Minus {op_annot = an} | 76 | mapAssignOp MinusAssign {assignOp_annot = an} = return Minus {op_annot = an} | 76 | mapAssignOp MinusAssign {assignOp_annot = an} = return Minus {op_annot = an} | 76 | false | false | 1 | 7 | 10 | 33 | 16 | 17 | null | null |
MnO2/lazy-doc | src/Input/Download.hs | bsd-3-clause | urls =
[("stackage.txt","https://www.stackage.org/lts/cabal.config")
,("platform.txt","https://raw.githubusercontent.com/haskell/haskell-platform/master/hptool/src/Releases2015.hs")
,("cabal.tar.gz","https://hackage.haskell.org/packages/index.tar.gz")
,("hoogle.tar.gz","https://hackage.haskell.org/packages/hoogle.tar.gz")
] | 345 | urls =
[("stackage.txt","https://www.stackage.org/lts/cabal.config")
,("platform.txt","https://raw.githubusercontent.com/haskell/haskell-platform/master/hptool/src/Releases2015.hs")
,("cabal.tar.gz","https://hackage.haskell.org/packages/index.tar.gz")
,("hoogle.tar.gz","https://hackage.haskell.org/packages/hoogle.tar.gz")
] | 345 | urls =
[("stackage.txt","https://www.stackage.org/lts/cabal.config")
,("platform.txt","https://raw.githubusercontent.com/haskell/haskell-platform/master/hptool/src/Releases2015.hs")
,("cabal.tar.gz","https://hackage.haskell.org/packages/index.tar.gz")
,("hoogle.tar.gz","https://hackage.haskell.org/packages/hoogle.tar.gz")
] | 345 | false | false | 0 | 6 | 26 | 42 | 27 | 15 | null | null |
Megaleo/Minehack | src/Attribute.hs | bsd-3-clause | attrID (PData pData) = TT.ID 3 $ show pData | 43 | attrID (PData pData) = TT.ID 3 $ show pData | 43 | attrID (PData pData) = TT.ID 3 $ show pData | 43 | false | false | 0 | 7 | 8 | 28 | 12 | 16 | null | null |
Zankoku-Okuno/templar | src/Text/Templar/Parser.hs | gpl-3.0 | parseText :: Parse Template
parseText cfg = do
let startTag = cfgStartTag cfg
startTrim = startTag <> "~"
text <- takeTillString startTag
trim <- (True <$ lookAhead (string startTrim)) <|> pure False
pure . Literal $ if trim
then T.dropWhileEnd isSpace text
else text | 307 | parseText :: Parse Template
parseText cfg = do
let startTag = cfgStartTag cfg
startTrim = startTag <> "~"
text <- takeTillString startTag
trim <- (True <$ lookAhead (string startTrim)) <|> pure False
pure . Literal $ if trim
then T.dropWhileEnd isSpace text
else text | 307 | parseText cfg = do
let startTag = cfgStartTag cfg
startTrim = startTag <> "~"
text <- takeTillString startTag
trim <- (True <$ lookAhead (string startTrim)) <|> pure False
pure . Literal $ if trim
then T.dropWhileEnd isSpace text
else text | 279 | false | true | 0 | 13 | 83 | 109 | 50 | 59 | null | null |
tomberek/rulestesting | src/Control/Arrow/CCA/AExp.hs | bsd-3-clause | normalize (First Id) = Id | 25 | normalize (First Id) = Id | 25 | normalize (First Id) = Id | 25 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
singingwolfboy/citeproc-hs | src/Text/CSL/Input/MODS.hs | bsd-3-clause | xpPage :: PU String
xpPage
= xpChoice (xpElemWithAttrValue "detail" "type" "page" $ xpIElem "number" xpText)
(xpElemWithAttrValue "extent" "unit" "page" $
xpPair (xpElem "start" xpText)
(xpElem "end" xpText))
(\(s,e) -> xpLift (s ++ "-" ++ e)) | 318 | xpPage :: PU String
xpPage
= xpChoice (xpElemWithAttrValue "detail" "type" "page" $ xpIElem "number" xpText)
(xpElemWithAttrValue "extent" "unit" "page" $
xpPair (xpElem "start" xpText)
(xpElem "end" xpText))
(\(s,e) -> xpLift (s ++ "-" ++ e)) | 318 | xpPage
= xpChoice (xpElemWithAttrValue "detail" "type" "page" $ xpIElem "number" xpText)
(xpElemWithAttrValue "extent" "unit" "page" $
xpPair (xpElem "start" xpText)
(xpElem "end" xpText))
(\(s,e) -> xpLift (s ++ "-" ++ e)) | 298 | false | true | 0 | 11 | 109 | 105 | 52 | 53 | null | null |
j5b/ps-pc | OutputProof.hs | gpl-3.0 | conceptToLatex (Or (Neg T) (Atom b)) = "\\bot \\lor "++b | 56 | conceptToLatex (Or (Neg T) (Atom b)) = "\\bot \\lor "++b | 56 | conceptToLatex (Or (Neg T) (Atom b)) = "\\bot \\lor "++b | 56 | false | false | 0 | 8 | 9 | 34 | 16 | 18 | null | null |
begriffs/postgrest | src/PostgREST/OpenAPI.hs | mit | makeMimeList :: [ContentType] -> MimeList
makeMimeList cs = MimeList $ map (fromString . toS . toMime) cs | 105 | makeMimeList :: [ContentType] -> MimeList
makeMimeList cs = MimeList $ map (fromString . toS . toMime) cs | 105 | makeMimeList cs = MimeList $ map (fromString . toS . toMime) cs | 63 | false | true | 2 | 8 | 16 | 48 | 22 | 26 | null | null |
charlescharles/mixcoin-hs | src/Mixcoin/Common/BitcoinClient.hs | mit | sendChunkWithFee :: Client -> UTXO -> UTXO -> H.Address -> BTC -> BTC -> IO ()
sendChunkWithFee c ut feeUt dest destAmt feeAmt = do
let dest' = convertAddress' dest
feeDest = convertAddress' (destAddr feeUt)
utxos = [unspentTx ut, unspentTx feeUt]
outs = [(dest', destAmt), (feeDest, feeAmt)]
raw <- B.createRawTransaction c (fromList utxos) (fromList outs)
signed <- B.signRawTransaction c raw Nothing Nothing Nothing
_ <- B.sendRawTransaction c (B.rawSigned signed)
return () | 505 | sendChunkWithFee :: Client -> UTXO -> UTXO -> H.Address -> BTC -> BTC -> IO ()
sendChunkWithFee c ut feeUt dest destAmt feeAmt = do
let dest' = convertAddress' dest
feeDest = convertAddress' (destAddr feeUt)
utxos = [unspentTx ut, unspentTx feeUt]
outs = [(dest', destAmt), (feeDest, feeAmt)]
raw <- B.createRawTransaction c (fromList utxos) (fromList outs)
signed <- B.signRawTransaction c raw Nothing Nothing Nothing
_ <- B.sendRawTransaction c (B.rawSigned signed)
return () | 505 | sendChunkWithFee c ut feeUt dest destAmt feeAmt = do
let dest' = convertAddress' dest
feeDest = convertAddress' (destAddr feeUt)
utxos = [unspentTx ut, unspentTx feeUt]
outs = [(dest', destAmt), (feeDest, feeAmt)]
raw <- B.createRawTransaction c (fromList utxos) (fromList outs)
signed <- B.signRawTransaction c raw Nothing Nothing Nothing
_ <- B.sendRawTransaction c (B.rawSigned signed)
return () | 426 | false | true | 0 | 13 | 98 | 204 | 99 | 105 | null | null |
owainlewis/bmcs-haskell-sdk | src/Network/Oracle/OCI/Common/Request.hs | bsd-3-clause | -- | Converts our intermal request structure into a Network.HTTP.Types.Request
toRequest :: OCIRequest -> H.Request
toRequest (OCIRequest host path method body hdrs query) =
let basicRequest = setRequestHost host
$ setRequestPath path
$ setRequestMethod method
$ setRequestSecure True
$ H.defaultRequest in
assignRequestBody body $ assignRequestQuery query basicRequest | 461 | toRequest :: OCIRequest -> H.Request
toRequest (OCIRequest host path method body hdrs query) =
let basicRequest = setRequestHost host
$ setRequestPath path
$ setRequestMethod method
$ setRequestSecure True
$ H.defaultRequest in
assignRequestBody body $ assignRequestQuery query basicRequest | 382 | toRequest (OCIRequest host path method body hdrs query) =
let basicRequest = setRequestHost host
$ setRequestPath path
$ setRequestMethod method
$ setRequestSecure True
$ H.defaultRequest in
assignRequestBody body $ assignRequestQuery query basicRequest | 345 | true | true | 0 | 13 | 138 | 95 | 43 | 52 | null | null |
danplubell/hbase-haskell | src/Database/HBase/Internal/Thrift/Hbase_Client.hs | mit | send_getVer op arg_tableName arg_row arg_column arg_numVersions arg_attributes = do
seq <- seqid
seqn <- readIORef seq
writeMessageBegin op ("getVer", M_CALL, seqn)
write_GetVer_args op (GetVer_args{f_GetVer_args_tableName=Just arg_tableName,f_GetVer_args_row=Just arg_row,f_GetVer_args_column=Just arg_column,f_GetVer_args_numVersions=Just arg_numVersions,f_GetVer_args_attributes=Just arg_attributes})
writeMessageEnd op
tFlush (getTransport op) | 459 | send_getVer op arg_tableName arg_row arg_column arg_numVersions arg_attributes = do
seq <- seqid
seqn <- readIORef seq
writeMessageBegin op ("getVer", M_CALL, seqn)
write_GetVer_args op (GetVer_args{f_GetVer_args_tableName=Just arg_tableName,f_GetVer_args_row=Just arg_row,f_GetVer_args_column=Just arg_column,f_GetVer_args_numVersions=Just arg_numVersions,f_GetVer_args_attributes=Just arg_attributes})
writeMessageEnd op
tFlush (getTransport op) | 459 | send_getVer op arg_tableName arg_row arg_column arg_numVersions arg_attributes = do
seq <- seqid
seqn <- readIORef seq
writeMessageBegin op ("getVer", M_CALL, seqn)
write_GetVer_args op (GetVer_args{f_GetVer_args_tableName=Just arg_tableName,f_GetVer_args_row=Just arg_row,f_GetVer_args_column=Just arg_column,f_GetVer_args_numVersions=Just arg_numVersions,f_GetVer_args_attributes=Just arg_attributes})
writeMessageEnd op
tFlush (getTransport op) | 459 | false | false | 0 | 11 | 45 | 129 | 63 | 66 | null | null |
ddssff/lens | src/System/IO/Error/Lens.hs | bsd-3-clause | _InvalidArgument :: Prism' IOErrorType ()
_InvalidArgument = only InvalidArgument | 81 | _InvalidArgument :: Prism' IOErrorType ()
_InvalidArgument = only InvalidArgument | 81 | _InvalidArgument = only InvalidArgument | 39 | false | true | 0 | 6 | 8 | 21 | 10 | 11 | null | null |
Bodigrim/arithmoi | Math/NumberTheory/Moduli/SomeMod.hs | mit | powSomeMod (InfMod r) a = InfMod (r ^ a) | 43 | powSomeMod (InfMod r) a = InfMod (r ^ a) | 43 | powSomeMod (InfMod r) a = InfMod (r ^ a) | 43 | false | false | 1 | 7 | 11 | 32 | 13 | 19 | null | null |
d0kt0r0/estuary | common/src/Estuary/Types/Definition.hs | gpl-3.0 | maybeSeeTime:: Definition -> Maybe Tempo
maybeSeeTime (SeeTime x) = Just x | 75 | maybeSeeTime:: Definition -> Maybe Tempo
maybeSeeTime (SeeTime x) = Just x | 74 | maybeSeeTime (SeeTime x) = Just x | 33 | false | true | 0 | 7 | 11 | 30 | 14 | 16 | null | null |
music-suite/music-pitch | src/Music/Pitch/Literal/Pitch.hs | bsd-3-clause | a'' = fromPitch $ viaPitchL (5, 0, 2) | 43 | a'' = fromPitch $ viaPitchL (5, 0, 2) | 43 | a'' = fromPitch $ viaPitchL (5, 0, 2) | 43 | false | false | 0 | 7 | 13 | 22 | 12 | 10 | null | null |
ysnrkdm/Hamlet | src/bench/Main.hs | mit | pns q r = ProofNumberSearch.proofNumberSearch t q board
where
t = BitBoard.turn board
board = BitBoard.fromString r | 135 | pns q r = ProofNumberSearch.proofNumberSearch t q board
where
t = BitBoard.turn board
board = BitBoard.fromString r | 135 | pns q r = ProofNumberSearch.proofNumberSearch t q board
where
t = BitBoard.turn board
board = BitBoard.fromString r | 135 | false | false | 0 | 8 | 36 | 42 | 20 | 22 | null | null |
Cahu/krpc-hs | src/KRPCHS/SpaceCenter.hs | gpl-3.0 | getDockingPortShieldedStreamReq :: KRPCHS.SpaceCenter.DockingPort -> KRPCStreamReq (Bool)
getDockingPortShieldedStreamReq thisArg =
let req = makeRequest "SpaceCenter" "DockingPort_get_Shielded" [makeArgument 0 thisArg]
in makeStream req | 246 | getDockingPortShieldedStreamReq :: KRPCHS.SpaceCenter.DockingPort -> KRPCStreamReq (Bool)
getDockingPortShieldedStreamReq thisArg =
let req = makeRequest "SpaceCenter" "DockingPort_get_Shielded" [makeArgument 0 thisArg]
in makeStream req | 246 | getDockingPortShieldedStreamReq thisArg =
let req = makeRequest "SpaceCenter" "DockingPort_get_Shielded" [makeArgument 0 thisArg]
in makeStream req | 156 | false | true | 0 | 11 | 29 | 60 | 28 | 32 | null | null |
mightymoose/liquidhaskell | benchmarks/base-4.5.1.0/Control/Monad.hs | bsd-3-clause | sequence_ ms = foldr (>>) (return ()) ms | 45 | sequence_ ms = foldr (>>) (return ()) ms | 45 | sequence_ ms = foldr (>>) (return ()) ms | 45 | false | false | 0 | 8 | 12 | 26 | 13 | 13 | null | null |
EdisonAlgorithms/HackerRank | practice/fp/intro/fp-hello-world-n-times/fp-hello-world-n-times.hs | mit | hello_worlds n = replicateM_ n (putStrLn "Hello World") | 55 | hello_worlds n = replicateM_ n (putStrLn "Hello World") | 55 | hello_worlds n = replicateM_ n (putStrLn "Hello World") | 55 | false | false | 0 | 7 | 7 | 20 | 9 | 11 | null | null |
dmwit/pi-eta-epsilon | src/Language/PiEtaEpsilon/Parser/Term.hs | bsd-3-clause | parseTerm = M.pTerm . M.myLexer | 31 | parseTerm = M.pTerm . M.myLexer | 31 | parseTerm = M.pTerm . M.myLexer | 31 | false | false | 1 | 7 | 4 | 18 | 7 | 11 | null | null |
snoyberg/ghc | compiler/utils/UniqFM.hs | bsd-3-clause | lookupUFM :: Uniquable key => UniqFM elt -> key -> Maybe elt
lookupUFM (UFM m) k = M.lookup (getKey $ getUnique k) m | 116 | lookupUFM :: Uniquable key => UniqFM elt -> key -> Maybe elt
lookupUFM (UFM m) k = M.lookup (getKey $ getUnique k) m | 116 | lookupUFM (UFM m) k = M.lookup (getKey $ getUnique k) m | 55 | false | true | 0 | 8 | 22 | 60 | 28 | 32 | null | null |
sboosali/Earley | bench/BenchAll.hs | bsd-3-clause | benchSizes :: [Int]
benchSizes = [100, 200] | 43 | benchSizes :: [Int]
benchSizes = [100, 200] | 43 | benchSizes = [100, 200] | 23 | false | true | 0 | 5 | 6 | 20 | 12 | 8 | null | null |
clintonmead/indextype | test/Tests.hs | mit | x5 :: Bool
x5 = f5 (HAFT (==)) 'x' 'x' | 38 | x5 :: Bool
x5 = f5 (HAFT (==)) 'x' 'x' | 38 | x5 = f5 (HAFT (==)) 'x' 'x' | 27 | false | true | 0 | 7 | 9 | 32 | 15 | 17 | null | null |
nikita-volkov/hasql | library/Hasql/Private/Decoders/Result.hs | mit | single :: Row.Row a -> Result a
single rowDec =
do
checkExecStatus $ \case
LibPQ.TuplesOk -> True
_ -> False
Result $ ReaderT $ \(integerDatetimes, result) -> ExceptT $ do
maxRows <- LibPQ.ntuples result
case maxRows of
1 -> do
maxCols <- LibPQ.nfields result
let fromRowError (col, err) = RowError 0 col err
fmap (mapLeft fromRowError) $ Row.run rowDec (result, 0, maxCols, integerDatetimes)
_ -> return (Left (UnexpectedAmountOfRows (rowToInt maxRows)))
where
rowToInt (LibPQ.Row n) =
fromIntegral n
intToRow =
LibPQ.Row . fromIntegral
| 641 | single :: Row.Row a -> Result a
single rowDec =
do
checkExecStatus $ \case
LibPQ.TuplesOk -> True
_ -> False
Result $ ReaderT $ \(integerDatetimes, result) -> ExceptT $ do
maxRows <- LibPQ.ntuples result
case maxRows of
1 -> do
maxCols <- LibPQ.nfields result
let fromRowError (col, err) = RowError 0 col err
fmap (mapLeft fromRowError) $ Row.run rowDec (result, 0, maxCols, integerDatetimes)
_ -> return (Left (UnexpectedAmountOfRows (rowToInt maxRows)))
where
rowToInt (LibPQ.Row n) =
fromIntegral n
intToRow =
LibPQ.Row . fromIntegral
| 641 | single rowDec =
do
checkExecStatus $ \case
LibPQ.TuplesOk -> True
_ -> False
Result $ ReaderT $ \(integerDatetimes, result) -> ExceptT $ do
maxRows <- LibPQ.ntuples result
case maxRows of
1 -> do
maxCols <- LibPQ.nfields result
let fromRowError (col, err) = RowError 0 col err
fmap (mapLeft fromRowError) $ Row.run rowDec (result, 0, maxCols, integerDatetimes)
_ -> return (Left (UnexpectedAmountOfRows (rowToInt maxRows)))
where
rowToInt (LibPQ.Row n) =
fromIntegral n
intToRow =
LibPQ.Row . fromIntegral
| 609 | false | true | 2 | 21 | 185 | 241 | 113 | 128 | null | null |
lukexi/rumpus | src/Rumpus/TestScene.hs | bsd-3-clause | room :: Start
room = do
setPose (identity & translation .~ V3 0 roomOffset (-roomD/2 + 0.4))
removeChildren
builderID <- ask
let makeWall pos size hue = spawnEntity_ $ do
myParent ==> builderID
myPose ==> position (pos & _y +~ roomOffset)
myShape ==> Cube
myBody ==> Animated
myBodyFlags ==> [Ungrabbable]
mySize ==> size
myColor ==> colorHSL hue 0.8 0.6
myMass ==> 0
--makeWall (V3 0 0 (-roomD/2)) (V3 roomW roomH wallD) 0.1 -- back
--makeWall (V3 0 0 (roomD/2)) (V3 roomW roomH wallD) 0.2 -- front
--makeWall (V3 (-roomW/2) 0 0) (V3 wallD roomH roomD) 0.3 -- left
--makeWall (V3 (roomW/2) 0 0) (V3 wallD roomH roomD) 0.4 -- right
makeWall (V3 0 (-roomH/2) 0) (V3 roomW wallD roomD) 0.5 -- floor
makeWall (V3 0 (roomH/2) 0) (V3 roomW wallD roomD) 0.6 -- ceiling
let numShelves = 4
forM_ [1..(numShelves - 1)] $ \n -> do
let shelfY = (roomH/realToFrac numShelves)
* n - (roomH/2)
makeWall (V3 0 shelfY (roomD/2))
(V3 roomW shelfH (wallD*2)) 0.7 -- shelf
-------------------------------------------------------------------------------
-- City
-- Golden Section Spiral
-- (via http://www.softimageblog.com/archives/115) | 1,420 | room :: Start
room = do
setPose (identity & translation .~ V3 0 roomOffset (-roomD/2 + 0.4))
removeChildren
builderID <- ask
let makeWall pos size hue = spawnEntity_ $ do
myParent ==> builderID
myPose ==> position (pos & _y +~ roomOffset)
myShape ==> Cube
myBody ==> Animated
myBodyFlags ==> [Ungrabbable]
mySize ==> size
myColor ==> colorHSL hue 0.8 0.6
myMass ==> 0
--makeWall (V3 0 0 (-roomD/2)) (V3 roomW roomH wallD) 0.1 -- back
--makeWall (V3 0 0 (roomD/2)) (V3 roomW roomH wallD) 0.2 -- front
--makeWall (V3 (-roomW/2) 0 0) (V3 wallD roomH roomD) 0.3 -- left
--makeWall (V3 (roomW/2) 0 0) (V3 wallD roomH roomD) 0.4 -- right
makeWall (V3 0 (-roomH/2) 0) (V3 roomW wallD roomD) 0.5 -- floor
makeWall (V3 0 (roomH/2) 0) (V3 roomW wallD roomD) 0.6 -- ceiling
let numShelves = 4
forM_ [1..(numShelves - 1)] $ \n -> do
let shelfY = (roomH/realToFrac numShelves)
* n - (roomH/2)
makeWall (V3 0 shelfY (roomD/2))
(V3 roomW shelfH (wallD*2)) 0.7 -- shelf
-------------------------------------------------------------------------------
-- City
-- Golden Section Spiral
-- (via http://www.softimageblog.com/archives/115) | 1,420 | room = do
setPose (identity & translation .~ V3 0 roomOffset (-roomD/2 + 0.4))
removeChildren
builderID <- ask
let makeWall pos size hue = spawnEntity_ $ do
myParent ==> builderID
myPose ==> position (pos & _y +~ roomOffset)
myShape ==> Cube
myBody ==> Animated
myBodyFlags ==> [Ungrabbable]
mySize ==> size
myColor ==> colorHSL hue 0.8 0.6
myMass ==> 0
--makeWall (V3 0 0 (-roomD/2)) (V3 roomW roomH wallD) 0.1 -- back
--makeWall (V3 0 0 (roomD/2)) (V3 roomW roomH wallD) 0.2 -- front
--makeWall (V3 (-roomW/2) 0 0) (V3 wallD roomH roomD) 0.3 -- left
--makeWall (V3 (roomW/2) 0 0) (V3 wallD roomH roomD) 0.4 -- right
makeWall (V3 0 (-roomH/2) 0) (V3 roomW wallD roomD) 0.5 -- floor
makeWall (V3 0 (roomH/2) 0) (V3 roomW wallD roomD) 0.6 -- ceiling
let numShelves = 4
forM_ [1..(numShelves - 1)] $ \n -> do
let shelfY = (roomH/realToFrac numShelves)
* n - (roomH/2)
makeWall (V3 0 shelfY (roomD/2))
(V3 roomW shelfH (wallD*2)) 0.7 -- shelf
-------------------------------------------------------------------------------
-- City
-- Golden Section Spiral
-- (via http://www.softimageblog.com/archives/115) | 1,406 | false | true | 0 | 19 | 479 | 366 | 179 | 187 | null | null |
wavewave/lhc-analysis-collection | analysis/2013-08-05-XQLD-prospino_2sg.hs | gpl-3.0 | minfty :: Double
minfty = 50000.0 | 34 | minfty :: Double
minfty = 50000.0 | 33 | minfty = 50000.0 | 16 | false | true | 0 | 4 | 6 | 11 | 6 | 5 | null | null |
dolio/vector | Data/Vector/Fusion/Bundle/Size.hs | bsd-3-clause | smaller (Exact m) (Max n) = Max (delay_inline min m n) | 58 | smaller (Exact m) (Max n) = Max (delay_inline min m n) | 58 | smaller (Exact m) (Max n) = Max (delay_inline min m n) | 58 | false | false | 0 | 7 | 14 | 36 | 17 | 19 | null | null |
diku-dk/futhark | src/Futhark/CodeGen/ImpGen/GPU/ToOpenCL.hs | isc | pointerQuals "constant" = return [C.ctyquals|__constant|] | 57 | pointerQuals "constant" = return [C.ctyquals|__constant|] | 57 | pointerQuals "constant" = return [C.ctyquals|__constant|] | 57 | false | false | 0 | 6 | 4 | 18 | 10 | 8 | null | null |
glguy/advent2016 | Day15.hs | isc | aux :: (Int,Int) -> Disc -> (Int,Int)
aux (stepSize, wait) (Disc a b) = (lcm stepSize a, wait')
where
wait':_= filter (\i -> (i+b)`rem`a == 0) [wait, wait+stepSize .. ] | 174 | aux :: (Int,Int) -> Disc -> (Int,Int)
aux (stepSize, wait) (Disc a b) = (lcm stepSize a, wait')
where
wait':_= filter (\i -> (i+b)`rem`a == 0) [wait, wait+stepSize .. ] | 174 | aux (stepSize, wait) (Disc a b) = (lcm stepSize a, wait')
where
wait':_= filter (\i -> (i+b)`rem`a == 0) [wait, wait+stepSize .. ] | 136 | false | true | 0 | 11 | 35 | 120 | 65 | 55 | null | null |
apyrgio/snf-ganeti | src/Ganeti/HTools/Loader.hs | bsd-2-clause | -- | In a cluster description, clear dynamic utilisation information.
clearDynU :: ClusterData -> Result ClusterData
clearDynU cdata@(ClusterData _ _ il _ _) =
let il2 = Container.map (\ inst -> inst {Instance.util = zeroUtil }) il
in Ok cdata { cdInstances = il2 } | 269 | clearDynU :: ClusterData -> Result ClusterData
clearDynU cdata@(ClusterData _ _ il _ _) =
let il2 = Container.map (\ inst -> inst {Instance.util = zeroUtil }) il
in Ok cdata { cdInstances = il2 } | 199 | clearDynU cdata@(ClusterData _ _ il _ _) =
let il2 = Container.map (\ inst -> inst {Instance.util = zeroUtil }) il
in Ok cdata { cdInstances = il2 } | 152 | true | true | 0 | 13 | 48 | 86 | 45 | 41 | null | null |
gxtaillon/spot | src/lib/Language/SPO/Parser/PrimaryParser.hs | gpl-3.0 | getGlobalScope :: PParser PScope
getGlobalScope = getScope scopeKeyGlobal | 73 | getGlobalScope :: PParser PScope
getGlobalScope = getScope scopeKeyGlobal | 73 | getGlobalScope = getScope scopeKeyGlobal | 40 | false | true | 0 | 6 | 7 | 23 | 9 | 14 | null | null |
glguy/5puzzle | src/SparseMap.hs | isc | constant :: v -> SparseMap k v
constant = SparseMap Map.empty | 61 | constant :: v -> SparseMap k v
constant = SparseMap Map.empty | 61 | constant = SparseMap Map.empty | 30 | false | true | 0 | 6 | 10 | 25 | 12 | 13 | null | null |
RossMeikleham/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | -- | Transform the FCs in a PTerm. The first function transforms the
-- general-purpose FCs, and the second transforms those that are used
-- for semantic source highlighting, so they can be treated specially.
mapPDeclFC :: (FC -> FC) -> (FC -> FC) -> PDecl -> PDecl
mapPDeclFC f g (PFix fc fixity ops) =
PFix (f fc) fixity ops | 331 | mapPDeclFC :: (FC -> FC) -> (FC -> FC) -> PDecl -> PDecl
mapPDeclFC f g (PFix fc fixity ops) =
PFix (f fc) fixity ops | 121 | mapPDeclFC f g (PFix fc fixity ops) =
PFix (f fc) fixity ops | 64 | true | true | 0 | 8 | 64 | 70 | 37 | 33 | null | null |
DanielG/cabal-helper | tests/TestOptions.hs | apache-2.0 | testOpts :: [String] -> IO (ModProgs, [String])
testOpts args =
case getOpt Permute options args of
(o,n,[] ) -> return (foldl (flip (.)) id o, n)
(_,_,errs) -> ioError (userError (concat errs ++ usageInfo header options))
where header = "Usage: ghc-session [OPTION..] [TEST_SPEC..]" | 301 | testOpts :: [String] -> IO (ModProgs, [String])
testOpts args =
case getOpt Permute options args of
(o,n,[] ) -> return (foldl (flip (.)) id o, n)
(_,_,errs) -> ioError (userError (concat errs ++ usageInfo header options))
where header = "Usage: ghc-session [OPTION..] [TEST_SPEC..]" | 301 | testOpts args =
case getOpt Permute options args of
(o,n,[] ) -> return (foldl (flip (.)) id o, n)
(_,_,errs) -> ioError (userError (concat errs ++ usageInfo header options))
where header = "Usage: ghc-session [OPTION..] [TEST_SPEC..]" | 253 | false | true | 0 | 13 | 60 | 132 | 70 | 62 | null | null |
mlite/hLLVM | src/Llvm/Pass/RewriteUse.hs | bsd-3-clause | rwComputingInst :: MaybeChange Value -> MaybeChange ComputingInst
rwComputingInst f (ComputingInst lhs rhs) = rwRhs f rhs >>= return . (ComputingInst lhs) | 154 | rwComputingInst :: MaybeChange Value -> MaybeChange ComputingInst
rwComputingInst f (ComputingInst lhs rhs) = rwRhs f rhs >>= return . (ComputingInst lhs) | 154 | rwComputingInst f (ComputingInst lhs rhs) = rwRhs f rhs >>= return . (ComputingInst lhs) | 88 | false | true | 0 | 7 | 20 | 53 | 25 | 28 | null | null |
ezyang/ghc | libraries/base/GHC/Event/PSQ.hs | bsd-3-clause | xor :: Nat -> Nat -> Nat
xor (W# w1) (W# w2) = W# (w1 `xor#` w2) | 64 | xor :: Nat -> Nat -> Nat
xor (W# w1) (W# w2) = W# (w1 `xor#` w2) | 64 | xor (W# w1) (W# w2) = W# (w1 `xor#` w2) | 39 | false | true | 0 | 7 | 16 | 48 | 25 | 23 | null | null |
noteed/opengl-api | Text/OpenGL/Spec.hs | bsd-3-clause | pEnum :: P EnumLine
pEnum = Enum <$>
(blanks1 *> identifier_) <*>
(char '=' *> blanks *> value) <*>
(optional $ blanks *> char '#' *> blanks *> many1 (noneOf "\n")) <* eol | 177 | pEnum :: P EnumLine
pEnum = Enum <$>
(blanks1 *> identifier_) <*>
(char '=' *> blanks *> value) <*>
(optional $ blanks *> char '#' *> blanks *> many1 (noneOf "\n")) <* eol | 177 | pEnum = Enum <$>
(blanks1 *> identifier_) <*>
(char '=' *> blanks *> value) <*>
(optional $ blanks *> char '#' *> blanks *> many1 (noneOf "\n")) <* eol | 157 | false | true | 0 | 11 | 38 | 82 | 41 | 41 | null | null |
DavidAlphaFox/ghc | libraries/haskeline/System/Console/Haskeline/Command.hs | bsd-3-clause | changeFromChar :: (LineState t, Monad m) => (Char -> s -> t) -> KeyCommand m s t
changeFromChar f = useChar $ change . f | 120 | changeFromChar :: (LineState t, Monad m) => (Char -> s -> t) -> KeyCommand m s t
changeFromChar f = useChar $ change . f | 120 | changeFromChar f = useChar $ change . f | 39 | false | true | 0 | 10 | 24 | 64 | 31 | 33 | null | null |
ssoudan/hsCRDT | test/IntMaxTest.hs | apache-2.0 | testEq :: Bool
testEq = let q1_ :: Maybe Bool
q1_ = do
-- on 0
let s0 :: IntMax
s0 = initial
s01 <- update s0 $ intToIntMax 2
-- on 1
let s1 :: IntMax
s1 = initial
s11 <- update s1 $ intToIntMax 2
return $ s11 == s01
in case q1_ of Just q -> q
Nothing -> False | 549 | testEq :: Bool
testEq = let q1_ :: Maybe Bool
q1_ = do
-- on 0
let s0 :: IntMax
s0 = initial
s01 <- update s0 $ intToIntMax 2
-- on 1
let s1 :: IntMax
s1 = initial
s11 <- update s1 $ intToIntMax 2
return $ s11 == s01
in case q1_ of Just q -> q
Nothing -> False | 549 | testEq = let q1_ :: Maybe Bool
q1_ = do
-- on 0
let s0 :: IntMax
s0 = initial
s01 <- update s0 $ intToIntMax 2
-- on 1
let s1 :: IntMax
s1 = initial
s11 <- update s1 $ intToIntMax 2
return $ s11 == s01
in case q1_ of Just q -> q
Nothing -> False | 534 | false | true | 0 | 13 | 351 | 124 | 59 | 65 | null | null |
nathankot/dbmigrations | test/BackendTest.hs | bsd-3-clause | isBootstrappedTrueTest :: (IConnection a) => a -> IO ()
isBootstrappedTrueTest conn = do
result <- isBootstrapped $ hdbcBackend conn
assertBool "Bootstrapped check" result | 175 | isBootstrappedTrueTest :: (IConnection a) => a -> IO ()
isBootstrappedTrueTest conn = do
result <- isBootstrapped $ hdbcBackend conn
assertBool "Bootstrapped check" result | 175 | isBootstrappedTrueTest conn = do
result <- isBootstrapped $ hdbcBackend conn
assertBool "Bootstrapped check" result | 119 | false | true | 0 | 10 | 26 | 59 | 26 | 33 | null | null |
rueshyna/gogol | gogol-books/gen/Network/Google/Books/Types/Product.hs | mpl-2.0 | -- | Suggested retail price. (In LITE projection.)
vsiListPrice :: Lens' VolumeSaleInfo (Maybe VolumeSaleInfoListPrice)
vsiListPrice
= lens _vsiListPrice (\ s a -> s{_vsiListPrice = a}) | 187 | vsiListPrice :: Lens' VolumeSaleInfo (Maybe VolumeSaleInfoListPrice)
vsiListPrice
= lens _vsiListPrice (\ s a -> s{_vsiListPrice = a}) | 136 | vsiListPrice
= lens _vsiListPrice (\ s a -> s{_vsiListPrice = a}) | 67 | true | true | 1 | 9 | 26 | 50 | 25 | 25 | null | null |
cabrera/ghc-mod | test/doctests.hs | bsd-3-clause | main :: IO ()
main = doctest [
"-package"
, "ghc"
, "-XConstraintKinds", "-XFlexibleContexts"
, "-idist/build/autogen/"
, "-optP-include"
, "-optPdist/build/autogen/cabal_macros.h"
, "Language/Haskell/GhcMod.hs"
] | 231 | main :: IO ()
main = doctest [
"-package"
, "ghc"
, "-XConstraintKinds", "-XFlexibleContexts"
, "-idist/build/autogen/"
, "-optP-include"
, "-optPdist/build/autogen/cabal_macros.h"
, "Language/Haskell/GhcMod.hs"
] | 231 | main = doctest [
"-package"
, "ghc"
, "-XConstraintKinds", "-XFlexibleContexts"
, "-idist/build/autogen/"
, "-optP-include"
, "-optPdist/build/autogen/cabal_macros.h"
, "Language/Haskell/GhcMod.hs"
] | 217 | false | true | 1 | 6 | 40 | 46 | 25 | 21 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.