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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Saulzar/reflex-animation | src/Reflex/Monad/Time.hs | bsd-3-clause | delay_ :: (MonadTime t time m) => Event t time -> m (Event t ())
delay_ e = void <$> delay (((), ) <$> e) | 107 | delay_ :: (MonadTime t time m) => Event t time -> m (Event t ())
delay_ e = void <$> delay (((), ) <$> e) | 107 | delay_ e = void <$> delay (((), ) <$> e) | 41 | false | true | 2 | 11 | 26 | 74 | 36 | 38 | null | null |
sdiehl/ghc | compiler/basicTypes/Name.hs | bsd-3-clause | -- NB: You might worry that after lots of huffing and
-- puffing we might end up with two local names with distinct
-- uniques, but the same OccName. Indeed we can, but that's ok
-- * the insides of the compiler don't care: they use the Unique
-- * when printing for -ddump-xxx you can switch on -dppr-debug to get the
-- uniques if you get confused
-- * for interface files we tidyCore first, which makes
-- the OccNames distinct when they need to be
mkClonedInternalName :: Unique -> Name -> Name
mkClonedInternalName uniq (Name { n_occ = occ, n_loc = loc })
= Name { n_uniq = uniq, n_sort = Internal
, n_occ = occ, n_loc = loc } | 729 | mkClonedInternalName :: Unique -> Name -> Name
mkClonedInternalName uniq (Name { n_occ = occ, n_loc = loc })
= Name { n_uniq = uniq, n_sort = Internal
, n_occ = occ, n_loc = loc } | 190 | mkClonedInternalName uniq (Name { n_occ = occ, n_loc = loc })
= Name { n_uniq = uniq, n_sort = Internal
, n_occ = occ, n_loc = loc } | 143 | true | true | 0 | 8 | 219 | 85 | 50 | 35 | null | null |
johnjcamilleri/maltese-verb-inflections | VerbCSV.hs | mit | cmpPol :: Inflection -> Inflection -> Ordering
cmpPol x y = case (pol x, pol y) of
("Pos", "Neg") -> LT
("Neg", "Pos") -> GT
_ -> EQ | 138 | cmpPol :: Inflection -> Inflection -> Ordering
cmpPol x y = case (pol x, pol y) of
("Pos", "Neg") -> LT
("Neg", "Pos") -> GT
_ -> EQ | 138 | cmpPol x y = case (pol x, pol y) of
("Pos", "Neg") -> LT
("Neg", "Pos") -> GT
_ -> EQ | 91 | false | true | 0 | 8 | 33 | 76 | 38 | 38 | null | null |
lukasmartinelli/hadolint | src/Hadolint/Formatter/Codeclimate.hs | gpl-3.0 | issueToFingerprintIssue :: Issue -> FingerprintIssue
issueToFingerprintIssue i =
FingerprintIssue
{ issue = i,
fingerprint = generateFingerprint i
} | 164 | issueToFingerprintIssue :: Issue -> FingerprintIssue
issueToFingerprintIssue i =
FingerprintIssue
{ issue = i,
fingerprint = generateFingerprint i
} | 164 | issueToFingerprintIssue i =
FingerprintIssue
{ issue = i,
fingerprint = generateFingerprint i
} | 111 | false | true | 0 | 8 | 33 | 39 | 20 | 19 | null | null |
Proclivis/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_CMD_LINEENDDISPLAY :: Int
wxSTC_CMD_LINEENDDISPLAY = 2347 | 63 | wxSTC_CMD_LINEENDDISPLAY :: Int
wxSTC_CMD_LINEENDDISPLAY = 2347 | 63 | wxSTC_CMD_LINEENDDISPLAY = 2347 | 31 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
kmilner/tamarin-prover | lib/sapic/src/Sapic/Facts.hs | gpl-3.0 | factToFact (Message t t') = protoFact Linear "Message" [t, t'] | 62 | factToFact (Message t t') = protoFact Linear "Message" [t, t'] | 62 | factToFact (Message t t') = protoFact Linear "Message" [t, t'] | 62 | false | false | 0 | 7 | 9 | 30 | 15 | 15 | null | null |
PelleJuul/popl | src/Reporter.hs | mit | post :: a -> Reporter a ()
post err = do
s <- get
put $ s ++ [err] | 70 | post :: a -> Reporter a ()
post err = do
s <- get
put $ s ++ [err] | 70 | post err = do
s <- get
put $ s ++ [err] | 43 | false | true | 0 | 8 | 22 | 46 | 22 | 24 | null | null |
gcampax/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | -- True <=> Occurs in only one case branch
-- so no code-duplication issue to worry about
oneBranch, notOneBranch :: OneBranch
oneBranch = True | 175 | oneBranch, notOneBranch :: OneBranch
oneBranch = True | 56 | oneBranch = True | 19 | true | true | 2 | 6 | 55 | 23 | 10 | 13 | null | null |
kojiromike/Idris-dev | src/Idris/Docs.hs | bsd-3-clause | docInterface :: Name -> InterfaceInfo -> Idris Docs
docInterface n ci
= do i <- getIState
let docStrings = listToMaybe $ lookupCtxt n $ idris_docstrings i
docstr = maybe emptyDocstring fst docStrings
params = map (\pn -> (pn, docStrings >>= (lookup pn . snd)))
(interface_params ci)
docsForImplementation impl = fromMaybe (emptyDocstring, []) .
flip lookupCtxtExact (idris_docstrings i) $
impl
implementations = map (\impl -> (namedImpl impl,
delabTy i impl,
docsForImplementation impl))
(nub (map fst (interface_implementations ci)))
(sub_interfaces, implementations') = partition (isSubInterface . (\(_,tm,_) -> tm)) implementations
super_interfaces = catMaybes $ map getDImpl (interface_default_super_interfaces ci)
mdocs <- mapM (docFun . fst) (interface_methods ci)
let ctorN = implementationCtorName ci
ctorDocs <- case basename ctorN of
SN _ -> return Nothing
_ -> fmap Just $ docFun ctorN
return $ InterfaceDoc
n docstr mdocs params (interface_constraints ci)
implementations' (map (\(_,tm,_) -> tm) sub_interfaces) super_interfaces
ctorDocs
where
namedImpl (NS n ns) = fmap (flip NS ns) (namedImpl n)
namedImpl n@(UN _) = Just n
namedImpl _ = Nothing
getDImpl (PImplementation _ _ _ _ _ _ _ _ _ _ _ _ t _ _) = Just t
getDImpl _ = Nothing
isSubInterface (PPi (Constraint _ _ _) _ _ (PApp _ _ args) (PApp _ (PRef _ _ nm) args'))
= nm == n && map getTm args == map getTm args'
isSubInterface (PPi _ _ _ _ pt)
= isSubInterface pt
isSubInterface _
= False | 1,973 | docInterface :: Name -> InterfaceInfo -> Idris Docs
docInterface n ci
= do i <- getIState
let docStrings = listToMaybe $ lookupCtxt n $ idris_docstrings i
docstr = maybe emptyDocstring fst docStrings
params = map (\pn -> (pn, docStrings >>= (lookup pn . snd)))
(interface_params ci)
docsForImplementation impl = fromMaybe (emptyDocstring, []) .
flip lookupCtxtExact (idris_docstrings i) $
impl
implementations = map (\impl -> (namedImpl impl,
delabTy i impl,
docsForImplementation impl))
(nub (map fst (interface_implementations ci)))
(sub_interfaces, implementations') = partition (isSubInterface . (\(_,tm,_) -> tm)) implementations
super_interfaces = catMaybes $ map getDImpl (interface_default_super_interfaces ci)
mdocs <- mapM (docFun . fst) (interface_methods ci)
let ctorN = implementationCtorName ci
ctorDocs <- case basename ctorN of
SN _ -> return Nothing
_ -> fmap Just $ docFun ctorN
return $ InterfaceDoc
n docstr mdocs params (interface_constraints ci)
implementations' (map (\(_,tm,_) -> tm) sub_interfaces) super_interfaces
ctorDocs
where
namedImpl (NS n ns) = fmap (flip NS ns) (namedImpl n)
namedImpl n@(UN _) = Just n
namedImpl _ = Nothing
getDImpl (PImplementation _ _ _ _ _ _ _ _ _ _ _ _ t _ _) = Just t
getDImpl _ = Nothing
isSubInterface (PPi (Constraint _ _ _) _ _ (PApp _ _ args) (PApp _ (PRef _ _ nm) args'))
= nm == n && map getTm args == map getTm args'
isSubInterface (PPi _ _ _ _ pt)
= isSubInterface pt
isSubInterface _
= False | 1,973 | docInterface n ci
= do i <- getIState
let docStrings = listToMaybe $ lookupCtxt n $ idris_docstrings i
docstr = maybe emptyDocstring fst docStrings
params = map (\pn -> (pn, docStrings >>= (lookup pn . snd)))
(interface_params ci)
docsForImplementation impl = fromMaybe (emptyDocstring, []) .
flip lookupCtxtExact (idris_docstrings i) $
impl
implementations = map (\impl -> (namedImpl impl,
delabTy i impl,
docsForImplementation impl))
(nub (map fst (interface_implementations ci)))
(sub_interfaces, implementations') = partition (isSubInterface . (\(_,tm,_) -> tm)) implementations
super_interfaces = catMaybes $ map getDImpl (interface_default_super_interfaces ci)
mdocs <- mapM (docFun . fst) (interface_methods ci)
let ctorN = implementationCtorName ci
ctorDocs <- case basename ctorN of
SN _ -> return Nothing
_ -> fmap Just $ docFun ctorN
return $ InterfaceDoc
n docstr mdocs params (interface_constraints ci)
implementations' (map (\(_,tm,_) -> tm) sub_interfaces) super_interfaces
ctorDocs
where
namedImpl (NS n ns) = fmap (flip NS ns) (namedImpl n)
namedImpl n@(UN _) = Just n
namedImpl _ = Nothing
getDImpl (PImplementation _ _ _ _ _ _ _ _ _ _ _ _ t _ _) = Just t
getDImpl _ = Nothing
isSubInterface (PPi (Constraint _ _ _) _ _ (PApp _ _ args) (PApp _ (PRef _ _ nm) args'))
= nm == n && map getTm args == map getTm args'
isSubInterface (PPi _ _ _ _ pt)
= isSubInterface pt
isSubInterface _
= False | 1,921 | false | true | 0 | 17 | 746 | 642 | 319 | 323 | null | null |
yangsiwei880813/CS644 | src/Hierarchy.hs | gpl-2.0 | -- Class -> Class -> Type Database -> highest || Nothing if symbols are unrelated
higherInChain :: Symbol -> Symbol -> TypeNode -> Maybe Symbol
higherInChain symA@(CL _ _ _ unitA) symB@(CL _ _ _ unitB) typeDB
| symA `elem` hierarchyB = Just symA
| symB `elem` hierarchyA = Just symB
| otherwise = Nothing
where hierarchyA = map symbol $ getClassHierarchy unitA typeDB
hierarchyB = map symbol $ getClassHierarchy unitB typeDB | 440 | higherInChain :: Symbol -> Symbol -> TypeNode -> Maybe Symbol
higherInChain symA@(CL _ _ _ unitA) symB@(CL _ _ _ unitB) typeDB
| symA `elem` hierarchyB = Just symA
| symB `elem` hierarchyA = Just symB
| otherwise = Nothing
where hierarchyA = map symbol $ getClassHierarchy unitA typeDB
hierarchyB = map symbol $ getClassHierarchy unitB typeDB | 358 | higherInChain symA@(CL _ _ _ unitA) symB@(CL _ _ _ unitB) typeDB
| symA `elem` hierarchyB = Just symA
| symB `elem` hierarchyA = Just symB
| otherwise = Nothing
where hierarchyA = map symbol $ getClassHierarchy unitA typeDB
hierarchyB = map symbol $ getClassHierarchy unitB typeDB | 296 | true | true | 19 | 7 | 87 | 141 | 71 | 70 | null | null |
kylcarte/harihara | src/Harihara/Lastfm/Types.hs | bsd-3-clause | io :: IO a -> Lastfm a
io = Lastfm . inBase | 43 | io :: IO a -> Lastfm a
io = Lastfm . inBase | 43 | io = Lastfm . inBase | 20 | false | true | 1 | 7 | 11 | 32 | 13 | 19 | null | null |
Fuuzetsu/yi | yi-keymap-vim/src/Yi/Keymap/Vim/StateUtils.hs | gpl-2.0 | setRegisterE :: RegisterName -> RegionStyle -> YiString -> EditorM ()
setRegisterE name style rope = do
rmap <- fmap vsRegisterMap getEditorDyn
let rmap' = HM.insert name (Register style rope) rmap
modifyStateE $ \state -> state { vsRegisterMap = rmap' } | 266 | setRegisterE :: RegisterName -> RegionStyle -> YiString -> EditorM ()
setRegisterE name style rope = do
rmap <- fmap vsRegisterMap getEditorDyn
let rmap' = HM.insert name (Register style rope) rmap
modifyStateE $ \state -> state { vsRegisterMap = rmap' } | 266 | setRegisterE name style rope = do
rmap <- fmap vsRegisterMap getEditorDyn
let rmap' = HM.insert name (Register style rope) rmap
modifyStateE $ \state -> state { vsRegisterMap = rmap' } | 196 | false | true | 0 | 12 | 51 | 93 | 45 | 48 | null | null |
flipstone/orville | orville-postgresql/src/Database/Orville/PostgreSQL/Internal/MigrateTable.hs | mit | mkPrimaryKeyDDL :: PrimaryKey key -> String
mkPrimaryKeyDDL keyDef =
let
names =
mapPrimaryKeyParts (\_ field -> fieldToNameForm field) keyDef
in
concat
[ "PRIMARY KEY ("
, List.intercalate ", " (map (rawExprToSql . generateSql) names)
, ")"
] | 285 | mkPrimaryKeyDDL :: PrimaryKey key -> String
mkPrimaryKeyDDL keyDef =
let
names =
mapPrimaryKeyParts (\_ field -> fieldToNameForm field) keyDef
in
concat
[ "PRIMARY KEY ("
, List.intercalate ", " (map (rawExprToSql . generateSql) names)
, ")"
] | 285 | mkPrimaryKeyDDL keyDef =
let
names =
mapPrimaryKeyParts (\_ field -> fieldToNameForm field) keyDef
in
concat
[ "PRIMARY KEY ("
, List.intercalate ", " (map (rawExprToSql . generateSql) names)
, ")"
] | 241 | false | true | 0 | 12 | 78 | 90 | 43 | 47 | null | null |
brendanhay/gogol | gogol-dlp/gen/Network/Google/DLP/Types/Product.hs | mpl-2.0 | -- | The estimated anonymity for these quasi-identifier values.
gpdvkmeqivEstimatedAnonymity :: Lens' GooglePrivacyDlpV2KMapEstimationQuasiIdValues (Maybe Int64)
gpdvkmeqivEstimatedAnonymity
= lens _gpdvkmeqivEstimatedAnonymity
(\ s a -> s{_gpdvkmeqivEstimatedAnonymity = a})
. mapping _Coerce | 307 | gpdvkmeqivEstimatedAnonymity :: Lens' GooglePrivacyDlpV2KMapEstimationQuasiIdValues (Maybe Int64)
gpdvkmeqivEstimatedAnonymity
= lens _gpdvkmeqivEstimatedAnonymity
(\ s a -> s{_gpdvkmeqivEstimatedAnonymity = a})
. mapping _Coerce | 243 | gpdvkmeqivEstimatedAnonymity
= lens _gpdvkmeqivEstimatedAnonymity
(\ s a -> s{_gpdvkmeqivEstimatedAnonymity = a})
. mapping _Coerce | 145 | true | true | 0 | 10 | 42 | 55 | 28 | 27 | null | null |
apyrgio/snf-ganeti | test/hs/Test/Ganeti/HTools/Backend/Text.hs | bsd-2-clause | prop_Load_InstanceFail :: [(String, Int)] -> [String] -> Property
prop_Load_InstanceFail ktn fields =
length fields < 10 || length fields > 12 ==>
case Text.loadInst nl fields of
Ok _ -> failTest "Managed to load instance from invalid data"
Bad msg -> printTestCase ("Unrecognised error message: " ++ msg) $
"Invalid/incomplete instance data: '" `isPrefixOf` msg
where nl = Map.fromList ktn | 429 | prop_Load_InstanceFail :: [(String, Int)] -> [String] -> Property
prop_Load_InstanceFail ktn fields =
length fields < 10 || length fields > 12 ==>
case Text.loadInst nl fields of
Ok _ -> failTest "Managed to load instance from invalid data"
Bad msg -> printTestCase ("Unrecognised error message: " ++ msg) $
"Invalid/incomplete instance data: '" `isPrefixOf` msg
where nl = Map.fromList ktn | 429 | prop_Load_InstanceFail ktn fields =
length fields < 10 || length fields > 12 ==>
case Text.loadInst nl fields of
Ok _ -> failTest "Managed to load instance from invalid data"
Bad msg -> printTestCase ("Unrecognised error message: " ++ msg) $
"Invalid/incomplete instance data: '" `isPrefixOf` msg
where nl = Map.fromList ktn | 363 | false | true | 0 | 13 | 98 | 123 | 61 | 62 | null | null |
bos/mysql-simple | Database/MySQL/Simple/Result.hs | bsd-3-clause | ok16 = mkCompats [Tiny,Short] | 29 | ok16 = mkCompats [Tiny,Short] | 29 | ok16 = mkCompats [Tiny,Short] | 29 | false | false | 1 | 6 | 3 | 18 | 8 | 10 | null | null |
kawu/dawg | src/Data/DAWG/Graph.hs | bsd-2-clause | -- | Add new graph node (assuming that it is not already a member
-- of the graph).
newNode :: Hash n => n -> Graph n -> (ID, Graph n)
newNode n Graph{..} =
(i, Graph idMap' freeIDs' nodeMap' ingoMap')
where
idMap' = H.insertUnsafe n i idMap
nodeMap' = M.insert i n nodeMap
ingoMap' = M.insert i 1 ingoMap
(i, freeIDs') = if S.null freeIDs
then (H.size idMap, freeIDs)
else S.deleteFindMin freeIDs
-- | Remove node from the graph (assuming that it is a member
-- of the graph). | 527 | newNode :: Hash n => n -> Graph n -> (ID, Graph n)
newNode n Graph{..} =
(i, Graph idMap' freeIDs' nodeMap' ingoMap')
where
idMap' = H.insertUnsafe n i idMap
nodeMap' = M.insert i n nodeMap
ingoMap' = M.insert i 1 ingoMap
(i, freeIDs') = if S.null freeIDs
then (H.size idMap, freeIDs)
else S.deleteFindMin freeIDs
-- | Remove node from the graph (assuming that it is a member
-- of the graph). | 443 | newNode n Graph{..} =
(i, Graph idMap' freeIDs' nodeMap' ingoMap')
where
idMap' = H.insertUnsafe n i idMap
nodeMap' = M.insert i n nodeMap
ingoMap' = M.insert i 1 ingoMap
(i, freeIDs') = if S.null freeIDs
then (H.size idMap, freeIDs)
else S.deleteFindMin freeIDs
-- | Remove node from the graph (assuming that it is a member
-- of the graph). | 392 | true | true | 3 | 9 | 139 | 154 | 80 | 74 | null | null |
kvelicka/Fizz | CellTypes.hs | lgpl-2.1 | locateCube n D = Vertex3 0.0 0.0 0.0 | 37 | locateCube n D = Vertex3 0.0 0.0 0.0 | 37 | locateCube n D = Vertex3 0.0 0.0 0.0 | 37 | false | false | 0 | 5 | 8 | 18 | 8 | 10 | null | null |
keithodulaigh/Hets | CSL/MathematicaInterpreter.hs | gpl-2.0 | mmShowOPNAME :: OPNAME -> String
mmShowOPNAME x =
case x of
OP_plus -> "Plus"
OP_mult -> "Times"
OP_pow -> "Power"
OP_div -> "Divide"
OP_neq -> "Unequal"
OP_lt -> "Less"
OP_leq -> "LessEqual"
OP_eq -> "Equal"
OP_gt -> "Greater"
OP_geq -> "GreaterEqual"
OP_sqrt -> "Sqrt"
OP_abs -> "Abs"
OP_sign -> "Sign"
OP_max -> "Max"
OP_min -> "Min"
OP_sin -> "Sin"
OP_cos -> "Cos"
OP_tan -> "Tan"
OP_cot -> "Cot"
OP_Pi -> "Pi"
OP_and -> "And"
OP_not -> "Not"
OP_or -> "Or"
OP_impl -> "Implies"
OP_false -> "False"
OP_true -> "True"
OP_approx -> "N"
-- these functions have to be defined in a package
OP_minus -> "minus"
OP_neg -> "negate"
OP_fthrt -> "fthrt"
OP_maxloc -> "maxloc"
OP_minloc -> "minloc"
OP_reldist -> "reldist"
OP_reldistLe -> "reldistLe"
OP_undef -> "undef"
OP_failure -> "fail"
_ -> showOPNAME x | 1,045 | mmShowOPNAME :: OPNAME -> String
mmShowOPNAME x =
case x of
OP_plus -> "Plus"
OP_mult -> "Times"
OP_pow -> "Power"
OP_div -> "Divide"
OP_neq -> "Unequal"
OP_lt -> "Less"
OP_leq -> "LessEqual"
OP_eq -> "Equal"
OP_gt -> "Greater"
OP_geq -> "GreaterEqual"
OP_sqrt -> "Sqrt"
OP_abs -> "Abs"
OP_sign -> "Sign"
OP_max -> "Max"
OP_min -> "Min"
OP_sin -> "Sin"
OP_cos -> "Cos"
OP_tan -> "Tan"
OP_cot -> "Cot"
OP_Pi -> "Pi"
OP_and -> "And"
OP_not -> "Not"
OP_or -> "Or"
OP_impl -> "Implies"
OP_false -> "False"
OP_true -> "True"
OP_approx -> "N"
-- these functions have to be defined in a package
OP_minus -> "minus"
OP_neg -> "negate"
OP_fthrt -> "fthrt"
OP_maxloc -> "maxloc"
OP_minloc -> "minloc"
OP_reldist -> "reldist"
OP_reldistLe -> "reldistLe"
OP_undef -> "undef"
OP_failure -> "fail"
_ -> showOPNAME x | 1,045 | mmShowOPNAME x =
case x of
OP_plus -> "Plus"
OP_mult -> "Times"
OP_pow -> "Power"
OP_div -> "Divide"
OP_neq -> "Unequal"
OP_lt -> "Less"
OP_leq -> "LessEqual"
OP_eq -> "Equal"
OP_gt -> "Greater"
OP_geq -> "GreaterEqual"
OP_sqrt -> "Sqrt"
OP_abs -> "Abs"
OP_sign -> "Sign"
OP_max -> "Max"
OP_min -> "Min"
OP_sin -> "Sin"
OP_cos -> "Cos"
OP_tan -> "Tan"
OP_cot -> "Cot"
OP_Pi -> "Pi"
OP_and -> "And"
OP_not -> "Not"
OP_or -> "Or"
OP_impl -> "Implies"
OP_false -> "False"
OP_true -> "True"
OP_approx -> "N"
-- these functions have to be defined in a package
OP_minus -> "minus"
OP_neg -> "negate"
OP_fthrt -> "fthrt"
OP_maxloc -> "maxloc"
OP_minloc -> "minloc"
OP_reldist -> "reldist"
OP_reldistLe -> "reldistLe"
OP_undef -> "undef"
OP_failure -> "fail"
_ -> showOPNAME x | 1,012 | false | true | 0 | 8 | 376 | 248 | 124 | 124 | null | null |
htquach/HaskellLED | Test_LEDDisplay.hs | mit | testTrimZeros2 = TestCase (assertEqual "Test trimZeros2 " ["1"] (trimZeros ["000001"])) | 87 | testTrimZeros2 = TestCase (assertEqual "Test trimZeros2 " ["1"] (trimZeros ["000001"])) | 87 | testTrimZeros2 = TestCase (assertEqual "Test trimZeros2 " ["1"] (trimZeros ["000001"])) | 87 | false | false | 0 | 10 | 9 | 31 | 16 | 15 | null | null |
sgillespie/ghc | compiler/basicTypes/OccName.hs | bsd-3-clause | mkVectDataConOcc = mk_simple_deriv_with dataName "VD:" | 56 | mkVectDataConOcc = mk_simple_deriv_with dataName "VD:" | 56 | mkVectDataConOcc = mk_simple_deriv_with dataName "VD:" | 56 | false | false | 0 | 5 | 6 | 11 | 5 | 6 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/SVGNumberList.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGNumberList.appendItem Mozilla SVGNumberList.appendItem documentation>
appendItem_ :: (MonadDOM m) => SVGNumberList -> SVGNumber -> m ()
appendItem_ self item
= liftDOM (void (self ^. jsf "appendItem" [toJSVal item])) | 277 | appendItem_ :: (MonadDOM m) => SVGNumberList -> SVGNumber -> m ()
appendItem_ self item
= liftDOM (void (self ^. jsf "appendItem" [toJSVal item])) | 148 | appendItem_ self item
= liftDOM (void (self ^. jsf "appendItem" [toJSVal item])) | 82 | true | true | 0 | 12 | 31 | 66 | 33 | 33 | null | null |
iand675/bearcat | src/Attributes.hs | bsd-3-clause | -- | Indicates the optimal numeric value.
optimum_ :: ValidAttr "optimum" e => Double -> Attribute e
optimum_ = attribute "optimum" | 131 | optimum_ :: ValidAttr "optimum" e => Double -> Attribute e
optimum_ = attribute "optimum" | 89 | optimum_ = attribute "optimum" | 30 | true | true | 0 | 7 | 20 | 31 | 15 | 16 | null | null |
dylanmc/cryptol | sbv/Data/SBV/BitVectors/Model.hs | bsd-3-clause | liftSym1Bool :: (State -> Kind -> SW -> IO SW) -> (Bool -> Bool) -> SBool -> SBool
liftSym1Bool _ opC (SBV _ (Left a)) = literal $ opC $ cwToBool a | 149 | liftSym1Bool :: (State -> Kind -> SW -> IO SW) -> (Bool -> Bool) -> SBool -> SBool
liftSym1Bool _ opC (SBV _ (Left a)) = literal $ opC $ cwToBool a | 149 | liftSym1Bool _ opC (SBV _ (Left a)) = literal $ opC $ cwToBool a | 66 | false | true | 0 | 10 | 33 | 80 | 40 | 40 | null | null |
keithodulaigh/Hets | Common/XPath.hs | gpl-2.0 | -- | all possible values
allAxis :: [Axis]
allAxis = let bl = [True, False] in
[ Attribute
, Child
, Namespace
, Parent
, Self ]
++ [ Ancestor b | b <- bl ]
++ [ Descendant b | b <- bl ]
++ [ Following b | b <- bl ]
++ [ Preceding b | b <- bl ] | 262 | allAxis :: [Axis]
allAxis = let bl = [True, False] in
[ Attribute
, Child
, Namespace
, Parent
, Self ]
++ [ Ancestor b | b <- bl ]
++ [ Descendant b | b <- bl ]
++ [ Following b | b <- bl ]
++ [ Preceding b | b <- bl ] | 237 | allAxis = let bl = [True, False] in
[ Attribute
, Child
, Namespace
, Parent
, Self ]
++ [ Ancestor b | b <- bl ]
++ [ Descendant b | b <- bl ]
++ [ Following b | b <- bl ]
++ [ Preceding b | b <- bl ] | 219 | true | true | 8 | 9 | 80 | 124 | 64 | 60 | null | null |
literate-unitb/literate-unitb | src/UnitB/UnitB.hs | mit | fromSyntax :: HasExpr expr => MachineAST' expr -> Machine' expr
fromSyntax m = check $ makeMachinePO' m | 103 | fromSyntax :: HasExpr expr => MachineAST' expr -> Machine' expr
fromSyntax m = check $ makeMachinePO' m | 103 | fromSyntax m = check $ makeMachinePO' m | 39 | false | true | 0 | 7 | 16 | 38 | 17 | 21 | null | null |
keithodulaigh/Hets | Common/Lib/Graph.hs | gpl-2.0 | isIsolated :: GrContext a b -> Bool
isIsolated c = Map.null (nodeSuccs c) && Map.null (nodePreds c) | 99 | isIsolated :: GrContext a b -> Bool
isIsolated c = Map.null (nodeSuccs c) && Map.null (nodePreds c) | 99 | isIsolated c = Map.null (nodeSuccs c) && Map.null (nodePreds c) | 63 | false | true | 0 | 8 | 16 | 54 | 24 | 30 | null | null |
urbanslug/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | staticPtrDataConName :: Name
staticPtrDataConName =
conName gHC_STATICPTR (fsLit "StaticPtr") staticPtrDataConKey | 117 | staticPtrDataConName :: Name
staticPtrDataConName =
conName gHC_STATICPTR (fsLit "StaticPtr") staticPtrDataConKey | 117 | staticPtrDataConName =
conName gHC_STATICPTR (fsLit "StaticPtr") staticPtrDataConKey | 88 | false | true | 0 | 7 | 13 | 24 | 12 | 12 | null | null |
urbanslug/ghc | testsuite/tests/numeric/should_run/CarryOverflow.hs | bsd-3-clause | testWords :: [Word]
testWords = map head . group . sort $
concatMap (\w -> [w - 1, w, w + 1]) $
concatMap (\w -> [w, maxBound - w]) $
trailingOnes ++ randoms
where trailingOnes = takeWhile (/= 0) $ iterate (`div` 2) $ maxBound
-- What would a Haskell program be without some Fibonacci numbers?
randoms = take 40 $ drop 100 fibs
fibs = 0 : 1 : zipWith (+) fibs (tail fibs) | 433 | testWords :: [Word]
testWords = map head . group . sort $
concatMap (\w -> [w - 1, w, w + 1]) $
concatMap (\w -> [w, maxBound - w]) $
trailingOnes ++ randoms
where trailingOnes = takeWhile (/= 0) $ iterate (`div` 2) $ maxBound
-- What would a Haskell program be without some Fibonacci numbers?
randoms = take 40 $ drop 100 fibs
fibs = 0 : 1 : zipWith (+) fibs (tail fibs) | 433 | testWords = map head . group . sort $
concatMap (\w -> [w - 1, w, w + 1]) $
concatMap (\w -> [w, maxBound - w]) $
trailingOnes ++ randoms
where trailingOnes = takeWhile (/= 0) $ iterate (`div` 2) $ maxBound
-- What would a Haskell program be without some Fibonacci numbers?
randoms = take 40 $ drop 100 fibs
fibs = 0 : 1 : zipWith (+) fibs (tail fibs) | 413 | false | true | 2 | 13 | 137 | 170 | 91 | 79 | null | null |
mboogerd/hello-haskell | src/lyah/Recursion.hs | apache-2.0 | --- === Quick, sort! === ---
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = [] | 81 | quicksort :: (Ord a) => [a] -> [a]
quicksort [] = [] | 52 | quicksort [] = [] | 17 | true | true | 0 | 7 | 17 | 38 | 21 | 17 | null | null |
keent/stack | src/Stack/PackageDump.hs | bsd-3-clause | -- | Load a @InstalledCache@ from disk, swallowing any errors and returning an
-- empty cache.
loadInstalledCache :: (MonadLogger m, MonadIO m) => Path Abs File -> m InstalledCache
loadInstalledCache path = do
m <- taggedDecodeOrLoad path (return $ InstalledCacheInner Map.empty)
liftIO $ InstalledCache <$> newIORef m
-- | Save a @InstalledCache@ to disk | 364 | loadInstalledCache :: (MonadLogger m, MonadIO m) => Path Abs File -> m InstalledCache
loadInstalledCache path = do
m <- taggedDecodeOrLoad path (return $ InstalledCacheInner Map.empty)
liftIO $ InstalledCache <$> newIORef m
-- | Save a @InstalledCache@ to disk | 269 | loadInstalledCache path = do
m <- taggedDecodeOrLoad path (return $ InstalledCacheInner Map.empty)
liftIO $ InstalledCache <$> newIORef m
-- | Save a @InstalledCache@ to disk | 183 | true | true | 0 | 13 | 62 | 87 | 41 | 46 | null | null |
brendanhay/gogol | gogol-containeranalysis/gen/Network/Google/Resource/ContainerAnalysis/Projects/Notes/Create.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
pncUploadProtocol :: Lens' ProjectsNotesCreate (Maybe Text)
pncUploadProtocol
= lens _pncUploadProtocol
(\ s a -> s{_pncUploadProtocol = a}) | 210 | pncUploadProtocol :: Lens' ProjectsNotesCreate (Maybe Text)
pncUploadProtocol
= lens _pncUploadProtocol
(\ s a -> s{_pncUploadProtocol = a}) | 148 | pncUploadProtocol
= lens _pncUploadProtocol
(\ s a -> s{_pncUploadProtocol = a}) | 88 | true | true | 1 | 9 | 33 | 51 | 25 | 26 | null | null |
schell/caltrops | src/Auth.hs | mit | nullCookie :: HeaderCookie
nullCookie = HeaderCookie $ cookieText "" "-1" | 73 | nullCookie :: HeaderCookie
nullCookie = HeaderCookie $ cookieText "" "-1" | 73 | nullCookie = HeaderCookie $ cookieText "" "-1" | 46 | false | true | 0 | 6 | 9 | 26 | 11 | 15 | null | null |
GaloisInc/saw-script | crux-mir-comp/src/Mir/Compositional/Builder.hs | bsd-3-clause | execBuilderT :: Monad m =>
MethodSpecBuilder sym t -> BuilderT sym t m () -> m (MethodSpecBuilder sym t)
execBuilderT s f = execStateT f s | 142 | execBuilderT :: Monad m =>
MethodSpecBuilder sym t -> BuilderT sym t m () -> m (MethodSpecBuilder sym t)
execBuilderT s f = execStateT f s | 142 | execBuilderT s f = execStateT f s | 33 | false | true | 0 | 10 | 29 | 63 | 29 | 34 | null | null |
x-y-z/cabal | Cabal/Distribution/Simple/Haddock.hs | bsd-3-clause | getSourceFiles :: [FilePath]
-> [ModuleName.ModuleName]
-> IO [(ModuleName.ModuleName, FilePath)]
getSourceFiles dirs modules = flip mapM modules $ \m -> fmap ((,) m) $
findFileWithExtension ["hs", "lhs"] dirs (ModuleName.toFilePath m)
>>= maybe (notFound m) (return . normalise)
where
notFound module_ = die $ "can't find source for module " ++ display module_
-- | The directory where we put build results for an executable | 478 | getSourceFiles :: [FilePath]
-> [ModuleName.ModuleName]
-> IO [(ModuleName.ModuleName, FilePath)]
getSourceFiles dirs modules = flip mapM modules $ \m -> fmap ((,) m) $
findFileWithExtension ["hs", "lhs"] dirs (ModuleName.toFilePath m)
>>= maybe (notFound m) (return . normalise)
where
notFound module_ = die $ "can't find source for module " ++ display module_
-- | The directory where we put build results for an executable | 478 | getSourceFiles dirs modules = flip mapM modules $ \m -> fmap ((,) m) $
findFileWithExtension ["hs", "lhs"] dirs (ModuleName.toFilePath m)
>>= maybe (notFound m) (return . normalise)
where
notFound module_ = die $ "can't find source for module " ++ display module_
-- | The directory where we put build results for an executable | 344 | false | true | 0 | 12 | 115 | 142 | 73 | 69 | null | null |
sdiehl/ghc | testsuite/tests/quasiquotation/qq006/Expr.hs | bsd-3-clause | antiExprExp :: Expr -> Maybe (Q Exp)
antiExprExp (AntiIntExpr v) = Just $ appE (conE (mkName "IntExpr"))
(varE (mkName v)) | 173 | antiExprExp :: Expr -> Maybe (Q Exp)
antiExprExp (AntiIntExpr v) = Just $ appE (conE (mkName "IntExpr"))
(varE (mkName v)) | 173 | antiExprExp (AntiIntExpr v) = Just $ appE (conE (mkName "IntExpr"))
(varE (mkName v)) | 136 | false | true | 0 | 10 | 70 | 70 | 33 | 37 | null | null |
tamarin-prover/tamarin-prover | lib/theory/src/Theory/Model/Rule.hs | gpl-3.0 | -- | Given a fresh rule instance and the rule instance to mirror, returns a substitution
-- determining how all new variables need to be instantiated if possible.
-- First parameter: original instance to mirror
-- Second parameter: fresh instance
getSubstitutionsFixingNewVars :: RuleACInst -> RuleACInst -> Maybe LNSubst
getSubstitutionsFixingNewVars (Rule (ProtoInfo (ProtoRuleACInstInfo _ _ _)) _ _ _ instancesO)
(Rule (ProtoInfo (ProtoRuleACInstInfo _ _ _)) _ _ _ instancesF)
| all (\(x, y) -> isPubVar x || x == y) $ zip instancesF instancesO
= Just $ Subst $ M.fromList $ substList instancesF instancesO
-- otherwise there is no substitution
| otherwise
= Nothing
where
substList [] [] = []
substList (f:fs) (o:os) = case getVar f of
Nothing -> (substList fs os)
Just v -> (v, o):(substList fs os)
substList _ _ = error "getSubstitutionsFixingNewVars: different number of new variables" | 1,021 | getSubstitutionsFixingNewVars :: RuleACInst -> RuleACInst -> Maybe LNSubst
getSubstitutionsFixingNewVars (Rule (ProtoInfo (ProtoRuleACInstInfo _ _ _)) _ _ _ instancesO)
(Rule (ProtoInfo (ProtoRuleACInstInfo _ _ _)) _ _ _ instancesF)
| all (\(x, y) -> isPubVar x || x == y) $ zip instancesF instancesO
= Just $ Subst $ M.fromList $ substList instancesF instancesO
-- otherwise there is no substitution
| otherwise
= Nothing
where
substList [] [] = []
substList (f:fs) (o:os) = case getVar f of
Nothing -> (substList fs os)
Just v -> (v, o):(substList fs os)
substList _ _ = error "getSubstitutionsFixingNewVars: different number of new variables" | 768 | getSubstitutionsFixingNewVars (Rule (ProtoInfo (ProtoRuleACInstInfo _ _ _)) _ _ _ instancesO)
(Rule (ProtoInfo (ProtoRuleACInstInfo _ _ _)) _ _ _ instancesF)
| all (\(x, y) -> isPubVar x || x == y) $ zip instancesF instancesO
= Just $ Subst $ M.fromList $ substList instancesF instancesO
-- otherwise there is no substitution
| otherwise
= Nothing
where
substList [] [] = []
substList (f:fs) (o:os) = case getVar f of
Nothing -> (substList fs os)
Just v -> (v, o):(substList fs os)
substList _ _ = error "getSubstitutionsFixingNewVars: different number of new variables" | 693 | true | true | 0 | 14 | 269 | 266 | 134 | 132 | null | null |
tjakway/ghcjvm | compiler/main/DriverPhases.hs | bsd-3-clause | startPhase "cmm" = CmmCpp | 30 | startPhase "cmm" = CmmCpp | 30 | startPhase "cmm" = CmmCpp | 30 | false | false | 1 | 5 | 8 | 13 | 4 | 9 | null | null |
GaloisInc/saw-script | src/SAWScript/Position.hs | bsd-3-clause | spanPos :: Pos -> Pos -> Pos
spanPos (PosInternal str) _ = PosInternal str | 74 | spanPos :: Pos -> Pos -> Pos
spanPos (PosInternal str) _ = PosInternal str | 74 | spanPos (PosInternal str) _ = PosInternal str | 45 | false | true | 0 | 7 | 13 | 33 | 16 | 17 | null | null |
ntc2/haskell-call-trace | src/Data/Function/Decorator/Test.hs | mpl-2.0 | f' f 5 = do
_ <- f 2
fail "" | 32 | f' f 5 = do
_ <- f 2
fail "" | 32 | f' f 5 = do
_ <- f 2
fail "" | 32 | false | false | 1 | 9 | 14 | 32 | 11 | 21 | null | null |
tsujigiri/btree-hs | spec/Spec.hs | mit | main :: IO ()
main = hspec $ do
describe "insert" $ do
it "inserts a value into a tree" $ do
let value = (1::Int)
tree = insert value empty in
member value tree `shouldBe` True
describe "balance" $ do
it "balances a tree" $ do
let tree = foldl (flip insert) empty ([1,2,3]::[Int]) in
(balance tree) `shouldBe` (foldl (flip insert) empty [2,1,3])
describe "==" $ do
it "returns True if two trees ar equal" $ do
foldl (flip insert) empty ([1,2,3,4,5]::[Int])
== foldl (flip insert) empty ([1,2,3,4,5]::[Int])
`shouldBe` True
it "returns False if two trees are different" $ do
foldl (flip insert) empty ([1,2,3,4,5]::[Int])
== foldl (flip insert) empty ([1,2,4,3,5]::[Int])
`shouldBe` False
describe "fromList" $ do
it "returns a balanced tree" $ do
fromList [1,2,3,4,5] `shouldBe` foldl (flip insert) empty ([1,2,3,4,5]::[Int])
describe "values" $ do
it "returns a list of the tree's values " $ do
((values . fromList) [1,2,3,4,5]::[Int]) `shouldBe` [1,2,3,4,5] | 1,200 | main :: IO ()
main = hspec $ do
describe "insert" $ do
it "inserts a value into a tree" $ do
let value = (1::Int)
tree = insert value empty in
member value tree `shouldBe` True
describe "balance" $ do
it "balances a tree" $ do
let tree = foldl (flip insert) empty ([1,2,3]::[Int]) in
(balance tree) `shouldBe` (foldl (flip insert) empty [2,1,3])
describe "==" $ do
it "returns True if two trees ar equal" $ do
foldl (flip insert) empty ([1,2,3,4,5]::[Int])
== foldl (flip insert) empty ([1,2,3,4,5]::[Int])
`shouldBe` True
it "returns False if two trees are different" $ do
foldl (flip insert) empty ([1,2,3,4,5]::[Int])
== foldl (flip insert) empty ([1,2,4,3,5]::[Int])
`shouldBe` False
describe "fromList" $ do
it "returns a balanced tree" $ do
fromList [1,2,3,4,5] `shouldBe` foldl (flip insert) empty ([1,2,3,4,5]::[Int])
describe "values" $ do
it "returns a list of the tree's values " $ do
((values . fromList) [1,2,3,4,5]::[Int]) `shouldBe` [1,2,3,4,5] | 1,200 | main = hspec $ do
describe "insert" $ do
it "inserts a value into a tree" $ do
let value = (1::Int)
tree = insert value empty in
member value tree `shouldBe` True
describe "balance" $ do
it "balances a tree" $ do
let tree = foldl (flip insert) empty ([1,2,3]::[Int]) in
(balance tree) `shouldBe` (foldl (flip insert) empty [2,1,3])
describe "==" $ do
it "returns True if two trees ar equal" $ do
foldl (flip insert) empty ([1,2,3,4,5]::[Int])
== foldl (flip insert) empty ([1,2,3,4,5]::[Int])
`shouldBe` True
it "returns False if two trees are different" $ do
foldl (flip insert) empty ([1,2,3,4,5]::[Int])
== foldl (flip insert) empty ([1,2,4,3,5]::[Int])
`shouldBe` False
describe "fromList" $ do
it "returns a balanced tree" $ do
fromList [1,2,3,4,5] `shouldBe` foldl (flip insert) empty ([1,2,3,4,5]::[Int])
describe "values" $ do
it "returns a list of the tree's values " $ do
((values . fromList) [1,2,3,4,5]::[Int]) `shouldBe` [1,2,3,4,5] | 1,186 | false | true | 2 | 19 | 394 | 556 | 297 | 259 | null | null |
literate-unitb/literate-unitb | src/Document/Tests/SmallMachine.hs | mit | path3 :: FilePath
path3 = [path|Tests/small_machine.tex|] | 57 | path3 :: FilePath
path3 = [path|Tests/small_machine.tex|] | 57 | path3 = [path|Tests/small_machine.tex|] | 39 | false | true | 0 | 6 | 5 | 22 | 11 | 11 | null | null |
chaosim/peasy | coffee/samples/latex.hs | mit | citation :: String -> CitationMode -> Bool -> LP Inlines
citation name mode multi = do
(c,raw) <- withRaw $ cites mode multi
return $ cite c (rawInline "latex" $ "\\" ++ name ++ raw) | 186 | citation :: String -> CitationMode -> Bool -> LP Inlines
citation name mode multi = do
(c,raw) <- withRaw $ cites mode multi
return $ cite c (rawInline "latex" $ "\\" ++ name ++ raw) | 186 | citation name mode multi = do
(c,raw) <- withRaw $ cites mode multi
return $ cite c (rawInline "latex" $ "\\" ++ name ++ raw) | 129 | false | true | 0 | 14 | 38 | 90 | 42 | 48 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/book/2019-01-10-Thinking_with_Types-Sandy_Maguire/src/Ch01.hs | unlicense | uc' :: ((b, c) -> a) -> (b, c) -> a
uc' = id | 45 | uc' :: ((b, c) -> a) -> (b, c) -> a
uc' = id | 45 | uc' = id | 9 | false | true | 0 | 9 | 14 | 45 | 23 | 22 | null | null |
mattgreen/hython | src/Hython/Types.hs | gpl-3.0 | newString :: MonadInterpreter m => Text -> m Object
newString s = return $ String s | 83 | newString :: MonadInterpreter m => Text -> m Object
newString s = return $ String s | 83 | newString s = return $ String s | 31 | false | true | 0 | 7 | 15 | 35 | 16 | 19 | null | null |
rCEx/feldspar-lang-small | src/Feldspar/FixedPoint.hs | bsd-3-clause | -- This function cannot be implemented now as we don't have access to range
-- information while building the tree anymore.
{-
significantBits :: forall a . (Type a, Num a, Ord a, Size a ~ Range a, Prelude.Real a) => Data a -> IntN
significantBits x = IntN $ fromInteger $ toInteger $ (Prelude.floor mf)+1
where
r :: Range a
r = dataSize x
m :: a
m = Prelude.max (Prelude.abs $ lowerBound r) (Prelude.abs $ upperBound r)
mf :: Float
mf = logBase 2 $ fromRational $ toRational m
-}
{-
setSignificantBits :: forall a . (Type a, Num a, Ord a, Size a ~ Range a, Prelude.Real a) => a -> Data a -> Data a
setSignificantBits sb x = resizeData r x
where
r :: Range a
r = Range 0 sb
-}
wordLength :: forall a . (Integral a, Prelude.Real a) => T a -> IntN
wordLength _ = Prelude.ceiling ( Prelude.logBase 2 $ fromRational $ toRational (maxBound :: a)) + 1 | 882 | wordLength :: forall a . (Integral a, Prelude.Real a) => T a -> IntN
wordLength _ = Prelude.ceiling ( Prelude.logBase 2 $ fromRational $ toRational (maxBound :: a)) + 1 | 168 | wordLength _ = Prelude.ceiling ( Prelude.logBase 2 $ fromRational $ toRational (maxBound :: a)) + 1 | 99 | true | true | 0 | 11 | 203 | 81 | 43 | 38 | null | null |
brendanhay/gogol | gogol-datastore/gen/Network/Google/Datastore/Types/Product.hs | mpl-2.0 | -- | The direction to order by. Defaults to \`ASCENDING\`.
poDirection :: Lens' PropertyOrder (Maybe PropertyOrderDirection)
poDirection
= lens _poDirection (\ s a -> s{_poDirection = a}) | 189 | poDirection :: Lens' PropertyOrder (Maybe PropertyOrderDirection)
poDirection
= lens _poDirection (\ s a -> s{_poDirection = a}) | 130 | poDirection
= lens _poDirection (\ s a -> s{_poDirection = a}) | 64 | true | true | 0 | 9 | 28 | 48 | 25 | 23 | null | null |
fmthoma/ghc | libraries/base/Data/Foldable.hs | bsd-3-clause | -- | Determines whether all elements of the structure satisfy the predicate.
all :: Foldable t => (a -> Bool) -> t a -> Bool
all p = getAll #. foldMap (All #. p) | 161 | all :: Foldable t => (a -> Bool) -> t a -> Bool
all p = getAll #. foldMap (All #. p) | 84 | all p = getAll #. foldMap (All #. p) | 36 | true | true | 0 | 8 | 33 | 57 | 28 | 29 | null | null |
sherwoodwang/wxHaskell | wxdirect/src/ParseC.hs | lgpl-2.1 | {-----------------------------------------------------------------------------------------
Parse C
-----------------------------------------------------------------------------------------}
parseC :: FilePath -> IO [Decl]
parseC fname
= do contents <- readHeaderFile fname
declss <- mapM (parseDecl fname) (pairComments contents)
return (concat declss) | 374 | parseC :: FilePath -> IO [Decl]
parseC fname
= do contents <- readHeaderFile fname
declss <- mapM (parseDecl fname) (pairComments contents)
return (concat declss) | 181 | parseC fname
= do contents <- readHeaderFile fname
declss <- mapM (parseDecl fname) (pairComments contents)
return (concat declss) | 149 | true | true | 0 | 11 | 49 | 76 | 34 | 42 | null | null |
gridaphobe/ghc | compiler/nativeGen/PPC/Ppr.hs | bsd-3-clause | pprInstr (STFAR fmt reg (AddrRegImm source off)) =
sdocWithPlatform $ \platform -> vcat [
pprInstr (ADDIS (tmpReg platform) source (HA off)),
pprInstr (ST fmt reg (AddrRegImm (tmpReg platform) (LO off)))
] | 230 | pprInstr (STFAR fmt reg (AddrRegImm source off)) =
sdocWithPlatform $ \platform -> vcat [
pprInstr (ADDIS (tmpReg platform) source (HA off)),
pprInstr (ST fmt reg (AddrRegImm (tmpReg platform) (LO off)))
] | 230 | pprInstr (STFAR fmt reg (AddrRegImm source off)) =
sdocWithPlatform $ \platform -> vcat [
pprInstr (ADDIS (tmpReg platform) source (HA off)),
pprInstr (ST fmt reg (AddrRegImm (tmpReg platform) (LO off)))
] | 230 | false | false | 0 | 15 | 55 | 103 | 51 | 52 | null | null |
PseudoPower/AFSM | src/Data/AFSM/SF/Core.hs | mit | faninSF :: SF a c -> SF b c -> SF (Either a b) c
faninSF (SF f0) (SF f1) = SF (f2 f0 f1)
where
f2 f0 f1 (Left a) = let (SF f0', c) = f0 a in (SF (f2 f0' f1), c)
f2 f0 f1 (Right b) = let (SF f1', c) = f1 b in (SF (f2 f0 f1'), c)
-- ArrowApply | 254 | faninSF :: SF a c -> SF b c -> SF (Either a b) c
faninSF (SF f0) (SF f1) = SF (f2 f0 f1)
where
f2 f0 f1 (Left a) = let (SF f0', c) = f0 a in (SF (f2 f0' f1), c)
f2 f0 f1 (Right b) = let (SF f1', c) = f1 b in (SF (f2 f0 f1'), c)
-- ArrowApply | 254 | faninSF (SF f0) (SF f1) = SF (f2 f0 f1)
where
f2 f0 f1 (Left a) = let (SF f0', c) = f0 a in (SF (f2 f0' f1), c)
f2 f0 f1 (Right b) = let (SF f1', c) = f1 b in (SF (f2 f0 f1'), c)
-- ArrowApply | 205 | false | true | 0 | 10 | 78 | 192 | 93 | 99 | null | null |
nushio3/ghc | compiler/utils/Util.hs | bsd-3-clause | takeList :: [b] -> [a] -> [a]
-- (takeList as bs) trims bs to the be same length
-- as as, unless as is longer in which case it's a no-op
takeList [] _ = [] | 156 | takeList :: [b] -> [a] -> [a]
takeList [] _ = [] | 48 | takeList [] _ = [] | 18 | true | true | 0 | 9 | 35 | 45 | 23 | 22 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/max_6.hs | mit | ltEsOrdering GT EQ = MyFalse | 28 | ltEsOrdering GT EQ = MyFalse | 28 | ltEsOrdering GT EQ = MyFalse | 28 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
seereason/ghcjs | src/Gen2/Prim.hs | mit | genPrim d t CopyByteArrayToAddrOp [] xs@[_a1,_o1,_a2,_o2,_n] = genPrim d t CopyByteArrayOp [] xs | 96 | genPrim d t CopyByteArrayToAddrOp [] xs@[_a1,_o1,_a2,_o2,_n] = genPrim d t CopyByteArrayOp [] xs | 96 | genPrim d t CopyByteArrayToAddrOp [] xs@[_a1,_o1,_a2,_o2,_n] = genPrim d t CopyByteArrayOp [] xs | 96 | false | false | 0 | 7 | 12 | 50 | 27 | 23 | null | null |
mettekou/ghc | compiler/utils/Util.hs | bsd-3-clause | nTimes n f = f . nTimes (n-1) f | 31 | nTimes n f = f . nTimes (n-1) f | 31 | nTimes n f = f . nTimes (n-1) f | 31 | false | false | 0 | 8 | 8 | 28 | 13 | 15 | null | null |
khibino/travis-ci-haskell | pkg-a/tests/useQuickCheckSimple.hs | bsd-3-clause | prop_stringHello :: Bool
prop_stringHello = stringHello == "Hello 2017-01-02 12:34:56" | 86 | prop_stringHello :: Bool
prop_stringHello = stringHello == "Hello 2017-01-02 12:34:56" | 86 | prop_stringHello = stringHello == "Hello 2017-01-02 12:34:56" | 61 | false | true | 1 | 6 | 9 | 25 | 10 | 15 | null | null |
igrep/igrep-cashbook | hs/convert-to-cashbook2.hs | mit | stripDate xs = Str.join " " xs | 31 | stripDate xs = Str.join " " xs | 31 | stripDate xs = Str.join " " xs | 31 | false | false | 0 | 6 | 7 | 16 | 7 | 9 | null | null |
frenetic-lang/nettle-openflow | src/Nettle/OpenFlow/MessagesBinary.hs | bsd-3-clause | -- 1 << 0
ofppsStpListen = 0 `shiftL` 8 | 40 | ofppsStpListen = 0 `shiftL` 8 | 30 | ofppsStpListen = 0 `shiftL` 8 | 30 | true | false | 0 | 5 | 9 | 13 | 8 | 5 | null | null |
olorin/amazonka | amazonka-iam/gen/Network/AWS/IAM/DetachRolePolicy.hs | mpl-2.0 | -- | The name (friendly name, not ARN) of the role to detach the policy from.
drpRoleName :: Lens' DetachRolePolicy Text
drpRoleName = lens _drpRoleName (\ s a -> s{_drpRoleName = a}) | 183 | drpRoleName :: Lens' DetachRolePolicy Text
drpRoleName = lens _drpRoleName (\ s a -> s{_drpRoleName = a}) | 105 | drpRoleName = lens _drpRoleName (\ s a -> s{_drpRoleName = a}) | 62 | true | true | 0 | 9 | 31 | 40 | 22 | 18 | null | null |
carlostome/HCrawler | test/Main.hs | gpl-2.0 | tests :: [Test]
tests =
[
testGroup "Analyzer"
[
testProperty "All pages generated" prop_buildGraph_allPagesIn,
testProperty "Keywords" prop_keywords,
testProperty "prop_links_domain" prop_links_domain
],
testGroup "WebGraph"
[
testProperty "After insert is in" prop_insert_exists,
testProperty "" prop_insert_uris,
testProperty "" prop_insert_links,
testProperty "" prop_insert_kws,
testProperty "" prop_unions
]
] | 493 | tests :: [Test]
tests =
[
testGroup "Analyzer"
[
testProperty "All pages generated" prop_buildGraph_allPagesIn,
testProperty "Keywords" prop_keywords,
testProperty "prop_links_domain" prop_links_domain
],
testGroup "WebGraph"
[
testProperty "After insert is in" prop_insert_exists,
testProperty "" prop_insert_uris,
testProperty "" prop_insert_links,
testProperty "" prop_insert_kws,
testProperty "" prop_unions
]
] | 493 | tests =
[
testGroup "Analyzer"
[
testProperty "All pages generated" prop_buildGraph_allPagesIn,
testProperty "Keywords" prop_keywords,
testProperty "prop_links_domain" prop_links_domain
],
testGroup "WebGraph"
[
testProperty "After insert is in" prop_insert_exists,
testProperty "" prop_insert_uris,
testProperty "" prop_insert_links,
testProperty "" prop_insert_kws,
testProperty "" prop_unions
]
] | 477 | false | true | 0 | 9 | 121 | 101 | 49 | 52 | null | null |
joelburget/tapl | Stlc/Interpret.hs | bsd-3-clause | printtm ctx (TmIf _ test b1 b2) = toStrict $ format "if {} then {} else {}"
(printtm ctx test, printtm ctx b1, printtm ctx b2) | 130 | printtm ctx (TmIf _ test b1 b2) = toStrict $ format "if {} then {} else {}"
(printtm ctx test, printtm ctx b1, printtm ctx b2) | 130 | printtm ctx (TmIf _ test b1 b2) = toStrict $ format "if {} then {} else {}"
(printtm ctx test, printtm ctx b1, printtm ctx b2) | 130 | false | false | 2 | 7 | 29 | 61 | 27 | 34 | null | null |
jecisc/TP_PF_L3 | PF-TP4/src/Main.hs | mit | element x (Noeud _ a ag ad) = x == a || element x ag || element x ad | 68 | element x (Noeud _ a ag ad) = x == a || element x ag || element x ad | 68 | element x (Noeud _ a ag ad) = x == a || element x ag || element x ad | 68 | false | false | 0 | 7 | 18 | 45 | 21 | 24 | null | null |
lodvaer/machines-attoparsec | src/Data/Attoparsec/Machine.hs | bsd-3-clause | ignoreParserError :: Monad m => ProcessT m (Result a) a
ignoreParserError = repeatedly $ await >>= \case Fail _ _ -> return ()
Success a -> yield a
-- | Stops the parser when it fails.
--
-- >>> runT . supply ["hia"] $ autoStreamParser (string "hi") ~> stopOnParserError
-- [Success "hi",Fail [] "string"]
-- | 358 | ignoreParserError :: Monad m => ProcessT m (Result a) a
ignoreParserError = repeatedly $ await >>= \case Fail _ _ -> return ()
Success a -> yield a
-- | Stops the parser when it fails.
--
-- >>> runT . supply ["hia"] $ autoStreamParser (string "hi") ~> stopOnParserError
-- [Success "hi",Fail [] "string"]
-- | 358 | ignoreParserError = repeatedly $ await >>= \case Fail _ _ -> return ()
Success a -> yield a
-- | Stops the parser when it fails.
--
-- >>> runT . supply ["hia"] $ autoStreamParser (string "hi") ~> stopOnParserError
-- [Success "hi",Fail [] "string"]
-- | 302 | false | true | 0 | 10 | 104 | 74 | 37 | 37 | null | null |
romanb/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types.hs | mpl-2.0 | -- | The network interface attachment.
niAttachment :: Lens' NetworkInterface (Maybe NetworkInterfaceAttachment)
niAttachment = lens _niAttachment (\s a -> s { _niAttachment = a }) | 180 | niAttachment :: Lens' NetworkInterface (Maybe NetworkInterfaceAttachment)
niAttachment = lens _niAttachment (\s a -> s { _niAttachment = a }) | 141 | niAttachment = lens _niAttachment (\s a -> s { _niAttachment = a }) | 67 | true | true | 1 | 9 | 24 | 51 | 25 | 26 | null | null |
ctford/Idris-Elba-dev | src/Idris/Transforms.hs | bsd-3-clause | suc x = x | 9 | suc x = x | 9 | suc x = x | 9 | false | false | 0 | 4 | 3 | 9 | 4 | 5 | null | null |
ekmett/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | doPrefetchByteArrayOp :: [LocalReg]
-> [CmmExpr]
-> FCode ()
doPrefetchByteArrayOp res [addr,idx]
= do dflags <- getDynFlags
mkBasicPrefetch (arrWordsHdrSize dflags) res addr idx | 233 | doPrefetchByteArrayOp :: [LocalReg]
-> [CmmExpr]
-> FCode ()
doPrefetchByteArrayOp res [addr,idx]
= do dflags <- getDynFlags
mkBasicPrefetch (arrWordsHdrSize dflags) res addr idx | 233 | doPrefetchByteArrayOp res [addr,idx]
= do dflags <- getDynFlags
mkBasicPrefetch (arrWordsHdrSize dflags) res addr idx | 128 | false | true | 0 | 9 | 76 | 66 | 33 | 33 | null | null |
projectorhq/haskell-liquid | src/Text/Liquid/Renderer.hs | bsd-3-clause | bothSidesEqual j Trueth (Variable xs) = (==) (pure True) <$> vl
where vl = preview _Bool <$> extractValue j xs | 125 | bothSidesEqual j Trueth (Variable xs) = (==) (pure True) <$> vl
where vl = preview _Bool <$> extractValue j xs | 125 | bothSidesEqual j Trueth (Variable xs) = (==) (pure True) <$> vl
where vl = preview _Bool <$> extractValue j xs | 125 | false | false | 3 | 8 | 34 | 61 | 26 | 35 | null | null |
HIPERFIT/futhark | src/Futhark/Optimise/Simplify/Rules/BasicOp.hs | isc | ruleBasicOp vtable pat aux (Update safety arr_x (Slice slice_x) (Var v))
| Just _ <- sliceIndices (Slice slice_x),
Just (Index arr_y (Slice slice_y), cs_y) <- ST.lookupBasicOp v vtable,
ST.available arr_y vtable,
-- XXX: we should check for proper aliasing here instead.
arr_y /= arr_x,
Just (slice_x_bef, DimFix i, []) <- focusNth (length slice_x - 1) slice_x,
Just (slice_y_bef, DimFix j, []) <- focusNth (length slice_y - 1) slice_y = Simplify $ do
let slice_x' = Slice $ slice_x_bef ++ [DimSlice i (intConst Int64 1) (intConst Int64 1)]
slice_y' = Slice $ slice_y_bef ++ [DimSlice j (intConst Int64 1) (intConst Int64 1)]
v' <- letExp (baseString v ++ "_slice") $ BasicOp $ Index arr_y slice_y'
certifying cs_y . auxing aux $
letBind pat $ BasicOp $ Update safety arr_x slice_x' $ Var v'
-- Simplify away 0<=i when 'i' is from a loop of form 'for i < n'. | 911 | ruleBasicOp vtable pat aux (Update safety arr_x (Slice slice_x) (Var v))
| Just _ <- sliceIndices (Slice slice_x),
Just (Index arr_y (Slice slice_y), cs_y) <- ST.lookupBasicOp v vtable,
ST.available arr_y vtable,
-- XXX: we should check for proper aliasing here instead.
arr_y /= arr_x,
Just (slice_x_bef, DimFix i, []) <- focusNth (length slice_x - 1) slice_x,
Just (slice_y_bef, DimFix j, []) <- focusNth (length slice_y - 1) slice_y = Simplify $ do
let slice_x' = Slice $ slice_x_bef ++ [DimSlice i (intConst Int64 1) (intConst Int64 1)]
slice_y' = Slice $ slice_y_bef ++ [DimSlice j (intConst Int64 1) (intConst Int64 1)]
v' <- letExp (baseString v ++ "_slice") $ BasicOp $ Index arr_y slice_y'
certifying cs_y . auxing aux $
letBind pat $ BasicOp $ Update safety arr_x slice_x' $ Var v'
-- Simplify away 0<=i when 'i' is from a loop of form 'for i < n'. | 911 | ruleBasicOp vtable pat aux (Update safety arr_x (Slice slice_x) (Var v))
| Just _ <- sliceIndices (Slice slice_x),
Just (Index arr_y (Slice slice_y), cs_y) <- ST.lookupBasicOp v vtable,
ST.available arr_y vtable,
-- XXX: we should check for proper aliasing here instead.
arr_y /= arr_x,
Just (slice_x_bef, DimFix i, []) <- focusNth (length slice_x - 1) slice_x,
Just (slice_y_bef, DimFix j, []) <- focusNth (length slice_y - 1) slice_y = Simplify $ do
let slice_x' = Slice $ slice_x_bef ++ [DimSlice i (intConst Int64 1) (intConst Int64 1)]
slice_y' = Slice $ slice_y_bef ++ [DimSlice j (intConst Int64 1) (intConst Int64 1)]
v' <- letExp (baseString v ++ "_slice") $ BasicOp $ Index arr_y slice_y'
certifying cs_y . auxing aux $
letBind pat $ BasicOp $ Update safety arr_x slice_x' $ Var v'
-- Simplify away 0<=i when 'i' is from a loop of form 'for i < n'. | 911 | false | false | 0 | 16 | 200 | 358 | 172 | 186 | null | null |
bgold-cosmos/Tidal | src/Sound/Tidal/UI.hs | gpl-3.0 | index :: Real b => b -> Pattern b -> Pattern c -> Pattern c
index sz indexpat pat =
spread' (zoom' $ toRational sz) (toRational . (*(1-sz)) <$> indexpat) pat
where
zoom' tSz s = zoomArc (Arc s (s+tSz))
{-
-- | @prrw f rot (blen, vlen) beatPattern valuePattern@: pattern rotate/replace.
prrw :: (a -> b -> c) -> Int -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c
prrw f rot (blen, vlen) beatPattern valuePattern =
let
ecompare (_,e1,_) (_,e2,_) = compare (fst e1) (fst e2)
beats = sortBy ecompare $ arc beatPattern (0, blen)
values = fmap thd' . sortBy ecompare $ arc valuePattern (0, vlen)
cycles = blen * (fromIntegral $ lcm (length beats) (length values) `div` (length beats))
in
_slow cycles $ stack $ zipWith
(\( _, (start, end), v') v -> (start `rotR`) $ densityGap (1 / (end - start)) $ pure (f v' v))
(sortBy ecompare $ arc (_fast cycles $ beatPattern) (0, blen))
(drop (rot `mod` length values) $ cycle values)
-- | @prr rot (blen, vlen) beatPattern valuePattern@: pattern rotate/replace.
prr :: Int -> (Time, Time) -> Pattern String -> Pattern b -> Pattern b
prr = prrw $ flip const
{-|
@preplace (blen, plen) beats values@ combines the timing of @beats@ with the values
of @values@. Other ways of saying this are:
* sequential convolution
* @values@ quantized to @beats@.
Examples:
@
d1 $ sound $ preplace (1,1) "x [~ x] x x" "bd sn"
d1 $ sound $ preplace (1,1) "x(3,8)" "bd sn"
d1 $ sound $ "x(3,8)" <~> "bd sn"
d1 $ sound "[jvbass jvbass:5]*3" |+| (shape $ "1 1 1 1 1" <~> "0.2 0.9")
@
It is assumed the pattern fits into a single cycle. This works well with
pattern literals, but not always with patterns defined elsewhere. In those cases
use @preplace@ and provide desired pattern lengths:
@
let p = slow 2 $ "x x x"
d1 $ sound $ preplace (2,1) p "bd sn"
@
-}
preplace :: (Time, Time) -> Pattern String -> Pattern b -> Pattern b
preplace = preplaceWith $ flip const
-- | @prep@ is an alias for preplace.
prep :: (Time, Time) -> Pattern String -> Pattern b -> Pattern b
prep = preplace
preplace1 :: Pattern String -> Pattern b -> Pattern b
preplace1 = preplace (1, 1)
preplaceWith :: (a -> b -> c) -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c
preplaceWith f (blen, plen) = prrw f 0 (blen, plen)
prw :: (a -> b -> c) -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c
prw = preplaceWith
preplaceWith1 :: (a -> b -> c) -> Pattern a -> Pattern b -> Pattern c
preplaceWith1 f = prrw f 0 (1, 1)
prw1 :: (a -> b -> c) -> Pattern a -> Pattern b -> Pattern c
prw1 = preplaceWith1
(<~>) :: Pattern String -> Pattern b -> Pattern b
(<~>) = preplace (1, 1)
-- | @protate len rot p@ rotates pattern @p@ by @rot@ beats to the left.
-- @len@: length of the pattern, in cycles.
-- Example: @d1 $ every 4 (protate 2 (-1)) $ slow 2 $ sound "bd hh hh hh"@
protate :: Time -> Int -> Pattern a -> Pattern a
protate len rot p = prrw (flip const) rot (len, len) p p
prot :: Time -> Int -> Pattern a -> Pattern a
prot = protate
prot1 :: Int -> Pattern a -> Pattern a
prot1 = protate 1
{-| The @<<~@ operator rotates a unit pattern to the left, similar to @<~@,
but by events rather than linear time. The timing of the pattern remains constant:
@
d1 $ (1 <<~) $ sound "bd ~ sn hh"
-- will become
d1 $ sound "sn ~ hh bd"
@ -}
(<<~) :: Int -> Pattern a -> Pattern a
(<<~) = protate 1
-- | @~>>@ is like @<<~@ but for shifting to the right.
(~>>) :: Int -> Pattern a -> Pattern a
(~>>) = (<<~) . (0-)
-- | @pequal cycles p1 p2@: quickly test if @p1@ and @p2@ are the same.
pequal :: Ord a => Time -> Pattern a -> Pattern a -> Bool
pequal cycles p1 p2 = (sort $ arc p1 (0, cycles)) == (sort $ arc p2 (0, cycles))
-}
-- | @rot n p@ rotates the values in a pattern @p@ by @n@ beats to the left.
-- Example: @d1 $ every 4 (rot 2) $ slow 2 $ sound "bd hh hh hh"@ | 3,833 | index :: Real b => b -> Pattern b -> Pattern c -> Pattern c
index sz indexpat pat =
spread' (zoom' $ toRational sz) (toRational . (*(1-sz)) <$> indexpat) pat
where
zoom' tSz s = zoomArc (Arc s (s+tSz))
{-
-- | @prrw f rot (blen, vlen) beatPattern valuePattern@: pattern rotate/replace.
prrw :: (a -> b -> c) -> Int -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c
prrw f rot (blen, vlen) beatPattern valuePattern =
let
ecompare (_,e1,_) (_,e2,_) = compare (fst e1) (fst e2)
beats = sortBy ecompare $ arc beatPattern (0, blen)
values = fmap thd' . sortBy ecompare $ arc valuePattern (0, vlen)
cycles = blen * (fromIntegral $ lcm (length beats) (length values) `div` (length beats))
in
_slow cycles $ stack $ zipWith
(\( _, (start, end), v') v -> (start `rotR`) $ densityGap (1 / (end - start)) $ pure (f v' v))
(sortBy ecompare $ arc (_fast cycles $ beatPattern) (0, blen))
(drop (rot `mod` length values) $ cycle values)
-- | @prr rot (blen, vlen) beatPattern valuePattern@: pattern rotate/replace.
prr :: Int -> (Time, Time) -> Pattern String -> Pattern b -> Pattern b
prr = prrw $ flip const
{-|
@preplace (blen, plen) beats values@ combines the timing of @beats@ with the values
of @values@. Other ways of saying this are:
* sequential convolution
* @values@ quantized to @beats@.
Examples:
@
d1 $ sound $ preplace (1,1) "x [~ x] x x" "bd sn"
d1 $ sound $ preplace (1,1) "x(3,8)" "bd sn"
d1 $ sound $ "x(3,8)" <~> "bd sn"
d1 $ sound "[jvbass jvbass:5]*3" |+| (shape $ "1 1 1 1 1" <~> "0.2 0.9")
@
It is assumed the pattern fits into a single cycle. This works well with
pattern literals, but not always with patterns defined elsewhere. In those cases
use @preplace@ and provide desired pattern lengths:
@
let p = slow 2 $ "x x x"
d1 $ sound $ preplace (2,1) p "bd sn"
@
-}
preplace :: (Time, Time) -> Pattern String -> Pattern b -> Pattern b
preplace = preplaceWith $ flip const
-- | @prep@ is an alias for preplace.
prep :: (Time, Time) -> Pattern String -> Pattern b -> Pattern b
prep = preplace
preplace1 :: Pattern String -> Pattern b -> Pattern b
preplace1 = preplace (1, 1)
preplaceWith :: (a -> b -> c) -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c
preplaceWith f (blen, plen) = prrw f 0 (blen, plen)
prw :: (a -> b -> c) -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c
prw = preplaceWith
preplaceWith1 :: (a -> b -> c) -> Pattern a -> Pattern b -> Pattern c
preplaceWith1 f = prrw f 0 (1, 1)
prw1 :: (a -> b -> c) -> Pattern a -> Pattern b -> Pattern c
prw1 = preplaceWith1
(<~>) :: Pattern String -> Pattern b -> Pattern b
(<~>) = preplace (1, 1)
-- | @protate len rot p@ rotates pattern @p@ by @rot@ beats to the left.
-- @len@: length of the pattern, in cycles.
-- Example: @d1 $ every 4 (protate 2 (-1)) $ slow 2 $ sound "bd hh hh hh"@
protate :: Time -> Int -> Pattern a -> Pattern a
protate len rot p = prrw (flip const) rot (len, len) p p
prot :: Time -> Int -> Pattern a -> Pattern a
prot = protate
prot1 :: Int -> Pattern a -> Pattern a
prot1 = protate 1
{-| The @<<~@ operator rotates a unit pattern to the left, similar to @<~@,
but by events rather than linear time. The timing of the pattern remains constant:
@
d1 $ (1 <<~) $ sound "bd ~ sn hh"
-- will become
d1 $ sound "sn ~ hh bd"
@ -}
(<<~) :: Int -> Pattern a -> Pattern a
(<<~) = protate 1
-- | @~>>@ is like @<<~@ but for shifting to the right.
(~>>) :: Int -> Pattern a -> Pattern a
(~>>) = (<<~) . (0-)
-- | @pequal cycles p1 p2@: quickly test if @p1@ and @p2@ are the same.
pequal :: Ord a => Time -> Pattern a -> Pattern a -> Bool
pequal cycles p1 p2 = (sort $ arc p1 (0, cycles)) == (sort $ arc p2 (0, cycles))
-}
-- | @rot n p@ rotates the values in a pattern @p@ by @n@ beats to the left.
-- Example: @d1 $ every 4 (rot 2) $ slow 2 $ sound "bd hh hh hh"@ | 3,833 | index sz indexpat pat =
spread' (zoom' $ toRational sz) (toRational . (*(1-sz)) <$> indexpat) pat
where
zoom' tSz s = zoomArc (Arc s (s+tSz))
{-
-- | @prrw f rot (blen, vlen) beatPattern valuePattern@: pattern rotate/replace.
prrw :: (a -> b -> c) -> Int -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c
prrw f rot (blen, vlen) beatPattern valuePattern =
let
ecompare (_,e1,_) (_,e2,_) = compare (fst e1) (fst e2)
beats = sortBy ecompare $ arc beatPattern (0, blen)
values = fmap thd' . sortBy ecompare $ arc valuePattern (0, vlen)
cycles = blen * (fromIntegral $ lcm (length beats) (length values) `div` (length beats))
in
_slow cycles $ stack $ zipWith
(\( _, (start, end), v') v -> (start `rotR`) $ densityGap (1 / (end - start)) $ pure (f v' v))
(sortBy ecompare $ arc (_fast cycles $ beatPattern) (0, blen))
(drop (rot `mod` length values) $ cycle values)
-- | @prr rot (blen, vlen) beatPattern valuePattern@: pattern rotate/replace.
prr :: Int -> (Time, Time) -> Pattern String -> Pattern b -> Pattern b
prr = prrw $ flip const
{-|
@preplace (blen, plen) beats values@ combines the timing of @beats@ with the values
of @values@. Other ways of saying this are:
* sequential convolution
* @values@ quantized to @beats@.
Examples:
@
d1 $ sound $ preplace (1,1) "x [~ x] x x" "bd sn"
d1 $ sound $ preplace (1,1) "x(3,8)" "bd sn"
d1 $ sound $ "x(3,8)" <~> "bd sn"
d1 $ sound "[jvbass jvbass:5]*3" |+| (shape $ "1 1 1 1 1" <~> "0.2 0.9")
@
It is assumed the pattern fits into a single cycle. This works well with
pattern literals, but not always with patterns defined elsewhere. In those cases
use @preplace@ and provide desired pattern lengths:
@
let p = slow 2 $ "x x x"
d1 $ sound $ preplace (2,1) p "bd sn"
@
-}
preplace :: (Time, Time) -> Pattern String -> Pattern b -> Pattern b
preplace = preplaceWith $ flip const
-- | @prep@ is an alias for preplace.
prep :: (Time, Time) -> Pattern String -> Pattern b -> Pattern b
prep = preplace
preplace1 :: Pattern String -> Pattern b -> Pattern b
preplace1 = preplace (1, 1)
preplaceWith :: (a -> b -> c) -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c
preplaceWith f (blen, plen) = prrw f 0 (blen, plen)
prw :: (a -> b -> c) -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c
prw = preplaceWith
preplaceWith1 :: (a -> b -> c) -> Pattern a -> Pattern b -> Pattern c
preplaceWith1 f = prrw f 0 (1, 1)
prw1 :: (a -> b -> c) -> Pattern a -> Pattern b -> Pattern c
prw1 = preplaceWith1
(<~>) :: Pattern String -> Pattern b -> Pattern b
(<~>) = preplace (1, 1)
-- | @protate len rot p@ rotates pattern @p@ by @rot@ beats to the left.
-- @len@: length of the pattern, in cycles.
-- Example: @d1 $ every 4 (protate 2 (-1)) $ slow 2 $ sound "bd hh hh hh"@
protate :: Time -> Int -> Pattern a -> Pattern a
protate len rot p = prrw (flip const) rot (len, len) p p
prot :: Time -> Int -> Pattern a -> Pattern a
prot = protate
prot1 :: Int -> Pattern a -> Pattern a
prot1 = protate 1
{-| The @<<~@ operator rotates a unit pattern to the left, similar to @<~@,
but by events rather than linear time. The timing of the pattern remains constant:
@
d1 $ (1 <<~) $ sound "bd ~ sn hh"
-- will become
d1 $ sound "sn ~ hh bd"
@ -}
(<<~) :: Int -> Pattern a -> Pattern a
(<<~) = protate 1
-- | @~>>@ is like @<<~@ but for shifting to the right.
(~>>) :: Int -> Pattern a -> Pattern a
(~>>) = (<<~) . (0-)
-- | @pequal cycles p1 p2@: quickly test if @p1@ and @p2@ are the same.
pequal :: Ord a => Time -> Pattern a -> Pattern a -> Bool
pequal cycles p1 p2 = (sort $ arc p1 (0, cycles)) == (sort $ arc p2 (0, cycles))
-}
-- | @rot n p@ rotates the values in a pattern @p@ by @n@ beats to the left.
-- Example: @d1 $ every 4 (rot 2) $ slow 2 $ sound "bd hh hh hh"@ | 3,773 | false | true | 0 | 11 | 835 | 126 | 61 | 65 | null | null |
nicolashery/cis194 | src/Homework/A/CreditCard.hs | bsd-3-clause | -- Convert positive Integers to a list of digits
toDigits :: Integer -> [Integer]
toDigits = reverse . toDigitsRev | 114 | toDigits :: Integer -> [Integer]
toDigits = reverse . toDigitsRev | 65 | toDigits = reverse . toDigitsRev | 32 | true | true | 0 | 6 | 18 | 23 | 13 | 10 | null | null |
rueshyna/gogol | gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs | mpl-2.0 | -- | Optional. The text code that corresponds to the promotion when applied
-- on the retailer?s website.
opGenericRedemptionCode :: Lens' OrderPromotion (Maybe Text)
opGenericRedemptionCode
= lens _opGenericRedemptionCode
(\ s a -> s{_opGenericRedemptionCode = a}) | 273 | opGenericRedemptionCode :: Lens' OrderPromotion (Maybe Text)
opGenericRedemptionCode
= lens _opGenericRedemptionCode
(\ s a -> s{_opGenericRedemptionCode = a}) | 167 | opGenericRedemptionCode
= lens _opGenericRedemptionCode
(\ s a -> s{_opGenericRedemptionCode = a}) | 106 | true | true | 0 | 8 | 42 | 50 | 26 | 24 | null | null |
nazrhom/vcs-clojure | src/Language/Clojure/Lang.hs | bsd-3-clause | onRecursiveGuy rec nonrec at@(USepExprList _) = rec at | 54 | onRecursiveGuy rec nonrec at@(USepExprList _) = rec at | 54 | onRecursiveGuy rec nonrec at@(USepExprList _) = rec at | 54 | false | false | 0 | 8 | 7 | 25 | 12 | 13 | null | null |
tangboyun/miranda | src/test.hs | gpl-3.0 | renderBond ali@(Align miR3' utr5' b) =
let (lhs:pair:loop:seed:rhs:[]) = splitPlaces (lengthOfEach ali) $
B8.unpack b
renderB = hcat . map (\c ->
if c /= ' '
then charC bondColor c
else char c)
in string " " ||| stringC gray lhs ||| renderB pair ||| stringC gray loop|||
renderB seed |||
stringC gray rhs ||| string " " | 496 | renderBond ali@(Align miR3' utr5' b) =
let (lhs:pair:loop:seed:rhs:[]) = splitPlaces (lengthOfEach ali) $
B8.unpack b
renderB = hcat . map (\c ->
if c /= ' '
then charC bondColor c
else char c)
in string " " ||| stringC gray lhs ||| renderB pair ||| stringC gray loop|||
renderB seed |||
stringC gray rhs ||| string " " | 496 | renderBond ali@(Align miR3' utr5' b) =
let (lhs:pair:loop:seed:rhs:[]) = splitPlaces (lengthOfEach ali) $
B8.unpack b
renderB = hcat . map (\c ->
if c /= ' '
then charC bondColor c
else char c)
in string " " ||| stringC gray lhs ||| renderB pair ||| stringC gray loop|||
renderB seed |||
stringC gray rhs ||| string " " | 496 | false | false | 0 | 15 | 235 | 168 | 80 | 88 | null | null |
muspellsson/hiccup | RToken.hs | lgpl-2.1 | rtokenTests = TestList [compTests, compTokenTests] where
compTests = "compile" ~: TestList [
"x -> x" ~: "x" `compiles_to` (lit "x")
,"$x -> VarRef x" ~: "$x" `compiles_to` (varref "x")
,"x(G) -> ArrRef x G" ~: "$x(G)" `compiles_to` (arrref "x" (lit "G"))
,"CatLst" ~: "$x$y" `compiles_to` (CatLst [varref "x", varref "y"])
,"lit" ~: "incr x -1" `compiles_to` lit "incr x -1"
,"esced" ~: "one \\n two \\n three" `compiles_to` (lit "one \n two \n three")
,"cmd" ~: "[double 4]" `compiles_to` cmdTok (BasicCmd (vlocal "double"), [ilit 4])
]
compTokenTests = "compToken" ~: TestList [
"1" ~: (mkwd "x") `tok_to` (lit "x")
,"2" ~: (mknosub "puts 4") `tok_to` (block "puts 4" [Cmd (BasicCmd (vlocal "puts")) [ilit 4]])
]
block s v = let bs = pack s in Block (pack s) (Right v, makeCExpr bs)
mknosub s = NoSub (pack s)
mkwd = Word . pack
lit = Lit . pack
ilit = LitInt
vlocal x = NSQual Nothing (pack x)
cmdTok (n,a) = CmdTok [(Cmd n a)]
varref = VarRef . parseVarName . pack
arrref s t = ArrRef Nothing (pack s) t
tok_to a b = do let r = compToken a
assertEqual (show a ++ " compiles to " ++ show b) b r
compiles_to a b = do let r = compile (pack a)
assertEqual (show a ++ " compiles to " ++ show b) b r | 1,347 | rtokenTests = TestList [compTests, compTokenTests] where
compTests = "compile" ~: TestList [
"x -> x" ~: "x" `compiles_to` (lit "x")
,"$x -> VarRef x" ~: "$x" `compiles_to` (varref "x")
,"x(G) -> ArrRef x G" ~: "$x(G)" `compiles_to` (arrref "x" (lit "G"))
,"CatLst" ~: "$x$y" `compiles_to` (CatLst [varref "x", varref "y"])
,"lit" ~: "incr x -1" `compiles_to` lit "incr x -1"
,"esced" ~: "one \\n two \\n three" `compiles_to` (lit "one \n two \n three")
,"cmd" ~: "[double 4]" `compiles_to` cmdTok (BasicCmd (vlocal "double"), [ilit 4])
]
compTokenTests = "compToken" ~: TestList [
"1" ~: (mkwd "x") `tok_to` (lit "x")
,"2" ~: (mknosub "puts 4") `tok_to` (block "puts 4" [Cmd (BasicCmd (vlocal "puts")) [ilit 4]])
]
block s v = let bs = pack s in Block (pack s) (Right v, makeCExpr bs)
mknosub s = NoSub (pack s)
mkwd = Word . pack
lit = Lit . pack
ilit = LitInt
vlocal x = NSQual Nothing (pack x)
cmdTok (n,a) = CmdTok [(Cmd n a)]
varref = VarRef . parseVarName . pack
arrref s t = ArrRef Nothing (pack s) t
tok_to a b = do let r = compToken a
assertEqual (show a ++ " compiles to " ++ show b) b r
compiles_to a b = do let r = compile (pack a)
assertEqual (show a ++ " compiles to " ++ show b) b r | 1,347 | rtokenTests = TestList [compTests, compTokenTests] where
compTests = "compile" ~: TestList [
"x -> x" ~: "x" `compiles_to` (lit "x")
,"$x -> VarRef x" ~: "$x" `compiles_to` (varref "x")
,"x(G) -> ArrRef x G" ~: "$x(G)" `compiles_to` (arrref "x" (lit "G"))
,"CatLst" ~: "$x$y" `compiles_to` (CatLst [varref "x", varref "y"])
,"lit" ~: "incr x -1" `compiles_to` lit "incr x -1"
,"esced" ~: "one \\n two \\n three" `compiles_to` (lit "one \n two \n three")
,"cmd" ~: "[double 4]" `compiles_to` cmdTok (BasicCmd (vlocal "double"), [ilit 4])
]
compTokenTests = "compToken" ~: TestList [
"1" ~: (mkwd "x") `tok_to` (lit "x")
,"2" ~: (mknosub "puts 4") `tok_to` (block "puts 4" [Cmd (BasicCmd (vlocal "puts")) [ilit 4]])
]
block s v = let bs = pack s in Block (pack s) (Right v, makeCExpr bs)
mknosub s = NoSub (pack s)
mkwd = Word . pack
lit = Lit . pack
ilit = LitInt
vlocal x = NSQual Nothing (pack x)
cmdTok (n,a) = CmdTok [(Cmd n a)]
varref = VarRef . parseVarName . pack
arrref s t = ArrRef Nothing (pack s) t
tok_to a b = do let r = compToken a
assertEqual (show a ++ " compiles to " ++ show b) b r
compiles_to a b = do let r = compile (pack a)
assertEqual (show a ++ " compiles to " ++ show b) b r | 1,347 | false | false | 0 | 18 | 376 | 561 | 289 | 272 | null | null |
henrystanley/Quark | Quark/Parse.hs | cc0-1.0 | qcorefunc = choice corefuncs >>= return . QCFunc
where corefuncs = map (try . corefuncKeyword)
[ "+", "*", "/", "@>", "@<", "<@", ">@", "><", "<>", "<"
, "show", "chars", "weld", "type", "def", "parse", "call"
, "match", ".", "load", "write", "cmd", "print" , "exit" ]
corefuncKeyword :: String -> Parsec String () String
corefuncKeyword keyword = do
token <- string keyword
try . lookAhead $ oneOf qcontrolchars
return token
--- Strings ---
-- escaped chars in strings | 549 | qcorefunc = choice corefuncs >>= return . QCFunc
where corefuncs = map (try . corefuncKeyword)
[ "+", "*", "/", "@>", "@<", "<@", ">@", "><", "<>", "<"
, "show", "chars", "weld", "type", "def", "parse", "call"
, "match", ".", "load", "write", "cmd", "print" , "exit" ]
corefuncKeyword :: String -> Parsec String () String
corefuncKeyword keyword = do
token <- string keyword
try . lookAhead $ oneOf qcontrolchars
return token
--- Strings ---
-- escaped chars in strings | 549 | qcorefunc = choice corefuncs >>= return . QCFunc
where corefuncs = map (try . corefuncKeyword)
[ "+", "*", "/", "@>", "@<", "<@", ">@", "><", "<>", "<"
, "show", "chars", "weld", "type", "def", "parse", "call"
, "match", ".", "load", "write", "cmd", "print" , "exit" ]
corefuncKeyword :: String -> Parsec String () String
corefuncKeyword keyword = do
token <- string keyword
try . lookAhead $ oneOf qcontrolchars
return token
--- Strings ---
-- escaped chars in strings | 549 | false | false | 6 | 7 | 155 | 158 | 93 | 65 | null | null |
bwalkowi/RBT | src/RBT.hs | bsd-3-clause | pushRedToRight t = t | 20 | pushRedToRight t = t | 20 | pushRedToRight t = t | 20 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
fredokun/piexplorer | src/Syntax.hs | gpl-3.0 | substProc (Sum p q info) env = Sum (substProc p env) (substProc q env) info | 75 | substProc (Sum p q info) env = Sum (substProc p env) (substProc q env) info | 75 | substProc (Sum p q info) env = Sum (substProc p env) (substProc q env) info | 75 | false | false | 0 | 7 | 14 | 44 | 21 | 23 | null | null |
adept/hledger | hledger/Hledger/Cli/CliOptions.hs | gpl-3.0 | -- common cmdargs flags
-- | Common help flags: --help, --debug, --version...
helpflags :: [Flag RawOpts]
helpflags = [
-- XXX why are these duplicated in defCommandMode below ?
flagNone ["help","h"] (setboolopt "help") "show general help (or after CMD, command help)"
,flagNone ["man"] (setboolopt "man") "Show user manual with man"
,flagNone ["info"] (setboolopt "info") "Show info manual with info"
-- ,flagNone ["browse-args"] (setboolopt "browse-args") "use a web UI to select options and build up a command line"
,flagReq ["debug"] (\s opts -> Right $ setopt "debug" s opts) "[N]" "show debug output (levels 1-9, default: 1)"
,flagNone ["version"] (setboolopt "version") "show version information"
] | 717 | helpflags :: [Flag RawOpts]
helpflags = [
-- XXX why are these duplicated in defCommandMode below ?
flagNone ["help","h"] (setboolopt "help") "show general help (or after CMD, command help)"
,flagNone ["man"] (setboolopt "man") "Show user manual with man"
,flagNone ["info"] (setboolopt "info") "Show info manual with info"
-- ,flagNone ["browse-args"] (setboolopt "browse-args") "use a web UI to select options and build up a command line"
,flagReq ["debug"] (\s opts -> Right $ setopt "debug" s opts) "[N]" "show debug output (levels 1-9, default: 1)"
,flagNone ["version"] (setboolopt "version") "show version information"
] | 638 | helpflags = [
-- XXX why are these duplicated in defCommandMode below ?
flagNone ["help","h"] (setboolopt "help") "show general help (or after CMD, command help)"
,flagNone ["man"] (setboolopt "man") "Show user manual with man"
,flagNone ["info"] (setboolopt "info") "Show info manual with info"
-- ,flagNone ["browse-args"] (setboolopt "browse-args") "use a web UI to select options and build up a command line"
,flagReq ["debug"] (\s opts -> Right $ setopt "debug" s opts) "[N]" "show debug output (levels 1-9, default: 1)"
,flagNone ["version"] (setboolopt "version") "show version information"
] | 610 | true | true | 0 | 10 | 115 | 136 | 74 | 62 | null | null |
DNNX/invariant-functors | test/THSpec.hs | bsd-2-clause | spec :: Spec
spec = do
describe "Compose Maybe Either Int Int" $ do
prop "satisfies the invmap laws" (prop_invmapLaws :: Compose Maybe Either Int Int -> Bool)
prop "satisfies the invmap2 laws" (prop_invmap2Laws :: Compose Maybe Either Int Int -> Bool)
#if MIN_VERSION_template_haskell(2,7,0)
describe "ComposeFam Maybe Either Int Int" $ do
prop "satisfies the invmap laws" (prop_invmapLaws :: ComposeFam Maybe Either Int Int -> Bool)
prop "satisfies the invmap2 laws" (prop_invmap2Laws :: ComposeFam Maybe Either Int Int -> Bool)
#endif | 589 | spec :: Spec
spec = do
describe "Compose Maybe Either Int Int" $ do
prop "satisfies the invmap laws" (prop_invmapLaws :: Compose Maybe Either Int Int -> Bool)
prop "satisfies the invmap2 laws" (prop_invmap2Laws :: Compose Maybe Either Int Int -> Bool)
#if MIN_VERSION_template_haskell(2,7,0)
describe "ComposeFam Maybe Either Int Int" $ do
prop "satisfies the invmap laws" (prop_invmapLaws :: ComposeFam Maybe Either Int Int -> Bool)
prop "satisfies the invmap2 laws" (prop_invmap2Laws :: ComposeFam Maybe Either Int Int -> Bool)
#endif | 589 | spec = do
describe "Compose Maybe Either Int Int" $ do
prop "satisfies the invmap laws" (prop_invmapLaws :: Compose Maybe Either Int Int -> Bool)
prop "satisfies the invmap2 laws" (prop_invmap2Laws :: Compose Maybe Either Int Int -> Bool)
#if MIN_VERSION_template_haskell(2,7,0)
describe "ComposeFam Maybe Either Int Int" $ do
prop "satisfies the invmap laws" (prop_invmapLaws :: ComposeFam Maybe Either Int Int -> Bool)
prop "satisfies the invmap2 laws" (prop_invmap2Laws :: ComposeFam Maybe Either Int Int -> Bool)
#endif | 576 | false | true | 0 | 14 | 133 | 148 | 69 | 79 | null | null |
gibiansky/IHaskell | ipython-kernel/src/IHaskell/IPython/Message/Parser.hs | mit | parser InputMessage = inputMessageParser | 40 | parser InputMessage = inputMessageParser | 40 | parser InputMessage = inputMessageParser | 40 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
vedgar/mlr | 2016 Kolokvij/Z1.hs | unlicense | binary op = Conn 2 (\ [x, y] -> x `op` y) | 41 | binary op = Conn 2 (\ [x, y] -> x `op` y) | 41 | binary op = Conn 2 (\ [x, y] -> x `op` y) | 41 | false | false | 1 | 8 | 11 | 39 | 19 | 20 | null | null |
kayuri/HNC | HN/TypeTools.hs | lgpl-3.0 | typeTv = collectSet matchTTV | 28 | typeTv = collectSet matchTTV | 28 | typeTv = collectSet matchTTV | 28 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
bitemyapp/ghc | compiler/basicTypes/RdrName.hs | bsd-3-clause | ppr_defn_site :: ImportSpec -> Name -> SDoc
ppr_defn_site imp_spec name
| same_module && not (isGoodSrcSpan loc)
= empty -- Nothing interesting to say
| otherwise
= parens $ hang (ptext (sLit "and originally defined") <+> pp_mod)
2 (pprLoc loc)
where
loc = nameSrcSpan name
defining_mod = nameModule name
same_module = importSpecModule imp_spec == moduleName defining_mod
pp_mod | same_module = empty
| otherwise = ptext (sLit "in") <+> quotes (ppr defining_mod) | 530 | ppr_defn_site :: ImportSpec -> Name -> SDoc
ppr_defn_site imp_spec name
| same_module && not (isGoodSrcSpan loc)
= empty -- Nothing interesting to say
| otherwise
= parens $ hang (ptext (sLit "and originally defined") <+> pp_mod)
2 (pprLoc loc)
where
loc = nameSrcSpan name
defining_mod = nameModule name
same_module = importSpecModule imp_spec == moduleName defining_mod
pp_mod | same_module = empty
| otherwise = ptext (sLit "in") <+> quotes (ppr defining_mod) | 530 | ppr_defn_site imp_spec name
| same_module && not (isGoodSrcSpan loc)
= empty -- Nothing interesting to say
| otherwise
= parens $ hang (ptext (sLit "and originally defined") <+> pp_mod)
2 (pprLoc loc)
where
loc = nameSrcSpan name
defining_mod = nameModule name
same_module = importSpecModule imp_spec == moduleName defining_mod
pp_mod | same_module = empty
| otherwise = ptext (sLit "in") <+> quotes (ppr defining_mod) | 486 | false | true | 5 | 11 | 137 | 186 | 80 | 106 | null | null |
ribag/ganeti-experiments | src/Ganeti/OpParams.hs | gpl-2.0 | pDiskTemplate :: Field
pDiskTemplate =
withDoc "Disk template" $
simpleField "disk_template" [t| DiskTemplate |] | 116 | pDiskTemplate :: Field
pDiskTemplate =
withDoc "Disk template" $
simpleField "disk_template" [t| DiskTemplate |] | 116 | pDiskTemplate =
withDoc "Disk template" $
simpleField "disk_template" [t| DiskTemplate |] | 93 | false | true | 0 | 6 | 17 | 34 | 16 | 18 | null | null |
zenhack/whenview | src/Main.hs | mit | main = do
argSpec <- parseArgs
months <- getMonthsFor
input <- if stdin argSpec then
getContents
else
readProcess "when" ("--noheader":whenArgs argSpec) ""
case process months input of
Right output -> do
user <- lookupEnv "USER"
display <- lookupEnv "DISPLAY"
let path = join [ "/tmp/whenview."
, maybe "" id user
, "."
, maybe "" id display
, ".html"
]
writeFile path output
callProcess (browser argSpec) [path]
Left err -> print err | 699 | main = do
argSpec <- parseArgs
months <- getMonthsFor
input <- if stdin argSpec then
getContents
else
readProcess "when" ("--noheader":whenArgs argSpec) ""
case process months input of
Right output -> do
user <- lookupEnv "USER"
display <- lookupEnv "DISPLAY"
let path = join [ "/tmp/whenview."
, maybe "" id user
, "."
, maybe "" id display
, ".html"
]
writeFile path output
callProcess (browser argSpec) [path]
Left err -> print err | 699 | main = do
argSpec <- parseArgs
months <- getMonthsFor
input <- if stdin argSpec then
getContents
else
readProcess "when" ("--noheader":whenArgs argSpec) ""
case process months input of
Right output -> do
user <- lookupEnv "USER"
display <- lookupEnv "DISPLAY"
let path = join [ "/tmp/whenview."
, maybe "" id user
, "."
, maybe "" id display
, ".html"
]
writeFile path output
callProcess (browser argSpec) [path]
Left err -> print err | 699 | false | false | 1 | 18 | 336 | 178 | 80 | 98 | null | null |
mcschroeder/ghc | compiler/basicTypes/OccName.hs | bsd-3-clause | isVarNameSpace _ = False | 30 | isVarNameSpace _ = False | 30 | isVarNameSpace _ = False | 30 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
fluffynukeit/FNIStash | src/Main.hs | bsd-3-clause | main = do
args <- getArgs
paths <- ensurePaths $ listToMaybe args
mvar <- newEmptyMVar
serve Config
{ tpPort = 10001
, tpRun = runTP
, tpWorker = launchAll paths mvar
, tpInitHTML = Just "GUI.html"
, tpStatic = encodeString (guiRoot paths)
} | 311 | main = do
args <- getArgs
paths <- ensurePaths $ listToMaybe args
mvar <- newEmptyMVar
serve Config
{ tpPort = 10001
, tpRun = runTP
, tpWorker = launchAll paths mvar
, tpInitHTML = Just "GUI.html"
, tpStatic = encodeString (guiRoot paths)
} | 311 | main = do
args <- getArgs
paths <- ensurePaths $ listToMaybe args
mvar <- newEmptyMVar
serve Config
{ tpPort = 10001
, tpRun = runTP
, tpWorker = launchAll paths mvar
, tpInitHTML = Just "GUI.html"
, tpStatic = encodeString (guiRoot paths)
} | 311 | false | false | 0 | 12 | 112 | 89 | 45 | 44 | null | null |
sdiehl/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | trimConArgs :: AltCon -> [CoreArg] -> [CoreArg]
-- ^ Given:
--
-- > case (C a b x y) of
-- > C b x y -> ...
--
-- We want to drop the leading type argument of the scrutinee
-- leaving the arguments to match against the pattern
trimConArgs DEFAULT args = ASSERT( null args ) [] | 289 | trimConArgs :: AltCon -> [CoreArg] -> [CoreArg]
trimConArgs DEFAULT args = ASSERT( null args ) [] | 102 | trimConArgs DEFAULT args = ASSERT( null args ) [] | 54 | true | true | 0 | 7 | 71 | 50 | 29 | 21 | null | null |
Hara-Laboratory/subleq-mips | TestSubnegInt.hs | gpl-3.0 | dec = 0x5 | 9 | dec = 0x5 | 9 | dec = 0x5 | 9 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
janschulz/pandoc | src/Text/Pandoc/Writers/Textile.hs | gpl-2.0 | inlineToTextile _ (LineBreak) = return "\n" | 43 | inlineToTextile _ (LineBreak) = return "\n" | 43 | inlineToTextile _ (LineBreak) = return "\n" | 43 | false | false | 1 | 5 | 5 | 19 | 8 | 11 | null | null |
HaliteChallenge/Halite-II | airesources/Haskell/Hlt/Constants.hs | mit | -- | Constant radius of a Ship.
shipRadius :: Float
shipRadius = 0.5 | 68 | shipRadius :: Float
shipRadius = 0.5 | 36 | shipRadius = 0.5 | 16 | true | true | 0 | 6 | 12 | 19 | 8 | 11 | null | null |
bendmorris/scotch | Scotch/Eval/ReadFile.hs | gpl-3.0 | searchPathMatch :: [String] -> IO String
searchPathMatch [] = do return "" | 74 | searchPathMatch :: [String] -> IO String
searchPathMatch [] = do return "" | 74 | searchPathMatch [] = do return "" | 33 | false | true | 0 | 7 | 11 | 32 | 15 | 17 | null | null |
AlexeyRaga/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | unobjName = varQual gHC_CLASSES (fsLit "unobj") unobjClassOpKey | 79 | unobjName = varQual gHC_CLASSES (fsLit "unobj") unobjClassOpKey | 79 | unobjName = varQual gHC_CLASSES (fsLit "unobj") unobjClassOpKey | 79 | false | false | 0 | 7 | 22 | 19 | 9 | 10 | null | null |
danchoi/imapget | src/Network/HaskellNet/IMAP.hs | bsd-3-clause | sendCommand' :: IMAPConnection -> String -> IO (ByteString, Int)
sendCommand' c cmdstr = do
(_, num) <- withNextCommandNum c $ \num -> bsPutCrLf (stream c) $
BS.pack $ show6 num ++ " " ++ cmdstr
resp <- getResponse (stream c)
return (resp, num) | 264 | sendCommand' :: IMAPConnection -> String -> IO (ByteString, Int)
sendCommand' c cmdstr = do
(_, num) <- withNextCommandNum c $ \num -> bsPutCrLf (stream c) $
BS.pack $ show6 num ++ " " ++ cmdstr
resp <- getResponse (stream c)
return (resp, num) | 264 | sendCommand' c cmdstr = do
(_, num) <- withNextCommandNum c $ \num -> bsPutCrLf (stream c) $
BS.pack $ show6 num ++ " " ++ cmdstr
resp <- getResponse (stream c)
return (resp, num) | 199 | false | true | 0 | 17 | 62 | 121 | 58 | 63 | null | null |
andreagenso/java2scala | src/J2s/Parser.hs | apache-2.0 | pZBreakStatementNested = (AGS.sem_StatementNested_SWTSBreakStatementNested) <$ pSpecialSimbol ";"
<|> (\i -> AGS.sem_StatementNested_SWTSBreakStatementIdNested i) <$> pIdentifier <* pSpecialSimbol ";" | 217 | pZBreakStatementNested = (AGS.sem_StatementNested_SWTSBreakStatementNested) <$ pSpecialSimbol ";"
<|> (\i -> AGS.sem_StatementNested_SWTSBreakStatementIdNested i) <$> pIdentifier <* pSpecialSimbol ";" | 217 | pZBreakStatementNested = (AGS.sem_StatementNested_SWTSBreakStatementNested) <$ pSpecialSimbol ";"
<|> (\i -> AGS.sem_StatementNested_SWTSBreakStatementIdNested i) <$> pIdentifier <* pSpecialSimbol ";" | 217 | false | false | 4 | 10 | 32 | 52 | 25 | 27 | null | null |
deech/hpack | src/Hpack/Run.hs | mit | renderExecutableSection :: Section Executable -> [Element]
renderExecutableSection sect@(sectionData -> Executable{..}) =
mainIs : renderSection sect ++ [otherModules, defaultLanguage]
where
mainIs = Field "main-is" (Literal executableMain)
otherModules = renderOtherModules executableOtherModules | 309 | renderExecutableSection :: Section Executable -> [Element]
renderExecutableSection sect@(sectionData -> Executable{..}) =
mainIs : renderSection sect ++ [otherModules, defaultLanguage]
where
mainIs = Field "main-is" (Literal executableMain)
otherModules = renderOtherModules executableOtherModules | 309 | renderExecutableSection sect@(sectionData -> Executable{..}) =
mainIs : renderSection sect ++ [otherModules, defaultLanguage]
where
mainIs = Field "main-is" (Literal executableMain)
otherModules = renderOtherModules executableOtherModules | 250 | false | true | 0 | 10 | 40 | 84 | 43 | 41 | null | null |
vTurbine/ghc | libraries/base/Data/Bifoldable.hs | bsd-3-clause | -- | Alias for 'bifor_'.
--
-- @since 4.10.0.0
biforM_ :: (Bifoldable t, Applicative f)
=> t a b -> (a -> f c) -> (b -> f d) -> f ()
biforM_ = bifor_ | 158 | biforM_ :: (Bifoldable t, Applicative f)
=> t a b -> (a -> f c) -> (b -> f d) -> f ()
biforM_ = bifor_ | 111 | biforM_ = bifor_ | 16 | true | true | 0 | 11 | 43 | 71 | 37 | 34 | null | null |
SWP-Ubau-SoSe2014-Haskell/SWPSoSe14 | src/RailEditor/RedoUndo.hs | mit | runaction tac (TAC.Insert (content@(char,_):xs), actpos) = do
if char == '\n'
then TACU.moveLinesDownXShift tac actpos True
else do
TACU.moveChars tac actpos (1,0)
TAC.putCell tac actpos (content, TAC.defaultColor)
runaction tac (TAC.Insert xs, actpos) | 292 | runaction tac (TAC.Insert (content@(char,_):xs), actpos) = do
if char == '\n'
then TACU.moveLinesDownXShift tac actpos True
else do
TACU.moveChars tac actpos (1,0)
TAC.putCell tac actpos (content, TAC.defaultColor)
runaction tac (TAC.Insert xs, actpos) | 292 | runaction tac (TAC.Insert (content@(char,_):xs), actpos) = do
if char == '\n'
then TACU.moveLinesDownXShift tac actpos True
else do
TACU.moveChars tac actpos (1,0)
TAC.putCell tac actpos (content, TAC.defaultColor)
runaction tac (TAC.Insert xs, actpos) | 292 | false | false | 0 | 12 | 71 | 119 | 61 | 58 | null | null |
AndrewWUw/cs9181 | Data/Array/Accelerate/C/Exp.hs | bsd-3-clause | fromIntegralToC :: IntegralType a -> NumType b -> C.Exp -> C.Exp
fromIntegralToC _ ty = ccast (NumScalarType ty) | 112 | fromIntegralToC :: IntegralType a -> NumType b -> C.Exp -> C.Exp
fromIntegralToC _ ty = ccast (NumScalarType ty) | 112 | fromIntegralToC _ ty = ccast (NumScalarType ty) | 47 | false | true | 0 | 8 | 17 | 47 | 22 | 25 | null | null |
ctford/Idris-Elba-dev | src/Idris/Core/TT.hs | bsd-3-clause | pEraseType t = t | 16 | pEraseType t = t | 16 | pEraseType t = t | 16 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.