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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
kovach/web | res1/Graph.hs | gpl-2.0 | s_ctxt :: Functor f => (b -> f b) -> ((a, b), c) -> f ((a, b), c)
s_ctxt = (_1 . _2) | 84 | s_ctxt :: Functor f => (b -> f b) -> ((a, b), c) -> f ((a, b), c)
s_ctxt = (_1 . _2) | 84 | s_ctxt = (_1 . _2) | 18 | false | true | 0 | 11 | 22 | 76 | 40 | 36 | null | null |
bergmark/happstack-fay | Language/Fay/AJAX.hs | bsd-3-clause | -- | Asynchronously call a command
--
-- Note: if the server returns 404 or some other non-success exit
-- code, the callback function will never be run.
--
-- This function is just a wrapper around 'ajaxCommand' which uses the
-- 'ResponseType res' phantom-typed parameter for added type safety.
call :: (Foreign cmd, Foreign res) =>
String -- ^ URL to 'POST' AJAX request to
-> (ResponseType res -> cmd) -- ^ AJAX command to send to server
-> (res -> Fay ()) -- ^ callback function to handle response
-> Fay ()
call uri f g =
ajaxCommand uri (f ResponseType) g | 618 | call :: (Foreign cmd, Foreign res) =>
String -- ^ URL to 'POST' AJAX request to
-> (ResponseType res -> cmd) -- ^ AJAX command to send to server
-> (res -> Fay ()) -- ^ callback function to handle response
-> Fay ()
call uri f g =
ajaxCommand uri (f ResponseType) g | 321 | call uri f g =
ajaxCommand uri (f ResponseType) g | 53 | true | true | 0 | 12 | 159 | 95 | 52 | 43 | null | null |
tolysz/prepare-ghcjs | spec-lts8/aeson/tests/DataFamilies/Encoders.hs | bsd-3-clause | thGADTToJSONDefault :: GADT String -> Value
thGADTToJSONDefault = $(mkToJSON defaultOptions 'GADT) | 98 | thGADTToJSONDefault :: GADT String -> Value
thGADTToJSONDefault = $(mkToJSON defaultOptions 'GADT) | 98 | thGADTToJSONDefault = $(mkToJSON defaultOptions 'GADT) | 54 | false | true | 0 | 7 | 10 | 28 | 14 | 14 | null | null |
dmeysman/fp-minesweeper | src/Minesweeper/Board.hs | mit | -- | Check whether a 'Board' determines a lost game.
lost :: Board -> Bool
lost Board { cells = css } = Df.or $ fmap (Df.any causesLoss) css | 140 | lost :: Board -> Bool
lost Board { cells = css } = Df.or $ fmap (Df.any causesLoss) css | 87 | lost Board { cells = css } = Df.or $ fmap (Df.any causesLoss) css | 65 | true | true | 3 | 9 | 28 | 52 | 25 | 27 | null | null |
rgaiacs/pandoc | src/Text/Pandoc/Readers/Org.hs | gpl-2.0 | isImageFilename :: String -> Bool
isImageFilename filename =
any (\x -> ('.':x) `isSuffixOf` filename) imageExtensions &&
(any (\x -> (x++":") `isPrefixOf` filename) protocols ||
':' `notElem` filename)
where
imageExtensions = [ "jpeg" , "jpg" , "png" , "gif" , "svg" ]
protocols = [ "file", "http", "https" ] | 324 | isImageFilename :: String -> Bool
isImageFilename filename =
any (\x -> ('.':x) `isSuffixOf` filename) imageExtensions &&
(any (\x -> (x++":") `isPrefixOf` filename) protocols ||
':' `notElem` filename)
where
imageExtensions = [ "jpeg" , "jpg" , "png" , "gif" , "svg" ]
protocols = [ "file", "http", "https" ] | 324 | isImageFilename filename =
any (\x -> ('.':x) `isSuffixOf` filename) imageExtensions &&
(any (\x -> (x++":") `isPrefixOf` filename) protocols ||
':' `notElem` filename)
where
imageExtensions = [ "jpeg" , "jpg" , "png" , "gif" , "svg" ]
protocols = [ "file", "http", "https" ] | 290 | false | true | 0 | 14 | 62 | 124 | 72 | 52 | null | null |
danplubell/color-noise | Haskeleton.hs | mit | path :: FilePath -> String -> String -> FilePath
path d s m = joinPath (d : parts (m <> s)) <.> "hs" | 100 | path :: FilePath -> String -> String -> FilePath
path d s m = joinPath (d : parts (m <> s)) <.> "hs" | 100 | path d s m = joinPath (d : parts (m <> s)) <.> "hs" | 51 | false | true | 0 | 10 | 22 | 60 | 28 | 32 | null | null |
plow-technologies/onping-data-language | OnPing/DataServer/Language.hs | bsd-3-clause | clientAction :: Client Key IO a -> Eval a
clientAction c = do
server <- valueOf "server"
port <- valueOf "port"
liftIO $ runClient (AwayServer OnPingData (unpack server) port) c | 183 | clientAction :: Client Key IO a -> Eval a
clientAction c = do
server <- valueOf "server"
port <- valueOf "port"
liftIO $ runClient (AwayServer OnPingData (unpack server) port) c | 183 | clientAction c = do
server <- valueOf "server"
port <- valueOf "port"
liftIO $ runClient (AwayServer OnPingData (unpack server) port) c | 141 | false | true | 0 | 13 | 35 | 81 | 35 | 46 | null | null |
saep/repo-based-blog | test-suite/Web/RBB/Crawler/MetaCombinerSpec.hs | bsd-3-clause | noNewline c = c `notElem` ("\n\r" :: String) | 44 | noNewline c = c `notElem` ("\n\r" :: String) | 44 | noNewline c = c `notElem` ("\n\r" :: String) | 44 | false | false | 0 | 6 | 7 | 21 | 12 | 9 | null | null |
marcelosousa/poet | src/Model/Interpreter.hs | gpl-2.0 | toIPMode 1 a n = IPSingleRand a n | 33 | toIPMode 1 a n = IPSingleRand a n | 33 | toIPMode 1 a n = IPSingleRand a n | 33 | false | false | 0 | 5 | 7 | 18 | 8 | 10 | null | null |
sternenseemann/large-hashable | test/Data/LargeHashable/Tests/TH.hs | bsd-3-clause | test_higherKinded :: IO ()
test_higherKinded =
assertNotEqual
(largeHash md5HashAlgorithm (HigherKinded (Bar 42 "Stefan")))
(largeHash md5HashAlgorithm (HigherKinded (Bar 5 "Stefan"))) | 204 | test_higherKinded :: IO ()
test_higherKinded =
assertNotEqual
(largeHash md5HashAlgorithm (HigherKinded (Bar 42 "Stefan")))
(largeHash md5HashAlgorithm (HigherKinded (Bar 5 "Stefan"))) | 204 | test_higherKinded =
assertNotEqual
(largeHash md5HashAlgorithm (HigherKinded (Bar 42 "Stefan")))
(largeHash md5HashAlgorithm (HigherKinded (Bar 5 "Stefan"))) | 177 | false | true | 0 | 11 | 38 | 65 | 32 | 33 | null | null |
UU-ComputerScience/uu-cco | uu-cco/src/CCO/Feedback.hs | bsd-3-clause | -- | Issues a 'Log' message at the default verbosity level 1 containing a
-- specified text.
trace_ :: String -> Feedback ()
trace_ = trace 1 | 141 | trace_ :: String -> Feedback ()
trace_ = trace 1 | 48 | trace_ = trace 1 | 16 | true | true | 0 | 7 | 26 | 25 | 13 | 12 | null | null |
arianvp/binary-serialise-cbor | Data/Binary/Serialise/CBOR/Class.hs | bsd-3-clause | -- UTCTime has an unnecessarily lazy representation, and the parsing is lazy
forceUTCTime :: UTCTime -> UTCTime
forceUTCTime t@(UTCTime !_day !_daytime) = t | 156 | forceUTCTime :: UTCTime -> UTCTime
forceUTCTime t@(UTCTime !_day !_daytime) = t | 79 | forceUTCTime t@(UTCTime !_day !_daytime) = t | 44 | true | true | 0 | 9 | 22 | 32 | 16 | 16 | null | null |
gscalzo/HaskellTheHardWay | gloss-try/gloss-master/gloss-examples/picture/Graph/Main.hs | mit | - | Get the set of edges in a graoh.
graphEdges :: Graph -> Set Edge
graphEdges
= Map.foldrWithKey' foldNeighs Set.empty . grNeighs
where
-- For each vertex `v1`, insert an edge for each neighbour `v2`.
foldNeighs v1 ns es
= Set.foldr' (\v2 -> Set.insert (order (v1, v2))) es ns
order (v1, v2)
= if v1 > v2 then (v1, v2) else (v2, v1)
-- Scene ----------------------------------------------------------------------
-- INVARIANT The keys in `scGraph` are the same as the keys in `scPoints`.
| 540 | graphEdges :: Graph -> Set Edge
graphEdges
= Map.foldrWithKey' foldNeighs Set.empty . grNeighs
where
-- For each vertex `v1`, insert an edge for each neighbour `v2`.
foldNeighs v1 ns es
= Set.foldr' (\v2 -> Set.insert (order (v1, v2))) es ns
order (v1, v2)
= if v1 > v2 then (v1, v2) else (v2, v1)
-- Scene ----------------------------------------------------------------------
-- INVARIANT The keys in `scGraph` are the same as the keys in `scPoints`. | 502 | graphEdges
= Map.foldrWithKey' foldNeighs Set.empty . grNeighs
where
-- For each vertex `v1`, insert an edge for each neighbour `v2`.
foldNeighs v1 ns es
= Set.foldr' (\v2 -> Set.insert (order (v1, v2))) es ns
order (v1, v2)
= if v1 > v2 then (v1, v2) else (v2, v1)
-- Scene ----------------------------------------------------------------------
-- INVARIANT The keys in `scGraph` are the same as the keys in `scPoints`. | 470 | true | true | 2 | 11 | 131 | 151 | 77 | 74 | null | null |
ghc-android/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | repTyConKey = mkPreludeTyConUnique 155 | 39 | repTyConKey = mkPreludeTyConUnique 155 | 39 | repTyConKey = mkPreludeTyConUnique 155 | 39 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
michaeljklein/HCy2C | Main.hs | mit | strSolutionPipe1 :: String -> [[Int]] -> (([Int], Int), [[Int]])
strSolutionPipe1 string graph = (solutionStrToTup string, graph) | 129 | strSolutionPipe1 :: String -> [[Int]] -> (([Int], Int), [[Int]])
strSolutionPipe1 string graph = (solutionStrToTup string, graph) | 129 | strSolutionPipe1 string graph = (solutionStrToTup string, graph) | 64 | false | true | 0 | 9 | 15 | 60 | 35 | 25 | null | null |
hpacheco/HAAP | src/HAAP/Shelly.hs | mit | (~~~) :: Sh.FilePath -> GlobPattern -> Sh Bool
f ~~~ p = return $ (shToFilePath f) ~~ p | 87 | (~~~) :: Sh.FilePath -> GlobPattern -> Sh Bool
f ~~~ p = return $ (shToFilePath f) ~~ p | 87 | f ~~~ p = return $ (shToFilePath f) ~~ p | 40 | false | true | 2 | 9 | 17 | 51 | 24 | 27 | null | null |
gjotter/hmpc | Main.hs | gpl-2.0 | playlist' = playlist { pl_buffer = Just 100 } | 46 | playlist' = playlist { pl_buffer = Just 100 } | 46 | playlist' = playlist { pl_buffer = Just 100 } | 46 | false | false | 1 | 8 | 9 | 24 | 10 | 14 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_V_NUMBER :: Int
wxSTC_V_NUMBER = 4 | 40 | wxSTC_V_NUMBER :: Int
wxSTC_V_NUMBER = 4 | 40 | wxSTC_V_NUMBER = 4 | 18 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
mightymoose/liquidhaskell | tests/pos/OrdList.hs | bsd-3-clause | foldlOL k z (Snoc xs x) = k (foldlOL k z xs) x | 46 | foldlOL k z (Snoc xs x) = k (foldlOL k z xs) x | 46 | foldlOL k z (Snoc xs x) = k (foldlOL k z xs) x | 46 | false | false | 0 | 7 | 12 | 39 | 17 | 22 | null | null |
ElArtista/HAr | src/Data/Ar.hs | mit | parseAr :: L.ByteString -> Either String Archive
parseAr s = case runGetOrFail parseHeader s of
Left _ -> Left "Could not parse header"
Right (bs, _, _) ->
case runGetOrFail parseEntries bs of
Left _ -> Left "Could not parse entries"
Right (_,_,ae) -> Right $
let symbolTable =
case find ((=="/") . fileName) ae of
Nothing -> []
Just f -> getSymbolList $ fileData f
in Archive symbolTable (replaceExtendedFileNames ae) | 683 | parseAr :: L.ByteString -> Either String Archive
parseAr s = case runGetOrFail parseHeader s of
Left _ -> Left "Could not parse header"
Right (bs, _, _) ->
case runGetOrFail parseEntries bs of
Left _ -> Left "Could not parse entries"
Right (_,_,ae) -> Right $
let symbolTable =
case find ((=="/") . fileName) ae of
Nothing -> []
Just f -> getSymbolList $ fileData f
in Archive symbolTable (replaceExtendedFileNames ae) | 683 | parseAr s = case runGetOrFail parseHeader s of
Left _ -> Left "Could not parse header"
Right (bs, _, _) ->
case runGetOrFail parseEntries bs of
Left _ -> Left "Could not parse entries"
Right (_,_,ae) -> Right $
let symbolTable =
case find ((=="/") . fileName) ae of
Nothing -> []
Just f -> getSymbolList $ fileData f
in Archive symbolTable (replaceExtendedFileNames ae) | 634 | false | true | 0 | 20 | 335 | 177 | 85 | 92 | null | null |
craynafinal/cs557_functional_languages | practice/week4/aug.hs | mit | addWord t w (Node v ts l r)
| w == v = Node v (t:ts) l r
| w < v = Node v ts (addWord t w l) r
| w > v = Node v ts l (addWord t w r) | 158 | addWord t w (Node v ts l r)
| w == v = Node v (t:ts) l r
| w < v = Node v ts (addWord t w l) r
| w > v = Node v ts l (addWord t w r) | 158 | addWord t w (Node v ts l r)
| w == v = Node v (t:ts) l r
| w < v = Node v ts (addWord t w l) r
| w > v = Node v ts l (addWord t w r) | 158 | false | false | 0 | 8 | 69 | 115 | 54 | 61 | null | null |
hverr/haskell-lxd-client | test/Integration.hs | gpl-3.0 | randomContainerName :: IO ContainerName
randomContainerName = ContainerName . T.unpack . ("lxd-test-suite-" <>) . UUID.toText <$> randomIO | 138 | randomContainerName :: IO ContainerName
randomContainerName = ContainerName . T.unpack . ("lxd-test-suite-" <>) . UUID.toText <$> randomIO | 138 | randomContainerName = ContainerName . T.unpack . ("lxd-test-suite-" <>) . UUID.toText <$> randomIO | 98 | false | true | 1 | 9 | 15 | 42 | 20 | 22 | null | null |
taktoa/SatOpt | library/SatOpt.hs | mit | --getPhase c@(HelmConf { helmsrc = HCircleSources _ [c1, c2] }) = Just $ relPhase c1 c2
--getPhase _ = Nothing
getPhase c@(HelmConf { helmsrc = HPointSources [_, (x, _, _)] }) = Just x | 184 | getPhase c@(HelmConf { helmsrc = HPointSources [_, (x, _, _)] }) = Just x | 73 | getPhase c@(HelmConf { helmsrc = HPointSources [_, (x, _, _)] }) = Just x | 73 | true | false | 0 | 13 | 33 | 47 | 27 | 20 | null | null |
binesiyu/ifl | examples/ch16/FormApp.hs | mit | {-- /snippet a_char --}
{-- snippet p_hex --}
p_hex :: CharParser () Char
p_hex = do
char '%'
a <- hexDigit
b <- hexDigit
let ((d, _):_) = readHex [a,b]
return . toEnum $ d
{-- /snippet p_hex --}
{-- snippet a_hex --} | 229 | p_hex :: CharParser () Char
p_hex = do
char '%'
a <- hexDigit
b <- hexDigit
let ((d, _):_) = readHex [a,b]
return . toEnum $ d
{-- /snippet p_hex --}
{-- snippet a_hex --} | 182 | p_hex = do
char '%'
a <- hexDigit
b <- hexDigit
let ((d, _):_) = readHex [a,b]
return . toEnum $ d
{-- /snippet p_hex --}
{-- snippet a_hex --} | 154 | true | true | 0 | 12 | 54 | 85 | 43 | 42 | null | null |
jecisc/TP_PF_L3 | PF-TP4/src/Main.hs | mit | --Question 13
element :: Eq a => a -> Arbre c a -> Bool
element _ Feuille = False | 81 | element :: Eq a => a -> Arbre c a -> Bool
element _ Feuille = False | 67 | element _ Feuille = False | 25 | true | true | 0 | 8 | 18 | 37 | 18 | 19 | null | null |
a-ford/notghc | NotGHC.hs | bsd-3-clause | stopBeforeMode :: Phase -> Mode
stopBeforeMode phase = mkPostLoadMode (StopBefore phase) | 88 | stopBeforeMode :: Phase -> Mode
stopBeforeMode phase = mkPostLoadMode (StopBefore phase) | 88 | stopBeforeMode phase = mkPostLoadMode (StopBefore phase) | 56 | false | true | 0 | 7 | 10 | 32 | 14 | 18 | null | null |
spacekitteh/smcghc | compiler/cmm/PprC.hs | bsd-3-clause | machRep_S_CType :: Width -> SDoc
machRep_S_CType w
= sdocWithDynFlags $ \dflags ->
case w of
_ | w == wordWidth dflags -> ptext (sLit "I_")
W8 -> ptext (sLit "StgInt8")
W16 -> ptext (sLit "StgInt16")
W32 -> ptext (sLit "StgInt32")
W64 -> ptext (sLit "StgInt64")
_ -> panic "machRep_S_CType"
-- ---------------------------------------------------------------------
-- print strings as valid C strings | 426 | machRep_S_CType :: Width -> SDoc
machRep_S_CType w
= sdocWithDynFlags $ \dflags ->
case w of
_ | w == wordWidth dflags -> ptext (sLit "I_")
W8 -> ptext (sLit "StgInt8")
W16 -> ptext (sLit "StgInt16")
W32 -> ptext (sLit "StgInt32")
W64 -> ptext (sLit "StgInt64")
_ -> panic "machRep_S_CType"
-- ---------------------------------------------------------------------
-- print strings as valid C strings | 426 | machRep_S_CType w
= sdocWithDynFlags $ \dflags ->
case w of
_ | w == wordWidth dflags -> ptext (sLit "I_")
W8 -> ptext (sLit "StgInt8")
W16 -> ptext (sLit "StgInt16")
W32 -> ptext (sLit "StgInt32")
W64 -> ptext (sLit "StgInt64")
_ -> panic "machRep_S_CType"
-- ---------------------------------------------------------------------
-- print strings as valid C strings | 393 | false | true | 0 | 14 | 84 | 130 | 62 | 68 | null | null |
urbanslug/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | isHoleCt:: Ct -> Bool
isHoleCt (CHoleCan {}) = True | 51 | isHoleCt:: Ct -> Bool
isHoleCt (CHoleCan {}) = True | 51 | isHoleCt (CHoleCan {}) = True | 29 | false | true | 0 | 7 | 8 | 25 | 13 | 12 | null | null |
asi1024/haling | src/Parser.hs | mit | symbol :: String -> Parser String
symbol = P.symbol lexer | 57 | symbol :: String -> Parser String
symbol = P.symbol lexer | 57 | symbol = P.symbol lexer | 23 | false | true | 0 | 6 | 9 | 23 | 11 | 12 | null | null |
olorin/amazonka | amazonka-autoscaling/test/Test/AWS/Gen/AutoScaling.hs | mpl-2.0 | testDescribeTerminationPolicyTypesResponse :: DescribeTerminationPolicyTypesResponse -> TestTree
testDescribeTerminationPolicyTypesResponse = res
"DescribeTerminationPolicyTypesResponse"
"fixture/DescribeTerminationPolicyTypesResponse.proto"
autoScaling
(Proxy :: Proxy DescribeTerminationPolicyTypes) | 317 | testDescribeTerminationPolicyTypesResponse :: DescribeTerminationPolicyTypesResponse -> TestTree
testDescribeTerminationPolicyTypesResponse = res
"DescribeTerminationPolicyTypesResponse"
"fixture/DescribeTerminationPolicyTypesResponse.proto"
autoScaling
(Proxy :: Proxy DescribeTerminationPolicyTypes) | 317 | testDescribeTerminationPolicyTypesResponse = res
"DescribeTerminationPolicyTypesResponse"
"fixture/DescribeTerminationPolicyTypesResponse.proto"
autoScaling
(Proxy :: Proxy DescribeTerminationPolicyTypes) | 220 | false | true | 0 | 6 | 30 | 36 | 17 | 19 | null | null |
yoo-e/weixin-mp-sdk | WeiXin/PublicPlatform/Types.hs | mit | parseAesKeyFromText :: Text -> Parser AesKey
parseAesKeyFromText t = either fail return $ decodeBase64AesKey t | 110 | parseAesKeyFromText :: Text -> Parser AesKey
parseAesKeyFromText t = either fail return $ decodeBase64AesKey t | 110 | parseAesKeyFromText t = either fail return $ decodeBase64AesKey t | 65 | false | true | 2 | 7 | 14 | 39 | 16 | 23 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/PrelNames.hs | bsd-3-clause | zipName = varQual gHC_LIST (fsLit "zip") zipIdKey | 62 | zipName = varQual gHC_LIST (fsLit "zip") zipIdKey | 62 | zipName = varQual gHC_LIST (fsLit "zip") zipIdKey | 62 | false | false | 0 | 7 | 19 | 19 | 9 | 10 | null | null |
green-haskell/ghc | ghc/GhciMonad.hs | bsd-3-clause | resume :: (SrcSpan -> Bool) -> GHC.SingleStep -> GHCi GHC.RunResult
resume canLogSpan step = do
st <- getGHCiState
reifyGHCi $ \x ->
withProgName (progname st) $
withArgs (args st) $
reflectGHCi x $ do
GHC.resume canLogSpan step
-- --------------------------------------------------------------------------
-- timing & statistics | 356 | resume :: (SrcSpan -> Bool) -> GHC.SingleStep -> GHCi GHC.RunResult
resume canLogSpan step = do
st <- getGHCiState
reifyGHCi $ \x ->
withProgName (progname st) $
withArgs (args st) $
reflectGHCi x $ do
GHC.resume canLogSpan step
-- --------------------------------------------------------------------------
-- timing & statistics | 356 | resume canLogSpan step = do
st <- getGHCiState
reifyGHCi $ \x ->
withProgName (progname st) $
withArgs (args st) $
reflectGHCi x $ do
GHC.resume canLogSpan step
-- --------------------------------------------------------------------------
-- timing & statistics | 288 | false | true | 0 | 14 | 69 | 107 | 50 | 57 | null | null |
amccausl/Swish | Swish/HaskellRDF/RDFGraphTest.hs | lgpl-2.1 | testClass47 = testClass "testClass47" isXMLLiteral l10 True | 63 | testClass47 = testClass "testClass47" isXMLLiteral l10 True | 63 | testClass47 = testClass "testClass47" isXMLLiteral l10 True | 63 | false | false | 0 | 5 | 10 | 15 | 7 | 8 | null | null |
kmate/HaRe | old/refactorer/RefacFunDef.hs | bsd-3-clause | zipHighlightedStmt pats w (exp1@(HsQualifier e1 e1')::HsStmtP)
(exp2@(HsQualifier e2 e2')::HsStmtP)
= do zippedE1 <- zipHighlightedMatch False pats w e1 e2
zippedE2 <- zipHighlightedStmt pats w e1' e2'
return [Nothing] | 260 | zipHighlightedStmt pats w (exp1@(HsQualifier e1 e1')::HsStmtP)
(exp2@(HsQualifier e2 e2')::HsStmtP)
= do zippedE1 <- zipHighlightedMatch False pats w e1 e2
zippedE2 <- zipHighlightedStmt pats w e1' e2'
return [Nothing] | 260 | zipHighlightedStmt pats w (exp1@(HsQualifier e1 e1')::HsStmtP)
(exp2@(HsQualifier e2 e2')::HsStmtP)
= do zippedE1 <- zipHighlightedMatch False pats w e1 e2
zippedE2 <- zipHighlightedStmt pats w e1' e2'
return [Nothing] | 260 | false | false | 0 | 10 | 69 | 94 | 46 | 48 | null | null |
hguenther/gtl | lib/Data/Graph/Inductive/Query/MinSpanningPath.hs | bsd-3-clause | edgeQueue :: (Graph gr, Ord l) => gr a l -> PQ.MinPQueue l Edge
edgeQueue = ufold edgeQueue' PQ.empty
where
edgeQueue' :: Ord l => Context a l -> PQ.MinPQueue l Edge -> PQ.MinPQueue l Edge
edgeQueue' (inE, currentNode, _, _) edges = -- assumes that ingoing and outgoing edges are the same, i.e. an undirected graph
foldl (insEdge currentNode) edges inE
where insEdge currentNode edges (label, node) = PQ.insert label (currentNode, node) edges
-- Kanten des minimalen, aufspannenden Pfades finden (analog zu Kruskal).
-- Erzeuge Graph mit Kanten aus q. Füge jeweils Minimum ein und nur, wenn Knoten Grad < 2 hat.
-- Solange n != ∅
-- Wähle e = min q : e = (u, v), u,v € n
-- Wenn e existiert:
-- Setze deg(u) += 1 und deg(v) += 1
-- Wenn deg(u) = 2: Setze n := n \ {u}
-- Wenn deg(v) = 2: Setze n := n \ {v}
-- Wenn n != ∅: -- Sonst entsteht ein Loop, da dann alle Knoten Grad 2 haben.
-- Füge e zu g' hinzu
-- Sonst: es ex. kein msp
--
-- Was passiert wenn einer der Knoten Grad 0 hat bzw. kann dies passieren? Nein!
-- Induktion über eingefügte Kanten?
--
-- Achtung Sonderfall: |n| <= 2 für den Gesamtgraphen. | 1,146 | edgeQueue :: (Graph gr, Ord l) => gr a l -> PQ.MinPQueue l Edge
edgeQueue = ufold edgeQueue' PQ.empty
where
edgeQueue' :: Ord l => Context a l -> PQ.MinPQueue l Edge -> PQ.MinPQueue l Edge
edgeQueue' (inE, currentNode, _, _) edges = -- assumes that ingoing and outgoing edges are the same, i.e. an undirected graph
foldl (insEdge currentNode) edges inE
where insEdge currentNode edges (label, node) = PQ.insert label (currentNode, node) edges
-- Kanten des minimalen, aufspannenden Pfades finden (analog zu Kruskal).
-- Erzeuge Graph mit Kanten aus q. Füge jeweils Minimum ein und nur, wenn Knoten Grad < 2 hat.
-- Solange n != ∅
-- Wähle e = min q : e = (u, v), u,v € n
-- Wenn e existiert:
-- Setze deg(u) += 1 und deg(v) += 1
-- Wenn deg(u) = 2: Setze n := n \ {u}
-- Wenn deg(v) = 2: Setze n := n \ {v}
-- Wenn n != ∅: -- Sonst entsteht ein Loop, da dann alle Knoten Grad 2 haben.
-- Füge e zu g' hinzu
-- Sonst: es ex. kein msp
--
-- Was passiert wenn einer der Knoten Grad 0 hat bzw. kann dies passieren? Nein!
-- Induktion über eingefügte Kanten?
--
-- Achtung Sonderfall: |n| <= 2 für den Gesamtgraphen. | 1,146 | edgeQueue = ufold edgeQueue' PQ.empty
where
edgeQueue' :: Ord l => Context a l -> PQ.MinPQueue l Edge -> PQ.MinPQueue l Edge
edgeQueue' (inE, currentNode, _, _) edges = -- assumes that ingoing and outgoing edges are the same, i.e. an undirected graph
foldl (insEdge currentNode) edges inE
where insEdge currentNode edges (label, node) = PQ.insert label (currentNode, node) edges
-- Kanten des minimalen, aufspannenden Pfades finden (analog zu Kruskal).
-- Erzeuge Graph mit Kanten aus q. Füge jeweils Minimum ein und nur, wenn Knoten Grad < 2 hat.
-- Solange n != ∅
-- Wähle e = min q : e = (u, v), u,v € n
-- Wenn e existiert:
-- Setze deg(u) += 1 und deg(v) += 1
-- Wenn deg(u) = 2: Setze n := n \ {u}
-- Wenn deg(v) = 2: Setze n := n \ {v}
-- Wenn n != ∅: -- Sonst entsteht ein Loop, da dann alle Knoten Grad 2 haben.
-- Füge e zu g' hinzu
-- Sonst: es ex. kein msp
--
-- Was passiert wenn einer der Knoten Grad 0 hat bzw. kann dies passieren? Nein!
-- Induktion über eingefügte Kanten?
--
-- Achtung Sonderfall: |n| <= 2 für den Gesamtgraphen. | 1,082 | false | true | 0 | 9 | 251 | 178 | 98 | 80 | null | null |
katychuang/getting-started-with-haskell | tutorials/foursquaretrends.hs | mit | renderLatLng :: LatLng -> String
renderLatLng (lat, lng) = show lat ++ "," ++ show lng | 86 | renderLatLng :: LatLng -> String
renderLatLng (lat, lng) = show lat ++ "," ++ show lng | 86 | renderLatLng (lat, lng) = show lat ++ "," ++ show lng | 53 | false | true | 0 | 7 | 15 | 38 | 19 | 19 | null | null |
rimmington/cabal | cabal-install/Distribution/Client/Install.hs | bsd-3-clause | installLocalTarballPackage
:: Verbosity
-> JobLimit
-> PackageIdentifier -> FilePath -> FilePath
-> (Maybe FilePath -> IO BuildResult)
-> IO BuildResult
installLocalTarballPackage verbosity jobLimit pkgid
tarballPath distPref installPkg = do
tmp <- getTemporaryDirectory
withTempDirectory verbosity tmp "cabal-tmp" $ \tmpDirPath ->
onFailure UnpackFailed $ do
let relUnpackedPath = display pkgid
absUnpackedPath = tmpDirPath </> relUnpackedPath
descFilePath = absUnpackedPath
</> display (packageName pkgid) <.> "cabal"
withJobLimit jobLimit $ do
info verbosity $ "Extracting " ++ tarballPath
++ " to " ++ tmpDirPath ++ "..."
extractTarGzFile tmpDirPath relUnpackedPath tarballPath
exists <- doesFileExist descFilePath
when (not exists) $
die $ "Package .cabal file not found: " ++ show descFilePath
maybeRenameDistDir absUnpackedPath
installPkg (Just absUnpackedPath)
where
-- 'cabal sdist' puts pre-generated files in the 'dist'
-- directory. This fails when a nonstandard build directory name
-- is used (as is the case with sandboxes), so we need to rename
-- the 'dist' dir here.
--
-- TODO: 'cabal get happy && cd sandbox && cabal install ../happy' still
-- fails even with this workaround. We probably can live with that.
maybeRenameDistDir :: FilePath -> IO ()
maybeRenameDistDir absUnpackedPath = do
let distDirPath = absUnpackedPath </> defaultDistPref
distDirPathTmp = absUnpackedPath </> (defaultDistPref ++ "-tmp")
distDirPathNew = absUnpackedPath </> distPref
distDirExists <- doesDirectoryExist distDirPath
when (distDirExists
&& (not $ distDirPath `equalFilePath` distDirPathNew)) $ do
-- NB: we need to handle the case when 'distDirPathNew' is a
-- subdirectory of 'distDirPath' (e.g. the former is
-- 'dist/dist-sandbox-3688fbc2' and the latter is 'dist').
debug verbosity $ "Renaming '" ++ distDirPath ++ "' to '"
++ distDirPathTmp ++ "'."
renameDirectory distDirPath distDirPathTmp
when (distDirPath `isPrefixOf` distDirPathNew) $
createDirectoryIfMissingVerbose verbosity False distDirPath
debug verbosity $ "Renaming '" ++ distDirPathTmp ++ "' to '"
++ distDirPathNew ++ "'."
renameDirectory distDirPathTmp distDirPathNew | 2,506 | installLocalTarballPackage
:: Verbosity
-> JobLimit
-> PackageIdentifier -> FilePath -> FilePath
-> (Maybe FilePath -> IO BuildResult)
-> IO BuildResult
installLocalTarballPackage verbosity jobLimit pkgid
tarballPath distPref installPkg = do
tmp <- getTemporaryDirectory
withTempDirectory verbosity tmp "cabal-tmp" $ \tmpDirPath ->
onFailure UnpackFailed $ do
let relUnpackedPath = display pkgid
absUnpackedPath = tmpDirPath </> relUnpackedPath
descFilePath = absUnpackedPath
</> display (packageName pkgid) <.> "cabal"
withJobLimit jobLimit $ do
info verbosity $ "Extracting " ++ tarballPath
++ " to " ++ tmpDirPath ++ "..."
extractTarGzFile tmpDirPath relUnpackedPath tarballPath
exists <- doesFileExist descFilePath
when (not exists) $
die $ "Package .cabal file not found: " ++ show descFilePath
maybeRenameDistDir absUnpackedPath
installPkg (Just absUnpackedPath)
where
-- 'cabal sdist' puts pre-generated files in the 'dist'
-- directory. This fails when a nonstandard build directory name
-- is used (as is the case with sandboxes), so we need to rename
-- the 'dist' dir here.
--
-- TODO: 'cabal get happy && cd sandbox && cabal install ../happy' still
-- fails even with this workaround. We probably can live with that.
maybeRenameDistDir :: FilePath -> IO ()
maybeRenameDistDir absUnpackedPath = do
let distDirPath = absUnpackedPath </> defaultDistPref
distDirPathTmp = absUnpackedPath </> (defaultDistPref ++ "-tmp")
distDirPathNew = absUnpackedPath </> distPref
distDirExists <- doesDirectoryExist distDirPath
when (distDirExists
&& (not $ distDirPath `equalFilePath` distDirPathNew)) $ do
-- NB: we need to handle the case when 'distDirPathNew' is a
-- subdirectory of 'distDirPath' (e.g. the former is
-- 'dist/dist-sandbox-3688fbc2' and the latter is 'dist').
debug verbosity $ "Renaming '" ++ distDirPath ++ "' to '"
++ distDirPathTmp ++ "'."
renameDirectory distDirPath distDirPathTmp
when (distDirPath `isPrefixOf` distDirPathNew) $
createDirectoryIfMissingVerbose verbosity False distDirPath
debug verbosity $ "Renaming '" ++ distDirPathTmp ++ "' to '"
++ distDirPathNew ++ "'."
renameDirectory distDirPathTmp distDirPathNew | 2,506 | installLocalTarballPackage verbosity jobLimit pkgid
tarballPath distPref installPkg = do
tmp <- getTemporaryDirectory
withTempDirectory verbosity tmp "cabal-tmp" $ \tmpDirPath ->
onFailure UnpackFailed $ do
let relUnpackedPath = display pkgid
absUnpackedPath = tmpDirPath </> relUnpackedPath
descFilePath = absUnpackedPath
</> display (packageName pkgid) <.> "cabal"
withJobLimit jobLimit $ do
info verbosity $ "Extracting " ++ tarballPath
++ " to " ++ tmpDirPath ++ "..."
extractTarGzFile tmpDirPath relUnpackedPath tarballPath
exists <- doesFileExist descFilePath
when (not exists) $
die $ "Package .cabal file not found: " ++ show descFilePath
maybeRenameDistDir absUnpackedPath
installPkg (Just absUnpackedPath)
where
-- 'cabal sdist' puts pre-generated files in the 'dist'
-- directory. This fails when a nonstandard build directory name
-- is used (as is the case with sandboxes), so we need to rename
-- the 'dist' dir here.
--
-- TODO: 'cabal get happy && cd sandbox && cabal install ../happy' still
-- fails even with this workaround. We probably can live with that.
maybeRenameDistDir :: FilePath -> IO ()
maybeRenameDistDir absUnpackedPath = do
let distDirPath = absUnpackedPath </> defaultDistPref
distDirPathTmp = absUnpackedPath </> (defaultDistPref ++ "-tmp")
distDirPathNew = absUnpackedPath </> distPref
distDirExists <- doesDirectoryExist distDirPath
when (distDirExists
&& (not $ distDirPath `equalFilePath` distDirPathNew)) $ do
-- NB: we need to handle the case when 'distDirPathNew' is a
-- subdirectory of 'distDirPath' (e.g. the former is
-- 'dist/dist-sandbox-3688fbc2' and the latter is 'dist').
debug verbosity $ "Renaming '" ++ distDirPath ++ "' to '"
++ distDirPathTmp ++ "'."
renameDirectory distDirPath distDirPathTmp
when (distDirPath `isPrefixOf` distDirPathNew) $
createDirectoryIfMissingVerbose verbosity False distDirPath
debug verbosity $ "Renaming '" ++ distDirPathTmp ++ "' to '"
++ distDirPathNew ++ "'."
renameDirectory distDirPathTmp distDirPathNew | 2,343 | false | true | 0 | 20 | 650 | 457 | 217 | 240 | null | null |
wavewave/lhc-analysis-collection | exe/evchainRunLeptoQuark.hs | gpl-3.0 | main :: IO ()
main = do
fp <- (!! 0) <$> getArgs
updateGlobalLogger "MadGraphAuto" (setLevel DEBUG)
mapM_ (scanwork fp) worksets -- [(500,10000)]
-- | | 166 | main :: IO ()
main = do
fp <- (!! 0) <$> getArgs
updateGlobalLogger "MadGraphAuto" (setLevel DEBUG)
mapM_ (scanwork fp) worksets -- [(500,10000)]
-- | | 165 | main = do
fp <- (!! 0) <$> getArgs
updateGlobalLogger "MadGraphAuto" (setLevel DEBUG)
mapM_ (scanwork fp) worksets -- [(500,10000)]
-- | | 151 | false | true | 0 | 10 | 40 | 67 | 31 | 36 | null | null |
jwiegley/ghc-release | utils/haddock/src/Haddock/Backends/Hoogle.hs | gpl-3.0 | asInline x = [x] | 16 | asInline x = [x] | 16 | asInline x = [x] | 16 | false | false | 0 | 5 | 3 | 12 | 6 | 6 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/nativeGen/Dwarf/Constants.hs | bsd-3-clause | dwarfLineLabel = sLit ".Lsection_line" | 40 | dwarfLineLabel = sLit ".Lsection_line" | 40 | dwarfLineLabel = sLit ".Lsection_line" | 40 | false | false | 1 | 5 | 5 | 13 | 4 | 9 | null | null |
orangeduck/PyMark | parsers/PyMark.hs | bsd-2-clause | pyMarkNoneType = 6 | 20 | pyMarkNoneType = 6 | 20 | pyMarkNoneType = 6 | 20 | false | false | 0 | 4 | 4 | 6 | 3 | 3 | null | null |
mvr/cf | src/Math/ContinuedFraction/Interval.hs | mit | Interval Infinity (Finite _) _ `smallerThan` Interval (Finite i2) (Finite s2) True = False | 90 | Interval Infinity (Finite _) _ `smallerThan` Interval (Finite i2) (Finite s2) True = False | 90 | Interval Infinity (Finite _) _ `smallerThan` Interval (Finite i2) (Finite s2) True = False | 90 | false | false | 0 | 8 | 13 | 46 | 22 | 24 | null | null |
hpacheco/HAAP | examples/plab/svn/2017li1g183/src/Tarefa1_2017li1g183.hs | mit | tr Sul = Oeste | 16 | tr Sul = Oeste | 16 | tr Sul = Oeste | 16 | false | false | 0 | 4 | 5 | 10 | 4 | 6 | null | null |
Tatsuki-I/Vihs | src/Ed.hs | apache-2.0 | addr1 :: Command -> EdArgs -> Maybe Int
addr1 cmd edArgs = ((fixAddr edArgs . takeAddr1) <$>) (addr cmd)
where
takeAddr1 (AddrSingle v) = v
takeAddr1 (AddrPair v _) = v | 190 | addr1 :: Command -> EdArgs -> Maybe Int
addr1 cmd edArgs = ((fixAddr edArgs . takeAddr1) <$>) (addr cmd)
where
takeAddr1 (AddrSingle v) = v
takeAddr1 (AddrPair v _) = v | 190 | addr1 cmd edArgs = ((fixAddr edArgs . takeAddr1) <$>) (addr cmd)
where
takeAddr1 (AddrSingle v) = v
takeAddr1 (AddrPair v _) = v | 139 | false | true | 1 | 9 | 52 | 83 | 41 | 42 | null | null |
pparkkin/eta | compiler/ETA/TypeCheck/TcGenDeriv.hs | bsd-3-clause | fmap_Expr = nlHsVar fmap_RDR | 34 | fmap_Expr = nlHsVar fmap_RDR | 34 | fmap_Expr = nlHsVar fmap_RDR | 34 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
TikhonJelvis/array-forth | test/Language/ArrayForth/Test.hs | gpl-3.0 | a,b,p,r,s,t :: (?res :: S.State) => F18Word
a = S.a ?res | 56 | a,b,p,r,s,t :: (?res :: S.State) => F18Word
a = S.a ?res | 56 | a = S.a ?res | 12 | false | true | 5 | 7 | 10 | 48 | 25 | 23 | null | null |
GaloisInc/elf | src/Data/ElfEdit/Types.hs | bsd-3-clause | toSomeElfClass :: Word8 -> Maybe SomeElfClass
toSomeElfClass 1 = Just (SomeElfClass ELFCLASS32) | 95 | toSomeElfClass :: Word8 -> Maybe SomeElfClass
toSomeElfClass 1 = Just (SomeElfClass ELFCLASS32) | 95 | toSomeElfClass 1 = Just (SomeElfClass ELFCLASS32) | 49 | false | true | 0 | 7 | 11 | 30 | 14 | 16 | null | null |
arthurmgo/regex-ftc | src/Sets.hs | bsd-3-clause | mapSet :: Ord b => (a -> b) -> Set a -> Set b
mapSet f (SetI xs) = makeSet (map f xs) | 85 | mapSet :: Ord b => (a -> b) -> Set a -> Set b
mapSet f (SetI xs) = makeSet (map f xs) | 85 | mapSet f (SetI xs) = makeSet (map f xs) | 39 | false | true | 0 | 8 | 22 | 61 | 29 | 32 | null | null |
Balletie/.xmonad | lib/XMobar.hs | unlicense | windowIconPathFormat :: String
windowIconPathFormat = toIconPath ("window_icon_%s") | 83 | windowIconPathFormat :: String
windowIconPathFormat = toIconPath ("window_icon_%s") | 83 | windowIconPathFormat = toIconPath ("window_icon_%s") | 52 | false | true | 0 | 6 | 6 | 17 | 9 | 8 | null | null |
Daniel-Diaz/yesod | yesod-auth/Yesod/Auth/Email.hs | mit | loginR, registerR, forgotPasswordR, setpassR :: AuthRoute
loginR = PluginR "email" ["login"] | 92 | loginR, registerR, forgotPasswordR, setpassR :: AuthRoute
loginR = PluginR "email" ["login"] | 92 | loginR = PluginR "email" ["login"] | 34 | false | true | 5 | 6 | 10 | 37 | 16 | 21 | null | null |
TomMD/llvm-pretty | src/Text/LLVM/AST.hs | bsd-3-clause | elimValSymbol _ = mzero | 37 | elimValSymbol _ = mzero | 37 | elimValSymbol _ = mzero | 37 | false | false | 0 | 5 | 17 | 9 | 4 | 5 | null | null |
nh2/quickcheck | Test/QuickCheck/Exception.hs | bsd-3-clause | isDiscard :: AnException -> Bool
(discard, isDiscard) = (E.throw (E.ErrorCall msg), isDiscard)
where
msg = "DISCARD. " ++
"You should not see this exception, it is internal to QuickCheck."
#if defined(OLD_EXCEPTIONS)
isDiscard (E.ErrorCall msg') = msg' == msg
isDiscard _ = False
#else
isDiscard (E.SomeException e) =
case cast e of
Just (E.ErrorCall msg') -> msg' == msg
_ -> False
#endif | 422 | isDiscard :: AnException -> Bool
(discard, isDiscard) = (E.throw (E.ErrorCall msg), isDiscard)
where
msg = "DISCARD. " ++
"You should not see this exception, it is internal to QuickCheck."
#if defined(OLD_EXCEPTIONS)
isDiscard (E.ErrorCall msg') = msg' == msg
isDiscard _ = False
#else
isDiscard (E.SomeException e) =
case cast e of
Just (E.ErrorCall msg') -> msg' == msg
_ -> False
#endif | 422 | (discard, isDiscard) = (E.throw (E.ErrorCall msg), isDiscard)
where
msg = "DISCARD. " ++
"You should not see this exception, it is internal to QuickCheck."
#if defined(OLD_EXCEPTIONS)
isDiscard (E.ErrorCall msg') = msg' == msg
isDiscard _ = False
#else
isDiscard (E.SomeException e) =
case cast e of
Just (E.ErrorCall msg') -> msg' == msg
_ -> False
#endif | 389 | false | true | 3 | 9 | 94 | 92 | 45 | 47 | null | null |
duairc/snap-extensions | src/Snap/Extension.hs | bsd-3-clause | nullReloadHandler :: MonadSnap m
=> IO [(ByteString, Maybe ByteString)]
-> m ()
nullReloadHandler = const pass | 146 | nullReloadHandler :: MonadSnap m
=> IO [(ByteString, Maybe ByteString)]
-> m ()
nullReloadHandler = const pass | 146 | nullReloadHandler = const pass | 30 | false | true | 0 | 11 | 51 | 51 | 23 | 28 | null | null |
rueshyna/gogol | gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs | mpl-2.0 | -- | How the data should be pasted.
pdrType :: Lens' PasteDataRequest (Maybe PasteDataRequestType)
pdrType = lens _pdrType (\ s a -> s{_pdrType = a}) | 149 | pdrType :: Lens' PasteDataRequest (Maybe PasteDataRequestType)
pdrType = lens _pdrType (\ s a -> s{_pdrType = a}) | 113 | pdrType = lens _pdrType (\ s a -> s{_pdrType = a}) | 50 | true | true | 1 | 9 | 24 | 50 | 25 | 25 | null | null |
keithodulaigh/Hets | SoftFOL/ParseTPTP.hs | gpl-2.0 | commentLine :: Parser String
commentLine = (char '%' <|> char '#') >> manyTill (satisfy printable) newline | 106 | commentLine :: Parser String
commentLine = (char '%' <|> char '#') >> manyTill (satisfy printable) newline | 106 | commentLine = (char '%' <|> char '#') >> manyTill (satisfy printable) newline | 77 | false | true | 0 | 8 | 15 | 47 | 21 | 26 | null | null |
sethfowler/pygmalion | indexers/Pygmalion/Index/Source.hs | bsd-3-clause | toSourceKind C.Cursor_CompoundLiteralExpr = CompoundLiteralExpr | 78 | toSourceKind C.Cursor_CompoundLiteralExpr = CompoundLiteralExpr | 78 | toSourceKind C.Cursor_CompoundLiteralExpr = CompoundLiteralExpr | 78 | false | false | 0 | 6 | 18 | 11 | 5 | 6 | null | null |
nevrenato/Hets_Fork | CASL/AS_Basic_CASL.der.hs | gpl-2.0 | mkVarDeclStr :: String -> SORT -> VAR_DECL
mkVarDeclStr = mkVarDecl . mkSimpleId | 80 | mkVarDeclStr :: String -> SORT -> VAR_DECL
mkVarDeclStr = mkVarDecl . mkSimpleId | 80 | mkVarDeclStr = mkVarDecl . mkSimpleId | 37 | false | true | 0 | 6 | 11 | 23 | 12 | 11 | null | null |
xmonad/xmonad-contrib | XMonad/Layout/DecorationMadness.hs | bsd-3-clause | -- | A 'Tall' layout with the xmonad DwmStyle decoration, default
-- theme and default shrinker.
--
-- Here you can find a screen shot:
--
-- <http://code.haskell.org/~arossato/xmonadShots/tallSimpleDwmStyle.png>
tallSimpleDwmStyle :: ModifiedLayout (Decoration DwmStyle DefaultShrinker) Tall Window
tallSimpleDwmStyle = decoration shrinkText def Dwm tall | 355 | tallSimpleDwmStyle :: ModifiedLayout (Decoration DwmStyle DefaultShrinker) Tall Window
tallSimpleDwmStyle = decoration shrinkText def Dwm tall | 142 | tallSimpleDwmStyle = decoration shrinkText def Dwm tall | 55 | true | true | 0 | 7 | 42 | 41 | 23 | 18 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Awk.hs | gpl-2.0 | parseRules ("AWK","base") =
(((pDetectSpaces >>= withAttribute NormalTok))
<|>
((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("AWK","Comment"))
<|>
((pDetectChar False '~' >>= withAttribute NormalTok) >>~ pushContext ("AWK","Match"))
<|>
((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("AWK","String"))
<|>
((pAnyChar "!%&*+,-./:;<=>?^|" >>= withAttribute NormalTok))
<|>
((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok))
<|>
((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_builtins >>= withAttribute NormalTok))
<|>
((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute FunctionTok))
<|>
((pFloat >>= withAttribute FloatTok))
<|>
((pInt >>= withAttribute DecValTok))
<|>
((pRegExpr regex_'5c'24'5bA'2dZa'2dz0'2d9'5f'5d'2b >>= withAttribute DataTypeTok))
<|>
(currentContext >>= \x -> guard (x == ("AWK","base")) >> pDefault >>= withAttribute NormalTok)) | 1,034 | parseRules ("AWK","base") =
(((pDetectSpaces >>= withAttribute NormalTok))
<|>
((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("AWK","Comment"))
<|>
((pDetectChar False '~' >>= withAttribute NormalTok) >>~ pushContext ("AWK","Match"))
<|>
((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("AWK","String"))
<|>
((pAnyChar "!%&*+,-./:;<=>?^|" >>= withAttribute NormalTok))
<|>
((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok))
<|>
((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_builtins >>= withAttribute NormalTok))
<|>
((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute FunctionTok))
<|>
((pFloat >>= withAttribute FloatTok))
<|>
((pInt >>= withAttribute DecValTok))
<|>
((pRegExpr regex_'5c'24'5bA'2dZa'2dz0'2d9'5f'5d'2b >>= withAttribute DataTypeTok))
<|>
(currentContext >>= \x -> guard (x == ("AWK","base")) >> pDefault >>= withAttribute NormalTok)) | 1,034 | parseRules ("AWK","base") =
(((pDetectSpaces >>= withAttribute NormalTok))
<|>
((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("AWK","Comment"))
<|>
((pDetectChar False '~' >>= withAttribute NormalTok) >>~ pushContext ("AWK","Match"))
<|>
((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("AWK","String"))
<|>
((pAnyChar "!%&*+,-./:;<=>?^|" >>= withAttribute NormalTok))
<|>
((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok))
<|>
((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_builtins >>= withAttribute NormalTok))
<|>
((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute FunctionTok))
<|>
((pFloat >>= withAttribute FloatTok))
<|>
((pInt >>= withAttribute DecValTok))
<|>
((pRegExpr regex_'5c'24'5bA'2dZa'2dz0'2d9'5f'5d'2b >>= withAttribute DataTypeTok))
<|>
(currentContext >>= \x -> guard (x == ("AWK","base")) >> pDefault >>= withAttribute NormalTok)) | 1,034 | false | false | 0 | 21 | 164 | 320 | 165 | 155 | null | null |
suhailshergill/liboleg | Control/CCRef.hs | bsd-3-clause | test2 = (expect 9 =<<) . runCC $ do
p <- newPrompt
incr 4 . pushPrompt p $ pushPrompt p (return 5) | 102 | test2 = (expect 9 =<<) . runCC $ do
p <- newPrompt
incr 4 . pushPrompt p $ pushPrompt p (return 5) | 102 | test2 = (expect 9 =<<) . runCC $ do
p <- newPrompt
incr 4 . pushPrompt p $ pushPrompt p (return 5) | 102 | false | false | 4 | 11 | 25 | 62 | 26 | 36 | null | null |
tgdavies/codeworld | codeworld-api/src/CodeWorld/Picture.hs | apache-2.0 | -- | A thin arc, starting and ending at these angles, with this radius
--
-- Angles are in radians.
arc :: HasCallStack => Double -> Double -> Double -> Picture
arc b e r = Arc callStack b e r 0 | 194 | arc :: HasCallStack => Double -> Double -> Double -> Picture
arc b e r = Arc callStack b e r 0 | 94 | arc b e r = Arc callStack b e r 0 | 33 | true | true | 0 | 10 | 41 | 54 | 26 | 28 | null | null |
minoki/LambdaQuest | src/LambdaQuest/Simple/Parse.hs | bsd-3-clause | simpleTerm :: (TermParser ty tm) => [NameBinding] -> Parser tm
simpleTerm ctx = (reserved "True" >> return (tPrimValue $ PVBool True))
<|> (reserved "False" >> return (tPrimValue $ PVBool False))
<|> (either (tPrimValue . PVInt) (tPrimValue . PVReal) <$> naturalOrFloat <?> "number")
<|> parens (term ctx)
<|> choice [reserved name >> return (tPrimValue v) | (name,v) <- builtinFunctions]
<|> (do name <- identifier <?> "variable"
case NVarBind name `elemIndex` ctx of
Just i -> return (tRef i name)
Nothing -> fail ("undefined variable: " ++ name))
<?> "simple expression" | 754 | simpleTerm :: (TermParser ty tm) => [NameBinding] -> Parser tm
simpleTerm ctx = (reserved "True" >> return (tPrimValue $ PVBool True))
<|> (reserved "False" >> return (tPrimValue $ PVBool False))
<|> (either (tPrimValue . PVInt) (tPrimValue . PVReal) <$> naturalOrFloat <?> "number")
<|> parens (term ctx)
<|> choice [reserved name >> return (tPrimValue v) | (name,v) <- builtinFunctions]
<|> (do name <- identifier <?> "variable"
case NVarBind name `elemIndex` ctx of
Just i -> return (tRef i name)
Nothing -> fail ("undefined variable: " ++ name))
<?> "simple expression" | 754 | simpleTerm ctx = (reserved "True" >> return (tPrimValue $ PVBool True))
<|> (reserved "False" >> return (tPrimValue $ PVBool False))
<|> (either (tPrimValue . PVInt) (tPrimValue . PVReal) <$> naturalOrFloat <?> "number")
<|> parens (term ctx)
<|> choice [reserved name >> return (tPrimValue v) | (name,v) <- builtinFunctions]
<|> (do name <- identifier <?> "variable"
case NVarBind name `elemIndex` ctx of
Just i -> return (tRef i name)
Nothing -> fail ("undefined variable: " ++ name))
<?> "simple expression" | 691 | false | true | 0 | 16 | 269 | 246 | 122 | 124 | null | null |
danstiner/clod | src/Main.hs | mit | optionParser :: Parser Options
optionParser = Options <$> Commands.parser | 73 | optionParser :: Parser Options
optionParser = Options <$> Commands.parser | 73 | optionParser = Options <$> Commands.parser | 42 | false | true | 0 | 6 | 8 | 20 | 10 | 10 | null | null |
kawamuray/ganeti | src/Ganeti/Hs2Py/OpDoc.hs | gpl-2.0 | opTestDummy :: String
opTestDummy =
"Utility opcode used by unittests." | 73 | opTestDummy :: String
opTestDummy =
"Utility opcode used by unittests." | 73 | opTestDummy =
"Utility opcode used by unittests." | 51 | false | true | 0 | 4 | 11 | 11 | 6 | 5 | null | null |
spechub/Hets | OWL2/ASKeywords.hs | gpl-2.0 | dataRangeAtomS :: String
dataRangeAtomS = "DataRangeAtom" | 57 | dataRangeAtomS :: String
dataRangeAtomS = "DataRangeAtom" | 57 | dataRangeAtomS = "DataRangeAtom" | 32 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
nicolashery/example-marvel-haskell | Views/Components/CharacterDetails.hs | mit | characterComicView :: ComicSummary -> Html
characterComicView comicSummary =
H.li $
case getId comicSummary of
Just comicId ->
H.a ! A.class_ (toValue SPFLink)
! A.href (toValue (ComicUrl comicId)) $
toHtml (CS.name comicSummary)
Nothing ->
toHtml (CS.name comicSummary) | 326 | characterComicView :: ComicSummary -> Html
characterComicView comicSummary =
H.li $
case getId comicSummary of
Just comicId ->
H.a ! A.class_ (toValue SPFLink)
! A.href (toValue (ComicUrl comicId)) $
toHtml (CS.name comicSummary)
Nothing ->
toHtml (CS.name comicSummary) | 326 | characterComicView comicSummary =
H.li $
case getId comicSummary of
Just comicId ->
H.a ! A.class_ (toValue SPFLink)
! A.href (toValue (ComicUrl comicId)) $
toHtml (CS.name comicSummary)
Nothing ->
toHtml (CS.name comicSummary) | 283 | false | true | 0 | 15 | 91 | 110 | 52 | 58 | null | null |
JustinUnger/haskell-book | ch22/shawty.hs | mit | saveURI :: R.Connection
-> BC.ByteString
-> BC.ByteString
-> IO (Either R.Reply R.Status)
saveURI conn shortURI uri =
R.runRedis conn $ R.set shortURI uri | 180 | saveURI :: R.Connection
-> BC.ByteString
-> BC.ByteString
-> IO (Either R.Reply R.Status)
saveURI conn shortURI uri =
R.runRedis conn $ R.set shortURI uri | 180 | saveURI conn shortURI uri =
R.runRedis conn $ R.set shortURI uri | 66 | false | true | 0 | 12 | 48 | 71 | 33 | 38 | null | null |
allanderek/ipclib | web/interface/IpcWeb.hs | gpl-2.0 | inputExampleName :: String
inputExampleName = "pepa-example-name" | 65 | inputExampleName :: String
inputExampleName = "pepa-example-name" | 65 | inputExampleName = "pepa-example-name" | 38 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
eklinkhammer/haskell-vision | SegmentTest.hs | mit | -- Segment Tests
-- UV Tests
getU_tests = test [ "getU (0,0,0,2)(1,1)" ~: 0.5 ~=? segGetU (Segment 0 0 0 2) (Point 1 1)
, "getU (10, 10, 10, 30) (15,20)" ~: 0.5 ~=? segGetU (Segment 10 10 10 30) (Point 15 20)] | 233 | getU_tests = test [ "getU (0,0,0,2)(1,1)" ~: 0.5 ~=? segGetU (Segment 0 0 0 2) (Point 1 1)
, "getU (10, 10, 10, 30) (15,20)" ~: 0.5 ~=? segGetU (Segment 10 10 10 30) (Point 15 20)] | 203 | getU_tests = test [ "getU (0,0,0,2)(1,1)" ~: 0.5 ~=? segGetU (Segment 0 0 0 2) (Point 1 1)
, "getU (10, 10, 10, 30) (15,20)" ~: 0.5 ~=? segGetU (Segment 10 10 10 30) (Point 15 20)] | 203 | true | false | 0 | 10 | 66 | 83 | 42 | 41 | null | null |
urbanslug/ghc | compiler/simplCore/SimplUtils.hs | bsd-3-clause | getUnfoldingInRuleMatch :: SimplEnv -> InScopeEnv
-- When matching in RULE, we want to "look through" an unfolding
-- (to see a constructor) if *rules* are on, even if *inlinings*
-- are not. A notable example is DFuns, which really we want to
-- match in rules like (op dfun) in gentle mode. Another example
-- is 'otherwise' which we want exprIsConApp_maybe to be able to
-- see very early on
getUnfoldingInRuleMatch env
= (in_scope, id_unf)
where
in_scope = seInScope env
mode = getMode env
id_unf id | unf_is_active id = idUnfolding id
| otherwise = NoUnfolding
unf_is_active id
| not (sm_rules mode) = active_unfolding_minimal id
| otherwise = isActive (sm_phase mode) (idInlineActivation id) | 759 | getUnfoldingInRuleMatch :: SimplEnv -> InScopeEnv
getUnfoldingInRuleMatch env
= (in_scope, id_unf)
where
in_scope = seInScope env
mode = getMode env
id_unf id | unf_is_active id = idUnfolding id
| otherwise = NoUnfolding
unf_is_active id
| not (sm_rules mode) = active_unfolding_minimal id
| otherwise = isActive (sm_phase mode) (idInlineActivation id) | 413 | getUnfoldingInRuleMatch env
= (in_scope, id_unf)
where
in_scope = seInScope env
mode = getMode env
id_unf id | unf_is_active id = idUnfolding id
| otherwise = NoUnfolding
unf_is_active id
| not (sm_rules mode) = active_unfolding_minimal id
| otherwise = isActive (sm_phase mode) (idInlineActivation id) | 363 | true | true | 0 | 10 | 174 | 130 | 63 | 67 | null | null |
maruks/haskell-book | src/records.hs | gpl-3.0 | -- bad x = foo x
f6 s = foo (s :: S) | 37 | f6 s = foo (s :: S) | 19 | f6 s = foo (s :: S) | 19 | true | false | 1 | 5 | 13 | 22 | 10 | 12 | null | null |
jetho/syncthing-hs | tests/UnitTests/Errors.hs | bsd-3-clause | requestWithException :: Exception ex => ex -> CatchM a -> SyncM Catch a
requestWithException ex action = throwM ex >> action | 124 | requestWithException :: Exception ex => ex -> CatchM a -> SyncM Catch a
requestWithException ex action = throwM ex >> action | 124 | requestWithException ex action = throwM ex >> action | 52 | false | true | 0 | 8 | 20 | 46 | 21 | 25 | null | null |
christiaanb/ghc | compiler/cmm/CmmCommonBlockElim.hs | bsd-3-clause | -- Try to find a block that is equal (or ``common'') to b.
common_block :: State -> (HashCode, CmmBlock) -> State
common_block (old_change, bmap, subst) (hash, b) =
case lookupUFM bmap hash of
Just bs -> case (List.find (eqBlockBodyWith (eqBid subst) b) bs,
mapLookup bid subst) of
(Just b', Nothing) -> addSubst b'
(Just b', Just b'') | entryLabel b' /= b'' -> addSubst b'
| otherwise -> (old_change, bmap, subst)
_ -> (old_change, addToUFM bmap hash (b : bs), subst)
Nothing -> (old_change, addToUFM bmap hash [b], subst)
where bid = entryLabel b
addSubst b' = my_trace "found new common block" (ppr bid <> char '=' <> ppr (entryLabel b')) $
(True, bmap, mapInsert bid (entryLabel b') subst)
-- -----------------------------------------------------------------------------
-- Hashing and equality on blocks
-- Below here is mostly boilerplate: hashing blocks ignoring labels,
-- and comparing blocks modulo a label mapping.
-- To speed up comparisons, we hash each basic block modulo labels.
-- The hashing is a bit arbitrary (the numbers are completely arbitrary),
-- but it should be fast and good enough. | 1,288 | common_block :: State -> (HashCode, CmmBlock) -> State
common_block (old_change, bmap, subst) (hash, b) =
case lookupUFM bmap hash of
Just bs -> case (List.find (eqBlockBodyWith (eqBid subst) b) bs,
mapLookup bid subst) of
(Just b', Nothing) -> addSubst b'
(Just b', Just b'') | entryLabel b' /= b'' -> addSubst b'
| otherwise -> (old_change, bmap, subst)
_ -> (old_change, addToUFM bmap hash (b : bs), subst)
Nothing -> (old_change, addToUFM bmap hash [b], subst)
where bid = entryLabel b
addSubst b' = my_trace "found new common block" (ppr bid <> char '=' <> ppr (entryLabel b')) $
(True, bmap, mapInsert bid (entryLabel b') subst)
-- -----------------------------------------------------------------------------
-- Hashing and equality on blocks
-- Below here is mostly boilerplate: hashing blocks ignoring labels,
-- and comparing blocks modulo a label mapping.
-- To speed up comparisons, we hash each basic block modulo labels.
-- The hashing is a bit arbitrary (the numbers are completely arbitrary),
-- but it should be fast and good enough. | 1,229 | common_block (old_change, bmap, subst) (hash, b) =
case lookupUFM bmap hash of
Just bs -> case (List.find (eqBlockBodyWith (eqBid subst) b) bs,
mapLookup bid subst) of
(Just b', Nothing) -> addSubst b'
(Just b', Just b'') | entryLabel b' /= b'' -> addSubst b'
| otherwise -> (old_change, bmap, subst)
_ -> (old_change, addToUFM bmap hash (b : bs), subst)
Nothing -> (old_change, addToUFM bmap hash [b], subst)
where bid = entryLabel b
addSubst b' = my_trace "found new common block" (ppr bid <> char '=' <> ppr (entryLabel b')) $
(True, bmap, mapInsert bid (entryLabel b') subst)
-- -----------------------------------------------------------------------------
-- Hashing and equality on blocks
-- Below here is mostly boilerplate: hashing blocks ignoring labels,
-- and comparing blocks modulo a label mapping.
-- To speed up comparisons, we hash each basic block modulo labels.
-- The hashing is a bit arbitrary (the numbers are completely arbitrary),
-- but it should be fast and good enough. | 1,174 | true | true | 1 | 15 | 356 | 313 | 162 | 151 | null | null |
uriba/biolab-analysis | Biolab/Analysis/Normalization.hs | bsd-3-clause | thresholdFromBlanks :: (ColonySample a) => [a RawMeasurement] -> DetectionThreshold
thresholdFromBlanks ms
| null ms = error "No blank values given"
| otherwise = DetectionThreshold . S.mean . V.fromList . map (dtVal . thresholdFromBlank) $ ms | 251 | thresholdFromBlanks :: (ColonySample a) => [a RawMeasurement] -> DetectionThreshold
thresholdFromBlanks ms
| null ms = error "No blank values given"
| otherwise = DetectionThreshold . S.mean . V.fromList . map (dtVal . thresholdFromBlank) $ ms | 251 | thresholdFromBlanks ms
| null ms = error "No blank values given"
| otherwise = DetectionThreshold . S.mean . V.fromList . map (dtVal . thresholdFromBlank) $ ms | 167 | false | true | 0 | 10 | 42 | 92 | 42 | 50 | null | null |
sdiehl/ghc | libraries/ghc-heap/tests/ClosureSizeUtils.hs | bsd-3-clause | assertSizeUnlifted
:: forall (a :: TYPE 'UnliftedRep). (HasCallStack, Typeable a)
=> a -- ^ closure
-> Int -- ^ expected size in words
-> IO ()
assertSizeUnlifted x =
assertSizeBox (Box (unsafeCoerce# x)) (typeRep @a) | 233 | assertSizeUnlifted
:: forall (a :: TYPE 'UnliftedRep). (HasCallStack, Typeable a)
=> a -- ^ closure
-> Int -- ^ expected size in words
-> IO ()
assertSizeUnlifted x =
assertSizeBox (Box (unsafeCoerce# x)) (typeRep @a) | 233 | assertSizeUnlifted x =
assertSizeBox (Box (unsafeCoerce# x)) (typeRep @a) | 75 | false | true | 0 | 11 | 50 | 87 | 44 | 43 | null | null |
Hara-Laboratory/subleq-toolchain | Language/Subleq/Assembly/Locate.hs | gpl-3.0 | loadElement :: MemoryArchitecture m -> Integer -> Element -> m -> (m, Integer)
loadElement ma i (ElemInst Subleq [(_, Number x)]) m = loadElement ma i (ElemInst Subleq $ map (\z->(Nothing, z)) [Number x, Number x]) m | 249 | loadElement :: MemoryArchitecture m -> Integer -> Element -> m -> (m, Integer)
loadElement ma i (ElemInst Subleq [(_, Number x)]) m = loadElement ma i (ElemInst Subleq $ map (\z->(Nothing, z)) [Number x, Number x]) m | 249 | loadElement ma i (ElemInst Subleq [(_, Number x)]) m = loadElement ma i (ElemInst Subleq $ map (\z->(Nothing, z)) [Number x, Number x]) m | 170 | false | true | 0 | 11 | 69 | 115 | 60 | 55 | null | null |
heathweiss/Tricad | src/Tests/MathPolarTest.hs | gpl-2.0 | {-
z = radius * sin(xySlope)
= 10 * sin(9.67442935245515) = 1.68049451236
-}
{-
createCornerPointTestR10PosX0PosY10XY10 = TestCase $ assertEqual
"createCornerPointTestR10PosX0PosY10XY10"
( F4 ( Point 1.7117865163545964 (-9.708023749268555) (-1.6804945123576784) ))
(createCornerPoint
(F4)
(Point{x_axis=0, y_axis=0, z_axis=0})
(Radius 10)
(adjustRadiusForSlope (Radius 10) (slopeAdjustedForVerticalAngle (PosXSlope 1) (PosYSlope 10) (xyQuadrantAngle 10)))
(Angle 10)--(xyQuadrantAngle 10)
(slopeAdjustedForVerticalAngle (PosXSlope 1) (PosYSlope 10) (xyQuadrantAngle 10))
)
-}
--was simplified
createCornerPointTestR10PosX0PosY10XY10 = TestCase $ assertEqual
"createCornerPointTestR10PosX0PosY10XY10"
( F4 ( Point 1.7117865163545964 (-9.708023749268555) (-1.6804945123576784) ))
(createCornerPoint
(F4)
(Point{x_axis=0, y_axis=0, z_axis=0})
(Radius 10)
(Angle 10)--(xyQuadrantAngle 10)
(PosXSlope 1)
(PosYSlope 10)
) | 988 | createCornerPointTestR10PosX0PosY10XY10 = TestCase $ assertEqual
"createCornerPointTestR10PosX0PosY10XY10"
( F4 ( Point 1.7117865163545964 (-9.708023749268555) (-1.6804945123576784) ))
(createCornerPoint
(F4)
(Point{x_axis=0, y_axis=0, z_axis=0})
(Radius 10)
(Angle 10)--(xyQuadrantAngle 10)
(PosXSlope 1)
(PosYSlope 10)
) | 357 | createCornerPointTestR10PosX0PosY10XY10 = TestCase $ assertEqual
"createCornerPointTestR10PosX0PosY10XY10"
( F4 ( Point 1.7117865163545964 (-9.708023749268555) (-1.6804945123576784) ))
(createCornerPoint
(F4)
(Point{x_axis=0, y_axis=0, z_axis=0})
(Radius 10)
(Angle 10)--(xyQuadrantAngle 10)
(PosXSlope 1)
(PosYSlope 10)
) | 357 | true | false | 0 | 10 | 160 | 115 | 63 | 52 | null | null |
elitak/hs-datahand | stm32f10x/hs_src/Data/Accessor/Example.hs | gpl-3.0 | infix0 :: Int
infix0 =
(('b',7),"hallo")^.first^.second | 58 | infix0 :: Int
infix0 =
(('b',7),"hallo")^.first^.second | 58 | infix0 =
(('b',7),"hallo")^.first^.second | 44 | false | true | 0 | 8 | 8 | 38 | 19 | 19 | null | null |
forste/haReFork | tools/hs2alfa/tests/Fields.hs | bsd-3-clause | sq x = x*x | 10 | sq x = x*x | 10 | sq x = x*x | 10 | false | false | 0 | 5 | 3 | 13 | 6 | 7 | null | null |
haroldcarr/bitly-client | src/BitlyClientResponses.hs | apache-2.0 | expandParse :: Value -> Parser Response
expandParse = withObject "expandParse" $
\o -> ExpandResponse
<$> o .:? "short_url"
<*> o .: "long_url"
<*> o .: "user_hash"
<*> o .: "global_hash"
<*> o .:? "hash"
<*> o .:? "error" | 391 | expandParse :: Value -> Parser Response
expandParse = withObject "expandParse" $
\o -> ExpandResponse
<$> o .:? "short_url"
<*> o .: "long_url"
<*> o .: "user_hash"
<*> o .: "global_hash"
<*> o .:? "hash"
<*> o .:? "error" | 391 | expandParse = withObject "expandParse" $
\o -> ExpandResponse
<$> o .:? "short_url"
<*> o .: "long_url"
<*> o .: "user_hash"
<*> o .: "global_hash"
<*> o .:? "hash"
<*> o .:? "error" | 351 | false | true | 0 | 18 | 206 | 84 | 40 | 44 | null | null |
locaweb/leela | src/warpdrive/src/Leela/Storage/Backend/ZMQ/Protocol.hs | apache-2.0 | msgDelKAttr :: [(GUID, Attr)] -> Object
msgDelKAttr attrs = ObjectArray [ ObjectString "del"
, ObjectString "k-attr"
, ObjectArray $ map mkTuple attrs
]
where
mkTuple (g, a) = ObjectArray [ asObjBinary g, asObjBinary a ] | 326 | msgDelKAttr :: [(GUID, Attr)] -> Object
msgDelKAttr attrs = ObjectArray [ ObjectString "del"
, ObjectString "k-attr"
, ObjectArray $ map mkTuple attrs
]
where
mkTuple (g, a) = ObjectArray [ asObjBinary g, asObjBinary a ] | 326 | msgDelKAttr attrs = ObjectArray [ ObjectString "del"
, ObjectString "k-attr"
, ObjectArray $ map mkTuple attrs
]
where
mkTuple (g, a) = ObjectArray [ asObjBinary g, asObjBinary a ] | 286 | false | true | 0 | 8 | 140 | 92 | 45 | 47 | null | null |
vlastachu/haskell-ccg | app/Main.hs | bsd-3-clause | -- (X \ Y) / Z • R => (X \ Y) / Z • Z / (Z \ R) (>T) => (X \ Y) / (Z \ R) (>B)
leftForwardTypeRaisingComposition :: Combinator
leftForwardTypeRaisingComposition left@((x :\ y) :/ z) r = forwardComposition left (forwardTypeRaising r z) | 234 | leftForwardTypeRaisingComposition :: Combinator
leftForwardTypeRaisingComposition left@((x :\ y) :/ z) r = forwardComposition left (forwardTypeRaising r z) | 155 | leftForwardTypeRaisingComposition left@((x :\ y) :/ z) r = forwardComposition left (forwardTypeRaising r z) | 107 | true | true | 0 | 10 | 45 | 47 | 25 | 22 | null | null |
guillep19/uulib | src/UU/Parsing/Examples.hs | bsd-3-clause | if_as_ident = ((("This is the identifier: ") ++) <$> pIdent) | 62 | if_as_ident = ((("This is the identifier: ") ++) <$> pIdent) | 62 | if_as_ident = ((("This is the identifier: ") ++) <$> pIdent) | 62 | false | false | 0 | 8 | 11 | 20 | 12 | 8 | null | null |
pliosoft/toml-parse | src/Text/Toml/Parser.hs | bsd-3-clause | allDouble _ = False | 19 | allDouble _ = False | 19 | allDouble _ = False | 19 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/types/Type.hs | bsd-3-clause | substTyWith :: [TyVar] -> [Type] -> Type -> Type
substTyWith tvs tys = ASSERT( length tvs == length tys )
substTy (zipOpenTvSubst tvs tys) | 160 | substTyWith :: [TyVar] -> [Type] -> Type -> Type
substTyWith tvs tys = ASSERT( length tvs == length tys )
substTy (zipOpenTvSubst tvs tys) | 160 | substTyWith tvs tys = ASSERT( length tvs == length tys )
substTy (zipOpenTvSubst tvs tys) | 111 | false | true | 0 | 9 | 45 | 67 | 32 | 35 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-data/Data/Drasil/Quantities/Physics.hs | bsd-2-clause | linearAccel = uc CP.linAccel (Concat [vec lA, Label "(", lT, Label ")"]) accelU | 88 | linearAccel = uc CP.linAccel (Concat [vec lA, Label "(", lT, Label ")"]) accelU | 88 | linearAccel = uc CP.linAccel (Concat [vec lA, Label "(", lT, Label ")"]) accelU | 88 | false | false | 1 | 9 | 21 | 46 | 21 | 25 | null | null |
Super-Fluid/heqet | Heqet/Input/Parse.hs | gpl-3.0 | -- & refinePitches table
-- & pitch5toPitch
-- & putInTime
-- & placeAllNoteItems
-- sorry, this is a bit hackish. Easier than writing a whole perfect
-- Pitch QQ and this will probably be just for debugging anyway
extractFirstPitch :: Music -> Pitch
extractFirstPitch [] = error "empty quoted pitch" | 313 | extractFirstPitch :: Music -> Pitch
extractFirstPitch [] = error "empty quoted pitch" | 85 | extractFirstPitch [] = error "empty quoted pitch" | 49 | true | true | 0 | 6 | 62 | 29 | 17 | 12 | null | null |
rueshyna/gogol | gogol-qpxexpress/gen/Network/Google/QPXExpress/Types.hs | mpl-2.0 | -- | Default request referring to version 'v1' of the QPX Express API. This contains the host and root path used as a starting point for constructing service requests.
qPXExpressService :: ServiceConfig
qPXExpressService
= defaultService (ServiceId "qpxExpress:v1")
"www.googleapis.com" | 294 | qPXExpressService :: ServiceConfig
qPXExpressService
= defaultService (ServiceId "qpxExpress:v1")
"www.googleapis.com" | 126 | qPXExpressService
= defaultService (ServiceId "qpxExpress:v1")
"www.googleapis.com" | 91 | true | true | 0 | 7 | 45 | 27 | 12 | 15 | null | null |
denumerate/raven | src/Raven/Server/Connection.hs | bsd-3-clause | -- |Listen for and handle events from the endpoint.
-- The pid is the id of the node's listening process
listenAtEnd :: Transport -> EndPoint -> LocalNode ->
MVar (Map ConnectionId Connection) -> ProcessId -> IO ()
listenAtEnd trans end serverN conns pid = receive end >>=
(\event -> case event of
ConnectionOpened cid reliabilty adrs -> forkIO
(takeMVar conns >>=
(\conns' ->
Network.Transport.connect end adrs reliabilty
(defaultConnectHints{connectTimeout = Just connTimeout}) >>=
(\conn -> case conn of
Right conn' -> putMVar conns $ Map.insert cid conn' conns'
Left err ->
putMVar conns conns' >>
runProcess serverN
(buildLogMsg
("Connection failed with " ++ show adrs
++ ". " ++ show err) >>=
Control.Distributed.Process.send pid)))) >>
listenAtEnd trans end serverN conns pid
Received cid [info] -> forkIO
(let wds = B.words info in
runProcess serverN (handleReceived pid wds cid)) >>
listenAtEnd trans end serverN conns pid
ConnectionClosed cid ->
takeMVar conns >>=
putMVar conns . Map.delete cid >>
runProcess serverN
(Control.Distributed.Process.send pid (ConnClosed cid)) >>
listenAtEnd trans end serverN conns pid
EndPointClosed -> putStrLn "EndPoint Closed"
ErrorEvent (TransportError _ err) ->
runProcess serverN
(buildLogMsg ("EndPoint Error: " ++ err) >>=
Control.Distributed.Process.send pid) >>
listenAtEnd trans end serverN conns pid
_ -> forkIO (runProcess serverN
(buildLogMsg "Uncaught event at endpoint" >>=
Control.Distributed.Process.send pid)) >>
listenAtEnd trans end serverN conns pid) | 2,044 | listenAtEnd :: Transport -> EndPoint -> LocalNode ->
MVar (Map ConnectionId Connection) -> ProcessId -> IO ()
listenAtEnd trans end serverN conns pid = receive end >>=
(\event -> case event of
ConnectionOpened cid reliabilty adrs -> forkIO
(takeMVar conns >>=
(\conns' ->
Network.Transport.connect end adrs reliabilty
(defaultConnectHints{connectTimeout = Just connTimeout}) >>=
(\conn -> case conn of
Right conn' -> putMVar conns $ Map.insert cid conn' conns'
Left err ->
putMVar conns conns' >>
runProcess serverN
(buildLogMsg
("Connection failed with " ++ show adrs
++ ". " ++ show err) >>=
Control.Distributed.Process.send pid)))) >>
listenAtEnd trans end serverN conns pid
Received cid [info] -> forkIO
(let wds = B.words info in
runProcess serverN (handleReceived pid wds cid)) >>
listenAtEnd trans end serverN conns pid
ConnectionClosed cid ->
takeMVar conns >>=
putMVar conns . Map.delete cid >>
runProcess serverN
(Control.Distributed.Process.send pid (ConnClosed cid)) >>
listenAtEnd trans end serverN conns pid
EndPointClosed -> putStrLn "EndPoint Closed"
ErrorEvent (TransportError _ err) ->
runProcess serverN
(buildLogMsg ("EndPoint Error: " ++ err) >>=
Control.Distributed.Process.send pid) >>
listenAtEnd trans end serverN conns pid
_ -> forkIO (runProcess serverN
(buildLogMsg "Uncaught event at endpoint" >>=
Control.Distributed.Process.send pid)) >>
listenAtEnd trans end serverN conns pid) | 1,939 | listenAtEnd trans end serverN conns pid = receive end >>=
(\event -> case event of
ConnectionOpened cid reliabilty adrs -> forkIO
(takeMVar conns >>=
(\conns' ->
Network.Transport.connect end adrs reliabilty
(defaultConnectHints{connectTimeout = Just connTimeout}) >>=
(\conn -> case conn of
Right conn' -> putMVar conns $ Map.insert cid conn' conns'
Left err ->
putMVar conns conns' >>
runProcess serverN
(buildLogMsg
("Connection failed with " ++ show adrs
++ ". " ++ show err) >>=
Control.Distributed.Process.send pid)))) >>
listenAtEnd trans end serverN conns pid
Received cid [info] -> forkIO
(let wds = B.words info in
runProcess serverN (handleReceived pid wds cid)) >>
listenAtEnd trans end serverN conns pid
ConnectionClosed cid ->
takeMVar conns >>=
putMVar conns . Map.delete cid >>
runProcess serverN
(Control.Distributed.Process.send pid (ConnClosed cid)) >>
listenAtEnd trans end serverN conns pid
EndPointClosed -> putStrLn "EndPoint Closed"
ErrorEvent (TransportError _ err) ->
runProcess serverN
(buildLogMsg ("EndPoint Error: " ++ err) >>=
Control.Distributed.Process.send pid) >>
listenAtEnd trans end serverN conns pid
_ -> forkIO (runProcess serverN
(buildLogMsg "Uncaught event at endpoint" >>=
Control.Distributed.Process.send pid)) >>
listenAtEnd trans end serverN conns pid) | 1,827 | true | true | 0 | 33 | 746 | 516 | 250 | 266 | null | null |
jcpetruzza/haskell-ast | src/Language/Haskell/AST/HSE.hs | bsd-3-clause | fromHseKind (E.KindFn l k1 k2) = Core.KindFn l (fromHseKind k1) (fromHseKind k2) | 83 | fromHseKind (E.KindFn l k1 k2) = Core.KindFn l (fromHseKind k1) (fromHseKind k2) | 83 | fromHseKind (E.KindFn l k1 k2) = Core.KindFn l (fromHseKind k1) (fromHseKind k2) | 83 | false | false | 0 | 7 | 14 | 43 | 20 | 23 | null | null |
pascal-knodel/haskell-craft | Examples/· Recursion/· General Recursion/Calculations/Power.hs | mit | power :: Integer -> Integer -> Integer
power basis exponent
| exponent < 0 = error "Power.hs: Negative exponent."
| otherwise = power' basis exponent
where
power' :: Integer -> Integer -> Integer
power' _ 0 = 1
-- power' _ 1 = 2 -- [1]
power' basis exponent
| even exponent = power' (square basis) (halve exponent)
| otherwise = basis * power' (square basis) (halve exponent)
square :: Integer -> Integer
square basis = basis * basis
halve :: Integer -> Integer
halve exponent = exponent `div` 2
{- GHCi>
power 2 0
power 2 1
power 2 2
power 2 3
-}
-- 1
-- 2
-- 4
-- 8 | 619 | power :: Integer -> Integer -> Integer
power basis exponent
| exponent < 0 = error "Power.hs: Negative exponent."
| otherwise = power' basis exponent
where
power' :: Integer -> Integer -> Integer
power' _ 0 = 1
-- power' _ 1 = 2 -- [1]
power' basis exponent
| even exponent = power' (square basis) (halve exponent)
| otherwise = basis * power' (square basis) (halve exponent)
square :: Integer -> Integer
square basis = basis * basis
halve :: Integer -> Integer
halve exponent = exponent `div` 2
{- GHCi>
power 2 0
power 2 1
power 2 2
power 2 3
-}
-- 1
-- 2
-- 4
-- 8 | 619 | power basis exponent
| exponent < 0 = error "Power.hs: Negative exponent."
| otherwise = power' basis exponent
where
power' :: Integer -> Integer -> Integer
power' _ 0 = 1
-- power' _ 1 = 2 -- [1]
power' basis exponent
| even exponent = power' (square basis) (halve exponent)
| otherwise = basis * power' (square basis) (halve exponent)
square :: Integer -> Integer
square basis = basis * basis
halve :: Integer -> Integer
halve exponent = exponent `div` 2
{- GHCi>
power 2 0
power 2 1
power 2 2
power 2 3
-}
-- 1
-- 2
-- 4
-- 8 | 580 | false | true | 2 | 8 | 164 | 190 | 96 | 94 | null | null |
Crazycolorz5/Haskell-Code | MyUsefulFunctions.hs | unlicense | digitsToInt::(Integral a)=>[a]->a
digitsToInt = List.foldl' (\acc->(\digit->acc*10+digit)) 0 | 92 | digitsToInt::(Integral a)=>[a]->a
digitsToInt = List.foldl' (\acc->(\digit->acc*10+digit)) 0 | 92 | digitsToInt = List.foldl' (\acc->(\digit->acc*10+digit)) 0 | 58 | false | true | 0 | 11 | 6 | 58 | 32 | 26 | null | null |
wouwouwou/2017_module_8 | src/haskell/PP-project-2016/Grammar.hs | apache-2.0 | join = Terminal "join" | 29 | join = Terminal "join" | 29 | join = Terminal "join" | 29 | false | false | 0 | 5 | 10 | 9 | 4 | 5 | null | null |
dan-t/layers | src/AppData.hs | bsd-3-clause | handleKeyEvent :: KI.KeyInfo -> AppData -> AppData
handleKeyEvent ki app =
let (gdata', stree') = SZ.handleKeyEvent ki (gameData app) (stateTree app)
in app {gameData = gdata', stateTree = stree'} | 206 | handleKeyEvent :: KI.KeyInfo -> AppData -> AppData
handleKeyEvent ki app =
let (gdata', stree') = SZ.handleKeyEvent ki (gameData app) (stateTree app)
in app {gameData = gdata', stateTree = stree'} | 206 | handleKeyEvent ki app =
let (gdata', stree') = SZ.handleKeyEvent ki (gameData app) (stateTree app)
in app {gameData = gdata', stateTree = stree'} | 155 | false | true | 0 | 11 | 38 | 79 | 41 | 38 | null | null |
yesodweb/shakespeare | test/Text/HamletSpec.hs | mit | caseJustChain :: Assertion
caseJustChain = helper "it's just" [hamlet|
$maybe n <- just(getArg(getArg(getArg theArg)))
it's #{n}
|] | 135 | caseJustChain :: Assertion
caseJustChain = helper "it's just" [hamlet|
$maybe n <- just(getArg(getArg(getArg theArg)))
it's #{n}
|] | 135 | caseJustChain = helper "it's just" [hamlet|
$maybe n <- just(getArg(getArg(getArg theArg)))
it's #{n}
|] | 108 | false | true | 0 | 6 | 20 | 28 | 13 | 15 | null | null |
imh/plover | src/Language/Plover/Reduce.hs | mit | -- Searches syntax tree for simple arithmetic expressions, simplifies them
reduceArith :: CExpr -> CExpr
reduceArith t = mvisit msimplify reduceArith t
where
scale :: Int -> CExpr -> CExpr
scale 1 x = x
scale x (IntLit 1) = IntLit x
scale x y = (IntLit x) * y
simplify :: S.Expr CExpr Int -> CExpr
simplify = S.simplify scale
atom :: CExpr -> Maybe (S.Expr CExpr Int)
atom = return . S.Atom
msimplify :: CExpr -> Maybe CExpr
msimplify e = do
e' <- toExpr e
let e'' = simplify e'
if e == e'' then Nothing else return e''
toExpr :: CExpr -> Maybe (S.Expr CExpr Int)
toExpr (a :+ b) = do
a' <- toExpr a
b' <- toExpr b
return $ S.Sum [a', b']
toExpr (a :* b) = do
a' <- toExpr a
b' <- toExpr b
return $ S.Mul [a', b']
toExpr (IntLit i) = return $ S.Prim i
toExpr (Negate x) = do
x' <- toExpr x
return $ S.Mul [S.Prim (-1), x']
toExpr e@(Ref _) = atom e
toExpr e@(_ :! _) = atom e
--toExpr e@(a :! b) = return $ S.Atom e
toExpr _ = Nothing
-- Attempts to simplify numeric expressions.
-- Called by type checker | 1,154 | reduceArith :: CExpr -> CExpr
reduceArith t = mvisit msimplify reduceArith t
where
scale :: Int -> CExpr -> CExpr
scale 1 x = x
scale x (IntLit 1) = IntLit x
scale x y = (IntLit x) * y
simplify :: S.Expr CExpr Int -> CExpr
simplify = S.simplify scale
atom :: CExpr -> Maybe (S.Expr CExpr Int)
atom = return . S.Atom
msimplify :: CExpr -> Maybe CExpr
msimplify e = do
e' <- toExpr e
let e'' = simplify e'
if e == e'' then Nothing else return e''
toExpr :: CExpr -> Maybe (S.Expr CExpr Int)
toExpr (a :+ b) = do
a' <- toExpr a
b' <- toExpr b
return $ S.Sum [a', b']
toExpr (a :* b) = do
a' <- toExpr a
b' <- toExpr b
return $ S.Mul [a', b']
toExpr (IntLit i) = return $ S.Prim i
toExpr (Negate x) = do
x' <- toExpr x
return $ S.Mul [S.Prim (-1), x']
toExpr e@(Ref _) = atom e
toExpr e@(_ :! _) = atom e
--toExpr e@(a :! b) = return $ S.Atom e
toExpr _ = Nothing
-- Attempts to simplify numeric expressions.
-- Called by type checker | 1,079 | reduceArith t = mvisit msimplify reduceArith t
where
scale :: Int -> CExpr -> CExpr
scale 1 x = x
scale x (IntLit 1) = IntLit x
scale x y = (IntLit x) * y
simplify :: S.Expr CExpr Int -> CExpr
simplify = S.simplify scale
atom :: CExpr -> Maybe (S.Expr CExpr Int)
atom = return . S.Atom
msimplify :: CExpr -> Maybe CExpr
msimplify e = do
e' <- toExpr e
let e'' = simplify e'
if e == e'' then Nothing else return e''
toExpr :: CExpr -> Maybe (S.Expr CExpr Int)
toExpr (a :+ b) = do
a' <- toExpr a
b' <- toExpr b
return $ S.Sum [a', b']
toExpr (a :* b) = do
a' <- toExpr a
b' <- toExpr b
return $ S.Mul [a', b']
toExpr (IntLit i) = return $ S.Prim i
toExpr (Negate x) = do
x' <- toExpr x
return $ S.Mul [S.Prim (-1), x']
toExpr e@(Ref _) = atom e
toExpr e@(_ :! _) = atom e
--toExpr e@(a :! b) = return $ S.Atom e
toExpr _ = Nothing
-- Attempts to simplify numeric expressions.
-- Called by type checker | 1,049 | true | true | 8 | 12 | 356 | 507 | 230 | 277 | null | null |
hughfdjackson/friday-pgm | test/Test/Vision/Image/Storage/PGM/Internal.hs | mit | pgmFile' (width, height, maxVal, px) = do
let headerItems = "P5" : (show <$> [width, height, maxVal])
header <- BC.pack . mconcat <$> sepBy spaces headerItems
space' <- BC.pack <$> space
let body = B.pack px
return $ mconcat [header, space', body] | 258 | pgmFile' (width, height, maxVal, px) = do
let headerItems = "P5" : (show <$> [width, height, maxVal])
header <- BC.pack . mconcat <$> sepBy spaces headerItems
space' <- BC.pack <$> space
let body = B.pack px
return $ mconcat [header, space', body] | 258 | pgmFile' (width, height, maxVal, px) = do
let headerItems = "P5" : (show <$> [width, height, maxVal])
header <- BC.pack . mconcat <$> sepBy spaces headerItems
space' <- BC.pack <$> space
let body = B.pack px
return $ mconcat [header, space', body] | 258 | false | false | 0 | 13 | 52 | 118 | 60 | 58 | null | null |
peterokagey/haskellOEIS | src/Sandbox/OEIS/FigurateSums.hs | apache-2.0 | pentagons = map (\n -> n*(3*n - 1) `div` 2) [1..] | 49 | pentagons = map (\n -> n*(3*n - 1) `div` 2) [1..] | 49 | pentagons = map (\n -> n*(3*n - 1) `div` 2) [1..] | 49 | false | false | 1 | 12 | 10 | 47 | 24 | 23 | null | null |
timorantalaiho/pong11 | src/GameLogic.hs | bsd-3-clause | chooseDirection :: Float -> (Float, [Coordinates]) -> Board -> CalculationResults
chooseDirection currentY (targetY, coords) board
| difference < (-threshold) = CalculationResults (-1.0) coords
| difference > threshold = CalculationResults 1.0 coords
| otherwise = CalculationResults 0.0 coords
where difference = targetY - currentY
threshold = (paddleH board) / 8.0 | 383 | chooseDirection :: Float -> (Float, [Coordinates]) -> Board -> CalculationResults
chooseDirection currentY (targetY, coords) board
| difference < (-threshold) = CalculationResults (-1.0) coords
| difference > threshold = CalculationResults 1.0 coords
| otherwise = CalculationResults 0.0 coords
where difference = targetY - currentY
threshold = (paddleH board) / 8.0 | 383 | chooseDirection currentY (targetY, coords) board
| difference < (-threshold) = CalculationResults (-1.0) coords
| difference > threshold = CalculationResults 1.0 coords
| otherwise = CalculationResults 0.0 coords
where difference = targetY - currentY
threshold = (paddleH board) / 8.0 | 301 | false | true | 3 | 10 | 65 | 130 | 65 | 65 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.