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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bergmark/hlint | data/Default.hs | bsd-3-clause | warn = flip mapM ==> Control.Monad.forM | 40 | warn = flip mapM ==> Control.Monad.forM | 40 | warn = flip mapM ==> Control.Monad.forM | 40 | false | false | 2 | 4 | 6 | 19 | 8 | 11 | null | null |
Lemmih/haskell-tc | src/Language/Haskell/TypeCheck/Proof.hs | mit | tcProofAbs lst (TcProofAp x lst') | map TcRef lst == lst' = x | 61 | tcProofAbs lst (TcProofAp x lst') | map TcRef lst == lst' = x | 61 | tcProofAbs lst (TcProofAp x lst') | map TcRef lst == lst' = x | 61 | false | false | 0 | 9 | 12 | 34 | 15 | 19 | null | null |
koengit/symbo | Main.hs | bsd-2-clause | sL = Cons "L" [stratT,stratT] stratT | 45 | sL = Cons "L" [stratT,stratT] stratT | 45 | sL = Cons "L" [stratT,stratT] stratT | 45 | false | false | 1 | 6 | 14 | 23 | 10 | 13 | null | null |
merijn/parsers | tests/QuickCheck.hs | bsd-3-clause | -- -------------------------------------------------------------------------- --
-- Properties
prop_notFollowedBy0 :: TestParser Char -> Char -> Char -> Bool
prop_notFollowedBy0 (TestParser _ p) x y = either (\_ -> x == y) (/= y)
$ p (P (notFollowedBy (char y) *> anyChar)) [x] | 282 | prop_notFollowedBy0 :: TestParser Char -> Char -> Char -> Bool
prop_notFollowedBy0 (TestParser _ p) x y = either (\_ -> x == y) (/= y)
$ p (P (notFollowedBy (char y) *> anyChar)) [x] | 186 | prop_notFollowedBy0 (TestParser _ p) x y = either (\_ -> x == y) (/= y)
$ p (P (notFollowedBy (char y) *> anyChar)) [x] | 123 | true | true | 2 | 12 | 43 | 99 | 51 | 48 | null | null |
lennart/Tidal | Sound/Tidal/Strategies.hs | gpl-3.0 | scale :: (Functor f, Num b) => b -> b -> f b -> f b
scale from to p = ((+ from) . (* (to-from))) <$> p | 102 | scale :: (Functor f, Num b) => b -> b -> f b -> f b
scale from to p = ((+ from) . (* (to-from))) <$> p | 102 | scale from to p = ((+ from) . (* (to-from))) <$> p | 50 | false | true | 0 | 10 | 27 | 77 | 41 | 36 | null | null |
akamaus/gcodec | src/CNC/GInterpreter.hs | bsd-3-clause | gcode_stats = gcode_stats' 0 0 M.empty | 38 | gcode_stats = gcode_stats' 0 0 M.empty | 38 | gcode_stats = gcode_stats' 0 0 M.empty | 38 | false | false | 0 | 6 | 5 | 15 | 7 | 8 | null | null |
jutaro/rdf4h | src/Text/RDF/RDF4H/TurtleParser.hs | bsd-3-clause | updateBaseUrl :: Maybe (Maybe BaseUrl) -> GenParser ParseState ()
updateBaseUrl val = _modifyState val no no no no no | 117 | updateBaseUrl :: Maybe (Maybe BaseUrl) -> GenParser ParseState ()
updateBaseUrl val = _modifyState val no no no no no | 117 | updateBaseUrl val = _modifyState val no no no no no | 51 | false | true | 0 | 8 | 18 | 47 | 22 | 25 | null | null |
juhp/network-uri | tests/uri001.hs | bsd-3-clause | testURIRef038 = testURIRef RelRf "//g" | 38 | testURIRef038 = testURIRef RelRf "//g" | 38 | testURIRef038 = testURIRef RelRf "//g" | 38 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
nuttycom/haskoin | Network/Haskoin/Node/SPVNode.hs | unlicense | heartbeat :: TBMChan SPVRequest -> IO ()
heartbeat rChan = forever $ do
threadDelay $ 1000000 * 120 -- Sleep for 2 minutes
atomically $ writeTBMChan rChan Heartbeat | 172 | heartbeat :: TBMChan SPVRequest -> IO ()
heartbeat rChan = forever $ do
threadDelay $ 1000000 * 120 -- Sleep for 2 minutes
atomically $ writeTBMChan rChan Heartbeat | 172 | heartbeat rChan = forever $ do
threadDelay $ 1000000 * 120 -- Sleep for 2 minutes
atomically $ writeTBMChan rChan Heartbeat | 131 | false | true | 0 | 9 | 35 | 54 | 25 | 29 | null | null |
mietek/idris-js | src/IRTS/CodegenUtils.hs | bsd-3-clause | clExp _ = 0 | 30 | clExp _ = 0 | 30 | clExp _ = 0 | 30 | false | false | 0 | 4 | 22 | 10 | 4 | 6 | null | null |
chrisdone/ace | src/ACE/Parsers.hs | bsd-3-clause | -- | Unmarked noun phrase coordination: some thing and a thing.
unmarkedNPCoord b =
UnmarkedNPCoord
<$> np b
<*> optional (try (string "and" *> unmarkedNPCoord b)) | 173 | unmarkedNPCoord b =
UnmarkedNPCoord
<$> np b
<*> optional (try (string "and" *> unmarkedNPCoord b)) | 109 | unmarkedNPCoord b =
UnmarkedNPCoord
<$> np b
<*> optional (try (string "and" *> unmarkedNPCoord b)) | 109 | true | false | 6 | 10 | 35 | 51 | 22 | 29 | null | null |
alphalambda/k12math | prog/demo/demo10grid.hs | mit | main = drawPicture myPicture | 28 | main = drawPicture myPicture | 28 | main = drawPicture myPicture | 28 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
beni55/haste-compiler | libraries/ghc-7.8/base/Debug/Trace.hs | bsd-3-clause | {-|
Like 'traceM', but uses 'show' on the argument to convert it to a 'String'.
> ... = do
> x <- ...
> traceMShow $ x
> y <- ...
> traceMShow $ x + y
/Since: 4.7.0.0/
-}
traceShowM :: (Show a, Monad m) => a -> m ()
traceShowM = traceM . show | 252 | traceShowM :: (Show a, Monad m) => a -> m ()
traceShowM = traceM . show | 71 | traceShowM = traceM . show | 26 | true | true | 0 | 9 | 65 | 46 | 22 | 24 | null | null |
mitochon/hoosalind | src/problems/lcsm.hs | mit | -- | Extracts only the longest element(s) from a list
filterMaxLen :: [[a]] -> [[a]]
filterMaxLen xs = filter ((== maxx) . length) xs
where maxx = maximum $ map length xs | 172 | filterMaxLen :: [[a]] -> [[a]]
filterMaxLen xs = filter ((== maxx) . length) xs
where maxx = maximum $ map length xs | 118 | filterMaxLen xs = filter ((== maxx) . length) xs
where maxx = maximum $ map length xs | 87 | true | true | 0 | 8 | 33 | 64 | 35 | 29 | null | null |
manyoo/reflex-dom | src/Reflex/Dom/Old.hs | bsd-3-clause | buildElement :: (MonadWidget t m, Attributes m attrs t) => Text -> attrs -> m a -> m (RawElement (DomBuilderSpace m), a)
buildElement = buildElementNS Nothing | 158 | buildElement :: (MonadWidget t m, Attributes m attrs t) => Text -> attrs -> m a -> m (RawElement (DomBuilderSpace m), a)
buildElement = buildElementNS Nothing | 158 | buildElement = buildElementNS Nothing | 37 | false | true | 0 | 13 | 25 | 68 | 34 | 34 | null | null |
yu-i9/thih | src/Thih/TI/Type.hs | bsd-3-clause | pptype d (TVar v) = pprint v | 29 | pptype d (TVar v) = pprint v | 29 | pptype d (TVar v) = pprint v | 29 | false | false | 0 | 6 | 7 | 22 | 9 | 13 | null | null |
DougBurke/swish | tests/RDFDatatypeXsdIntegerTest.hs | lgpl-2.1 | ruleXsdIntegerDivMod = xsdIntName "DivMod" | 45 | ruleXsdIntegerDivMod = xsdIntName "DivMod" | 45 | ruleXsdIntegerDivMod = xsdIntName "DivMod" | 45 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
jacekszymanski/wxHaskell | wx/src/Graphics/UI/WX/Draw.hs | lgpl-2.1 | ellipse :: DC a -> Rect -> [Prop (DC a)] -> IO ()
ellipse dc rect_ props
= dcWith dc props (dcDrawEllipse dc rect_) | 117 | ellipse :: DC a -> Rect -> [Prop (DC a)] -> IO ()
ellipse dc rect_ props
= dcWith dc props (dcDrawEllipse dc rect_) | 117 | ellipse dc rect_ props
= dcWith dc props (dcDrawEllipse dc rect_) | 67 | false | true | 0 | 11 | 25 | 65 | 31 | 34 | null | null |
oldmanmike/ghc | compiler/types/Coercion.hs | bsd-3-clause | nthRole Representational tc n
= (tyConRolesRepresentational tc) `getNth` n | 76 | nthRole Representational tc n
= (tyConRolesRepresentational tc) `getNth` n | 76 | nthRole Representational tc n
= (tyConRolesRepresentational tc) `getNth` n | 76 | false | false | 0 | 7 | 10 | 25 | 13 | 12 | null | null |
ThoughtWorksInc/DeepDarkFantasy | DDF/Fix.hs | apache-2.0 | runFix1 = app runFix | 20 | runFix1 = app runFix | 20 | runFix1 = app runFix | 20 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
rahulmutt/ghcvm | compiler/Eta/Main/DriverPhases.hs | bsd-3-clause | isJavaishFilename f = isJavaishSuffix (drop 1 $ takeExtension f) | 78 | isJavaishFilename f = isJavaishSuffix (drop 1 $ takeExtension f) | 78 | isJavaishFilename f = isJavaishSuffix (drop 1 $ takeExtension f) | 78 | false | false | 0 | 8 | 22 | 25 | 11 | 14 | null | null |
leshchevds/ganeti | test/hs/Test/Ganeti/Locking/Allocation.hs | bsd-2-clause | -- | Verify that for LockRequest we have readJSON . showJSON = Ok.
prop_ReadShowRequest :: Property
prop_ReadShowRequest =
forAll (arbitrary :: Gen (LockRequest TestLock)) $ \state ->
J.readJSON (J.showJSON state) ==? J.Ok state | 232 | prop_ReadShowRequest :: Property
prop_ReadShowRequest =
forAll (arbitrary :: Gen (LockRequest TestLock)) $ \state ->
J.readJSON (J.showJSON state) ==? J.Ok state | 165 | prop_ReadShowRequest =
forAll (arbitrary :: Gen (LockRequest TestLock)) $ \state ->
J.readJSON (J.showJSON state) ==? J.Ok state | 132 | true | true | 0 | 11 | 36 | 61 | 31 | 30 | null | null |
mydaum/cabal | cabal-install/Distribution/Solver/Modular/Tree.hs | bsd-3-clause | inn (FChoiceF p s i b m d ts) = FChoice p s i b m d ts | 60 | inn (FChoiceF p s i b m d ts) = FChoice p s i b m d ts | 60 | inn (FChoiceF p s i b m d ts) = FChoice p s i b m d ts | 60 | false | false | 0 | 6 | 23 | 43 | 20 | 23 | null | null |
plow-technologies/distributed-simple-cell | tests/Tests.hs | mit | cellHUnits :: [CellHUnit]
cellHUnits = [testInsertGet, testInsertGetSpaced, testInsertLotsGet] | 94 | cellHUnits :: [CellHUnit]
cellHUnits = [testInsertGet, testInsertGetSpaced, testInsertLotsGet] | 94 | cellHUnits = [testInsertGet, testInsertGetSpaced, testInsertLotsGet] | 68 | false | true | 0 | 5 | 7 | 23 | 14 | 9 | null | null |
ThoughtWorksInc/DeepDarkFantasy | DDF/DBI.hs | apache-2.0 | map2 = app2 map | 15 | map2 = app2 map | 15 | map2 = app2 map | 15 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
acowley/ghc | includes/CodeGen.Platform.hs | bsd-3-clause | globalRegMaybe (YmmReg 2) = Just (RealRegSingle REG_YMM2) | 71 | globalRegMaybe (YmmReg 2) = Just (RealRegSingle REG_YMM2) | 71 | globalRegMaybe (YmmReg 2) = Just (RealRegSingle REG_YMM2) | 71 | false | false | 0 | 7 | 20 | 24 | 11 | 13 | null | null |
adinapoli/api-tools | src/Data/API/Changes.hs | bsd-3-clause | withObjectMatchingFields _ _ v p = Left (JSONError $ expectedObject v, p) | 73 | withObjectMatchingFields _ _ v p = Left (JSONError $ expectedObject v, p) | 73 | withObjectMatchingFields _ _ v p = Left (JSONError $ expectedObject v, p) | 73 | false | false | 1 | 8 | 11 | 27 | 13 | 14 | null | null |
Numberartificial/workflow | haskell-first-principles/haskell-programming-from-first-principles-master/src/Chapter10.hs | mit | filterDbNumber :: [DatabaseItem] -> [Integer]
filterDbNumber = map (fromJust . getNumber) . filter isDbNumber | 109 | filterDbNumber :: [DatabaseItem] -> [Integer]
filterDbNumber = map (fromJust . getNumber) . filter isDbNumber | 109 | filterDbNumber = map (fromJust . getNumber) . filter isDbNumber | 63 | false | true | 0 | 8 | 13 | 38 | 20 | 18 | null | null |
apyrgio/snf-ganeti | src/Ganeti/Constants.hs | bsd-2-clause | -- | The hail iallocator
iallocHail :: String
iallocHail = "hail" | 65 | iallocHail :: String
iallocHail = "hail" | 40 | iallocHail = "hail" | 19 | true | true | 0 | 4 | 10 | 12 | 7 | 5 | null | null |
recursion-ninja/megaparsec | tests/Test/Hspec/Megaparsec/AdHoc.hs | bsd-2-clause | -- | Just like 'prs', but interprets given parser as various monads (tries
-- all supported monads transformers in turn).
grs
:: (forall m. MonadParsec Void String m => m a) -- ^ Parser to run
-> String -- ^ Input for the parser
-> (Either (ParseError Char Void) a -> Expectation)
-- ^ How to check result of parsing
-> Expectation
grs p s r = do
r (prs p s)
r (prs (runIdentityT p) s)
r (prs (runReaderT p ()) s)
r (prs (L.evalStateT p ()) s)
r (prs (S.evalStateT p ()) s)
r (prs (evalWriterTL p) s)
r (prs (evalWriterTS p) s)
r (prs (evalRWSTL p) s)
r (prs (evalRWSTS p) s)
-- | 'grs'' to 'grs' is as 'prs'' to 'prs'. | 685 | grs
:: (forall m. MonadParsec Void String m => m a) -- ^ Parser to run
-> String -- ^ Input for the parser
-> (Either (ParseError Char Void) a -> Expectation)
-- ^ How to check result of parsing
-> Expectation
grs p s r = do
r (prs p s)
r (prs (runIdentityT p) s)
r (prs (runReaderT p ()) s)
r (prs (L.evalStateT p ()) s)
r (prs (S.evalStateT p ()) s)
r (prs (evalWriterTL p) s)
r (prs (evalWriterTS p) s)
r (prs (evalRWSTL p) s)
r (prs (evalRWSTS p) s)
-- | 'grs'' to 'grs' is as 'prs'' to 'prs'. | 562 | grs p s r = do
r (prs p s)
r (prs (runIdentityT p) s)
r (prs (runReaderT p ()) s)
r (prs (L.evalStateT p ()) s)
r (prs (S.evalStateT p ()) s)
r (prs (evalWriterTL p) s)
r (prs (evalWriterTS p) s)
r (prs (evalRWSTL p) s)
r (prs (evalRWSTS p) s)
-- | 'grs'' to 'grs' is as 'prs'' to 'prs'. | 329 | true | true | 0 | 13 | 190 | 274 | 129 | 145 | null | null |
zinfra/khan | amazonka-limited/src/Network/AWS/Internal/Types.hs | mpl-2.0 | getAuth :: AWS Auth
getAuth = fmap awsAuth getEnv >>= liftIO . readIORef | 72 | getAuth :: AWS Auth
getAuth = fmap awsAuth getEnv >>= liftIO . readIORef | 72 | getAuth = fmap awsAuth getEnv >>= liftIO . readIORef | 52 | false | true | 0 | 7 | 12 | 34 | 14 | 20 | null | null |
damianfral/PlotDSL | src/Graphics/PlotDSL.hs | mit | scale ∷ ScaleValue -> PlotF a
scale s = liftF $ Scale s () | 58 | scale ∷ ScaleValue -> PlotF a
scale s = liftF $ Scale s () | 58 | scale s = liftF $ Scale s () | 28 | false | true | 2 | 7 | 13 | 37 | 16 | 21 | null | null |
ejlilley/AbstractMusic | LilyParse.hs | gpl-3.0 | dictToAssoc (LilyOverride a) = dictToAssoc a | 44 | dictToAssoc (LilyOverride a) = dictToAssoc a | 44 | dictToAssoc (LilyOverride a) = dictToAssoc a | 44 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
shouya/poi | src/Webhook.hs | gpl-3.0 | startWebhook :: IO ()
startWebhook = config >>= flip serverWith handler | 71 | startWebhook :: IO ()
startWebhook = config >>= flip serverWith handler | 71 | startWebhook = config >>= flip serverWith handler | 49 | false | true | 0 | 6 | 10 | 25 | 12 | 13 | null | null |
urbanslug/ghc | compiler/typecheck/TcClassDcl.hs | bsd-3-clause | tcClassDecl2 d = pprPanic "tcClassDecl2" (ppr d) | 48 | tcClassDecl2 d = pprPanic "tcClassDecl2" (ppr d) | 48 | tcClassDecl2 d = pprPanic "tcClassDecl2" (ppr d) | 48 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
iemxblog/hpcb | src/Hpcb/Data/Connection.hs | mit | -- | Looks for a footprint, given its reference
getFootprintByRef :: String -- ^ Footprint reference
-> Circuit -- ^ Circuit to look into
-> Footprint
getFootprintByRef fpRef c =
case filter (\fp -> getFpRef fp == fpRef) $ toListOf (_footprints . traverse) c of
[] -> error $ "Component " ++ fpRef ++ " doesn't exist"
[x] -> x
_ -> error $ "Multiple components with same reference (" ++ fpRef ++ ") found "
-- | Returns the nets associated with pin name
-- It is named like this so that we can use it like so :
--
-- @
-- connect (net \"GND\") (pinName \"U1\" \"GND\")
-- @
--
-- which is quite convenient :) | 678 | getFootprintByRef :: String -- ^ Footprint reference
-> Circuit -- ^ Circuit to look into
-> Footprint
getFootprintByRef fpRef c =
case filter (\fp -> getFpRef fp == fpRef) $ toListOf (_footprints . traverse) c of
[] -> error $ "Component " ++ fpRef ++ " doesn't exist"
[x] -> x
_ -> error $ "Multiple components with same reference (" ++ fpRef ++ ") found "
-- | Returns the nets associated with pin name
-- It is named like this so that we can use it like so :
--
-- @
-- connect (net \"GND\") (pinName \"U1\" \"GND\")
-- @
--
-- which is quite convenient :) | 630 | getFootprintByRef fpRef c =
case filter (\fp -> getFpRef fp == fpRef) $ toListOf (_footprints . traverse) c of
[] -> error $ "Component " ++ fpRef ++ " doesn't exist"
[x] -> x
_ -> error $ "Multiple components with same reference (" ++ fpRef ++ ") found "
-- | Returns the nets associated with pin name
-- It is named like this so that we can use it like so :
--
-- @
-- connect (net \"GND\") (pinName \"U1\" \"GND\")
-- @
--
-- which is quite convenient :) | 472 | true | true | 0 | 11 | 188 | 126 | 67 | 59 | null | null |
shlevy/arithmoi | Math/NumberTheory/Primes/Testing/Certificates/Internal.hs | mit | checkCertificate (Prime pp) = checkPrimalityProof pp | 52 | checkCertificate (Prime pp) = checkPrimalityProof pp | 52 | checkCertificate (Prime pp) = checkPrimalityProof pp | 52 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
spechub/Hets | CspCASL/LocalTop.hs | gpl-2.0 | lteError :: Obligation SORT -> Diagnosis
lteError (Obligation x y z) = mkDiag Error msg ()
where msg = "local top element obligation ("
++ show x ++ " < " ++ show y ++ ", " ++ show z
++ ") unfulfilled"
{- | This is the main interface for the LTE check. Check a CspCASL signature
(actually just the sort relation) for local top elements in its subsort
relation. Returns empty list for sucess or a list of diags for failure where
diags is a list of diagnostic errors resulting from the check. -} | 530 | lteError :: Obligation SORT -> Diagnosis
lteError (Obligation x y z) = mkDiag Error msg ()
where msg = "local top element obligation ("
++ show x ++ " < " ++ show y ++ ", " ++ show z
++ ") unfulfilled"
{- | This is the main interface for the LTE check. Check a CspCASL signature
(actually just the sort relation) for local top elements in its subsort
relation. Returns empty list for sucess or a list of diags for failure where
diags is a list of diagnostic errors resulting from the check. -} | 530 | lteError (Obligation x y z) = mkDiag Error msg ()
where msg = "local top element obligation ("
++ show x ++ " < " ++ show y ++ ", " ++ show z
++ ") unfulfilled"
{- | This is the main interface for the LTE check. Check a CspCASL signature
(actually just the sort relation) for local top elements in its subsort
relation. Returns empty list for sucess or a list of diags for failure where
diags is a list of diagnostic errors resulting from the check. -} | 489 | false | true | 5 | 9 | 132 | 93 | 40 | 53 | null | null |
vikraman/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | hasNoOneShotInfo _ = False | 38 | hasNoOneShotInfo _ = False | 38 | hasNoOneShotInfo _ = False | 38 | false | false | 0 | 5 | 15 | 9 | 4 | 5 | null | null |
dmjio/miso | src/Miso/Html/Element.hs | bsd-3-clause | -- | https://developer.mozilla.org/en-US/docs/Web/HTML/Element/s
s_ :: [Attribute action] -> [View action] -> View action
s_ = nodeHtml "s" | 139 | s_ :: [Attribute action] -> [View action] -> View action
s_ = nodeHtml "s" | 74 | s_ = nodeHtml "s" | 17 | true | true | 0 | 9 | 16 | 44 | 20 | 24 | null | null |
sru-systems/protobuf-simple | src/Parser/EnumValueDesc.hs | mit | new :: ValueName -> ValueNumber -> EnumValueDesc
new = EnumValueDesc | 68 | new :: ValueName -> ValueNumber -> EnumValueDesc
new = EnumValueDesc | 68 | new = EnumValueDesc | 19 | false | true | 0 | 8 | 9 | 26 | 11 | 15 | null | null |
rehno-lindeque/poet | src/haskell/LangLang/Semantic.hs | gpl-3.0 | expression (Query domain SelectionDisjunct argument) = do
putStrLn "SelectionDisjunct "
query c_SelectionDisjunct domain argument | 133 | expression (Query domain SelectionDisjunct argument) = do
putStrLn "SelectionDisjunct "
query c_SelectionDisjunct domain argument | 133 | expression (Query domain SelectionDisjunct argument) = do
putStrLn "SelectionDisjunct "
query c_SelectionDisjunct domain argument | 133 | false | false | 0 | 7 | 17 | 35 | 15 | 20 | null | null |
mathlover2/number-theory | NumberTheory/Permutations/CycManip.hs | gpl-3.0 | involuteCancel :: Perm -> Int -> Perm
involuteCancel l n
| n > (length l) - 1 = error "Position can't exceed length of list!"
| (l !! (n - 1)) /= (l !! n) = error "No involution here to cancel!"
| otherwise = replaceParts (n, n + 1) l [] | 251 | involuteCancel :: Perm -> Int -> Perm
involuteCancel l n
| n > (length l) - 1 = error "Position can't exceed length of list!"
| (l !! (n - 1)) /= (l !! n) = error "No involution here to cancel!"
| otherwise = replaceParts (n, n + 1) l [] | 251 | involuteCancel l n
| n > (length l) - 1 = error "Position can't exceed length of list!"
| (l !! (n - 1)) /= (l !! n) = error "No involution here to cancel!"
| otherwise = replaceParts (n, n + 1) l [] | 213 | false | true | 0 | 12 | 65 | 122 | 58 | 64 | null | null |
MichaelBurge/ToxicSludgeDB | src/Database/Toxic/Query/Interpreter.hs | mit | -- | Splits a syntax tree on its aggregates, leaving a placeholder variable
-- | Yields: An input transformer, an aggregate, and an output transformer
splitAggregate :: Expression -> Maybe (Expression, QueryAggregate, Expression)
splitAggregate expression =
let identity = EPlaceholder 0
in case expression of
ELiteral _ -> Nothing
ERename x name -> case splitAggregate x of
Just (continuation, aggregate, transform) ->
Just $ (ERename continuation name, aggregate, transform)
Nothing -> Nothing
ECase _ _ -> error "splitAggregate: Aggregates in case expressions unsupported"
EVariable _ -> Nothing
EAggregate aggregate argument ->
Just $ (identity, aggregate, argument)
EPlaceholder x -> Nothing
EUnop unop x -> case splitAggregate x of
Just (continuation, aggregate, transform) ->
Just $ (EUnop unop continuation, aggregate, transform)
Nothing -> Nothing
EBinop binop x y -> case (splitAggregate x, splitAggregate y) of
(Nothing, Nothing) -> Nothing
(Just (c1, a1, t1), Nothing) -> Just (EBinop binop c1 y, a1, t1)
(Nothing, Just (c1, a1, t1)) -> Just (EBinop binop x c1, a1, t1)
(Just (c1, a1, t1), Just (c2, a2, t2)) ->
error "splitAggregate: Aggregates on both sides of a binary operator are unsupported"
-- | Same as splitAggregate, but replaces non-aggregate expressions with a placeholder
-- | that fails if aggregated. | 1,442 | splitAggregate :: Expression -> Maybe (Expression, QueryAggregate, Expression)
splitAggregate expression =
let identity = EPlaceholder 0
in case expression of
ELiteral _ -> Nothing
ERename x name -> case splitAggregate x of
Just (continuation, aggregate, transform) ->
Just $ (ERename continuation name, aggregate, transform)
Nothing -> Nothing
ECase _ _ -> error "splitAggregate: Aggregates in case expressions unsupported"
EVariable _ -> Nothing
EAggregate aggregate argument ->
Just $ (identity, aggregate, argument)
EPlaceholder x -> Nothing
EUnop unop x -> case splitAggregate x of
Just (continuation, aggregate, transform) ->
Just $ (EUnop unop continuation, aggregate, transform)
Nothing -> Nothing
EBinop binop x y -> case (splitAggregate x, splitAggregate y) of
(Nothing, Nothing) -> Nothing
(Just (c1, a1, t1), Nothing) -> Just (EBinop binop c1 y, a1, t1)
(Nothing, Just (c1, a1, t1)) -> Just (EBinop binop x c1, a1, t1)
(Just (c1, a1, t1), Just (c2, a2, t2)) ->
error "splitAggregate: Aggregates on both sides of a binary operator are unsupported"
-- | Same as splitAggregate, but replaces non-aggregate expressions with a placeholder
-- | that fails if aggregated. | 1,291 | splitAggregate expression =
let identity = EPlaceholder 0
in case expression of
ELiteral _ -> Nothing
ERename x name -> case splitAggregate x of
Just (continuation, aggregate, transform) ->
Just $ (ERename continuation name, aggregate, transform)
Nothing -> Nothing
ECase _ _ -> error "splitAggregate: Aggregates in case expressions unsupported"
EVariable _ -> Nothing
EAggregate aggregate argument ->
Just $ (identity, aggregate, argument)
EPlaceholder x -> Nothing
EUnop unop x -> case splitAggregate x of
Just (continuation, aggregate, transform) ->
Just $ (EUnop unop continuation, aggregate, transform)
Nothing -> Nothing
EBinop binop x y -> case (splitAggregate x, splitAggregate y) of
(Nothing, Nothing) -> Nothing
(Just (c1, a1, t1), Nothing) -> Just (EBinop binop c1 y, a1, t1)
(Nothing, Just (c1, a1, t1)) -> Just (EBinop binop x c1, a1, t1)
(Just (c1, a1, t1), Just (c2, a2, t2)) ->
error "splitAggregate: Aggregates on both sides of a binary operator are unsupported"
-- | Same as splitAggregate, but replaces non-aggregate expressions with a placeholder
-- | that fails if aggregated. | 1,212 | true | true | 0 | 15 | 317 | 403 | 212 | 191 | null | null |
BartAdv/idris-cil | src/IRTS/CodegenCil.hs | bsd-3-clause | sconTypeRef :: PrimitiveType
sconTypeRef = ReferenceType "" "SCon" | 66 | sconTypeRef :: PrimitiveType
sconTypeRef = ReferenceType "" "SCon" | 66 | sconTypeRef = ReferenceType "" "SCon" | 37 | false | true | 0 | 6 | 7 | 22 | 9 | 13 | null | null |
mdunsmuir/routequery-service | src/Com/Google/Transit/Realtime/Alert/Effect.hs | gpl-3.0 | toMaybe'Enum 2 = Prelude'.Just REDUCED_SERVICE | 46 | toMaybe'Enum 2 = Prelude'.Just REDUCED_SERVICE | 46 | toMaybe'Enum 2 = Prelude'.Just REDUCED_SERVICE | 46 | false | false | 0 | 6 | 4 | 14 | 6 | 8 | null | null |
coolhacks/scripts-hacks | examples/shellcheck-master/ShellCheck/Analytics.hs | mit | checkComparisonAgainstGlob _ (TC_Binary _ DoubleBracket op _ (T_NormalWord id [T_DollarBraced _ _]))
| op `elem` ["=", "==", "!="] =
warn id 2053 $ "Quote the rhs of " ++ op ++ " in [[ ]] to prevent glob matching." | 226 | checkComparisonAgainstGlob _ (TC_Binary _ DoubleBracket op _ (T_NormalWord id [T_DollarBraced _ _]))
| op `elem` ["=", "==", "!="] =
warn id 2053 $ "Quote the rhs of " ++ op ++ " in [[ ]] to prevent glob matching." | 226 | checkComparisonAgainstGlob _ (TC_Binary _ DoubleBracket op _ (T_NormalWord id [T_DollarBraced _ _]))
| op `elem` ["=", "==", "!="] =
warn id 2053 $ "Quote the rhs of " ++ op ++ " in [[ ]] to prevent glob matching." | 226 | false | false | 0 | 11 | 50 | 79 | 40 | 39 | null | null |
dpwright/z80 | src/Z80/Assembler.hs | mit | labelled :: Z80 a -> Z80 Location
labelled asm = do
l <- label
asm >> return l | 82 | labelled :: Z80 a -> Z80 Location
labelled asm = do
l <- label
asm >> return l | 82 | labelled asm = do
l <- label
asm >> return l | 48 | false | true | 0 | 8 | 21 | 41 | 18 | 23 | null | null |
bitemyapp/ghc | compiler/basicTypes/MkId.hs | bsd-3-clause | coercionTokenId :: Id -- :: () ~ ()
coercionTokenId -- Used to replace Coercion terms when we go to STG
= pcMiscPrelId coercionTokenName
(mkTyConApp eqPrimTyCon [liftedTypeKind, unitTy, unitTy])
noCafIdInfo | 250 | coercionTokenId :: Id
coercionTokenId -- Used to replace Coercion terms when we go to STG
= pcMiscPrelId coercionTokenName
(mkTyConApp eqPrimTyCon [liftedTypeKind, unitTy, unitTy])
noCafIdInfo | 228 | coercionTokenId -- Used to replace Coercion terms when we go to STG
= pcMiscPrelId coercionTokenName
(mkTyConApp eqPrimTyCon [liftedTypeKind, unitTy, unitTy])
noCafIdInfo | 206 | true | true | 0 | 8 | 72 | 40 | 21 | 19 | null | null |
kazu-yamamoto/domain-auth | Network/DomainAuth/Utils.hs | bsd-3-clause | inSP bs = " " +++ outSP bs'
where
(_,bs') = BS.span isSpace bs | 68 | inSP bs = " " +++ outSP bs'
where
(_,bs') = BS.span isSpace bs | 68 | inSP bs = " " +++ outSP bs'
where
(_,bs') = BS.span isSpace bs | 68 | false | false | 0 | 6 | 19 | 38 | 18 | 20 | null | null |
clockworkdevstudio/Idlewild-Lang | Semantics.hs | bsd-2-clause | isStringExpression :: Statement -> SymbolTable -> SymbolTable -> SymbolTable -> Bool
isStringExpression (Statement {statementID = id,
statementContents = contents}) symbols localSymbols types
| id == EXPRESSION_ADD &&
any (== VARIABLE_TYPE_STRING) (map (\ e -> getExpressionType e symbols localSymbols types) contents) = True
| otherwise = False | 411 | isStringExpression :: Statement -> SymbolTable -> SymbolTable -> SymbolTable -> Bool
isStringExpression (Statement {statementID = id,
statementContents = contents}) symbols localSymbols types
| id == EXPRESSION_ADD &&
any (== VARIABLE_TYPE_STRING) (map (\ e -> getExpressionType e symbols localSymbols types) contents) = True
| otherwise = False | 411 | isStringExpression (Statement {statementID = id,
statementContents = contents}) symbols localSymbols types
| id == EXPRESSION_ADD &&
any (== VARIABLE_TYPE_STRING) (map (\ e -> getExpressionType e symbols localSymbols types) contents) = True
| otherwise = False | 326 | false | true | 0 | 14 | 111 | 111 | 57 | 54 | null | null |
Xingtao/RLHask | test/TestChapter4DP.hs | bsd-3-clause | doGamblerTest :: Config -> IO ()
doGamblerTest config = do
(prob::Double) <- require config "gambler.headProb"
(gamblerGoal::Int) <- require config "gambler.goal"
(theTheta::Double) <- require config "gambler.theta"
let gambler = mkGambler prob theTheta gamblerGoal
(_, !gambler') = runState gamblerStep gambler
drawGamblerGraph gambler'
threadDelay 100000
pure () | 385 | doGamblerTest :: Config -> IO ()
doGamblerTest config = do
(prob::Double) <- require config "gambler.headProb"
(gamblerGoal::Int) <- require config "gambler.goal"
(theTheta::Double) <- require config "gambler.theta"
let gambler = mkGambler prob theTheta gamblerGoal
(_, !gambler') = runState gamblerStep gambler
drawGamblerGraph gambler'
threadDelay 100000
pure () | 384 | doGamblerTest config = do
(prob::Double) <- require config "gambler.headProb"
(gamblerGoal::Int) <- require config "gambler.goal"
(theTheta::Double) <- require config "gambler.theta"
let gambler = mkGambler prob theTheta gamblerGoal
(_, !gambler') = runState gamblerStep gambler
drawGamblerGraph gambler'
threadDelay 100000
pure () | 351 | false | true | 0 | 11 | 64 | 134 | 61 | 73 | null | null |
randallalexander/LYAH | src/Ch4.hs | bsd-3-clause | calcBmis :: [(Double, Double)] -> [Double]
calcBmis xs = [bmi w h | (w, h) <- xs]
where bmi weight height = weight / height ^ 2 | 128 | calcBmis :: [(Double, Double)] -> [Double]
calcBmis xs = [bmi w h | (w, h) <- xs]
where bmi weight height = weight / height ^ 2 | 128 | calcBmis xs = [bmi w h | (w, h) <- xs]
where bmi weight height = weight / height ^ 2 | 85 | false | true | 0 | 8 | 27 | 73 | 39 | 34 | null | null |
dimsuz/java-ast | src/LexicalParser.hs | mit | -- escape, nonEscape, character, literal functions are taken from this SO answer
-- http://stackoverflow.com/a/24106749/258848
stringEscape :: Parser String
stringEscape = do
d <- char '\\'
c <- escapes
return [d, c] | 228 | stringEscape :: Parser String
stringEscape = do
d <- char '\\'
c <- escapes
return [d, c] | 101 | stringEscape = do
d <- char '\\'
c <- escapes
return [d, c] | 71 | true | true | 1 | 9 | 42 | 49 | 22 | 27 | null | null |
ktvoelker/cookie-jar | src/Network/DNS/Public/Types.hs | gpl-3.0 | lowerDiff :: Word8
lowerDiff = lowercaseA - capitalA | 52 | lowerDiff :: Word8
lowerDiff = lowercaseA - capitalA | 52 | lowerDiff = lowercaseA - capitalA | 33 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
ajnsit/snap-routes | src/Routes/TH/ParseRoute.hs | mit | instanceD = InstanceD Nothing | 29 | instanceD = InstanceD Nothing | 29 | instanceD = InstanceD Nothing | 29 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
sgillespie/ghc | compiler/llvmGen/LlvmMangler.hs | bsd-3-clause | rewriteAVX :: Rewrite
rewriteAVX dflags s
| not isX86_64 = Nothing
| isVmovdqa s = Just $ replaceOnce (B.pack "vmovdqa") (B.pack "vmovdqu") s
| isVmovap s = Just $ replaceOnce (B.pack "vmovap") (B.pack "vmovup") s
| otherwise = Nothing
where
isX86_64 = platformArch (targetPlatform dflags) == ArchX86_64
isVmovdqa = B.isPrefixOf (B.pack "vmovdqa")
isVmovap = B.isPrefixOf (B.pack "vmovap")
-- | @replaceOnce match replace bs@ replaces the first occurrence of the
-- substring @match@ in @bs@ with @replace@. | 536 | rewriteAVX :: Rewrite
rewriteAVX dflags s
| not isX86_64 = Nothing
| isVmovdqa s = Just $ replaceOnce (B.pack "vmovdqa") (B.pack "vmovdqu") s
| isVmovap s = Just $ replaceOnce (B.pack "vmovap") (B.pack "vmovup") s
| otherwise = Nothing
where
isX86_64 = platformArch (targetPlatform dflags) == ArchX86_64
isVmovdqa = B.isPrefixOf (B.pack "vmovdqa")
isVmovap = B.isPrefixOf (B.pack "vmovap")
-- | @replaceOnce match replace bs@ replaces the first occurrence of the
-- substring @match@ in @bs@ with @replace@. | 536 | rewriteAVX dflags s
| not isX86_64 = Nothing
| isVmovdqa s = Just $ replaceOnce (B.pack "vmovdqa") (B.pack "vmovdqu") s
| isVmovap s = Just $ replaceOnce (B.pack "vmovap") (B.pack "vmovup") s
| otherwise = Nothing
where
isX86_64 = platformArch (targetPlatform dflags) == ArchX86_64
isVmovdqa = B.isPrefixOf (B.pack "vmovdqa")
isVmovap = B.isPrefixOf (B.pack "vmovap")
-- | @replaceOnce match replace bs@ replaces the first occurrence of the
-- substring @match@ in @bs@ with @replace@. | 514 | false | true | 7 | 8 | 104 | 194 | 85 | 109 | null | null |
arekfu/project_euler | p0096/p0096.hs | mit | subSquare :: Sudoku -> Int -> Int -> Sudoku
subSquare s i j = let ((i0,i1),(j0,j1)) = subSquareRange i j
in submatrix i0 i1 j0 j1 s | 149 | subSquare :: Sudoku -> Int -> Int -> Sudoku
subSquare s i j = let ((i0,i1),(j0,j1)) = subSquareRange i j
in submatrix i0 i1 j0 j1 s | 149 | subSquare s i j = let ((i0,i1),(j0,j1)) = subSquareRange i j
in submatrix i0 i1 j0 j1 s | 105 | false | true | 0 | 10 | 44 | 83 | 40 | 43 | null | null |
ozgurakgun/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | showEnvDbg env t = showEnv' env t True | 38 | showEnvDbg env t = showEnv' env t True | 38 | showEnvDbg env t = showEnv' env t True | 38 | false | false | 0 | 5 | 7 | 19 | 8 | 11 | null | null |
idleberg/NSIS | Development/NSIS/Show.hs | apache-2.0 | out fs (FindWindow a b c d e) = [unwords $ "FindWindow" : show a : map show ([b,c] ++ maybeToList d ++ maybeToList e)] | 118 | out fs (FindWindow a b c d e) = [unwords $ "FindWindow" : show a : map show ([b,c] ++ maybeToList d ++ maybeToList e)] | 118 | out fs (FindWindow a b c d e) = [unwords $ "FindWindow" : show a : map show ([b,c] ++ maybeToList d ++ maybeToList e)] | 118 | false | false | 0 | 11 | 24 | 72 | 35 | 37 | null | null |
mdorman/couch-simple | src/lib/Database/Couch/ResponseParser.hs | mit | getHeader :: HeaderName -> ResponseParser ByteString
getHeader header =
maybeGetHeader header >>= maybe (throwE NotFound) return | 130 | getHeader :: HeaderName -> ResponseParser ByteString
getHeader header =
maybeGetHeader header >>= maybe (throwE NotFound) return | 130 | getHeader header =
maybeGetHeader header >>= maybe (throwE NotFound) return | 77 | false | true | 0 | 8 | 17 | 39 | 18 | 21 | null | null |
maruks/haskell-book | src/Chapter9_lists.hs | gpl-3.0 | capit :: String -> String
capit (x:xs) = toUpper x : xs | 55 | capit :: String -> String
capit (x:xs) = toUpper x : xs | 55 | capit (x:xs) = toUpper x : xs | 29 | false | true | 0 | 7 | 11 | 32 | 16 | 16 | null | null |
keithodulaigh/Hets | OMDoc/OMDocInterface.hs | gpl-2.0 | isDefinition _ = False | 22 | isDefinition _ = False | 22 | isDefinition _ = False | 22 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
frantisekfarka/ghc-dsi | compiler/utils/IOEnv.hs | bsd-3-clause | tryMostM :: IOEnv env r -> IOEnv env (Either SomeException r)
tryMostM (IOEnv thing) = IOEnv (\ env -> tryMost (thing env)) | 123 | tryMostM :: IOEnv env r -> IOEnv env (Either SomeException r)
tryMostM (IOEnv thing) = IOEnv (\ env -> tryMost (thing env)) | 123 | tryMostM (IOEnv thing) = IOEnv (\ env -> tryMost (thing env)) | 61 | false | true | 0 | 10 | 21 | 62 | 30 | 32 | null | null |
iblumenfeld/cryptol | src/Cryptol/Transform/Specialize.hs | bsd-3-clause | getSpecCache :: Monad m => SpecT m SpecCache
getSpecCache = get | 63 | getSpecCache :: Monad m => SpecT m SpecCache
getSpecCache = get | 63 | getSpecCache = get | 18 | false | true | 0 | 7 | 10 | 29 | 12 | 17 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/PrimOp.hs | bsd-3-clause | tagOf_PrimOp Int642AddrOp = _ILIT(1138) | 39 | tagOf_PrimOp Int642AddrOp = _ILIT(1138) | 39 | tagOf_PrimOp Int642AddrOp = _ILIT(1138) | 39 | false | false | 0 | 6 | 3 | 15 | 7 | 8 | null | null |
alpicola/mel | src/K/Normalize.hs | mit | normDecl (ADecl (name, TypeScheme [] t) e) = do
let b = (name, toKType t)
let (bs, e') = first (map (second toKType)) $ foldFunction e
case bs of
[] -> KDecl b . fst <$> normExpr e'
_ -> KFunDecl b bs . fst <$> withBind bs (normExpr e') | 250 | normDecl (ADecl (name, TypeScheme [] t) e) = do
let b = (name, toKType t)
let (bs, e') = first (map (second toKType)) $ foldFunction e
case bs of
[] -> KDecl b . fst <$> normExpr e'
_ -> KFunDecl b bs . fst <$> withBind bs (normExpr e') | 250 | normDecl (ADecl (name, TypeScheme [] t) e) = do
let b = (name, toKType t)
let (bs, e') = first (map (second toKType)) $ foldFunction e
case bs of
[] -> KDecl b . fst <$> normExpr e'
_ -> KFunDecl b bs . fst <$> withBind bs (normExpr e') | 250 | false | false | 0 | 15 | 63 | 146 | 69 | 77 | null | null |
brendanhay/gogol | gogol-sourcerepo/gen/Network/Google/Resource/SourceRepo/Projects/Repos/SetIAMPolicy.hs | mpl-2.0 | -- | REQUIRED: The resource for which the policy is being specified. See the
-- operation documentation for the appropriate value for this field.
prsipResource :: Lens' ProjectsReposSetIAMPolicy Text
prsipResource
= lens _prsipResource
(\ s a -> s{_prsipResource = a}) | 276 | prsipResource :: Lens' ProjectsReposSetIAMPolicy Text
prsipResource
= lens _prsipResource
(\ s a -> s{_prsipResource = a}) | 130 | prsipResource
= lens _prsipResource
(\ s a -> s{_prsipResource = a}) | 76 | true | true | 1 | 9 | 47 | 46 | 23 | 23 | null | null |
gcross/PauliQSC | Data/Quantum/Small/Operator/ReducedEschelonForm.hs | bsd-2-clause | addAllToReducedEschelonForm :: [Operator] → ReducedEschelonForm → ReducedEschelonForm -- {{{
addAllToReducedEschelonForm operators form =
foldl'
(flip addToReducedEschelonForm)
form
operators | 219 | addAllToReducedEschelonForm :: [Operator] → ReducedEschelonForm → ReducedEschelonForm
addAllToReducedEschelonForm operators form =
foldl'
(flip addToReducedEschelonForm)
form
operators | 212 | addAllToReducedEschelonForm operators form =
foldl'
(flip addToReducedEschelonForm)
form
operators | 126 | true | true | 0 | 7 | 45 | 41 | 21 | 20 | null | null |
JacquesCarette/literate-scientific-software | People/Dan/Presentations/CommitteeMeeting4/BodyNew.hs | bsd-2-clause | trace_t3_DD7 = [] | 17 | trace_t3_DD7 = [] | 17 | trace_t3_DD7 = [] | 17 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
acowley/ghc | compiler/main/HscTypes.hs | bsd-3-clause | showModMsg :: DynFlags -> HscTarget -> Bool -> ModSummary -> String
showModMsg dflags target recomp mod_summary
= showSDoc dflags $
hsep [text (mod_str ++ replicate (max 0 (16 - length mod_str)) ' '),
char '(', text (normalise $ msHsFilePath mod_summary) <> comma,
case target of
HscInterpreted | recomp
-> text "interpreted"
HscNothing -> text "nothing"
_ | HsigFile == ms_hsc_src mod_summary -> text "nothing"
| otherwise -> text (normalise $ msObjFilePath mod_summary),
char ')']
where
mod = moduleName (ms_mod mod_summary)
mod_str = showPpr dflags mod
++ hscSourceString' dflags mod (ms_hsc_src mod_summary)
-- | Variant of hscSourceString which prints more information for signatures.
-- This can't live in DriverPhases because this would cause a module loop. | 949 | showModMsg :: DynFlags -> HscTarget -> Bool -> ModSummary -> String
showModMsg dflags target recomp mod_summary
= showSDoc dflags $
hsep [text (mod_str ++ replicate (max 0 (16 - length mod_str)) ' '),
char '(', text (normalise $ msHsFilePath mod_summary) <> comma,
case target of
HscInterpreted | recomp
-> text "interpreted"
HscNothing -> text "nothing"
_ | HsigFile == ms_hsc_src mod_summary -> text "nothing"
| otherwise -> text (normalise $ msObjFilePath mod_summary),
char ')']
where
mod = moduleName (ms_mod mod_summary)
mod_str = showPpr dflags mod
++ hscSourceString' dflags mod (ms_hsc_src mod_summary)
-- | Variant of hscSourceString which prints more information for signatures.
-- This can't live in DriverPhases because this would cause a module loop. | 949 | showModMsg dflags target recomp mod_summary
= showSDoc dflags $
hsep [text (mod_str ++ replicate (max 0 (16 - length mod_str)) ' '),
char '(', text (normalise $ msHsFilePath mod_summary) <> comma,
case target of
HscInterpreted | recomp
-> text "interpreted"
HscNothing -> text "nothing"
_ | HsigFile == ms_hsc_src mod_summary -> text "nothing"
| otherwise -> text (normalise $ msObjFilePath mod_summary),
char ')']
where
mod = moduleName (ms_mod mod_summary)
mod_str = showPpr dflags mod
++ hscSourceString' dflags mod (ms_hsc_src mod_summary)
-- | Variant of hscSourceString which prints more information for signatures.
-- This can't live in DriverPhases because this would cause a module loop. | 881 | false | true | 6 | 14 | 299 | 249 | 113 | 136 | null | null |
peteg/ADHOC | Tests/08_Kesterel/140_nondet_bits.hs | gpl-2.0 | nextBitP = "next bit" | 21 | nextBitP = "next bit" | 21 | nextBitP = "next bit" | 21 | false | false | 0 | 4 | 3 | 6 | 3 | 3 | null | null |
forsyde/forsyde-atom | tests/VectorTest.hs | bsd-3-clause | prop_rot_1 v | l > 0 = (rotl . rotr) v == v
| otherwise = True
where types = (v :: Vector Int)
l = V.length v | 137 | prop_rot_1 v | l > 0 = (rotl . rotr) v == v
| otherwise = True
where types = (v :: Vector Int)
l = V.length v | 137 | prop_rot_1 v | l > 0 = (rotl . rotr) v == v
| otherwise = True
where types = (v :: Vector Int)
l = V.length v | 137 | false | false | 2 | 9 | 55 | 81 | 35 | 46 | null | null |
shayan-najd/Haskell-Desugar-Generic | Language/Haskell/Exts/Desugar/Generic/Others.hs | bsd-3-clause | desugarThenBy = noDesugaring | 28 | desugarThenBy = noDesugaring | 28 | desugarThenBy = noDesugaring | 28 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/executables/sblgnt.hs | mit | dumpCharacters :: Int -> IO ()
dumpCharacters bookIndex = do
book <- getBook bookIndex
mapM_ (\(Character c (Word t _ _) _ _) -> T.putStrLn $ format' "{} {}" (c, t)) $ wordsToCharacters . segmentsToWords . segments $ book | 225 | dumpCharacters :: Int -> IO ()
dumpCharacters bookIndex = do
book <- getBook bookIndex
mapM_ (\(Character c (Word t _ _) _ _) -> T.putStrLn $ format' "{} {}" (c, t)) $ wordsToCharacters . segmentsToWords . segments $ book | 225 | dumpCharacters bookIndex = do
book <- getBook bookIndex
mapM_ (\(Character c (Word t _ _) _ _) -> T.putStrLn $ format' "{} {}" (c, t)) $ wordsToCharacters . segmentsToWords . segments $ book | 194 | false | true | 0 | 17 | 42 | 102 | 50 | 52 | null | null |
zrho/pylon | src/Language/Pylon/Core/Check.hs | bsd-3-clause | isLhsForm :: Name -> Exp -> Bool
isLhsForm n (EApp f _) = isLhsForm n f | 71 | isLhsForm :: Name -> Exp -> Bool
isLhsForm n (EApp f _) = isLhsForm n f | 71 | isLhsForm n (EApp f _) = isLhsForm n f | 38 | false | true | 0 | 7 | 15 | 37 | 18 | 19 | null | null |
phischu/fragnix | tests/packages/scotty/Data.IntSet.Internal.hs | bsd-3-clause | difference Nil _ = Nil | 26 | difference Nil _ = Nil | 26 | difference Nil _ = Nil | 26 | false | false | 0 | 5 | 8 | 11 | 5 | 6 | null | null |
mrmonday/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp v (LZExt ITChar (ITFixed to)) [x]
= doOp v (LZExt ITNative (ITFixed to)) [x] | 85 | doOp v (LZExt ITChar (ITFixed to)) [x]
= doOp v (LZExt ITNative (ITFixed to)) [x] | 85 | doOp v (LZExt ITChar (ITFixed to)) [x]
= doOp v (LZExt ITNative (ITFixed to)) [x] | 85 | false | false | 0 | 9 | 18 | 54 | 27 | 27 | null | null |
iatorm/grime | Matcher.hs | mit | anyMatch :: (Monad m) => [a] -> (a -> m Match) -> m Match
anyMatch xs f = foldr (|?) (return NoMatch) $ f <$> xs | 112 | anyMatch :: (Monad m) => [a] -> (a -> m Match) -> m Match
anyMatch xs f = foldr (|?) (return NoMatch) $ f <$> xs | 112 | anyMatch xs f = foldr (|?) (return NoMatch) $ f <$> xs | 54 | false | true | 0 | 10 | 25 | 70 | 36 | 34 | null | null |
nevrenato/Hets_Fork | DFOL/AS_DFOL.hs | gpl-2.0 | eqType (Func [t1] s1) (Func [t2] s2) = and [t1 == t2, s1 == s2] | 63 | eqType (Func [t1] s1) (Func [t2] s2) = and [t1 == t2, s1 == s2] | 63 | eqType (Func [t1] s1) (Func [t2] s2) = and [t1 == t2, s1 == s2] | 63 | false | false | 0 | 8 | 14 | 50 | 26 | 24 | null | null |
ideas-edu/ideas | src/Ideas/Encoding/NewModeJSON.hs | apache-2.0 | jsonRPC2 :: DomainReasoner -> String -> JSON -> RPCHandler -> IO JSON
jsonRPC2 dr serviceName input rpc = do
json <- rpc serviceName input
return (okResponse dr serviceName json)
`catch` handler
where
handler :: SomeException -> IO JSON
handler e =
let msg = maybe (show e) ioeGetErrorString (fromException e)
in return $ errorResponse dr (toJSON msg) | 377 | jsonRPC2 :: DomainReasoner -> String -> JSON -> RPCHandler -> IO JSON
jsonRPC2 dr serviceName input rpc = do
json <- rpc serviceName input
return (okResponse dr serviceName json)
`catch` handler
where
handler :: SomeException -> IO JSON
handler e =
let msg = maybe (show e) ioeGetErrorString (fromException e)
in return $ errorResponse dr (toJSON msg) | 377 | jsonRPC2 dr serviceName input rpc = do
json <- rpc serviceName input
return (okResponse dr serviceName json)
`catch` handler
where
handler :: SomeException -> IO JSON
handler e =
let msg = maybe (show e) ioeGetErrorString (fromException e)
in return $ errorResponse dr (toJSON msg) | 307 | false | true | 0 | 11 | 82 | 148 | 69 | 79 | null | null |
ZjMNZHgG5jMXw/smallcaps | src/smallcaps/Text/SmallCaps.hs | bsd-3-clause | -- ** Meta information
version :: Version
version = makeVersion [0,6,0,4] | 74 | version :: Version
version = makeVersion [0,6,0,4] | 50 | version = makeVersion [0,6,0,4] | 31 | true | true | 0 | 6 | 11 | 33 | 17 | 16 | null | null |
matteosister/haskell-exercises | List2.hs | mit | slice :: [a] -> Int -> Int -> [a]
slice list start end = drop (start - 1) . take end $ list | 92 | slice :: [a] -> Int -> Int -> [a]
slice list start end = drop (start - 1) . take end $ list | 91 | slice list start end = drop (start - 1) . take end $ list | 57 | false | true | 0 | 9 | 23 | 57 | 29 | 28 | null | null |
kikofernandez/kikofernandez.github.io | files/monadic-typechecker/typechecker/src/Initial/AST.hs | mit | -- | Helper function to check whether a 'FieldDef' is mutable.
isVarField :: FieldDef -> Bool
isVarField = not . isValField | 123 | isVarField :: FieldDef -> Bool
isVarField = not . isValField | 60 | isVarField = not . isValField | 29 | true | true | 1 | 7 | 20 | 28 | 12 | 16 | null | null |
markuspf/Idris-dev | src/IRTS/Compiler.hs | bsd-3-clause | irSC top vs (ProjCase tm alts) = do
tm' <- irTerm top vs [] tm
alts' <- mapM (irAlt top vs tm') alts
return $ LCase Shared tm' alts'
-- Transform matching on Delay to applications of Force. | 204 | irSC top vs (ProjCase tm alts) = do
tm' <- irTerm top vs [] tm
alts' <- mapM (irAlt top vs tm') alts
return $ LCase Shared tm' alts'
-- Transform matching on Delay to applications of Force. | 204 | irSC top vs (ProjCase tm alts) = do
tm' <- irTerm top vs [] tm
alts' <- mapM (irAlt top vs tm') alts
return $ LCase Shared tm' alts'
-- Transform matching on Delay to applications of Force. | 204 | false | false | 0 | 10 | 52 | 76 | 35 | 41 | null | null |
kaizhang/clustering | src/AI/Clustering/KMeans/Internal.hs | mit | kmeansPP :: (PrimMonad m, G.Vector v a)
=> Gen (PrimState m)
-> Int -- ^ The number of clusters
-> v a -- ^ Input data
-> (a -> U.Vector Double) -- ^ Feature extraction function
-> m (MU.Matrix Double)
kmeansPP g k dat fn
| k > n = error "k is larger than sample size"
| otherwise = do
c1 <- uniformR (0,n-1) g
loop [c1] 1
where
loop centers !k'
| k' == k = return $ MU.fromRows $ map (fn . G.unsafeIndex dat) centers
| otherwise = do
c' <- flip categorical g $ U.generate n $ \i -> minimum $
map (\c -> sumSquares (fn $ G.unsafeIndex dat i) (fn $ G.unsafeIndex dat c))
centers
loop (c':centers) (k'+1)
n = G.length dat
| 812 | kmeansPP :: (PrimMonad m, G.Vector v a)
=> Gen (PrimState m)
-> Int -- ^ The number of clusters
-> v a -- ^ Input data
-> (a -> U.Vector Double) -- ^ Feature extraction function
-> m (MU.Matrix Double)
kmeansPP g k dat fn
| k > n = error "k is larger than sample size"
| otherwise = do
c1 <- uniformR (0,n-1) g
loop [c1] 1
where
loop centers !k'
| k' == k = return $ MU.fromRows $ map (fn . G.unsafeIndex dat) centers
| otherwise = do
c' <- flip categorical g $ U.generate n $ \i -> minimum $
map (\c -> sumSquares (fn $ G.unsafeIndex dat i) (fn $ G.unsafeIndex dat c))
centers
loop (c':centers) (k'+1)
n = G.length dat
| 812 | kmeansPP g k dat fn
| k > n = error "k is larger than sample size"
| otherwise = do
c1 <- uniformR (0,n-1) g
loop [c1] 1
where
loop centers !k'
| k' == k = return $ MU.fromRows $ map (fn . G.unsafeIndex dat) centers
| otherwise = do
c' <- flip categorical g $ U.generate n $ \i -> minimum $
map (\c -> sumSquares (fn $ G.unsafeIndex dat i) (fn $ G.unsafeIndex dat c))
centers
loop (c':centers) (k'+1)
n = G.length dat
| 524 | false | true | 3 | 18 | 319 | 324 | 155 | 169 | null | null |
anttisalonen/freekick2 | src/Main.hs | gpl-3.0 | rotateTeam _ (Just (_, HumanOwner)) = Nothing | 45 | rotateTeam _ (Just (_, HumanOwner)) = Nothing | 45 | rotateTeam _ (Just (_, HumanOwner)) = Nothing | 45 | false | false | 0 | 8 | 6 | 23 | 12 | 11 | null | null |
alexbiehl/StringMap | Data/StringMap/FuzzySearch.hs | mit | -- | Same as 'Lazy.lookup', but case insensitive
lookupNoCase :: Key -> StringMap a -> StringMap a
lookupNoCase k = cutAllPx' (noCaseKeys k) | 177 | lookupNoCase :: Key -> StringMap a -> StringMap a
lookupNoCase k = cutAllPx' (noCaseKeys k) | 127 | lookupNoCase k = cutAllPx' (noCaseKeys k) | 58 | true | true | 0 | 7 | 59 | 38 | 18 | 20 | null | null |
ennocramer/hindent | src/HIndent/Pretty.hs | bsd-3-clause | dependBind :: MonadState (PrintState s) m => m a -> (a -> m b) -> m b
dependBind maker dependent =
do state' <- get
v <- maker
st <- get
col <- gets psColumn
if psLine state' /= psLine st || psColumn state' /= psColumn st
then column col (dependent v)
else (dependent v)
-- | Wrap in parens. | 330 | dependBind :: MonadState (PrintState s) m => m a -> (a -> m b) -> m b
dependBind maker dependent =
do state' <- get
v <- maker
st <- get
col <- gets psColumn
if psLine state' /= psLine st || psColumn state' /= psColumn st
then column col (dependent v)
else (dependent v)
-- | Wrap in parens. | 330 | dependBind maker dependent =
do state' <- get
v <- maker
st <- get
col <- gets psColumn
if psLine state' /= psLine st || psColumn state' /= psColumn st
then column col (dependent v)
else (dependent v)
-- | Wrap in parens. | 260 | false | true | 0 | 11 | 98 | 139 | 64 | 75 | null | null |
juhp/stack | src/Stack/Constants.hs | bsd-3-clause | relDirLocal :: Path Rel Dir
relDirLocal = $(mkRelDir "local") | 61 | relDirLocal :: Path Rel Dir
relDirLocal = $(mkRelDir "local") | 61 | relDirLocal = $(mkRelDir "local") | 33 | false | true | 0 | 8 | 8 | 29 | 12 | 17 | null | null |
Soares/tagwiki | src/Main.hs | mit | alter :: Wiki -> (Int, (FilePath, String)) -> IO Wiki
alter w (i, (path, txt)) = case takeExtension path of
".era" -> load recordEra parseEra
".char" -> load recordCharacter parseCharacter
".place" -> load recordPlace parsePlace
_ -> load record parseNote
where load rec par = case parse (par i) path txt of
Left err -> warn err *> pure w
Right note -> pure $ rec w path note
-- | Handling unexpected arguments | 488 | alter :: Wiki -> (Int, (FilePath, String)) -> IO Wiki
alter w (i, (path, txt)) = case takeExtension path of
".era" -> load recordEra parseEra
".char" -> load recordCharacter parseCharacter
".place" -> load recordPlace parsePlace
_ -> load record parseNote
where load rec par = case parse (par i) path txt of
Left err -> warn err *> pure w
Right note -> pure $ rec w path note
-- | Handling unexpected arguments | 488 | alter w (i, (path, txt)) = case takeExtension path of
".era" -> load recordEra parseEra
".char" -> load recordCharacter parseCharacter
".place" -> load recordPlace parsePlace
_ -> load record parseNote
where load rec par = case parse (par i) path txt of
Left err -> warn err *> pure w
Right note -> pure $ rec w path note
-- | Handling unexpected arguments | 434 | false | true | 0 | 10 | 151 | 177 | 85 | 92 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Streaming.Network.hs | bsd-3-clause | -- | Attempt to bind a listening @Socket@ on the given host/port. If no host is
-- given, will use the first address available.
bindPortUDP :: Int -> HostPreference -> IO Socket
bindPortUDP = bindPortGen NS.Datagram | 215 | bindPortUDP :: Int -> HostPreference -> IO Socket
bindPortUDP = bindPortGen NS.Datagram | 87 | bindPortUDP = bindPortGen NS.Datagram | 37 | true | true | 0 | 7 | 35 | 29 | 15 | 14 | null | null |
gsnewmark/cis194 | src/Cis194/Week10/AParser.hs | apache-2.0 | intPair :: Parser [Integer]
intPair = (\a _ b -> [a, b]) <$> posInt <*> char ' ' <*> posInt | 91 | intPair :: Parser [Integer]
intPair = (\a _ b -> [a, b]) <$> posInt <*> char ' ' <*> posInt | 91 | intPair = (\a _ b -> [a, b]) <$> posInt <*> char ' ' <*> posInt | 63 | false | true | 0 | 10 | 19 | 56 | 28 | 28 | null | null |
gabesoft/kapi | test/PersistenceMongoDBSpec.hs | bsd-3-clause | commonDoc :: Document
commonDoc =
[ mkStrField "optional" "optionalValue"
, mkIntField "optionalWithDefault" 1
, mkIntField "required" 100
, mkStrField "requiredWithDefault" "requiredValue"
] | 201 | commonDoc :: Document
commonDoc =
[ mkStrField "optional" "optionalValue"
, mkIntField "optionalWithDefault" 1
, mkIntField "required" 100
, mkStrField "requiredWithDefault" "requiredValue"
] | 201 | commonDoc =
[ mkStrField "optional" "optionalValue"
, mkIntField "optionalWithDefault" 1
, mkIntField "required" 100
, mkStrField "requiredWithDefault" "requiredValue"
] | 179 | false | true | 0 | 7 | 31 | 50 | 23 | 27 | null | null |
Oblosys/webviews | src/lib/Types.hs | mit | strRef (Widget _ _ (TextView (ViewId i) h _ _ _ _ _)) = ViewIdRef i | 67 | strRef (Widget _ _ (TextView (ViewId i) h _ _ _ _ _)) = ViewIdRef i | 67 | strRef (Widget _ _ (TextView (ViewId i) h _ _ _ _ _)) = ViewIdRef i | 67 | false | false | 0 | 10 | 15 | 47 | 22 | 25 | null | null |
gnn/Hets | OWL2/XMLKeywords.hs | gpl-2.0 | dataRangeList :: [String]
dataRangeList = [datatypeK, datatypeRestrictionK, dataComplementOfK,
dataOneOfK, dataIntersectionOfK, dataUnionOfK] | 147 | dataRangeList :: [String]
dataRangeList = [datatypeK, datatypeRestrictionK, dataComplementOfK,
dataOneOfK, dataIntersectionOfK, dataUnionOfK] | 147 | dataRangeList = [datatypeK, datatypeRestrictionK, dataComplementOfK,
dataOneOfK, dataIntersectionOfK, dataUnionOfK] | 121 | false | true | 0 | 7 | 16 | 39 | 21 | 18 | null | null |
trenttobler/hs-asteroids | src/Asteroids/GameLogic/Constants.hs | bsd-3-clause | maxBulletAge = bulletRange / bulletSpeed | 40 | maxBulletAge = bulletRange / bulletSpeed | 40 | maxBulletAge = bulletRange / bulletSpeed | 40 | false | false | 0 | 5 | 4 | 10 | 5 | 5 | null | null |
lucas8/netlist-compiler | parser.hs | mit | getidx mp tp s = let l = M.lookup s mp in case l of
Just (x,_) -> return x
Nothing -> fail (s ++ " " ++ tp ++ " variable not declared in vars") | 186 | getidx mp tp s = let l = M.lookup s mp in case l of
Just (x,_) -> return x
Nothing -> fail (s ++ " " ++ tp ++ " variable not declared in vars") | 186 | getidx mp tp s = let l = M.lookup s mp in case l of
Just (x,_) -> return x
Nothing -> fail (s ++ " " ++ tp ++ " variable not declared in vars") | 186 | false | false | 1 | 14 | 78 | 82 | 37 | 45 | null | null |
markflorisson/hpack | testrepo/bytestring-0.10.2.0/Data/ByteString/Builder/Prim/Internal.hs | bsd-3-clause | contramapB :: (b -> a) -> BoundedPrim a -> BoundedPrim b
contramapB f (BE b io) = BE b (\x op -> io (f x) op) | 109 | contramapB :: (b -> a) -> BoundedPrim a -> BoundedPrim b
contramapB f (BE b io) = BE b (\x op -> io (f x) op) | 109 | contramapB f (BE b io) = BE b (\x op -> io (f x) op) | 52 | false | true | 0 | 10 | 25 | 71 | 35 | 36 | null | null |
davmre/matrizer | src/Matrizer/Search.hs | gpl-2.0 | -- n: type representing an element of the search domain
-- c: numeric type for the cost/heuristic functions
-- start: start state
-- succ: function that maps a state to a list of successor states with costs
-- goalCheck: test whether a state is a goal
-- cost: fringe ranking fn f(x), given current state x and cost-so-far g(x). for valid A*, this should return f(x) = g(x) + h(x) for some heuristic h(x). For best-first search, just return g(x); for greedy search, just return h(x).
-- returns: goal state found, or Nothing if search completes without success.
astar :: (Ord n, Real c, Show c, Show n) => n -> (n -> [(n,c, Maybe String)]) -> (n -> Bool) -> ( SearchNode n c -> c ) -> c -> Maybe (SearchNode n c)
astar start succ goalCheck cost maxCost = astarIter (Heap.singleton (0, SearchNode {nvalue=start, gcost=0, nprev=Nothing, move=Nothing})) Set.empty succ goalCheck cost maxCost | 890 | astar :: (Ord n, Real c, Show c, Show n) => n -> (n -> [(n,c, Maybe String)]) -> (n -> Bool) -> ( SearchNode n c -> c ) -> c -> Maybe (SearchNode n c)
astar start succ goalCheck cost maxCost = astarIter (Heap.singleton (0, SearchNode {nvalue=start, gcost=0, nprev=Nothing, move=Nothing})) Set.empty succ goalCheck cost maxCost | 326 | astar start succ goalCheck cost maxCost = astarIter (Heap.singleton (0, SearchNode {nvalue=start, gcost=0, nprev=Nothing, move=Nothing})) Set.empty succ goalCheck cost maxCost | 175 | true | true | 0 | 13 | 156 | 190 | 103 | 87 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.