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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ambiata/tinfoil | Setup.hs | bsd-3-clause | timestamp :: Verbosity -> IO String
timestamp verbosity =
rawSystemStdout verbosity "date" ["+%Y%m%d%H%M%S"] >>= \s ->
case splitAt 14 s of
(d, n : []) ->
if (length d == 14 && filter isDigit d == d)
then return d
else fail $ "date has failed to produce the correct format [" <> s <> "]."
_ ->
fail $ "date has failed to produce a date long enough [" <> s <> "]." | 417 | timestamp :: Verbosity -> IO String
timestamp verbosity =
rawSystemStdout verbosity "date" ["+%Y%m%d%H%M%S"] >>= \s ->
case splitAt 14 s of
(d, n : []) ->
if (length d == 14 && filter isDigit d == d)
then return d
else fail $ "date has failed to produce the correct format [" <> s <> "]."
_ ->
fail $ "date has failed to produce a date long enough [" <> s <> "]." | 417 | timestamp verbosity =
rawSystemStdout verbosity "date" ["+%Y%m%d%H%M%S"] >>= \s ->
case splitAt 14 s of
(d, n : []) ->
if (length d == 14 && filter isDigit d == d)
then return d
else fail $ "date has failed to produce the correct format [" <> s <> "]."
_ ->
fail $ "date has failed to produce a date long enough [" <> s <> "]." | 381 | false | true | 0 | 15 | 127 | 137 | 67 | 70 | null | null |
manyoo/Morakot | Handler.hs | bsd-3-clause | -- check the validity of the request path.
-- if the request want to access some unauthorized file,
-- then change it to the default file.
handleReqURI conf _ = undefined | 327 | handleReqURI conf _ = undefined | 31 | handleReqURI conf _ = undefined | 31 | true | false | 0 | 5 | 187 | 14 | 8 | 6 | null | null |
jsavatgy/hatupist | hatupist-103.hs | gpl-2.0 | setFonts gsRef = do
gs <- readIORef gsRef
let gui = g gs
newFont = font (s gs)
srcfont <- fontDescriptionFromString newFont
widgetModifyFont (gLabel1 gui) (Just srcfont)
widgetModifyFont (gLabel2 gui) (Just srcfont)
widgetModifyFont (gEntry gui) (Just srcfont)
labelSetWidthChars (gLabel1 gui) (lineLen (s gs) + 3) | 336 | setFonts gsRef = do
gs <- readIORef gsRef
let gui = g gs
newFont = font (s gs)
srcfont <- fontDescriptionFromString newFont
widgetModifyFont (gLabel1 gui) (Just srcfont)
widgetModifyFont (gLabel2 gui) (Just srcfont)
widgetModifyFont (gEntry gui) (Just srcfont)
labelSetWidthChars (gLabel1 gui) (lineLen (s gs) + 3) | 336 | setFonts gsRef = do
gs <- readIORef gsRef
let gui = g gs
newFont = font (s gs)
srcfont <- fontDescriptionFromString newFont
widgetModifyFont (gLabel1 gui) (Just srcfont)
widgetModifyFont (gLabel2 gui) (Just srcfont)
widgetModifyFont (gEntry gui) (Just srcfont)
labelSetWidthChars (gLabel1 gui) (lineLen (s gs) + 3) | 336 | false | false | 1 | 13 | 66 | 149 | 65 | 84 | null | null |
rueshyna/gogol | gogol-deploymentmanager/gen/Network/Google/DeploymentManager/Types/Product.hs | mpl-2.0 | -- | A token used to continue a truncated list request.
tlrNextPageToken :: Lens' TypesListResponse (Maybe Text)
tlrNextPageToken
= lens _tlrNextPageToken
(\ s a -> s{_tlrNextPageToken = a}) | 198 | tlrNextPageToken :: Lens' TypesListResponse (Maybe Text)
tlrNextPageToken
= lens _tlrNextPageToken
(\ s a -> s{_tlrNextPageToken = a}) | 142 | tlrNextPageToken
= lens _tlrNextPageToken
(\ s a -> s{_tlrNextPageToken = a}) | 85 | true | true | 0 | 9 | 35 | 48 | 25 | 23 | null | null |
rueshyna/gogol | gogol-compute/gen/Network/Google/Compute/Types/Product.hs | mpl-2.0 | -- | [Output Only] This token allows you to get the next page of results for
-- list requests. If the number of results is larger than maxResults, use
-- the nextPageToken as a value for the query parameter pageToken in the
-- next list request. Subsequent list requests will have their own
-- nextPageToken to continue paging through the results.
tsplNextPageToken :: Lens' TargetSSLProxyList (Maybe Text)
tsplNextPageToken
= lens _tsplNextPageToken
(\ s a -> s{_tsplNextPageToken = a}) | 495 | tsplNextPageToken :: Lens' TargetSSLProxyList (Maybe Text)
tsplNextPageToken
= lens _tsplNextPageToken
(\ s a -> s{_tsplNextPageToken = a}) | 147 | tsplNextPageToken
= lens _tsplNextPageToken
(\ s a -> s{_tsplNextPageToken = a}) | 88 | true | true | 1 | 9 | 85 | 56 | 29 | 27 | null | null |
elizabrock/Hapless-Path | HAppS/src/ExecuteQuery.hs | mit | evaluateQuery (PredicateTest test next) elems = evaluateQuery next $ passesTest test elems | 90 | evaluateQuery (PredicateTest test next) elems = evaluateQuery next $ passesTest test elems | 90 | evaluateQuery (PredicateTest test next) elems = evaluateQuery next $ passesTest test elems | 90 | false | false | 0 | 7 | 11 | 31 | 14 | 17 | null | null |
robeverest/accelerate | Data/Array/Accelerate/Pretty/Print.hs | bsd-3-clause | prettyPrim (PrimBNot _) = (False, text "complement") | 62 | prettyPrim (PrimBNot _) = (False, text "complement") | 62 | prettyPrim (PrimBNot _) = (False, text "complement") | 62 | false | false | 0 | 7 | 16 | 24 | 12 | 12 | null | null |
andorp/grin | grin/src/Grin/Research.hs | bsd-3-clause | mkVariable :: Text.Text -> Info t -> Result t
mkVariable n t = Result mempty (Map.singleton (Text.unpack n) [t]) | 112 | mkVariable :: Text.Text -> Info t -> Result t
mkVariable n t = Result mempty (Map.singleton (Text.unpack n) [t]) | 112 | mkVariable n t = Result mempty (Map.singleton (Text.unpack n) [t]) | 66 | false | true | 0 | 10 | 18 | 58 | 28 | 30 | null | null |
ttuegel/emacs2nix | src/Distribution/Melpa.hs | gpl-3.0 | recipeFileName :: Melpa -> Text -> FilePath
recipeFileName Melpa {..} (T.unpack -> name) = melpaDir </> "recipes" </> name | 122 | recipeFileName :: Melpa -> Text -> FilePath
recipeFileName Melpa {..} (T.unpack -> name) = melpaDir </> "recipes" </> name | 122 | recipeFileName Melpa {..} (T.unpack -> name) = melpaDir </> "recipes" </> name | 78 | false | true | 0 | 8 | 18 | 47 | 24 | 23 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/main/DriverPhases.hs | bsd-3-clause | anyHsc :: Phase
anyHsc = Hsc (panic "anyHsc") | 45 | anyHsc :: Phase
anyHsc = Hsc (panic "anyHsc") | 45 | anyHsc = Hsc (panic "anyHsc") | 29 | false | true | 0 | 7 | 7 | 20 | 10 | 10 | null | null |
jespino/haskell-validate | Validate/US.hs | bsd-3-clause | -- Strict parameter
region :: String -> Bool
region reg = region $ map toUpper reg | 82 | region :: String -> Bool
region reg = region $ map toUpper reg | 62 | region reg = region $ map toUpper reg | 37 | true | true | 0 | 6 | 15 | 28 | 14 | 14 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Data.hs | bsd-3-clause | millisE :: Arduino (Expr Word32)
millisE = Arduino $ primitive MillisE | 70 | millisE :: Arduino (Expr Word32)
millisE = Arduino $ primitive MillisE | 70 | millisE = Arduino $ primitive MillisE | 37 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
jsnajder/genprog | src/GenProg.hs | bsd-3-clause | -- | Default mutation. Replaces a node, irrespective of its value,
-- with a randomly generated subexpression whose depth is limited to
-- 'iDepth'.
defaultMutation :: (GenProg m e) => EvolParams m e -> Mutate m e
defaultMutation p = const $ generateGrownExpr (iDepth p) | 270 | defaultMutation :: (GenProg m e) => EvolParams m e -> Mutate m e
defaultMutation p = const $ generateGrownExpr (iDepth p) | 121 | defaultMutation p = const $ generateGrownExpr (iDepth p) | 56 | true | true | 0 | 8 | 44 | 55 | 28 | 27 | null | null |
pseudonom/persistent | persistent-mongoDB/Database/Persist/MongoDB.hs | mit | nestNe = nestedFilterOp Ne | 26 | nestNe = nestedFilterOp Ne | 26 | nestNe = nestedFilterOp Ne | 26 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
Kinokkory/thorn | Data/Thorn/Internal.hs | bsd-3-clause | applySpecial n tx@(BasicTx _) = return (n,tx) | 45 | applySpecial n tx@(BasicTx _) = return (n,tx) | 45 | applySpecial n tx@(BasicTx _) = return (n,tx) | 45 | false | false | 1 | 8 | 6 | 34 | 15 | 19 | null | null |
Lexer747/Haskell-Fractals | Core/Colouring.hs | gpl-3.0 | genOutline seed = (r1,r2,r3) where
[r1,r2,r3] = genList (0,255) 3 seed | 74 | genOutline seed = (r1,r2,r3) where
[r1,r2,r3] = genList (0,255) 3 seed | 74 | genOutline seed = (r1,r2,r3) where
[r1,r2,r3] = genList (0,255) 3 seed | 74 | false | false | 0 | 8 | 14 | 48 | 27 | 21 | null | null |
moccu/weekly-challenge | challenges/binarytree/andreas/haskell/src/tests.hs | unlicense | main = runTestTT $ TestList [ testInsert
, testFromList
, testLookup
, testToList
] | 195 | main = runTestTT $ TestList [ testInsert
, testFromList
, testLookup
, testToList
] | 195 | main = runTestTT $ TestList [ testInsert
, testFromList
, testLookup
, testToList
] | 195 | false | false | 0 | 7 | 125 | 25 | 14 | 11 | null | null |
bos/critbit | Data/CritBit/Tree.hs | bsd-2-clause | -- | /O(k)/. Retrieves the maximal (key,value) pair of the map, and
-- the map stripped of that element, or 'Nothing' if passed an empty map.
--
-- > maxViewWithKey (fromList [("a",5), ("b",3)]) == Just (("b",3), fromList [("a",5)])
-- > maxViewWithKey empty == Nothing
maxViewWithKey :: CritBit k v -> Maybe ((k,v), CritBit k v)
maxViewWithKey (CritBit root) = go root CritBit
where
go (Internal left (Leaf lk lv) _ _) cont = Just ((lk,lv), cont left)
go i@(Internal _ right _ _) cont = go right $ (cont $!) . setRight i
go (Leaf lk lv) _ = Just ((lk,lv),empty)
go _ _ = Nothing
| 598 | maxViewWithKey :: CritBit k v -> Maybe ((k,v), CritBit k v)
maxViewWithKey (CritBit root) = go root CritBit
where
go (Internal left (Leaf lk lv) _ _) cont = Just ((lk,lv), cont left)
go i@(Internal _ right _ _) cont = go right $ (cont $!) . setRight i
go (Leaf lk lv) _ = Just ((lk,lv),empty)
go _ _ = Nothing
| 328 | maxViewWithKey (CritBit root) = go root CritBit
where
go (Internal left (Leaf lk lv) _ _) cont = Just ((lk,lv), cont left)
go i@(Internal _ right _ _) cont = go right $ (cont $!) . setRight i
go (Leaf lk lv) _ = Just ((lk,lv),empty)
go _ _ = Nothing
| 268 | true | true | 0 | 9 | 124 | 196 | 103 | 93 | null | null |
emmanueltouzery/cigale-timesheet | tests/SkypeSpec.hs | mit | splitWhenNeeded :: Spec
splitWhenNeeded = it "splits when needed" $ do
let day = fromGregorian 2012 1 1
let t1 = UTCTime day 0
let t2 = UTCTime day (skypeMinIntervalToSplitChatsSecondsD+1)
let source = [[ChatRecord "" t1 "", ChatRecord "" t2 ""]]
let expected = [[ChatRecord "" t1 ""], [ChatRecord "" t2 ""]]
assertEqual "doesn't match" expected (splitFarawayChats source) | 396 | splitWhenNeeded :: Spec
splitWhenNeeded = it "splits when needed" $ do
let day = fromGregorian 2012 1 1
let t1 = UTCTime day 0
let t2 = UTCTime day (skypeMinIntervalToSplitChatsSecondsD+1)
let source = [[ChatRecord "" t1 "", ChatRecord "" t2 ""]]
let expected = [[ChatRecord "" t1 ""], [ChatRecord "" t2 ""]]
assertEqual "doesn't match" expected (splitFarawayChats source) | 396 | splitWhenNeeded = it "splits when needed" $ do
let day = fromGregorian 2012 1 1
let t1 = UTCTime day 0
let t2 = UTCTime day (skypeMinIntervalToSplitChatsSecondsD+1)
let source = [[ChatRecord "" t1 "", ChatRecord "" t2 ""]]
let expected = [[ChatRecord "" t1 ""], [ChatRecord "" t2 ""]]
assertEqual "doesn't match" expected (splitFarawayChats source) | 372 | false | true | 0 | 13 | 81 | 152 | 73 | 79 | null | null |
uws-eresearch/docx2pandoc | src/Text/Pandoc/Readers/DocX/Parse.hs | gpl-2.0 | elemToDrawing :: NameSpaces -> Element -> Maybe ParPart
elemToDrawing ns element
| qName (elName element) == "drawing" &&
qURI (elName element) == (lookup "w" ns) =
let a_ns = "http://schemas.openxmlformats.org/drawingml/2006/main"
in
findElement (QName "blip" (Just a_ns) (Just "a")) element
>>= findAttr (QName "embed" (lookup "r" ns) (Just "r"))
>>= (\s -> Just $ Drawing s) | 416 | elemToDrawing :: NameSpaces -> Element -> Maybe ParPart
elemToDrawing ns element
| qName (elName element) == "drawing" &&
qURI (elName element) == (lookup "w" ns) =
let a_ns = "http://schemas.openxmlformats.org/drawingml/2006/main"
in
findElement (QName "blip" (Just a_ns) (Just "a")) element
>>= findAttr (QName "embed" (lookup "r" ns) (Just "r"))
>>= (\s -> Just $ Drawing s) | 416 | elemToDrawing ns element
| qName (elName element) == "drawing" &&
qURI (elName element) == (lookup "w" ns) =
let a_ns = "http://schemas.openxmlformats.org/drawingml/2006/main"
in
findElement (QName "blip" (Just a_ns) (Just "a")) element
>>= findAttr (QName "embed" (lookup "r" ns) (Just "r"))
>>= (\s -> Just $ Drawing s) | 360 | false | true | 0 | 14 | 93 | 159 | 76 | 83 | null | null |
snowleopard/alga | src/Algebra/Graph.hs | mit | -- TODO: Export
-- Filter vertices in a subgraph context.
filterContext :: Eq a => a -> (a -> Bool) -> (a -> Bool) -> Graph a -> Graph a
filterContext s i o g = maybe g go $ context (==s) g
where
go (Context is os) = induce (/=s) g `overlay` transpose (star s (filter i is))
`overlay` star s (filter o os)
| 363 | filterContext :: Eq a => a -> (a -> Bool) -> (a -> Bool) -> Graph a -> Graph a
filterContext s i o g = maybe g go $ context (==s) g
where
go (Context is os) = induce (/=s) g `overlay` transpose (star s (filter i is))
`overlay` star s (filter o os)
| 305 | filterContext s i o g = maybe g go $ context (==s) g
where
go (Context is os) = induce (/=s) g `overlay` transpose (star s (filter i is))
`overlay` star s (filter o os)
| 226 | true | true | 0 | 11 | 122 | 154 | 79 | 75 | null | null |
xenophobia/Egison-Quote | Language/Egison/Quote.hs | mit | toHaskellExp expr antiquotes typ = appE (converter typ) (evalEgisonTopLevel expr antiquotes (map (varE . mkName) antiquotes)) | 125 | toHaskellExp expr antiquotes typ = appE (converter typ) (evalEgisonTopLevel expr antiquotes (map (varE . mkName) antiquotes)) | 125 | toHaskellExp expr antiquotes typ = appE (converter typ) (evalEgisonTopLevel expr antiquotes (map (varE . mkName) antiquotes)) | 125 | false | false | 0 | 11 | 15 | 51 | 24 | 27 | null | null |
termite2/tsl | TSL2Boogie/Spec2Boogie.hs | bsd-3-clause | mkOpDecl (Right Gt , w) = mkBOpDecl "bvugt" (bvbopname Gt) w "bool" | 78 | mkOpDecl (Right Gt , w) = mkBOpDecl "bvugt" (bvbopname Gt) w "bool" | 78 | mkOpDecl (Right Gt , w) = mkBOpDecl "bvugt" (bvbopname Gt) w "bool" | 78 | false | false | 0 | 7 | 22 | 34 | 16 | 18 | null | null |
urbanslug/ghc | testsuite/tests/perf/compiler/T783.hs | bsd-3-clause | foo x | x == 257 = 257 | 22 | foo x | x == 257 = 257 | 22 | foo x | x == 257 = 257 | 22 | false | false | 0 | 8 | 7 | 23 | 9 | 14 | null | null |
AndreasVoellmy/nettle-openflow | src/Network/Data/OpenFlow/MatchBuilder.hs | bsd-3-clause | eth_src_ :: EthernetAddress -> MatchBuilder
eth_src_ addr = eth_addr_set addr "eth_src" updSrcEthAddress srcEthAddress | 118 | eth_src_ :: EthernetAddress -> MatchBuilder
eth_src_ addr = eth_addr_set addr "eth_src" updSrcEthAddress srcEthAddress | 118 | eth_src_ addr = eth_addr_set addr "eth_src" updSrcEthAddress srcEthAddress | 74 | false | true | 0 | 5 | 12 | 27 | 13 | 14 | null | null |
josuf107/Adverb | Adverb/Common.hs | gpl-3.0 | disheveledly = id | 17 | disheveledly = id | 17 | disheveledly = id | 17 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
DaMSL/K3 | src/Language/K3/Parser.hs | apache-2.0 | parseK3WithIncludes :: Bool -> [(Bool, String)] -> K3 Declaration -> IO (Either String (K3 Declaration))
parseK3WithIncludes noFeed fileContents initProg = do
let parseE = foldl chainValidParse (return (initProg, Nothing)) fileContents
case parseE of
Left msg -> return $! Left msg
Right (prog, _) -> return $! Right prog
where
chainValidParse parse (asDriver, src) = parse >>= parseAndCompose src asDriver
parseAndCompose src asDriver (prog, parseEnvOpt) = do
(prog', nEnv) <- parseAtLevel asDriver parseEnvOpt src
nprog <- concatProgram prog prog'
return (nprog, Just $ nEnv)
parseAtLevel asDriver parseEnvOpt src =
stringifyError $ flip (runK3Parser parseEnvOpt) src $ do
decl <- program $ not asDriver || noFeed
env <- P.getState
return (decl, env) | 829 | parseK3WithIncludes :: Bool -> [(Bool, String)] -> K3 Declaration -> IO (Either String (K3 Declaration))
parseK3WithIncludes noFeed fileContents initProg = do
let parseE = foldl chainValidParse (return (initProg, Nothing)) fileContents
case parseE of
Left msg -> return $! Left msg
Right (prog, _) -> return $! Right prog
where
chainValidParse parse (asDriver, src) = parse >>= parseAndCompose src asDriver
parseAndCompose src asDriver (prog, parseEnvOpt) = do
(prog', nEnv) <- parseAtLevel asDriver parseEnvOpt src
nprog <- concatProgram prog prog'
return (nprog, Just $ nEnv)
parseAtLevel asDriver parseEnvOpt src =
stringifyError $ flip (runK3Parser parseEnvOpt) src $ do
decl <- program $ not asDriver || noFeed
env <- P.getState
return (decl, env) | 829 | parseK3WithIncludes noFeed fileContents initProg = do
let parseE = foldl chainValidParse (return (initProg, Nothing)) fileContents
case parseE of
Left msg -> return $! Left msg
Right (prog, _) -> return $! Right prog
where
chainValidParse parse (asDriver, src) = parse >>= parseAndCompose src asDriver
parseAndCompose src asDriver (prog, parseEnvOpt) = do
(prog', nEnv) <- parseAtLevel asDriver parseEnvOpt src
nprog <- concatProgram prog prog'
return (nprog, Just $ nEnv)
parseAtLevel asDriver parseEnvOpt src =
stringifyError $ flip (runK3Parser parseEnvOpt) src $ do
decl <- program $ not asDriver || noFeed
env <- P.getState
return (decl, env) | 724 | false | true | 2 | 13 | 186 | 309 | 146 | 163 | null | null |
zerobuzz/hs-webdriver | test/etc/Async.hs | bsd-3-clause | main :: IO ()
main = runSession defaultConfig . finallyClose $ do
openPage "http://www.wikipedia.org/"
r <- asyncJS [] "arguments[0]();"
if r /= Just A.Null
then error $ "Async returned " ++ show r
else return () | 236 | main :: IO ()
main = runSession defaultConfig . finallyClose $ do
openPage "http://www.wikipedia.org/"
r <- asyncJS [] "arguments[0]();"
if r /= Just A.Null
then error $ "Async returned " ++ show r
else return () | 236 | main = runSession defaultConfig . finallyClose $ do
openPage "http://www.wikipedia.org/"
r <- asyncJS [] "arguments[0]();"
if r /= Just A.Null
then error $ "Async returned " ++ show r
else return () | 222 | false | true | 0 | 12 | 59 | 89 | 39 | 50 | null | null |
dmcclean/kaos | src/Kaos/Signals/SignalFunctions.hs | mit | interpretTI Integral = undefined | 32 | interpretTI Integral = undefined | 32 | interpretTI Integral = undefined | 32 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
markus1189/optparse-applicative | tests/Tests.hs | bsd-3-clause | case_args :: Assertion
case_args = do
let result = run Commands.opts ["hello", "foo", "bar"]
case result of
Success (Commands.Hello args) ->
["foo", "bar"] @=? args
Success Commands.Goodbye ->
assertFailure "unexpected result: Goodbye"
_ ->
assertFailure "unexpected parse error" | 313 | case_args :: Assertion
case_args = do
let result = run Commands.opts ["hello", "foo", "bar"]
case result of
Success (Commands.Hello args) ->
["foo", "bar"] @=? args
Success Commands.Goodbye ->
assertFailure "unexpected result: Goodbye"
_ ->
assertFailure "unexpected parse error" | 313 | case_args = do
let result = run Commands.opts ["hello", "foo", "bar"]
case result of
Success (Commands.Hello args) ->
["foo", "bar"] @=? args
Success Commands.Goodbye ->
assertFailure "unexpected result: Goodbye"
_ ->
assertFailure "unexpected parse error" | 290 | false | true | 0 | 14 | 71 | 100 | 47 | 53 | null | null |
shicks/shsh | Language/Sh/Parser/Parsec.hs | bsd-3-clause | tok :: Char -> String
tok c | c `elem` "\n\r" = "newline"
| otherwise = [c] | 87 | tok :: Char -> String
tok c | c `elem` "\n\r" = "newline"
| otherwise = [c] | 87 | tok c | c `elem` "\n\r" = "newline"
| otherwise = [c] | 65 | false | true | 1 | 8 | 28 | 46 | 22 | 24 | null | null |
facebookincubator/duckling | Duckling/Time/EN/Rules.hs | bsd-3-clause | ruleLastCycleOfTime :: Rule
ruleLastCycleOfTime = Rule
{ name = "last <cycle> of <time>"
, pattern =
[ regex "last"
, dimension TimeGrain
, regex "of|in"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleLastOf grain td
_ -> Nothing
} | 343 | ruleLastCycleOfTime :: Rule
ruleLastCycleOfTime = Rule
{ name = "last <cycle> of <time>"
, pattern =
[ regex "last"
, dimension TimeGrain
, regex "of|in"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleLastOf grain td
_ -> Nothing
} | 343 | ruleLastCycleOfTime = Rule
{ name = "last <cycle> of <time>"
, pattern =
[ regex "last"
, dimension TimeGrain
, regex "of|in"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleLastOf grain td
_ -> Nothing
} | 315 | false | true | 0 | 17 | 99 | 124 | 62 | 62 | null | null |
danr/emna | examples/Rotate.hs | bsd-3-clause | rotlen xs = rotate (length xs) xs === xs | 40 | rotlen xs = rotate (length xs) xs === xs | 40 | rotlen xs = rotate (length xs) xs === xs | 40 | false | false | 0 | 8 | 8 | 24 | 11 | 13 | null | null |
AlexanderPankiv/ghc | compiler/types/TypeRep.hs | bsd-3-clause | pprTyList :: TyPrec -> Type -> Type -> SDoc
-- Given a type-level list (t1 ': t2), see if we can print
-- it in list notation [t1, ...].
pprTyList p ty1 ty2
= case gather ty2 of
(arg_tys, Nothing) -> char '\'' <> brackets (fsep (punctuate comma
(map (ppr_type TopPrec) (ty1:arg_tys))))
(arg_tys, Just tl) -> maybeParen p FunPrec $
hang (ppr_type FunPrec ty1)
2 (fsep [ colon <+> ppr_type FunPrec ty | ty <- arg_tys ++ [tl]])
where
gather :: Type -> ([Type], Maybe Type)
-- (gather ty) = (tys, Nothing) means ty is a list [t1, .., tn]
-- = (tys, Just tl) means ty is of form t1:t2:...tn:tl
gather (TyConApp tc tys)
| tc `hasKey` consDataConKey
, [_kind, ty1,ty2] <- tys
, (args, tl) <- gather ty2
= (ty1:args, tl)
| tc `hasKey` nilDataConKey
= ([], Nothing)
gather ty = ([], Just ty)
---------------- | 989 | pprTyList :: TyPrec -> Type -> Type -> SDoc
pprTyList p ty1 ty2
= case gather ty2 of
(arg_tys, Nothing) -> char '\'' <> brackets (fsep (punctuate comma
(map (ppr_type TopPrec) (ty1:arg_tys))))
(arg_tys, Just tl) -> maybeParen p FunPrec $
hang (ppr_type FunPrec ty1)
2 (fsep [ colon <+> ppr_type FunPrec ty | ty <- arg_tys ++ [tl]])
where
gather :: Type -> ([Type], Maybe Type)
-- (gather ty) = (tys, Nothing) means ty is a list [t1, .., tn]
-- = (tys, Just tl) means ty is of form t1:t2:...tn:tl
gather (TyConApp tc tys)
| tc `hasKey` consDataConKey
, [_kind, ty1,ty2] <- tys
, (args, tl) <- gather ty2
= (ty1:args, tl)
| tc `hasKey` nilDataConKey
= ([], Nothing)
gather ty = ([], Just ty)
---------------- | 896 | pprTyList p ty1 ty2
= case gather ty2 of
(arg_tys, Nothing) -> char '\'' <> brackets (fsep (punctuate comma
(map (ppr_type TopPrec) (ty1:arg_tys))))
(arg_tys, Just tl) -> maybeParen p FunPrec $
hang (ppr_type FunPrec ty1)
2 (fsep [ colon <+> ppr_type FunPrec ty | ty <- arg_tys ++ [tl]])
where
gather :: Type -> ([Type], Maybe Type)
-- (gather ty) = (tys, Nothing) means ty is a list [t1, .., tn]
-- = (tys, Just tl) means ty is of form t1:t2:...tn:tl
gather (TyConApp tc tys)
| tc `hasKey` consDataConKey
, [_kind, ty1,ty2] <- tys
, (args, tl) <- gather ty2
= (ty1:args, tl)
| tc `hasKey` nilDataConKey
= ([], Nothing)
gather ty = ([], Just ty)
---------------- | 852 | true | true | 0 | 17 | 336 | 309 | 163 | 146 | null | null |
HIPERFIT/futhark | src/Futhark/TypeCheck.hs | isc | checkType (Acc cert shape ts _) = do
requireI [Prim Unit] cert
mapM_ (require [Prim int64]) $ shapeDims shape
mapM_ checkType ts | 134 | checkType (Acc cert shape ts _) = do
requireI [Prim Unit] cert
mapM_ (require [Prim int64]) $ shapeDims shape
mapM_ checkType ts | 134 | checkType (Acc cert shape ts _) = do
requireI [Prim Unit] cert
mapM_ (require [Prim int64]) $ shapeDims shape
mapM_ checkType ts | 134 | false | false | 0 | 12 | 27 | 69 | 30 | 39 | null | null |
andyarvanitis/Idris-dev | src/IRTS/Bytecode.hs | bsd-3-clause | bc reg (SProj (Loc l) i) r = PROJECTINTO reg (L l) i : clean r | 62 | bc reg (SProj (Loc l) i) r = PROJECTINTO reg (L l) i : clean r | 62 | bc reg (SProj (Loc l) i) r = PROJECTINTO reg (L l) i : clean r | 62 | false | false | 0 | 9 | 15 | 47 | 22 | 25 | null | null |
rfw/cosanostra | glue/plan.hs | mit | main :: IO ()
main = do
[gamePath, actionGroupsPath, planPath] <- getArgs
game <- either error id <$> decodeEither <$> BS.readFile gamePath
groups <- either error id <$> decodeEither <$> BS.readFile actionGroupsPath
p <- either error id <$> decodeEither <$> BS.readFile planPath
args <- either error id <$> decodeEither <$> BS.hGetContents stdin
let actionGroup = args ^. planArgsActionGroup
let source = args ^. planArgsSource
let m = case args ^. planArgsTargets of Just targets' -> plan groups
actionGroup
(args ^. planArgsAction)
source
targets'
Nothing -> unplan actionGroup source
let (_, p') = either (error . show) id $ evalState (runPlanner m p) game
p' `seq` BS.writeFile planPath $ encode p' | 1,055 | main :: IO ()
main = do
[gamePath, actionGroupsPath, planPath] <- getArgs
game <- either error id <$> decodeEither <$> BS.readFile gamePath
groups <- either error id <$> decodeEither <$> BS.readFile actionGroupsPath
p <- either error id <$> decodeEither <$> BS.readFile planPath
args <- either error id <$> decodeEither <$> BS.hGetContents stdin
let actionGroup = args ^. planArgsActionGroup
let source = args ^. planArgsSource
let m = case args ^. planArgsTargets of Just targets' -> plan groups
actionGroup
(args ^. planArgsAction)
source
targets'
Nothing -> unplan actionGroup source
let (_, p') = either (error . show) id $ evalState (runPlanner m p) game
p' `seq` BS.writeFile planPath $ encode p' | 1,055 | main = do
[gamePath, actionGroupsPath, planPath] <- getArgs
game <- either error id <$> decodeEither <$> BS.readFile gamePath
groups <- either error id <$> decodeEither <$> BS.readFile actionGroupsPath
p <- either error id <$> decodeEither <$> BS.readFile planPath
args <- either error id <$> decodeEither <$> BS.hGetContents stdin
let actionGroup = args ^. planArgsActionGroup
let source = args ^. planArgsSource
let m = case args ^. planArgsTargets of Just targets' -> plan groups
actionGroup
(args ^. planArgsAction)
source
targets'
Nothing -> unplan actionGroup source
let (_, p') = either (error . show) id $ evalState (runPlanner m p) game
p' `seq` BS.writeFile planPath $ encode p' | 1,041 | false | true | 0 | 15 | 462 | 279 | 131 | 148 | null | null |
np/mime-bytestring | Codec/MIME/Base64.hs | bsd-3-clause | decodeB :: ByteString -> ByteString
decodeB = decodeBPrim '+' '/' | 65 | decodeB :: ByteString -> ByteString
decodeB = decodeBPrim '+' '/' | 65 | decodeB = decodeBPrim '+' '/' | 29 | false | true | 0 | 7 | 9 | 27 | 11 | 16 | null | null |
mhuesch/scheme_compiler | src/L4ToL3/Compile.hs | bsd-3-clause | coerceEtoV e = error $ "invalid: " ++ show e | 44 | coerceEtoV e = error $ "invalid: " ++ show e | 44 | coerceEtoV e = error $ "invalid: " ++ show e | 44 | false | false | 0 | 6 | 9 | 20 | 9 | 11 | null | null |
duikboot/holyhaskell | test/Test.hs | mit | tests :: TestTree
tests = testGroup "All Tests"
[ swallowSuite
, coconutSuite
] | 115 | tests :: TestTree
tests = testGroup "All Tests"
[ swallowSuite
, coconutSuite
] | 115 | tests = testGroup "All Tests"
[ swallowSuite
, coconutSuite
] | 97 | false | true | 0 | 6 | 48 | 22 | 12 | 10 | null | null |
ekr/tamarin-prover | lib/theory/src/Theory/Constraint/System/Constraints.hs | gpl-3.0 | -- | Pretty print a less-atom as @src < tgt@.
prettyLess :: HighlightDocument d => Less -> d
prettyLess (i, j) = prettyNAtom $ Less (varTerm i) (varTerm j) | 155 | prettyLess :: HighlightDocument d => Less -> d
prettyLess (i, j) = prettyNAtom $ Less (varTerm i) (varTerm j) | 109 | prettyLess (i, j) = prettyNAtom $ Less (varTerm i) (varTerm j) | 62 | true | true | 0 | 8 | 28 | 57 | 28 | 29 | null | null |
IreneKnapp/Faction | libfaction/Distribution/Simple/GHC.hs | bsd-3-clause | stripExe :: Verbosity -> LocalBuildInfo -> FilePath -> FilePath -> IO ()
stripExe verbosity lbi name path = when (stripExes lbi) $
case lookupProgram stripProgram (withPrograms lbi) of
Just strip -> rawSystemProgram verbosity strip args
Nothing -> unless (buildOS == Windows) $
-- Don't bother warning on windows, we don't expect them to
-- have the strip program anyway.
warn verbosity $ "Unable to strip executable '" ++ name
++ "' (missing the 'strip' program)"
where
args = path : case buildOS of
OSX -> ["-x"] -- By default, stripping the ghc binary on at least
-- some OS X installations causes:
-- HSbase-3.0.o: unknown symbol `_environ'"
-- The -x flag fixes that.
_ -> []
-- |Install for ghc, .hi, .a and, if --with-ghci given, .o | 928 | stripExe :: Verbosity -> LocalBuildInfo -> FilePath -> FilePath -> IO ()
stripExe verbosity lbi name path = when (stripExes lbi) $
case lookupProgram stripProgram (withPrograms lbi) of
Just strip -> rawSystemProgram verbosity strip args
Nothing -> unless (buildOS == Windows) $
-- Don't bother warning on windows, we don't expect them to
-- have the strip program anyway.
warn verbosity $ "Unable to strip executable '" ++ name
++ "' (missing the 'strip' program)"
where
args = path : case buildOS of
OSX -> ["-x"] -- By default, stripping the ghc binary on at least
-- some OS X installations causes:
-- HSbase-3.0.o: unknown symbol `_environ'"
-- The -x flag fixes that.
_ -> []
-- |Install for ghc, .hi, .a and, if --with-ghci given, .o | 928 | stripExe verbosity lbi name path = when (stripExes lbi) $
case lookupProgram stripProgram (withPrograms lbi) of
Just strip -> rawSystemProgram verbosity strip args
Nothing -> unless (buildOS == Windows) $
-- Don't bother warning on windows, we don't expect them to
-- have the strip program anyway.
warn verbosity $ "Unable to strip executable '" ++ name
++ "' (missing the 'strip' program)"
where
args = path : case buildOS of
OSX -> ["-x"] -- By default, stripping the ghc binary on at least
-- some OS X installations causes:
-- HSbase-3.0.o: unknown symbol `_environ'"
-- The -x flag fixes that.
_ -> []
-- |Install for ghc, .hi, .a and, if --with-ghci given, .o | 855 | false | true | 8 | 10 | 315 | 153 | 80 | 73 | null | null |
jtojnar/haste-compiler | libraries/ghc-7.8/base/Foreign/Marshal/Array.hs | bsd-3-clause | -- marshalling
-- -----------
-- |Convert an array of given length into a Haskell list. The implementation
-- is tail-recursive and so uses constant stack space.
--
peekArray :: Storable a => Int -> Ptr a -> IO [a]
peekArray size ptr | size <= 0 = return []
| otherwise = f (size-1) []
where
f 0 acc = do e <- peekElemOff ptr 0; return (e:acc)
f n acc = do e <- peekElemOff ptr n; f (n-1) (e:acc)
-- |Convert an array terminated by the given end marker into a Haskell list
-- | 516 | peekArray :: Storable a => Int -> Ptr a -> IO [a]
peekArray size ptr | size <= 0 = return []
| otherwise = f (size-1) []
where
f 0 acc = do e <- peekElemOff ptr 0; return (e:acc)
f n acc = do e <- peekElemOff ptr n; f (n-1) (e:acc)
-- |Convert an array terminated by the given end marker into a Haskell list
-- | 349 | peekArray size ptr | size <= 0 = return []
| otherwise = f (size-1) []
where
f 0 acc = do e <- peekElemOff ptr 0; return (e:acc)
f n acc = do e <- peekElemOff ptr n; f (n-1) (e:acc)
-- |Convert an array terminated by the given end marker into a Haskell list
-- | 290 | true | true | 1 | 10 | 136 | 169 | 83 | 86 | null | null |
markflorisson/hpack | testrepo/bytestring-0.10.4.1/tests/builder/Data/ByteString/Builder/Prim/TestUtils.hs | bsd-3-clause | compareImpls :: (Arbitrary a, Show a, Show b, Eq b)
=> TestName -> (a -> b) -> (a -> b) -> Test
compareImpls name f1 f2 =
testProperty name check
where
check x
| y1 == y2 = True
| otherwise = error $ unlines $
[ "compareImpls: results disagree for " ++ quote (show x)
, " f1: " ++ show y1
, " f2: " ++ show y2
]
where
y1 = f1 x
y2 = f2 x
------------------------------------------------------------------------------
-- Encoding reference implementations
------------------------------------------------------------------------------
-- | Char8 encoding: truncate Unicode codepoint to 8-bits. | 694 | compareImpls :: (Arbitrary a, Show a, Show b, Eq b)
=> TestName -> (a -> b) -> (a -> b) -> Test
compareImpls name f1 f2 =
testProperty name check
where
check x
| y1 == y2 = True
| otherwise = error $ unlines $
[ "compareImpls: results disagree for " ++ quote (show x)
, " f1: " ++ show y1
, " f2: " ++ show y2
]
where
y1 = f1 x
y2 = f2 x
------------------------------------------------------------------------------
-- Encoding reference implementations
------------------------------------------------------------------------------
-- | Char8 encoding: truncate Unicode codepoint to 8-bits. | 694 | compareImpls name f1 f2 =
testProperty name check
where
check x
| y1 == y2 = True
| otherwise = error $ unlines $
[ "compareImpls: results disagree for " ++ quote (show x)
, " f1: " ++ show y1
, " f2: " ++ show y2
]
where
y1 = f1 x
y2 = f2 x
------------------------------------------------------------------------------
-- Encoding reference implementations
------------------------------------------------------------------------------
-- | Char8 encoding: truncate Unicode codepoint to 8-bits. | 585 | false | true | 2 | 11 | 196 | 191 | 90 | 101 | null | null |
urbanslug/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | unboxedUnitDataCon :: DataCon
unboxedUnitDataCon = tupleDataCon Unboxed 0 | 75 | unboxedUnitDataCon :: DataCon
unboxedUnitDataCon = tupleDataCon Unboxed 0 | 75 | unboxedUnitDataCon = tupleDataCon Unboxed 0 | 45 | false | true | 0 | 6 | 9 | 23 | 9 | 14 | null | null |
urbanslug/ghc | compiler/types/TyCon.hs | bsd-3-clause | tyConDataCons :: TyCon -> [DataCon]
-- It's convenient for tyConDataCons to return the
-- empty list for type synonyms etc
tyConDataCons tycon = tyConDataCons_maybe tycon `orElse` [] | 182 | tyConDataCons :: TyCon -> [DataCon]
tyConDataCons tycon = tyConDataCons_maybe tycon `orElse` [] | 95 | tyConDataCons tycon = tyConDataCons_maybe tycon `orElse` [] | 59 | true | true | 0 | 8 | 26 | 40 | 20 | 20 | null | null |
toddmohney/json-api | test/Network/JSONApi/DocumentSpec.hs | mit | encodeDocumentObject :: (ToJSON a) => Document a -> ByteString
encodeDocumentObject = prettyEncode | 98 | encodeDocumentObject :: (ToJSON a) => Document a -> ByteString
encodeDocumentObject = prettyEncode | 98 | encodeDocumentObject = prettyEncode | 35 | false | true | 0 | 7 | 11 | 27 | 14 | 13 | null | null |
phischu/fragnix | tests/packages/scotty/Data.IntPSQ.Internal.hs | bsd-3-clause | keys :: IntPSQ p v -> [Int]
keys t = [k | (k, _, _) <- toList t] | 64 | keys :: IntPSQ p v -> [Int]
keys t = [k | (k, _, _) <- toList t] | 64 | keys t = [k | (k, _, _) <- toList t] | 36 | false | true | 0 | 9 | 17 | 55 | 27 | 28 | null | null |
aelve/json-x | bench/Bench.hs | bsd-3-clause | eitherToMaybe :: Either a b -> Maybe b
eitherToMaybe (Left _) = Nothing | 71 | eitherToMaybe :: Either a b -> Maybe b
eitherToMaybe (Left _) = Nothing | 71 | eitherToMaybe (Left _) = Nothing | 32 | false | true | 0 | 7 | 12 | 32 | 15 | 17 | null | null |
ingemaradahl/bilder | src/Compiler/Dependencies.hs | lgpl-3.0 | expDeps (EPartCall cid es _) =
(None, Var (cIdentToString cid):Fun (cIdentToString cid):concatMap snd es') : es'
where
es' = concatMap expDeps es | 150 | expDeps (EPartCall cid es _) =
(None, Var (cIdentToString cid):Fun (cIdentToString cid):concatMap snd es') : es'
where
es' = concatMap expDeps es | 150 | expDeps (EPartCall cid es _) =
(None, Var (cIdentToString cid):Fun (cIdentToString cid):concatMap snd es') : es'
where
es' = concatMap expDeps es | 150 | false | false | 1 | 11 | 26 | 79 | 35 | 44 | null | null |
jtobin/sampling | lib/Numeric/Sampling.hs | mit | -- | (/O(n log n)/) Unequal probability resampling.
presample
:: (PrimMonad m, Foldable f)
=> Int -> f (Double, a) -> Gen (PrimState m) -> m [a]
presample n weighted gen
| n <= 0 = return []
| otherwise = do
let (bprobs, vals) = unzip $ sortProbs weighted
probs = drop 1 (F.scan F.sum bprobs)
cumulative = zip probs vals
computeSample n cumulative gen
where
computeSample
:: PrimMonad m => Int -> [(Double, a)] -> Gen (PrimState m) -> m [a]
computeSample size xs g = go [] size where
go !acc s
| s <= 0 = return acc
| otherwise = do
z <- uniform g
case F.fold (F.find ((>= z) . fst)) xs of
Just (_, val) -> go (val:acc) (pred s)
Nothing -> return acc
| 818 | presample
:: (PrimMonad m, Foldable f)
=> Int -> f (Double, a) -> Gen (PrimState m) -> m [a]
presample n weighted gen
| n <= 0 = return []
| otherwise = do
let (bprobs, vals) = unzip $ sortProbs weighted
probs = drop 1 (F.scan F.sum bprobs)
cumulative = zip probs vals
computeSample n cumulative gen
where
computeSample
:: PrimMonad m => Int -> [(Double, a)] -> Gen (PrimState m) -> m [a]
computeSample size xs g = go [] size where
go !acc s
| s <= 0 = return acc
| otherwise = do
z <- uniform g
case F.fold (F.find ((>= z) . fst)) xs of
Just (_, val) -> go (val:acc) (pred s)
Nothing -> return acc
| 766 | presample n weighted gen
| n <= 0 = return []
| otherwise = do
let (bprobs, vals) = unzip $ sortProbs weighted
probs = drop 1 (F.scan F.sum bprobs)
cumulative = zip probs vals
computeSample n cumulative gen
where
computeSample
:: PrimMonad m => Int -> [(Double, a)] -> Gen (PrimState m) -> m [a]
computeSample size xs g = go [] size where
go !acc s
| s <= 0 = return acc
| otherwise = do
z <- uniform g
case F.fold (F.find ((>= z) . fst)) xs of
Just (_, val) -> go (val:acc) (pred s)
Nothing -> return acc
| 669 | true | true | 5 | 16 | 298 | 349 | 170 | 179 | null | null |
gibiansky/IHaskell | ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Style/SliderStyle.hs | mit | -- | Create a new button style
mkSliderStyle :: IO SliderStyle
mkSliderStyle = do
wid <- U.random
let stl = defaultDescriptionStyleWidget "SliderStyleModel"
but = (HandleColor =:: Nothing)
:& RNil
btnStlState = WidgetState (stl <+> but)
stateIO <- newIORef btnStlState
let style = IPythonWidget wid stateIO
-- Open a comm for this widget, and store it in the kernel state
widgetSendOpen style $ toJSON btnStlState
-- Return the style widget
return style | 498 | mkSliderStyle :: IO SliderStyle
mkSliderStyle = do
wid <- U.random
let stl = defaultDescriptionStyleWidget "SliderStyleModel"
but = (HandleColor =:: Nothing)
:& RNil
btnStlState = WidgetState (stl <+> but)
stateIO <- newIORef btnStlState
let style = IPythonWidget wid stateIO
-- Open a comm for this widget, and store it in the kernel state
widgetSendOpen style $ toJSON btnStlState
-- Return the style widget
return style | 467 | mkSliderStyle = do
wid <- U.random
let stl = defaultDescriptionStyleWidget "SliderStyleModel"
but = (HandleColor =:: Nothing)
:& RNil
btnStlState = WidgetState (stl <+> but)
stateIO <- newIORef btnStlState
let style = IPythonWidget wid stateIO
-- Open a comm for this widget, and store it in the kernel state
widgetSendOpen style $ toJSON btnStlState
-- Return the style widget
return style | 435 | true | true | 0 | 12 | 115 | 112 | 53 | 59 | null | null |
weswigham/simplex | haskell/simplex.hs | mit | e = exp 1 | 9 | e = exp 1 | 9 | e = exp 1 | 9 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
ejconlon/analyze | src/Analyze/Decoding.hs | bsd-3-clause | -- | Simple 'Decoder' that just looks up and returns the value for a given key.
require :: Applicative m => k -> Decoder m k v v
require k = fromArg (Arg k pure) | 161 | require :: Applicative m => k -> Decoder m k v v
require k = fromArg (Arg k pure) | 81 | require k = fromArg (Arg k pure) | 32 | true | true | 0 | 7 | 34 | 46 | 22 | 24 | null | null |
brendanhay/gogol | gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs | mpl-2.0 | -- | The comment\'s text. The format is either plain text or HTML dependent
-- on what has been requested. Even the plain text representation may
-- differ from the text originally posted in that it may replace video
-- links with video titles etc.
cTextDisplay :: Lens' CommentSnippet (Maybe Text)
cTextDisplay
= lens _cTextDisplay (\ s a -> s{_cTextDisplay = a}) | 366 | cTextDisplay :: Lens' CommentSnippet (Maybe Text)
cTextDisplay
= lens _cTextDisplay (\ s a -> s{_cTextDisplay = a}) | 117 | cTextDisplay
= lens _cTextDisplay (\ s a -> s{_cTextDisplay = a}) | 67 | true | true | 0 | 9 | 63 | 51 | 28 | 23 | null | null |
darthdeus/ghc-mod-ng | src/GHCModi.hs | bsd-3-clause | checkStx :: Options
-> Set FilePath
-> FilePath
-> GhcMod (String, Bool, Set FilePath)
checkStx _ set file = do
set' <- toGhcMod $ newFileSet set file
let files = S.toList set'
eret <- check files
case eret of
Right ret -> return (ret, True, set')
Left ret -> return (ret, True, set) -- fxime: set | 357 | checkStx :: Options
-> Set FilePath
-> FilePath
-> GhcMod (String, Bool, Set FilePath)
checkStx _ set file = do
set' <- toGhcMod $ newFileSet set file
let files = S.toList set'
eret <- check files
case eret of
Right ret -> return (ret, True, set')
Left ret -> return (ret, True, set) -- fxime: set | 357 | checkStx _ set file = do
set' <- toGhcMod $ newFileSet set file
let files = S.toList set'
eret <- check files
case eret of
Right ret -> return (ret, True, set')
Left ret -> return (ret, True, set) -- fxime: set | 243 | false | true | 0 | 12 | 115 | 143 | 68 | 75 | null | null |
beala/twitter-bot | src/OAuth.hs | bsd-3-clause | twitterOAuth :: ConsumerKey -> ConsumerSecret -> OAuth
twitterOAuth key secret = def
{ oauthServerName = "twitter"
, oauthRequestUri = "https://api.twitter.com/oauth/request_token"
, oauthAccessTokenUri = "https://api.twitter.com/oauth/access_token"
, oauthAuthorizeUri = "https://api.twitter.com/oauth/authorize"
, oauthConsumerKey = key
, oauthConsumerSecret = secret
, oauthSignatureMethod = HMACSHA1
, oauthCallback = Just "oob" -- PIN auth
} | 680 | twitterOAuth :: ConsumerKey -> ConsumerSecret -> OAuth
twitterOAuth key secret = def
{ oauthServerName = "twitter"
, oauthRequestUri = "https://api.twitter.com/oauth/request_token"
, oauthAccessTokenUri = "https://api.twitter.com/oauth/access_token"
, oauthAuthorizeUri = "https://api.twitter.com/oauth/authorize"
, oauthConsumerKey = key
, oauthConsumerSecret = secret
, oauthSignatureMethod = HMACSHA1
, oauthCallback = Just "oob" -- PIN auth
} | 680 | twitterOAuth key secret = def
{ oauthServerName = "twitter"
, oauthRequestUri = "https://api.twitter.com/oauth/request_token"
, oauthAccessTokenUri = "https://api.twitter.com/oauth/access_token"
, oauthAuthorizeUri = "https://api.twitter.com/oauth/authorize"
, oauthConsumerKey = key
, oauthConsumerSecret = secret
, oauthSignatureMethod = HMACSHA1
, oauthCallback = Just "oob" -- PIN auth
} | 625 | false | true | 0 | 7 | 282 | 78 | 47 | 31 | null | null |
bamboo/idris-cil | src/IRTS/CodegenCil.hs | bsd-3-clause | quoted :: String -> String
quoted name = "'" <> (name >>= validChar) <> "'"
where validChar :: Char -> String
validChar c = if c == '\''
then "\\'"
else [c] | 216 | quoted :: String -> String
quoted name = "'" <> (name >>= validChar) <> "'"
where validChar :: Char -> String
validChar c = if c == '\''
then "\\'"
else [c] | 216 | quoted name = "'" <> (name >>= validChar) <> "'"
where validChar :: Char -> String
validChar c = if c == '\''
then "\\'"
else [c] | 189 | false | true | 2 | 7 | 91 | 78 | 38 | 40 | null | null |
unvirtual/Ziped | src/Cursor.hs | bsd-2-clause | moveTo n dir crs = move dir crs >>= moveTo (n - 1) dir | 54 | moveTo n dir crs = move dir crs >>= moveTo (n - 1) dir | 54 | moveTo n dir crs = move dir crs >>= moveTo (n - 1) dir | 54 | false | false | 0 | 8 | 13 | 34 | 16 | 18 | null | null |
nickbart1980/pandoc | src/Text/Pandoc/Writers/FB2.hs | gpl-2.0 | toXml (Cite _ ss) = cMapM toXml ss | 34 | toXml (Cite _ ss) = cMapM toXml ss | 34 | toXml (Cite _ ss) = cMapM toXml ss | 34 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
range12/there-is-no-B-side | tools/generators/GuestEncoder/GenTM5Parser.hs | mit | arrayOfText :: Array -> Parser [Text]
arrayOfText a = mapM valueToText (V.toList a) | 83 | arrayOfText :: Array -> Parser [Text]
arrayOfText a = mapM valueToText (V.toList a) | 83 | arrayOfText a = mapM valueToText (V.toList a) | 45 | false | true | 0 | 8 | 12 | 37 | 18 | 19 | null | null |
rahulmutt/ghcvm | compiler/Eta/Types/TypeRep.hs | bsd-3-clause | pprTyLit :: TyLit -> SDoc
pprTyLit = ppr_tylit TopPrec | 54 | pprTyLit :: TyLit -> SDoc
pprTyLit = ppr_tylit TopPrec | 54 | pprTyLit = ppr_tylit TopPrec | 28 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
meditans/hint | src/Hint/Eval.hs | bsd-3-clause | -- | Evaluates an expression, given a witness for its monomorphic type.
interpret :: (MonadInterpreter m, Typeable a) => String -> a -> m a
interpret expr wit = unsafeInterpret expr (show $ Data.Typeable.typeOf wit) | 215 | interpret :: (MonadInterpreter m, Typeable a) => String -> a -> m a
interpret expr wit = unsafeInterpret expr (show $ Data.Typeable.typeOf wit) | 143 | interpret expr wit = unsafeInterpret expr (show $ Data.Typeable.typeOf wit) | 75 | true | true | 0 | 9 | 34 | 61 | 31 | 30 | null | null |
iand675/hs-flowdock | src/Chat/Flowdock/Internal.hs | mit | snakeCase x = x | 15 | snakeCase x = x | 15 | snakeCase x = x | 15 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
spaceships/circuit-synthesis | src/Circuit/Format/Netlist.hs | mit | readNetlist :: Gate g => FilePath -> IO (Circuit g, [TestCase])
readNetlist file = do
s <- readFile file
let (_,_,st) = execCircParser (NetlistSt IM.empty IM.empty IM.empty) parseNetlist s
return (buildNetlist st, [])
--------------------------------------------------------------------------------
-- read the netlist file first: parse it into a NetlistSt, then translate it into
-- a circuit. | 407 | readNetlist :: Gate g => FilePath -> IO (Circuit g, [TestCase])
readNetlist file = do
s <- readFile file
let (_,_,st) = execCircParser (NetlistSt IM.empty IM.empty IM.empty) parseNetlist s
return (buildNetlist st, [])
--------------------------------------------------------------------------------
-- read the netlist file first: parse it into a NetlistSt, then translate it into
-- a circuit. | 407 | readNetlist file = do
s <- readFile file
let (_,_,st) = execCircParser (NetlistSt IM.empty IM.empty IM.empty) parseNetlist s
return (buildNetlist st, [])
--------------------------------------------------------------------------------
-- read the netlist file first: parse it into a NetlistSt, then translate it into
-- a circuit. | 343 | false | true | 0 | 14 | 64 | 117 | 57 | 60 | null | null |
d12frosted/kitsunebook-v1 | src/ArgsParser.hs | gpl-3.0 | trashDomainParser :: Parser Command
trashDomainParser =
generateCmdParser
["view","path","list","filter","move","remove","clear","restore"] | 145 | trashDomainParser :: Parser Command
trashDomainParser =
generateCmdParser
["view","path","list","filter","move","remove","clear","restore"] | 145 | trashDomainParser =
generateCmdParser
["view","path","list","filter","move","remove","clear","restore"] | 109 | false | true | 0 | 5 | 13 | 41 | 24 | 17 | null | null |
qnikst/2pc-haskell | Network/TwoPhase.hs | bsd-3-clause | generateTID :: IO ByteString
generateTID = MWC.withSystemRandom . MWC.asGenIO $ \gen ->
S.pack <$> replicateM 20 (MWC.uniform gen) | 150 | generateTID :: IO ByteString
generateTID = MWC.withSystemRandom . MWC.asGenIO $ \gen ->
S.pack <$> replicateM 20 (MWC.uniform gen) | 150 | generateTID = MWC.withSystemRandom . MWC.asGenIO $ \gen ->
S.pack <$> replicateM 20 (MWC.uniform gen) | 121 | false | true | 0 | 11 | 37 | 50 | 25 | 25 | null | null |
adarqui/ghcjs-jquery | JavaScript/JQuery.hs | mit | getOuterHeight :: Bool -- ^ include margin?
-> JQuery
-> IO Double
getOuterHeight b = jq_getOuterHeight b | 137 | getOuterHeight :: Bool -- ^ include margin?
-> JQuery
-> IO Double
getOuterHeight b = jq_getOuterHeight b | 137 | getOuterHeight b = jq_getOuterHeight b | 38 | false | true | 0 | 7 | 48 | 29 | 14 | 15 | null | null |
mrkkrp/stack | src/Stack/Build/Execute.hs | bsd-3-clause | copyExecutables exes = do
snapBin <- (</> bindirSuffix) `liftM` installationRootDeps
localBin <- (</> bindirSuffix) `liftM` installationRootLocal
destDir <- view $ configL.to configLocalBin
ensureDir destDir
destDir' <- liftIO . D.canonicalizePath . toFilePath $ destDir
platform <- view platformL
let ext =
case platform of
Platform _ Windows -> ".exe"
_ -> ""
currExe <- liftIO getExecutablePath -- needed for windows, see below
installed <- forMaybeM (Map.toList exes) $ \(name, loc) -> do
let bindir =
case loc of
Snap -> snapBin
Local -> localBin
mfp <- forgivingAbsence (resolveFile bindir $ T.unpack name ++ ext)
>>= rejectMissingFile
case mfp of
Nothing -> do
$logWarn $ T.concat
[ "Couldn't find executable "
, name
, " in directory "
, T.pack $ toFilePath bindir
]
return Nothing
Just file -> do
let destFile = destDir' FP.</> T.unpack name ++ ext
$logInfo $ T.concat
[ "Copying from "
, T.pack $ toFilePath file
, " to "
, T.pack destFile
]
liftIO $ case platform of
Platform _ Windows | FP.equalFilePath destFile currExe ->
windowsRenameCopy (toFilePath file) destFile
_ -> D.copyFile (toFilePath file) destFile
return $ Just (name <> T.pack ext)
unless (null installed) $ do
$logInfo ""
$logInfo $ T.concat
[ "Copied executables to "
, T.pack destDir'
, ":"]
forM_ installed $ \exe -> $logInfo ("- " <> exe)
warnInstallSearchPathIssues destDir' installed
-- | Windows can't write over the current executable. Instead, we rename the
-- current executable to something else and then do the copy. | 2,132 | copyExecutables exes = do
snapBin <- (</> bindirSuffix) `liftM` installationRootDeps
localBin <- (</> bindirSuffix) `liftM` installationRootLocal
destDir <- view $ configL.to configLocalBin
ensureDir destDir
destDir' <- liftIO . D.canonicalizePath . toFilePath $ destDir
platform <- view platformL
let ext =
case platform of
Platform _ Windows -> ".exe"
_ -> ""
currExe <- liftIO getExecutablePath -- needed for windows, see below
installed <- forMaybeM (Map.toList exes) $ \(name, loc) -> do
let bindir =
case loc of
Snap -> snapBin
Local -> localBin
mfp <- forgivingAbsence (resolveFile bindir $ T.unpack name ++ ext)
>>= rejectMissingFile
case mfp of
Nothing -> do
$logWarn $ T.concat
[ "Couldn't find executable "
, name
, " in directory "
, T.pack $ toFilePath bindir
]
return Nothing
Just file -> do
let destFile = destDir' FP.</> T.unpack name ++ ext
$logInfo $ T.concat
[ "Copying from "
, T.pack $ toFilePath file
, " to "
, T.pack destFile
]
liftIO $ case platform of
Platform _ Windows | FP.equalFilePath destFile currExe ->
windowsRenameCopy (toFilePath file) destFile
_ -> D.copyFile (toFilePath file) destFile
return $ Just (name <> T.pack ext)
unless (null installed) $ do
$logInfo ""
$logInfo $ T.concat
[ "Copied executables to "
, T.pack destDir'
, ":"]
forM_ installed $ \exe -> $logInfo ("- " <> exe)
warnInstallSearchPathIssues destDir' installed
-- | Windows can't write over the current executable. Instead, we rename the
-- current executable to something else and then do the copy. | 2,132 | copyExecutables exes = do
snapBin <- (</> bindirSuffix) `liftM` installationRootDeps
localBin <- (</> bindirSuffix) `liftM` installationRootLocal
destDir <- view $ configL.to configLocalBin
ensureDir destDir
destDir' <- liftIO . D.canonicalizePath . toFilePath $ destDir
platform <- view platformL
let ext =
case platform of
Platform _ Windows -> ".exe"
_ -> ""
currExe <- liftIO getExecutablePath -- needed for windows, see below
installed <- forMaybeM (Map.toList exes) $ \(name, loc) -> do
let bindir =
case loc of
Snap -> snapBin
Local -> localBin
mfp <- forgivingAbsence (resolveFile bindir $ T.unpack name ++ ext)
>>= rejectMissingFile
case mfp of
Nothing -> do
$logWarn $ T.concat
[ "Couldn't find executable "
, name
, " in directory "
, T.pack $ toFilePath bindir
]
return Nothing
Just file -> do
let destFile = destDir' FP.</> T.unpack name ++ ext
$logInfo $ T.concat
[ "Copying from "
, T.pack $ toFilePath file
, " to "
, T.pack destFile
]
liftIO $ case platform of
Platform _ Windows | FP.equalFilePath destFile currExe ->
windowsRenameCopy (toFilePath file) destFile
_ -> D.copyFile (toFilePath file) destFile
return $ Just (name <> T.pack ext)
unless (null installed) $ do
$logInfo ""
$logInfo $ T.concat
[ "Copied executables to "
, T.pack destDir'
, ":"]
forM_ installed $ \exe -> $logInfo ("- " <> exe)
warnInstallSearchPathIssues destDir' installed
-- | Windows can't write over the current executable. Instead, we rename the
-- current executable to something else and then do the copy. | 2,132 | false | false | 0 | 25 | 869 | 526 | 247 | 279 | null | null |
mbakke/ganeti | test/hs/htest.hs | bsd-2-clause | -- | Our default test options, overring the built-in test-framework
-- ones (but not the supplied command line parameters).
defOpts :: TestOptions
defOpts = TestOptions
{ topt_seed = Nothing
, topt_maximum_generated_tests = Just 500
, topt_maximum_unsuitable_generated_tests = Just 5000
, topt_maximum_test_size = Nothing
, topt_maximum_test_depth = Nothing
, topt_timeout = Nothing
} | 534 | defOpts :: TestOptions
defOpts = TestOptions
{ topt_seed = Nothing
, topt_maximum_generated_tests = Just 500
, topt_maximum_unsuitable_generated_tests = Just 5000
, topt_maximum_test_size = Nothing
, topt_maximum_test_depth = Nothing
, topt_timeout = Nothing
} | 410 | defOpts = TestOptions
{ topt_seed = Nothing
, topt_maximum_generated_tests = Just 500
, topt_maximum_unsuitable_generated_tests = Just 5000
, topt_maximum_test_size = Nothing
, topt_maximum_test_depth = Nothing
, topt_timeout = Nothing
} | 387 | true | true | 0 | 7 | 201 | 57 | 35 | 22 | null | null |
green-haskell/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | isAnyInlinePragma :: InlinePragma -> Bool
-- INLINE or INLINABLE
isAnyInlinePragma prag = case inl_inline prag of
Inline -> True
Inlinable -> True
_ -> False | 240 | isAnyInlinePragma :: InlinePragma -> Bool
isAnyInlinePragma prag = case inl_inline prag of
Inline -> True
Inlinable -> True
_ -> False | 217 | isAnyInlinePragma prag = case inl_inline prag of
Inline -> True
Inlinable -> True
_ -> False | 175 | true | true | 0 | 7 | 107 | 44 | 22 | 22 | null | null |
romanofski/gtfsschedule | src/GTFS/Realtime/Internal/Com/Google/Transit/Realtime/VehiclePosition/CongestionLevel.hs | gpl-3.0 | toMaybe'Enum 4 = Prelude'.Just SEVERE_CONGESTION | 48 | toMaybe'Enum 4 = Prelude'.Just SEVERE_CONGESTION | 48 | toMaybe'Enum 4 = Prelude'.Just SEVERE_CONGESTION | 48 | false | false | 1 | 6 | 4 | 17 | 6 | 11 | null | null |
gnn/Hets | OWL2/Parse.hs | gpl-2.0 | postDecimal :: CharParser st NNInt
postDecimal = char '.' >> option zeroNNInt getNNInt | 86 | postDecimal :: CharParser st NNInt
postDecimal = char '.' >> option zeroNNInt getNNInt | 86 | postDecimal = char '.' >> option zeroNNInt getNNInt | 51 | false | true | 0 | 6 | 12 | 28 | 13 | 15 | null | null |
hguenther/gtl | lib/Language/GTL/Target/Common.hs | bsd-3-clause | buildTargetModel' :: GTLSpec String -> InputMap -> OutputMap -> TargetModel
buildTargetModel' spec inmp outmp
= let all_vars = Map.foldrWithKey (\(mf,vf,fi) (vars,lvl,tp) cur
-> case lvl of
Nothing -> cur
Just rlvl -> Map.insertWith (\(lvl1,inp,tp) (lvl2,_,_) -> (max lvl1 lvl2,inp,tp)
) (mf,vf,fi) (rlvl,False,tp) cur
) (fmap (\(lvl,tp) -> (lvl,True,tp)) inmp) outmp
all_vars2 = Map.foldrWithKey
(\iname inst mp
-> let defs = Map.union
(gtlInstanceDefaults inst)
(gtlModelDefaults mdl)
mdl = (gtlSpecModels spec)!(gtlInstanceModel inst)
in Map.foldrWithKey
(\var def mp
-> let tp = case Map.lookup var (gtlModelInput mdl) of
Nothing -> case Map.lookup var (gtlModelOutput mdl) of
Nothing -> (gtlModelLocals mdl)!var
Just p -> p
Just p -> p
in case def of
Just v -> foldl (\mp (c,(rtp,idx))
-> let nmp = Map.adjust (\(lvl,inp,tp,restr)
-> (lvl,inp,tp,case restr of
Nothing -> Just $ Set.singleton c
Just r -> Just (Set.insert c r)
)) (iname,var,idx) mp
in case Map.lookup (iname,var,idx) outmp of
Nothing -> nmp
Just (tvars,_,_) -> foldl (\mp' tvar -> Map.adjust (\(lvl,inp,tp,restr)
-> (lvl,inp,tp,case restr of
Nothing -> Just $ Set.singleton c
Just r -> Just (Set.insert c r)
)) tvar mp') nmp tvars
) mp $ zip (flattenConstant v) (flattenVar tp [])
Nothing -> mp) mp defs
) (fmap (\(lvl,inp,tp) -> (lvl,inp,tp,Nothing)) all_vars) (gtlSpecInstances spec)
in TargetModel
{ tmodelVars = [ ((mdl,var,idx),lvl,tp,inits)
| ((mdl,var,idx),(lvl,inp,tp,inits)) <- Map.toList all_vars2
] {- ++
[ ((iname,var,
| (iname,inst) <- Map.toList (gtlSpecInstances spec)
, let mdl = (gtlSpecModels spec)!(gtlInstanceModel inst)
, (var,tp) <- Map.toList (gtlModelLocals mdl)
, let def = case Map.lookup var (gtlModelDefaults mdl) of
Nothing -> Nothing
Just p -> p
]-}
, tmodelProcs = buildModelProcs spec outmp inmp
, tmodelVerify = flattenExpr (\(m,v) i -> (m,v,i)) [] (gtlSpecVerify spec)
} | 3,880 | buildTargetModel' :: GTLSpec String -> InputMap -> OutputMap -> TargetModel
buildTargetModel' spec inmp outmp
= let all_vars = Map.foldrWithKey (\(mf,vf,fi) (vars,lvl,tp) cur
-> case lvl of
Nothing -> cur
Just rlvl -> Map.insertWith (\(lvl1,inp,tp) (lvl2,_,_) -> (max lvl1 lvl2,inp,tp)
) (mf,vf,fi) (rlvl,False,tp) cur
) (fmap (\(lvl,tp) -> (lvl,True,tp)) inmp) outmp
all_vars2 = Map.foldrWithKey
(\iname inst mp
-> let defs = Map.union
(gtlInstanceDefaults inst)
(gtlModelDefaults mdl)
mdl = (gtlSpecModels spec)!(gtlInstanceModel inst)
in Map.foldrWithKey
(\var def mp
-> let tp = case Map.lookup var (gtlModelInput mdl) of
Nothing -> case Map.lookup var (gtlModelOutput mdl) of
Nothing -> (gtlModelLocals mdl)!var
Just p -> p
Just p -> p
in case def of
Just v -> foldl (\mp (c,(rtp,idx))
-> let nmp = Map.adjust (\(lvl,inp,tp,restr)
-> (lvl,inp,tp,case restr of
Nothing -> Just $ Set.singleton c
Just r -> Just (Set.insert c r)
)) (iname,var,idx) mp
in case Map.lookup (iname,var,idx) outmp of
Nothing -> nmp
Just (tvars,_,_) -> foldl (\mp' tvar -> Map.adjust (\(lvl,inp,tp,restr)
-> (lvl,inp,tp,case restr of
Nothing -> Just $ Set.singleton c
Just r -> Just (Set.insert c r)
)) tvar mp') nmp tvars
) mp $ zip (flattenConstant v) (flattenVar tp [])
Nothing -> mp) mp defs
) (fmap (\(lvl,inp,tp) -> (lvl,inp,tp,Nothing)) all_vars) (gtlSpecInstances spec)
in TargetModel
{ tmodelVars = [ ((mdl,var,idx),lvl,tp,inits)
| ((mdl,var,idx),(lvl,inp,tp,inits)) <- Map.toList all_vars2
] {- ++
[ ((iname,var,
| (iname,inst) <- Map.toList (gtlSpecInstances spec)
, let mdl = (gtlSpecModels spec)!(gtlInstanceModel inst)
, (var,tp) <- Map.toList (gtlModelLocals mdl)
, let def = case Map.lookup var (gtlModelDefaults mdl) of
Nothing -> Nothing
Just p -> p
]-}
, tmodelProcs = buildModelProcs spec outmp inmp
, tmodelVerify = flattenExpr (\(m,v) i -> (m,v,i)) [] (gtlSpecVerify spec)
} | 3,880 | buildTargetModel' spec inmp outmp
= let all_vars = Map.foldrWithKey (\(mf,vf,fi) (vars,lvl,tp) cur
-> case lvl of
Nothing -> cur
Just rlvl -> Map.insertWith (\(lvl1,inp,tp) (lvl2,_,_) -> (max lvl1 lvl2,inp,tp)
) (mf,vf,fi) (rlvl,False,tp) cur
) (fmap (\(lvl,tp) -> (lvl,True,tp)) inmp) outmp
all_vars2 = Map.foldrWithKey
(\iname inst mp
-> let defs = Map.union
(gtlInstanceDefaults inst)
(gtlModelDefaults mdl)
mdl = (gtlSpecModels spec)!(gtlInstanceModel inst)
in Map.foldrWithKey
(\var def mp
-> let tp = case Map.lookup var (gtlModelInput mdl) of
Nothing -> case Map.lookup var (gtlModelOutput mdl) of
Nothing -> (gtlModelLocals mdl)!var
Just p -> p
Just p -> p
in case def of
Just v -> foldl (\mp (c,(rtp,idx))
-> let nmp = Map.adjust (\(lvl,inp,tp,restr)
-> (lvl,inp,tp,case restr of
Nothing -> Just $ Set.singleton c
Just r -> Just (Set.insert c r)
)) (iname,var,idx) mp
in case Map.lookup (iname,var,idx) outmp of
Nothing -> nmp
Just (tvars,_,_) -> foldl (\mp' tvar -> Map.adjust (\(lvl,inp,tp,restr)
-> (lvl,inp,tp,case restr of
Nothing -> Just $ Set.singleton c
Just r -> Just (Set.insert c r)
)) tvar mp') nmp tvars
) mp $ zip (flattenConstant v) (flattenVar tp [])
Nothing -> mp) mp defs
) (fmap (\(lvl,inp,tp) -> (lvl,inp,tp,Nothing)) all_vars) (gtlSpecInstances spec)
in TargetModel
{ tmodelVars = [ ((mdl,var,idx),lvl,tp,inits)
| ((mdl,var,idx),(lvl,inp,tp,inits)) <- Map.toList all_vars2
] {- ++
[ ((iname,var,
| (iname,inst) <- Map.toList (gtlSpecInstances spec)
, let mdl = (gtlSpecModels spec)!(gtlInstanceModel inst)
, (var,tp) <- Map.toList (gtlModelLocals mdl)
, let def = case Map.lookup var (gtlModelDefaults mdl) of
Nothing -> Nothing
Just p -> p
]-}
, tmodelProcs = buildModelProcs spec outmp inmp
, tmodelVerify = flattenExpr (\(m,v) i -> (m,v,i)) [] (gtlSpecVerify spec)
} | 3,804 | false | true | 1 | 44 | 2,280 | 879 | 480 | 399 | null | null |
llllllllll/Math.Diophantine | Math/Diophantine/Parser.hs | gpl-2.0 | findY2Coef :: Expr -> Z -> Z
findY2Coef (Plus expr (Variable n YTerm 2)) m = findY2Coef expr (n + m) | 101 | findY2Coef :: Expr -> Z -> Z
findY2Coef (Plus expr (Variable n YTerm 2)) m = findY2Coef expr (n + m) | 101 | findY2Coef (Plus expr (Variable n YTerm 2)) m = findY2Coef expr (n + m) | 72 | false | true | 0 | 9 | 21 | 54 | 27 | 27 | null | null |
caenrique/fuzzyParking | src/FuzzyParking.hs | gpl-2.0 | pB = sramp pb | 13 | pB = sramp pb | 13 | pB = sramp pb | 13 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
brendanhay/gogol | gogol-drive/gen/Network/Google/Drive/Types/Product.hs | mpl-2.0 | -- | Whether the current user can delete this shared drive. Attempting to
-- delete the shared drive may still fail if there are untrashed items
-- inside the shared drive.
dcCanDeleteDrive :: Lens' DriveCapabilities (Maybe Bool)
dcCanDeleteDrive
= lens _dcCanDeleteDrive
(\ s a -> s{_dcCanDeleteDrive = a}) | 315 | dcCanDeleteDrive :: Lens' DriveCapabilities (Maybe Bool)
dcCanDeleteDrive
= lens _dcCanDeleteDrive
(\ s a -> s{_dcCanDeleteDrive = a}) | 142 | dcCanDeleteDrive
= lens _dcCanDeleteDrive
(\ s a -> s{_dcCanDeleteDrive = a}) | 85 | true | true | 0 | 9 | 55 | 50 | 27 | 23 | null | null |
ozgurakgun/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | fmapMB f (Guess t v) = liftM2 Guess (f t) (f v) | 47 | fmapMB f (Guess t v) = liftM2 Guess (f t) (f v) | 47 | fmapMB f (Guess t v) = liftM2 Guess (f t) (f v) | 47 | false | false | 0 | 7 | 11 | 40 | 18 | 22 | null | null |
oldmanmike/vulkan | generate/src/Parse/Utils.hs | bsd-3-clause | onlyChildWithName :: String -> IOStateArrow s XmlTree XmlTree
onlyChildWithName s = oneRequired s (hasName s <<< getChildren) | 125 | onlyChildWithName :: String -> IOStateArrow s XmlTree XmlTree
onlyChildWithName s = oneRequired s (hasName s <<< getChildren) | 125 | onlyChildWithName s = oneRequired s (hasName s <<< getChildren) | 63 | false | true | 0 | 8 | 16 | 40 | 19 | 21 | null | null |
markus-git/imperative-edsl-vhdl | src/Language/Embedded/Hardware/Interface/AXI.hs | bsd-3-clause | declareRegisters :: forall instr (exp :: * -> *) pred m a . AXIPred instr exp pred
=> Sig instr exp pred Identity a
-> Prog instr exp pred (Argument pred a)
declareRegisters (Ret _) = return Nil | 199 | declareRegisters :: forall instr (exp :: * -> *) pred m a . AXIPred instr exp pred
=> Sig instr exp pred Identity a
-> Prog instr exp pred (Argument pred a)
declareRegisters (Ret _) = return Nil | 199 | declareRegisters (Ret _) = return Nil | 37 | false | true | 0 | 11 | 42 | 86 | 44 | 42 | null | null |
JustinUnger/haskell-book | ch24/ch24-parse-integer.hs | mit | if' :: Bool -> a -> a -> a
if' True x _ = x | 44 | if' :: Bool -> a -> a -> a
if' True x _ = x | 44 | if' True x _ = x | 17 | false | true | 0 | 7 | 15 | 30 | 15 | 15 | null | null |
tekul/cryptonite | Crypto/ECC/Simple/Prim.hs | bsd-3-clause | pointAdd p q
| p == q = pointDouble p
| p == pointNegate q = PointO | 83 | pointAdd p q
| p == q = pointDouble p
| p == pointNegate q = PointO | 83 | pointAdd p q
| p == q = pointDouble p
| p == pointNegate q = PointO | 83 | false | false | 0 | 9 | 32 | 43 | 18 | 25 | null | null |
ezyang/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | -- | Translate value prefetch operations into proper primcalls.
doPrefetchValueOp :: Int
-> [CmmExpr]
-> FCode ()
doPrefetchValueOp locality [addr]
= do dflags <- getDynFlags
mkBasicPrefetch locality 0 addr (CmmLit (CmmInt 0 (wordWidth dflags))) | 294 | doPrefetchValueOp :: Int
-> [CmmExpr]
-> FCode ()
doPrefetchValueOp locality [addr]
= do dflags <- getDynFlags
mkBasicPrefetch locality 0 addr (CmmLit (CmmInt 0 (wordWidth dflags))) | 230 | doPrefetchValueOp locality [addr]
= do dflags <- getDynFlags
mkBasicPrefetch locality 0 addr (CmmLit (CmmInt 0 (wordWidth dflags))) | 146 | true | true | 0 | 14 | 82 | 80 | 38 | 42 | null | null |
diku-dk/futhark | src/Language/Futhark/Prop.hs | isc | peelArray _ _ = Nothing | 23 | peelArray _ _ = Nothing | 23 | peelArray _ _ = Nothing | 23 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
pellagic-puffbomb/simpleservantblog | app/Plumbing.hs | bsd-3-clause | runUserPasswdMigrations :: Connection -> Bool -> Bool -> Bool -> IO ()
runUserPasswdMigrations conn mkUser changePass migrations =
userLoop conn mkUser >>
changePasswd conn changePass >>
migrate conn migrations | 223 | runUserPasswdMigrations :: Connection -> Bool -> Bool -> Bool -> IO ()
runUserPasswdMigrations conn mkUser changePass migrations =
userLoop conn mkUser >>
changePasswd conn changePass >>
migrate conn migrations | 223 | runUserPasswdMigrations conn mkUser changePass migrations =
userLoop conn mkUser >>
changePasswd conn changePass >>
migrate conn migrations | 152 | false | true | 0 | 10 | 41 | 67 | 30 | 37 | null | null |
keera-studios/hsQt | Qtc/Enums/Core/QUrl.hs | bsd-2-clause | fRemovePort :: FormattingOptions
fRemovePort
= ifFormattingOptions $ 8 | 72 | fRemovePort :: FormattingOptions
fRemovePort
= ifFormattingOptions $ 8 | 72 | fRemovePort
= ifFormattingOptions $ 8 | 39 | false | true | 0 | 6 | 9 | 18 | 8 | 10 | null | null |
expipiplus1/minizinc | test/Aust.hs | mit | aust :: Model
aust = runMZ $
do nc <- parameter (3 :: Expression 'Int)
wa <- boundedVar 1 nc
nt <- boundedVar 1 nc
sa <- boundedVar 1 nc
q <- boundedVar 1 nc
nsw <- boundedVar 1 nc
v <- boundedVar 1 nc
t <- boundedVar 1 nc
constraint (wa /=: nt)
constraint (wa /=: sa)
constraint (nt /=: sa)
constraint (nt /=: q)
constraint (sa /=: q)
constraint (sa /=: nsw)
constraint (sa /=: v)
constraint (q /=: nsw)
constraint (nsw /=: v)
solve Satisfy
output [ "wa=", show' wa
, "\nnt=", show' nt
, "\nsa=", show' sa
, "\nq=", show' q
, "\nnsw=", show' nsw
, "\nv=", show' v
, "\nt=" , show' t
] | 789 | aust :: Model
aust = runMZ $
do nc <- parameter (3 :: Expression 'Int)
wa <- boundedVar 1 nc
nt <- boundedVar 1 nc
sa <- boundedVar 1 nc
q <- boundedVar 1 nc
nsw <- boundedVar 1 nc
v <- boundedVar 1 nc
t <- boundedVar 1 nc
constraint (wa /=: nt)
constraint (wa /=: sa)
constraint (nt /=: sa)
constraint (nt /=: q)
constraint (sa /=: q)
constraint (sa /=: nsw)
constraint (sa /=: v)
constraint (q /=: nsw)
constraint (nsw /=: v)
solve Satisfy
output [ "wa=", show' wa
, "\nnt=", show' nt
, "\nsa=", show' sa
, "\nq=", show' q
, "\nnsw=", show' nsw
, "\nv=", show' v
, "\nt=" , show' t
] | 789 | aust = runMZ $
do nc <- parameter (3 :: Expression 'Int)
wa <- boundedVar 1 nc
nt <- boundedVar 1 nc
sa <- boundedVar 1 nc
q <- boundedVar 1 nc
nsw <- boundedVar 1 nc
v <- boundedVar 1 nc
t <- boundedVar 1 nc
constraint (wa /=: nt)
constraint (wa /=: sa)
constraint (nt /=: sa)
constraint (nt /=: q)
constraint (sa /=: q)
constraint (sa /=: nsw)
constraint (sa /=: v)
constraint (q /=: nsw)
constraint (nsw /=: v)
solve Satisfy
output [ "wa=", show' wa
, "\nnt=", show' nt
, "\nsa=", show' sa
, "\nq=", show' q
, "\nnsw=", show' nsw
, "\nv=", show' v
, "\nt=" , show' t
] | 775 | false | true | 0 | 12 | 322 | 312 | 146 | 166 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/PrelNames.hs | bsd-3-clause | step_RDR, alt_RDR, reset_RDR, prec_RDR, pfail_RDR :: RdrName
step_RDR = varQual_RDR rEAD_PREC (fsLit "step") | 124 | step_RDR, alt_RDR, reset_RDR, prec_RDR, pfail_RDR :: RdrName
step_RDR = varQual_RDR rEAD_PREC (fsLit "step") | 124 | step_RDR = varQual_RDR rEAD_PREC (fsLit "step") | 63 | false | true | 0 | 7 | 28 | 30 | 19 | 11 | null | null |
urbanslug/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | rOOT_MAIN = mkMainModule (fsLit ":Main") | 46 | rOOT_MAIN = mkMainModule (fsLit ":Main") | 46 | rOOT_MAIN = mkMainModule (fsLit ":Main") | 46 | false | false | 0 | 7 | 10 | 15 | 7 | 8 | null | null |
TomMD/io-streams | test/System/IO/Streams/Tests/Handle.hs | bsd-3-clause | testInputStreamToHandle :: Test
testInputStreamToHandle = testCase "handle/inputStreamToHandle" $ do
h <- Streams.fromList ["foo", "bar", "baz"] >>=
Streams.inputStreamToHandle
S.hGetContents h >>= assertEqual "inputStreamToHandle" "foobarbaz"
------------------------------------------------------------------------------ | 341 | testInputStreamToHandle :: Test
testInputStreamToHandle = testCase "handle/inputStreamToHandle" $ do
h <- Streams.fromList ["foo", "bar", "baz"] >>=
Streams.inputStreamToHandle
S.hGetContents h >>= assertEqual "inputStreamToHandle" "foobarbaz"
------------------------------------------------------------------------------ | 341 | testInputStreamToHandle = testCase "handle/inputStreamToHandle" $ do
h <- Streams.fromList ["foo", "bar", "baz"] >>=
Streams.inputStreamToHandle
S.hGetContents h >>= assertEqual "inputStreamToHandle" "foobarbaz"
------------------------------------------------------------------------------ | 309 | false | true | 0 | 11 | 42 | 63 | 31 | 32 | null | null |
egaburov/funstuff | Haskell/BartoszBofH/7_TokenizerHOF/tokenize.hs | apache-2.0 | opToChar :: Operator -> Char
-- opToChar = undefined
opToChar Plus = '+' | 74 | opToChar :: Operator -> Char
opToChar Plus = '+' | 49 | opToChar Plus = '+' | 20 | true | true | 0 | 5 | 14 | 19 | 10 | 9 | null | null |
peddie/fingertrees | src/Data/FingerTree/IntervalMap.hs | bsd-3-clause | greaterThan (Key i _) v = low i > v | 35 | greaterThan (Key i _) v = low i > v | 35 | greaterThan (Key i _) v = low i > v | 35 | false | false | 0 | 6 | 9 | 27 | 12 | 15 | null | null |
Helkafen/haddock | haddock-api/src/Haddock/Backends/LaTeX.hs | bsd-2-clause | isUndocdInstance _ = Nothing | 28 | isUndocdInstance _ = Nothing | 28 | isUndocdInstance _ = Nothing | 28 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
nbrendler/twitch-cli-hs | Commands.hs | mit | followChannel :: String -> IO ()
followChannel channelName = do
makeRequest (getUrl "follow" ++ channelName) makePut
putStrLn $ "Followed " ++ channelName | 170 | followChannel :: String -> IO ()
followChannel channelName = do
makeRequest (getUrl "follow" ++ channelName) makePut
putStrLn $ "Followed " ++ channelName | 170 | followChannel channelName = do
makeRequest (getUrl "follow" ++ channelName) makePut
putStrLn $ "Followed " ++ channelName | 137 | false | true | 0 | 10 | 37 | 52 | 24 | 28 | null | null |
schernichkin/yarn-client | tools/Main.hs | bsd-3-clause | textTag :: (Stream s m (Tag str), Show str) => ParsecT s u m str
textTag = tagPrim matchTagText
where
matchTagText (TagText str) = Just str
matchTagText _ = Nothing
-- | Skip tags till parser succeed. | 212 | textTag :: (Stream s m (Tag str), Show str) => ParsecT s u m str
textTag = tagPrim matchTagText
where
matchTagText (TagText str) = Just str
matchTagText _ = Nothing
-- | Skip tags till parser succeed. | 212 | textTag = tagPrim matchTagText
where
matchTagText (TagText str) = Just str
matchTagText _ = Nothing
-- | Skip tags till parser succeed. | 146 | false | true | 1 | 8 | 48 | 76 | 38 | 38 | null | null |
andyarvanitis/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp _ LPrintStr [x] = "fputs(GETSTR(" ++ creg x ++ "), stdout)" | 64 | doOp _ LPrintStr [x] = "fputs(GETSTR(" ++ creg x ++ "), stdout)" | 64 | doOp _ LPrintStr [x] = "fputs(GETSTR(" ++ creg x ++ "), stdout)" | 64 | false | false | 0 | 7 | 11 | 27 | 13 | 14 | null | null |
cchalmers/geometry | benchmarks/Samples.hs | bsd-3-clause | rewriteFunction Y = [M, F, X, M, Y] | 35 | rewriteFunction Y = [M, F, X, M, Y] | 35 | rewriteFunction Y = [M, F, X, M, Y] | 35 | false | false | 1 | 5 | 7 | 27 | 14 | 13 | null | null |
chreekat/yesod | yesod-core/Yesod/Logger.hs | bsd-2-clause | makeLoggerWithHandle, developmentLogger, productionLogger :: Handle -> IO Logger
makeLoggerWithHandle = productionLogger | 120 | makeLoggerWithHandle, developmentLogger, productionLogger :: Handle -> IO Logger
makeLoggerWithHandle = productionLogger | 120 | makeLoggerWithHandle = productionLogger | 39 | false | true | 0 | 6 | 10 | 22 | 13 | 9 | null | null |
brendanhay/gogol | gogol-logging/gen/Network/Google/Resource/Logging/Entries/Tail.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
etUploadProtocol :: Lens' EntriesTail (Maybe Text)
etUploadProtocol
= lens _etUploadProtocol
(\ s a -> s{_etUploadProtocol = a}) | 198 | etUploadProtocol :: Lens' EntriesTail (Maybe Text)
etUploadProtocol
= lens _etUploadProtocol
(\ s a -> s{_etUploadProtocol = a}) | 136 | etUploadProtocol
= lens _etUploadProtocol
(\ s a -> s{_etUploadProtocol = a}) | 85 | true | true | 0 | 9 | 33 | 48 | 25 | 23 | null | null |
spechub/Hets | Comorphisms/ExtModal2HasCASL.hs | gpl-2.0 | resetArgs :: Term -> Args -> Args
resetArgs t as = as
{ sourceW = t
, targetW = t
, targetN = zeroT } | 107 | resetArgs :: Term -> Args -> Args
resetArgs t as = as
{ sourceW = t
, targetW = t
, targetN = zeroT } | 107 | resetArgs t as = as
{ sourceW = t
, targetW = t
, targetN = zeroT } | 73 | false | true | 0 | 7 | 30 | 48 | 26 | 22 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.