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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ssoudan/hsChess | src/Move.hs | apache-2.0 | forbiddenMoves dir (Pos (px,py)) color (Just (ex, ey, Just (Piece _ ecolor))) = case dir of N -> [Pos (a, py) | a <- [0..ex], a /= ex || color == ecolor ]
S -> [Pos (a, py) | a <- [ex..7], a /= ex || color == ecolor ]
E -> [Pos (px, a) | a <- [ey..7], a /= ey || color == ecolor ]
W -> [Pos (px, a) | a <- [0..ey], a /= ey || color == ecolor ]
SE -> [Pos (ex+a, ey+a) | a <- [0..7], (a /= 0 || color == ecolor) && boardFilter (Pos (ex+a, ey+a))]
NE -> [Pos (ex-a, ey+a) | a <- [0..7], (a /= 0 || color == ecolor) && boardFilter (Pos (ex-a, ey+a))]
NW -> [Pos (ex-a, ey-a) | a <- [0..7], (a /= 0 || color == ecolor) && boardFilter (Pos (ex-a, ey-a))]
SW -> [Pos (ex+a, ey-a) | a <- [0..7], (a /= 0 || color == ecolor) && boardFilter (Pos (ex+a, ey-a))] | 1,395 | forbiddenMoves dir (Pos (px,py)) color (Just (ex, ey, Just (Piece _ ecolor))) = case dir of N -> [Pos (a, py) | a <- [0..ex], a /= ex || color == ecolor ]
S -> [Pos (a, py) | a <- [ex..7], a /= ex || color == ecolor ]
E -> [Pos (px, a) | a <- [ey..7], a /= ey || color == ecolor ]
W -> [Pos (px, a) | a <- [0..ey], a /= ey || color == ecolor ]
SE -> [Pos (ex+a, ey+a) | a <- [0..7], (a /= 0 || color == ecolor) && boardFilter (Pos (ex+a, ey+a))]
NE -> [Pos (ex-a, ey+a) | a <- [0..7], (a /= 0 || color == ecolor) && boardFilter (Pos (ex-a, ey+a))]
NW -> [Pos (ex-a, ey-a) | a <- [0..7], (a /= 0 || color == ecolor) && boardFilter (Pos (ex-a, ey-a))]
SW -> [Pos (ex+a, ey-a) | a <- [0..7], (a /= 0 || color == ecolor) && boardFilter (Pos (ex+a, ey-a))] | 1,395 | forbiddenMoves dir (Pos (px,py)) color (Just (ex, ey, Just (Piece _ ecolor))) = case dir of N -> [Pos (a, py) | a <- [0..ex], a /= ex || color == ecolor ]
S -> [Pos (a, py) | a <- [ex..7], a /= ex || color == ecolor ]
E -> [Pos (px, a) | a <- [ey..7], a /= ey || color == ecolor ]
W -> [Pos (px, a) | a <- [0..ey], a /= ey || color == ecolor ]
SE -> [Pos (ex+a, ey+a) | a <- [0..7], (a /= 0 || color == ecolor) && boardFilter (Pos (ex+a, ey+a))]
NE -> [Pos (ex-a, ey+a) | a <- [0..7], (a /= 0 || color == ecolor) && boardFilter (Pos (ex-a, ey+a))]
NW -> [Pos (ex-a, ey-a) | a <- [0..7], (a /= 0 || color == ecolor) && boardFilter (Pos (ex-a, ey-a))]
SW -> [Pos (ex+a, ey-a) | a <- [0..7], (a /= 0 || color == ecolor) && boardFilter (Pos (ex+a, ey-a))] | 1,395 | false | false | 0 | 15 | 811 | 585 | 310 | 275 | null | null |
higgsd/euler | hs/68.hs | bsd-2-clause | bestGon n = maximum $ map toString $ buildGons (2*n) []
where toString xs = fromDigits $ concat $ map (toDigitsBase 10) $ concat xs | 135 | bestGon n = maximum $ map toString $ buildGons (2*n) []
where toString xs = fromDigits $ concat $ map (toDigitsBase 10) $ concat xs | 135 | bestGon n = maximum $ map toString $ buildGons (2*n) []
where toString xs = fromDigits $ concat $ map (toDigitsBase 10) $ concat xs | 135 | false | false | 0 | 9 | 28 | 68 | 32 | 36 | null | null |
hvr/jhc | examples/Forall.hs | mit | id6 :: a -> (forall b . Show b => (forall d . (Eq b, Show d) => (b,d)))
id6 = undefined | 87 | id6 :: a -> (forall b . Show b => (forall d . (Eq b, Show d) => (b,d)))
id6 = undefined | 87 | id6 = undefined | 15 | false | true | 0 | 12 | 21 | 59 | 33 | 26 | null | null |
ku-fpg/kansas-amber | tests/ExprTests/ExprWord8.hs | bsd-3-clause | prop_lt :: ArduinoConnection -> RemoteRef Bool -> Word8 -> Word8 -> Property
prop_lt c r x y = monadicIO $ do
let local = x < y
remote <- run $ send c $ do
writeRemoteRefE r $ (lit x) <* (lit y)
v <- readRemoteRefE r
return v
assert (local == litEvalB remote) | 295 | prop_lt :: ArduinoConnection -> RemoteRef Bool -> Word8 -> Word8 -> Property
prop_lt c r x y = monadicIO $ do
let local = x < y
remote <- run $ send c $ do
writeRemoteRefE r $ (lit x) <* (lit y)
v <- readRemoteRefE r
return v
assert (local == litEvalB remote) | 295 | prop_lt c r x y = monadicIO $ do
let local = x < y
remote <- run $ send c $ do
writeRemoteRefE r $ (lit x) <* (lit y)
v <- readRemoteRefE r
return v
assert (local == litEvalB remote) | 218 | false | true | 0 | 16 | 89 | 139 | 61 | 78 | null | null |
haskoin/haskoin | src/Haskoin/Util/Arbitrary/Keys.hs | unlicense | {- Custom derivations -}
-- | Arbitrary derivation index with last bit unset.
genIndex :: Gen Word32
genIndex = (`clearBit` 31) <$> arbitrary | 142 | genIndex :: Gen Word32
genIndex = (`clearBit` 31) <$> arbitrary | 63 | genIndex = (`clearBit` 31) <$> arbitrary | 40 | true | true | 0 | 6 | 23 | 26 | 16 | 10 | null | null |
thalerjonathan/phd | thesis/code/concurrent/sugarscape/SugarScapePure/src/Discrete.hs | gpl-3.0 | wrapDisc2d l@(_, maxY) WrapVertical (x, y)
| y < 0 = wrapDisc2d l WrapVertical (x, y + maxY)
| y >= maxY = wrapDisc2d l WrapVertical (x, y - maxY)
| otherwise = (x, y) | 183 | wrapDisc2d l@(_, maxY) WrapVertical (x, y)
| y < 0 = wrapDisc2d l WrapVertical (x, y + maxY)
| y >= maxY = wrapDisc2d l WrapVertical (x, y - maxY)
| otherwise = (x, y) | 183 | wrapDisc2d l@(_, maxY) WrapVertical (x, y)
| y < 0 = wrapDisc2d l WrapVertical (x, y + maxY)
| y >= maxY = wrapDisc2d l WrapVertical (x, y - maxY)
| otherwise = (x, y) | 183 | false | false | 2 | 8 | 50 | 99 | 52 | 47 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/AppSyncFunctionConfiguration.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-functionconfiguration.html#cfn-appsync-functionconfiguration-responsemappingtemplates3location
asfcResponseMappingTemplateS3Location :: Lens' AppSyncFunctionConfiguration (Maybe (Val Text))
asfcResponseMappingTemplateS3Location = lens _appSyncFunctionConfigurationResponseMappingTemplateS3Location (\s a -> s { _appSyncFunctionConfigurationResponseMappingTemplateS3Location = a }) | 468 | asfcResponseMappingTemplateS3Location :: Lens' AppSyncFunctionConfiguration (Maybe (Val Text))
asfcResponseMappingTemplateS3Location = lens _appSyncFunctionConfigurationResponseMappingTemplateS3Location (\s a -> s { _appSyncFunctionConfigurationResponseMappingTemplateS3Location = a }) | 285 | asfcResponseMappingTemplateS3Location = lens _appSyncFunctionConfigurationResponseMappingTemplateS3Location (\s a -> s { _appSyncFunctionConfigurationResponseMappingTemplateS3Location = a }) | 190 | true | true | 0 | 9 | 22 | 52 | 28 | 24 | null | null |
kylcarte/threepenny-extra | src/Graphics/UI/Threepenny/Extra.hs | bsd-3-clause | (#.+) :: UI Element -> String -> UI Element
e #.+ c = e # modify class_ (L.insert c) | 84 | (#.+) :: UI Element -> String -> UI Element
e #.+ c = e # modify class_ (L.insert c) | 84 | e #.+ c = e # modify class_ (L.insert c) | 40 | false | true | 2 | 9 | 18 | 55 | 25 | 30 | null | null |
benkolera/haskell-hubbub | test/Network/Hubbub/Http/Test.hs | mit | serverErrorGetPublishedResource :: Assertion
serverErrorGetPublishedResource = scottyTest scottyM $ do
either <- runEitherT (getPublishedResource . publicationEvent $ localTopic [])
assertError either
where
scottyM = get "/topic" $ status status500
assertError (Left (ServerError _ res)) = res @?= "Internal Server Error"
assertError res = assertFailure $ "Expected ServerErr but got: " ++ show res | 416 | serverErrorGetPublishedResource :: Assertion
serverErrorGetPublishedResource = scottyTest scottyM $ do
either <- runEitherT (getPublishedResource . publicationEvent $ localTopic [])
assertError either
where
scottyM = get "/topic" $ status status500
assertError (Left (ServerError _ res)) = res @?= "Internal Server Error"
assertError res = assertFailure $ "Expected ServerErr but got: " ++ show res | 416 | serverErrorGetPublishedResource = scottyTest scottyM $ do
either <- runEitherT (getPublishedResource . publicationEvent $ localTopic [])
assertError either
where
scottyM = get "/topic" $ status status500
assertError (Left (ServerError _ res)) = res @?= "Internal Server Error"
assertError res = assertFailure $ "Expected ServerErr but got: " ++ show res | 371 | false | true | 0 | 13 | 69 | 113 | 53 | 60 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 218530 = 3534 | 33 | getValueFromProduct 218530 = 3534 | 33 | getValueFromProduct 218530 = 3534 | 33 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
vikraman/ghc-mod | Language/Haskell/GhcMod/Browse.hs | bsd-3-clause | showThing' _ _ = Nothing | 34 | showThing' _ _ = Nothing | 34 | showThing' _ _ = Nothing | 34 | false | false | 0 | 5 | 14 | 11 | 5 | 6 | null | null |
Ni-Br/luminifu | brain/Colors.hs | mit | -- Operators
-- Timify
timify :: a -> Double -> a
timify f = (\t -> f) | 70 | timify :: a -> Double -> a
timify f = (\t -> f) | 47 | timify f = (\t -> f) | 20 | true | true | 0 | 6 | 16 | 32 | 18 | 14 | null | null |
SteffenMichels/IHPMC | src/Parser.hs | mit | stringConstant = identifier <|> stringLit | 41 | stringConstant = identifier <|> stringLit | 41 | stringConstant = identifier <|> stringLit | 41 | false | false | 1 | 5 | 4 | 13 | 5 | 8 | null | null |
deontologician/orbRPG | Game/OrbRPG/HAdventure/Engine.hs | gpl-3.0 | doDrop :: Adv ()
doDrop = do d <- gets $ getL dirO
inv <- inventory
doDrop' d inv
where
doDrop' None _ = msg "Drop what?"
doDrop' (Unknown s) _ = msg $ noneHereMsg s
doDrop' (Target o) inv = if o `elem` inv
then dropFromInventory o
else msg "You're not holding that."
-- | Perform a \'drop\': remove an object from the player's inventory,
-- add it to the current location, and display a message. | 513 | doDrop :: Adv ()
doDrop = do d <- gets $ getL dirO
inv <- inventory
doDrop' d inv
where
doDrop' None _ = msg "Drop what?"
doDrop' (Unknown s) _ = msg $ noneHereMsg s
doDrop' (Target o) inv = if o `elem` inv
then dropFromInventory o
else msg "You're not holding that."
-- | Perform a \'drop\': remove an object from the player's inventory,
-- add it to the current location, and display a message. | 513 | doDrop = do d <- gets $ getL dirO
inv <- inventory
doDrop' d inv
where
doDrop' None _ = msg "Drop what?"
doDrop' (Unknown s) _ = msg $ noneHereMsg s
doDrop' (Target o) inv = if o `elem` inv
then dropFromInventory o
else msg "You're not holding that."
-- | Perform a \'drop\': remove an object from the player's inventory,
-- add it to the current location, and display a message. | 496 | false | true | 2 | 9 | 193 | 132 | 59 | 73 | null | null |
alexander-at-github/eta | compiler/ETA/HsSyn/HsTypes.hs | bsd-3-clause | mkHsQTvs :: [LHsTyVarBndr RdrName] -> LHsTyVarBndrs RdrName
-- Just at RdrName because in the Name variant we should know just
-- what the kind-variable binders are; and we don't
-- We put an empty list (rather than a panic) for the kind vars so
-- that the pretty printer works ok on them.
mkHsQTvs tvs = HsQTvs { hsq_kvs = [], hsq_tvs = tvs } | 344 | mkHsQTvs :: [LHsTyVarBndr RdrName] -> LHsTyVarBndrs RdrName
mkHsQTvs tvs = HsQTvs { hsq_kvs = [], hsq_tvs = tvs } | 113 | mkHsQTvs tvs = HsQTvs { hsq_kvs = [], hsq_tvs = tvs } | 53 | true | true | 0 | 8 | 64 | 52 | 28 | 24 | null | null |
igrep/open-msys2-mintty | app/Main.hs | mit | main :: IO ()
main =
getTargetDirectory >>= runMinttyAt | 57 | main :: IO ()
main =
getTargetDirectory >>= runMinttyAt | 57 | main =
getTargetDirectory >>= runMinttyAt | 43 | false | true | 1 | 6 | 10 | 24 | 10 | 14 | null | null |
Shaac/chartleston | src/duration.hs | gpl-3.0 | matchTempo :: [PossibleDurations] -> [PossibleDurations]
matchTempo l = if null result then finish l else result
where
finish = id
result = mapMaybe remove l
remove xs = liftM (aux xs) $ split (0 :: Rational) [] $ current xs
aux xs (a, b) = PossibleDurations (ok xs ++ a) (err' a + old * okErr xs) b
split a acc xs
| a == 0.25 = Just (reverse acc, xs)
| a > 0.25 = if (duration $ value $ head acc) > (0.25 :: Rational)
then split (a - 0.25) acc xs else Nothing
| otherwise = case xs of
[] -> Just ([], reverse acc)
(x : xs') -> split (a + (duration $ value $ x)) (x : acc) xs'
-- Give the fraction of a measure corresponding to a Duration. | 742 | matchTempo :: [PossibleDurations] -> [PossibleDurations]
matchTempo l = if null result then finish l else result
where
finish = id
result = mapMaybe remove l
remove xs = liftM (aux xs) $ split (0 :: Rational) [] $ current xs
aux xs (a, b) = PossibleDurations (ok xs ++ a) (err' a + old * okErr xs) b
split a acc xs
| a == 0.25 = Just (reverse acc, xs)
| a > 0.25 = if (duration $ value $ head acc) > (0.25 :: Rational)
then split (a - 0.25) acc xs else Nothing
| otherwise = case xs of
[] -> Just ([], reverse acc)
(x : xs') -> split (a + (duration $ value $ x)) (x : acc) xs'
-- Give the fraction of a measure corresponding to a Duration. | 742 | matchTempo l = if null result then finish l else result
where
finish = id
result = mapMaybe remove l
remove xs = liftM (aux xs) $ split (0 :: Rational) [] $ current xs
aux xs (a, b) = PossibleDurations (ok xs ++ a) (err' a + old * okErr xs) b
split a acc xs
| a == 0.25 = Just (reverse acc, xs)
| a > 0.25 = if (duration $ value $ head acc) > (0.25 :: Rational)
then split (a - 0.25) acc xs else Nothing
| otherwise = case xs of
[] -> Just ([], reverse acc)
(x : xs') -> split (a + (duration $ value $ x)) (x : acc) xs'
-- Give the fraction of a measure corresponding to a Duration. | 685 | false | true | 9 | 17 | 237 | 318 | 163 | 155 | null | null |
cluzz/AVRasp | util/SampleGenerator.hs | gpl-3.0 | pdm :: Function -> [Int]
pdm = _pdm 0 [] . sample
where
_pdm _ acc [] = acc
_pdm qe acc (x:xs) =
let f r = _pdm (qe + r - x) (r:acc) xs
in case x `compare` qe of
LT -> f 0
_ -> f 255 | 226 | pdm :: Function -> [Int]
pdm = _pdm 0 [] . sample
where
_pdm _ acc [] = acc
_pdm qe acc (x:xs) =
let f r = _pdm (qe + r - x) (r:acc) xs
in case x `compare` qe of
LT -> f 0
_ -> f 255 | 226 | pdm = _pdm 0 [] . sample
where
_pdm _ acc [] = acc
_pdm qe acc (x:xs) =
let f r = _pdm (qe + r - x) (r:acc) xs
in case x `compare` qe of
LT -> f 0
_ -> f 255 | 201 | false | true | 3 | 12 | 93 | 148 | 67 | 81 | null | null |
pjones/xmonad-test | vendor/xmonad-contrib/XMonad/Hooks/DebugEvents.hs | bsd-2-clause | dumpActiveWindow :: Decoder Bool
dumpActiveWindow = guardSize 32 $ do
t <- asks pType
nAW <- inX $ getAtom "_NET_ACTIVE_WINDOW"
case () of
() | t == wINDOW -> dumpWindow
| t == nAW -> dumpList' [("source" ,dumpEnum awSource,cARDINAL)
,("timestamp" ,dumpTime ,cARDINAL)
,("active window",dumpWindow ,wINDOW )
]
_ -> do
t' <- inX $ atomName t
failure $ concat ["(bad type "
,t'
,"; expected WINDOW or _NET_ACTIVE_WINDOW"
]
-- dump a generic CARDINAL value | 1,035 | dumpActiveWindow :: Decoder Bool
dumpActiveWindow = guardSize 32 $ do
t <- asks pType
nAW <- inX $ getAtom "_NET_ACTIVE_WINDOW"
case () of
() | t == wINDOW -> dumpWindow
| t == nAW -> dumpList' [("source" ,dumpEnum awSource,cARDINAL)
,("timestamp" ,dumpTime ,cARDINAL)
,("active window",dumpWindow ,wINDOW )
]
_ -> do
t' <- inX $ atomName t
failure $ concat ["(bad type "
,t'
,"; expected WINDOW or _NET_ACTIVE_WINDOW"
]
-- dump a generic CARDINAL value | 1,035 | dumpActiveWindow = guardSize 32 $ do
t <- asks pType
nAW <- inX $ getAtom "_NET_ACTIVE_WINDOW"
case () of
() | t == wINDOW -> dumpWindow
| t == nAW -> dumpList' [("source" ,dumpEnum awSource,cARDINAL)
,("timestamp" ,dumpTime ,cARDINAL)
,("active window",dumpWindow ,wINDOW )
]
_ -> do
t' <- inX $ atomName t
failure $ concat ["(bad type "
,t'
,"; expected WINDOW or _NET_ACTIVE_WINDOW"
]
-- dump a generic CARDINAL value | 1,002 | false | true | 0 | 15 | 656 | 167 | 84 | 83 | null | null |
abuiles/turbinado-blog | tmp/dependencies/hs-plugins-1.3.1/testsuite/objc/expression_parser/KeyValueParser.hs | bsd-3-clause | resource :: String -> IO String
resource text = do
parsedText <- mapM parseString (lines text)
return (unlines parsedText) | 126 | resource :: String -> IO String
resource text = do
parsedText <- mapM parseString (lines text)
return (unlines parsedText) | 126 | resource text = do
parsedText <- mapM parseString (lines text)
return (unlines parsedText) | 94 | false | true | 0 | 10 | 22 | 51 | 23 | 28 | null | null |
rahulmutt/ghcvm | compiler/Eta/SimplCore/CallArity.hs | bsd-3-clause | -- In the result, find out the minimum arity and whether the variable is called
-- at most once.
lookupCallArityRes :: CallArityRes -> Var -> (Arity, Bool)
lookupCallArityRes (g, ae) v
= case lookupVarEnv ae v of
Just a -> (a, not (v `elemUnVarSet` (neighbors g v)))
Nothing -> (0, False) | 308 | lookupCallArityRes :: CallArityRes -> Var -> (Arity, Bool)
lookupCallArityRes (g, ae) v
= case lookupVarEnv ae v of
Just a -> (a, not (v `elemUnVarSet` (neighbors g v)))
Nothing -> (0, False) | 211 | lookupCallArityRes (g, ae) v
= case lookupVarEnv ae v of
Just a -> (a, not (v `elemUnVarSet` (neighbors g v)))
Nothing -> (0, False) | 152 | true | true | 0 | 13 | 70 | 94 | 52 | 42 | null | null |
badp/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | daemonsLogbase :: Map String String
daemonsLogbase =
Map.fromList
[ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ] | 141 | daemonsLogbase :: Map String String
daemonsLogbase =
Map.fromList
[ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ] | 141 | daemonsLogbase =
Map.fromList
[ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ] | 105 | false | true | 0 | 8 | 21 | 51 | 26 | 25 | null | null |
ancientlanguage/haskell-analysis | prepare/src/Prepare/Decompose.hs | mit | decomposeChar '\x2F9A2' = "\x83CC" | 34 | decomposeChar '\x2F9A2' = "\x83CC" | 34 | decomposeChar '\x2F9A2' = "\x83CC" | 34 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
nickbart1980/pandoc-citeproc | src/Text/CSL/Eval/Names.hs | bsd-3-clause | (<+>) :: Formatted -> Formatted -> Formatted
Formatted [] <+> ss = ss | 69 | (<+>) :: Formatted -> Formatted -> Formatted
Formatted [] <+> ss = ss | 69 | Formatted [] <+> ss = ss | 24 | false | true | 0 | 10 | 12 | 36 | 17 | 19 | null | null |
cullina/Extractor | src/ExpertData.hs | bsd-3-clause | b3 = expand 1 3001 z1 | 21 | b3 = expand 1 3001 z1 | 21 | b3 = expand 1 3001 z1 | 21 | false | false | 1 | 5 | 5 | 16 | 6 | 10 | null | null |
termite2/tsl | Frontend/ExprOps.hs | bsd-3-clause | exprScalars' e (StructSpec _ fs) = concatMap (\f -> exprScalars $ EField nopos e (name f)) fs | 117 | exprScalars' e (StructSpec _ fs) = concatMap (\f -> exprScalars $ EField nopos e (name f)) fs | 117 | exprScalars' e (StructSpec _ fs) = concatMap (\f -> exprScalars $ EField nopos e (name f)) fs | 117 | false | false | 0 | 11 | 40 | 49 | 24 | 25 | null | null |
adamwalker/hlibBladeRF | src/LibBladeRF/LibBladeRF.hs | lgpl-2.1 | -- | Handy helper to wrap around Either results
openBladeRF :: IO DeviceHandle
openBladeRF = do
r <- openBladeRF'
case r of
Left e -> throwIO e
Right dev -> return dev
-- Open specified device using a device identifier string.
-- See bladerf_open_with_devinfo() if a device identifier string
-- is not readily available. | 333 | openBladeRF :: IO DeviceHandle
openBladeRF = do
r <- openBladeRF'
case r of
Left e -> throwIO e
Right dev -> return dev
-- Open specified device using a device identifier string.
-- See bladerf_open_with_devinfo() if a device identifier string
-- is not readily available. | 285 | openBladeRF = do
r <- openBladeRF'
case r of
Left e -> throwIO e
Right dev -> return dev
-- Open specified device using a device identifier string.
-- See bladerf_open_with_devinfo() if a device identifier string
-- is not readily available. | 254 | true | true | 0 | 11 | 66 | 62 | 28 | 34 | null | null |
rubik/moodle-to-latex | app/Main.hs | bsd-3-clause | main :: IO ()
main = do
(line:_) <- getArgs
case parseOnly parseExpr $ pack line of
Left er -> putStrLn $ "Error: " ++ show er
Right cl -> putStrLn $ toLatex cl | 186 | main :: IO ()
main = do
(line:_) <- getArgs
case parseOnly parseExpr $ pack line of
Left er -> putStrLn $ "Error: " ++ show er
Right cl -> putStrLn $ toLatex cl | 186 | main = do
(line:_) <- getArgs
case parseOnly parseExpr $ pack line of
Left er -> putStrLn $ "Error: " ++ show er
Right cl -> putStrLn $ toLatex cl | 172 | false | true | 0 | 11 | 59 | 83 | 38 | 45 | null | null |
jgoerzen/dtmconv | HaXml-1.12/src/Text/XML/HaXml/Html/Generate.hs | gpl-2.0 | (?) = showattr | 14 | (?) = showattr | 14 | (?) = showattr | 14 | false | false | 1 | 5 | 2 | 12 | 5 | 7 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-utils/Utils/Drasil/Sentence.hs | bsd-2-clause | sIs = sentHelper "is" | 25 | sIs = sentHelper "is" | 25 | sIs = sentHelper "is" | 25 | false | false | 1 | 5 | 7 | 12 | 4 | 8 | null | null |
konn/lxc-dummy | src/System/LXC/Internal/Container.hs | bsd-3-clause | parseState "RUNNING" = ContainerRunning | 40 | parseState "RUNNING" = ContainerRunning | 40 | parseState "RUNNING" = ContainerRunning | 40 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
DavidAlphaFox/ghc | libraries/Cabal/Cabal/Distribution/PackageDescription/Configuration.hs | bsd-3-clause | mapTreeConstrs :: (c -> d) -> CondTree v c a -> CondTree v d a
mapTreeConstrs f = mapCondTree id f id | 101 | mapTreeConstrs :: (c -> d) -> CondTree v c a -> CondTree v d a
mapTreeConstrs f = mapCondTree id f id | 101 | mapTreeConstrs f = mapCondTree id f id | 38 | false | true | 0 | 7 | 21 | 50 | 24 | 26 | null | null |
foreverbell/unlimited-plt-toys | tapl/simplebool/PPrint.hs | bsd-3-clause | pprintAtomicTerm _ TermFalse = "false" | 38 | pprintAtomicTerm _ TermFalse = "false" | 38 | pprintAtomicTerm _ TermFalse = "false" | 38 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
tjakway/blackjack-simulator | src/Jakway/Blackjack/IO/DatabaseCommon.hs | mit | cardIdMap :: HashMap.Map (Visibility Card) Int
cardIdMap = HashMap.fromList $ zip cardPermutations ids
where ids = [1..(length cardPermutations)]
-- |TODO: reduce duplication | 179 | cardIdMap :: HashMap.Map (Visibility Card) Int
cardIdMap = HashMap.fromList $ zip cardPermutations ids
where ids = [1..(length cardPermutations)]
-- |TODO: reduce duplication | 179 | cardIdMap = HashMap.fromList $ zip cardPermutations ids
where ids = [1..(length cardPermutations)]
-- |TODO: reduce duplication | 132 | false | true | 0 | 7 | 26 | 55 | 28 | 27 | null | null |
elieux/ghc | ghc/Main.hs | bsd-3-clause | isShowVersionMode _ = False | 27 | isShowVersionMode _ = False | 27 | isShowVersionMode _ = False | 27 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
markflorisson/hpack | testrepo/bytestring-0.10.4.1/Data/ByteString/Lazy.hs | bsd-3-clause | -- | Map a function over a 'ByteString' and concatenate the results
concatMap :: (Word8 -> ByteString) -> ByteString -> ByteString
concatMap _ Empty = Empty | 163 | concatMap :: (Word8 -> ByteString) -> ByteString -> ByteString
concatMap _ Empty = Empty | 95 | concatMap _ Empty = Empty | 32 | true | true | 0 | 7 | 32 | 32 | 17 | 15 | null | null |
CodaFi/language-swift | src/Language/Swift/Util.hs | mit | sepBy s f (x:xs)
| null xs = next
| next == mempty = rest
| otherwise = next <> sepBeginBy s f xs
where
next = f x
rest = sepBy s f xs | 178 | sepBy s f (x:xs)
| null xs = next
| next == mempty = rest
| otherwise = next <> sepBeginBy s f xs
where
next = f x
rest = sepBy s f xs | 178 | sepBy s f (x:xs)
| null xs = next
| next == mempty = rest
| otherwise = next <> sepBeginBy s f xs
where
next = f x
rest = sepBy s f xs | 178 | false | false | 2 | 8 | 78 | 82 | 39 | 43 | null | null |
FranklinChen/Ebnf2ps | src/ParseAux.hs | bsd-3-clause | yaccpreprocessor ('\n':cs) = '\n':yaccpreprocessor cs | 56 | yaccpreprocessor ('\n':cs) = '\n':yaccpreprocessor cs | 56 | yaccpreprocessor ('\n':cs) = '\n':yaccpreprocessor cs | 56 | false | false | 0 | 7 | 7 | 23 | 11 | 12 | null | null |
GaloisInc/halvm-ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | absIntegerIdKey = mkPreludeMiscIdUnique 72 | 56 | absIntegerIdKey = mkPreludeMiscIdUnique 72 | 56 | absIntegerIdKey = mkPreludeMiscIdUnique 72 | 56 | false | false | 0 | 5 | 17 | 9 | 4 | 5 | null | null |
miguelpagano/equ | Equ/Theories.hs | gpl-3.0 | opGroup :: Grouped Operator
opGroup = mkGrouped theories [ F.theoryOperatorsList
, A.theoryOperatorsList
, L.theoryOperatorsList
] | 217 | opGroup :: Grouped Operator
opGroup = mkGrouped theories [ F.theoryOperatorsList
, A.theoryOperatorsList
, L.theoryOperatorsList
] | 217 | opGroup = mkGrouped theories [ F.theoryOperatorsList
, A.theoryOperatorsList
, L.theoryOperatorsList
] | 189 | false | true | 0 | 7 | 101 | 40 | 19 | 21 | null | null |
iconnect/network-transport-amqp | src/Network/Transport/AMQP.hs | mit | publish :: AMQP.Channel
-> AMQPExchange
-> AMQPMessage
-> IO ()
publish chn (AMQPExchange e) msg = do
AMQP.publishMsg chn e mempty --TODO: Do we need a routing key?
(AMQP.newMsg { AMQP.msgBody = encode' msg
, AMQP.msgDeliveryMode = Just AMQP.NonPersistent
})
-------------------------------------------------------------------------------- | 456 | publish :: AMQP.Channel
-> AMQPExchange
-> AMQPMessage
-> IO ()
publish chn (AMQPExchange e) msg = do
AMQP.publishMsg chn e mempty --TODO: Do we need a routing key?
(AMQP.newMsg { AMQP.msgBody = encode' msg
, AMQP.msgDeliveryMode = Just AMQP.NonPersistent
})
-------------------------------------------------------------------------------- | 456 | publish chn (AMQPExchange e) msg = do
AMQP.publishMsg chn e mempty --TODO: Do we need a routing key?
(AMQP.newMsg { AMQP.msgBody = encode' msg
, AMQP.msgDeliveryMode = Just AMQP.NonPersistent
})
-------------------------------------------------------------------------------- | 366 | false | true | 0 | 12 | 157 | 90 | 46 | 44 | null | null |
supermitch/learn-haskell | real-world-haskell/ch03/Distinctions.hs | mit | -- file: ch03/Distictions.hs
a = ("Porpoise", "Grey") | 53 | a = ("Porpoise", "Grey") | 24 | a = ("Porpoise", "Grey") | 24 | true | false | 1 | 5 | 6 | 16 | 8 | 8 | null | null |
jrclogic/SMCDEL | src/SMCDEL/Explicit/DEMO_S5.hs | gpl-2.0 | -- | semantics: truth at a world in a model
isTrueAt :: (Show state, Ord state) => EpistM state -> state -> DemoForm state -> Bool
isTrueAt _ _ Top = True | 154 | isTrueAt :: (Show state, Ord state) => EpistM state -> state -> DemoForm state -> Bool
isTrueAt _ _ Top = True | 110 | isTrueAt _ _ Top = True | 23 | true | true | 0 | 9 | 31 | 52 | 26 | 26 | null | null |
bgamari/pandoc | src/Text/Pandoc/Writers/OpenDocument.hs | gpl-2.0 | paraTableStyles t s (a:xs)
| AlignRight <- a = ( pName s, res s "end" ) : paraTableStyles t (s + 1) xs
| AlignCenter <- a = ( pName s, res s "center") : paraTableStyles t (s + 1) xs
| otherwise = ("Table_20_" ++ t, empty ) : paraTableStyles t s xs
where pName sn = "P" ++ show (sn + 1)
res sn x = inTags True "style:style"
[ ("style:name" , pName sn )
, ("style:family" , "paragraph" )
, ("style:parent-style-name", "Table_20_" ++ t)] $
selfClosingTag "style:paragraph-properties"
[ ("fo:text-align", x)
, ("style:justify-single-word", "false")] | 770 | paraTableStyles t s (a:xs)
| AlignRight <- a = ( pName s, res s "end" ) : paraTableStyles t (s + 1) xs
| AlignCenter <- a = ( pName s, res s "center") : paraTableStyles t (s + 1) xs
| otherwise = ("Table_20_" ++ t, empty ) : paraTableStyles t s xs
where pName sn = "P" ++ show (sn + 1)
res sn x = inTags True "style:style"
[ ("style:name" , pName sn )
, ("style:family" , "paragraph" )
, ("style:parent-style-name", "Table_20_" ++ t)] $
selfClosingTag "style:paragraph-properties"
[ ("fo:text-align", x)
, ("style:justify-single-word", "false")] | 770 | paraTableStyles t s (a:xs)
| AlignRight <- a = ( pName s, res s "end" ) : paraTableStyles t (s + 1) xs
| AlignCenter <- a = ( pName s, res s "center") : paraTableStyles t (s + 1) xs
| otherwise = ("Table_20_" ++ t, empty ) : paraTableStyles t s xs
where pName sn = "P" ++ show (sn + 1)
res sn x = inTags True "style:style"
[ ("style:name" , pName sn )
, ("style:family" , "paragraph" )
, ("style:parent-style-name", "Table_20_" ++ t)] $
selfClosingTag "style:paragraph-properties"
[ ("fo:text-align", x)
, ("style:justify-single-word", "false")] | 770 | false | false | 2 | 10 | 320 | 238 | 125 | 113 | null | null |
itkovian/number-six | src/NumberSix/Handlers/Quote.hs | bsd-3-clause | --------------------------------------------------------------------------------
addQuoteHook :: Irc ()
addQuoteHook = onBangCommand "!addquote" $ do
text <- getBangCommandText
host <- getHost
channel <- getChannel
localId <- (fmap (+ 1)) getLastId
withDatabase $ \db -> Sqlite.execute db
"INSERT INTO quotes (local_id, host, channel, text) VALUES (?, ?, ?, ?)"
(localId, host, channel, text)
write $ "Quote " <> T.pack (show localId) <> " added"
-------------------------------------------------------------------------------- | 575 | addQuoteHook :: Irc ()
addQuoteHook = onBangCommand "!addquote" $ do
text <- getBangCommandText
host <- getHost
channel <- getChannel
localId <- (fmap (+ 1)) getLastId
withDatabase $ \db -> Sqlite.execute db
"INSERT INTO quotes (local_id, host, channel, text) VALUES (?, ?, ?, ?)"
(localId, host, channel, text)
write $ "Quote " <> T.pack (show localId) <> " added"
-------------------------------------------------------------------------------- | 494 | addQuoteHook = onBangCommand "!addquote" $ do
text <- getBangCommandText
host <- getHost
channel <- getChannel
localId <- (fmap (+ 1)) getLastId
withDatabase $ \db -> Sqlite.execute db
"INSERT INTO quotes (local_id, host, channel, text) VALUES (?, ?, ?, ?)"
(localId, host, channel, text)
write $ "Quote " <> T.pack (show localId) <> " added"
-------------------------------------------------------------------------------- | 471 | true | true | 0 | 12 | 107 | 125 | 62 | 63 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 25352141 = 1754 | 35 | getValueFromProduct 25352141 = 1754 | 35 | getValueFromProduct 25352141 = 1754 | 35 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
spire/spire | src/Spire/Expression/Checker.hs | bsd-3-clause | check' (CArg _A _B) (VDesc _I) = do
_A' <- check _A VType
_B' <- checkExtend _A' _B (VDesc _I)
return $ VArg _A' _B' | 122 | check' (CArg _A _B) (VDesc _I) = do
_A' <- check _A VType
_B' <- checkExtend _A' _B (VDesc _I)
return $ VArg _A' _B' | 122 | check' (CArg _A _B) (VDesc _I) = do
_A' <- check _A VType
_B' <- checkExtend _A' _B (VDesc _I)
return $ VArg _A' _B' | 122 | false | false | 0 | 10 | 30 | 71 | 31 | 40 | null | null |
romanb/aws | Aws/Sqs/Core.hs | bsd-3-clause | sqsEndpointApSouthEast2 :: Endpoint
sqsEndpointApSouthEast2
= Endpoint {
endpointHost = "sqs.ap-southeast-2.amazonaws.com"
, endpointDefaultLocationConstraint = locationApSouthEast2
, endpointAllowedLocationConstraints = [locationApSouthEast2]
} | 275 | sqsEndpointApSouthEast2 :: Endpoint
sqsEndpointApSouthEast2
= Endpoint {
endpointHost = "sqs.ap-southeast-2.amazonaws.com"
, endpointDefaultLocationConstraint = locationApSouthEast2
, endpointAllowedLocationConstraints = [locationApSouthEast2]
} | 275 | sqsEndpointApSouthEast2
= Endpoint {
endpointHost = "sqs.ap-southeast-2.amazonaws.com"
, endpointDefaultLocationConstraint = locationApSouthEast2
, endpointAllowedLocationConstraints = [locationApSouthEast2]
} | 239 | false | true | 0 | 8 | 48 | 41 | 22 | 19 | null | null |
flipstone/orville | orville-postgresql-libpq/src/Orville/PostgreSQL/Internal/SqlValue.hs | mit | {- |
Encodes an 'Word' value for usage with database
-}
fromWord :: Word -> SqlValue
fromWord =
fromBSBuilderWithNoNULs BSB.wordDec | 135 | fromWord :: Word -> SqlValue
fromWord =
fromBSBuilderWithNoNULs BSB.wordDec | 77 | fromWord =
fromBSBuilderWithNoNULs BSB.wordDec | 48 | true | true | 0 | 7 | 23 | 27 | 12 | 15 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitPrimOp dflags res WriteOffAddrOp_Word8 args = doWriteOffAddrOp (Just (mo_WordTo8 dflags)) b8 res args | 117 | emitPrimOp dflags res WriteOffAddrOp_Word8 args = doWriteOffAddrOp (Just (mo_WordTo8 dflags)) b8 res args | 117 | emitPrimOp dflags res WriteOffAddrOp_Word8 args = doWriteOffAddrOp (Just (mo_WordTo8 dflags)) b8 res args | 117 | false | false | 0 | 9 | 24 | 36 | 17 | 19 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 542659 = 100 | 32 | getValueFromProduct 542659 = 100 | 32 | getValueFromProduct 542659 = 100 | 32 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
CloudI/CloudI | src/api/haskell/external/zlib-0.6.2.1/test/Test.hs | mit | test_right_dictionary :: Assertion
test_right_dictionary = do
withSampleData "custom-dict.zlib" $ \hnd -> do
dict <- readSampleData "custom-dict.zlib-dict"
let decomp = decompressIO zlibFormat defaultDecompressParams {
decompressDictionary =
Just (toStrict dict)
}
assertDecompressOk hnd decomp | 437 | test_right_dictionary :: Assertion
test_right_dictionary = do
withSampleData "custom-dict.zlib" $ \hnd -> do
dict <- readSampleData "custom-dict.zlib-dict"
let decomp = decompressIO zlibFormat defaultDecompressParams {
decompressDictionary =
Just (toStrict dict)
}
assertDecompressOk hnd decomp | 437 | test_right_dictionary = do
withSampleData "custom-dict.zlib" $ \hnd -> do
dict <- readSampleData "custom-dict.zlib-dict"
let decomp = decompressIO zlibFormat defaultDecompressParams {
decompressDictionary =
Just (toStrict dict)
}
assertDecompressOk hnd decomp | 402 | false | true | 0 | 19 | 174 | 75 | 35 | 40 | null | null |
dorchard/pde-specs | TestCase-split.hs | bsd-2-clause | experiment = let ?dx = 0.05
?dt = 0.05 :: Float
?nx = 40 :: Int
?nt = 20 :: Int
?name = "h" in
let alpha = 0.006
spec' = let ?nx = ?nx :: Int
?nt = ?nt :: Int
in spec (constant alpha) (implFast alpha)
f = check spec'
outputFun (x, t) = putStrLn $ "x = " ++ (show x) ++ " t = " ++ (show t)
++ " results = " ++ (show $ f (x,t))
figureEqn axis xs = plot3d' 1 1 (0, ?nx - 2) (0, ?nt - 1) (show X) (show T) axis xs
dat = map outputFun [(0,0)..(?nx-2,?nt-1)]
heatImpl = plot3d' 1 1 (0, ?nx) (0, ?nt) (show X) (show T) (?name) (curry (implFast alpha))
heatLHS = figureEqn (toString $ lhs spec') (curry $ fst . f)
heatRHS = figureEqn (toString $ rhs spec') (curry $ snd . f)
heatErr = figureEqn "|err|" (\x t -> (abs . uncurry (-)) . f $ (x, t))
in do plotX11 heatImpl
plotX11 heatLHS
plotX11 heatRHS
plotX11 heatErr
writePlotPNG heatImpl "heatImpl"
writePlotPNG heatLHS "heatLHS"
writePlotPNG heatRHS "heatRHS"
writePlotPNG heatErr "heatErr" | 1,493 | experiment = let ?dx = 0.05
?dt = 0.05 :: Float
?nx = 40 :: Int
?nt = 20 :: Int
?name = "h" in
let alpha = 0.006
spec' = let ?nx = ?nx :: Int
?nt = ?nt :: Int
in spec (constant alpha) (implFast alpha)
f = check spec'
outputFun (x, t) = putStrLn $ "x = " ++ (show x) ++ " t = " ++ (show t)
++ " results = " ++ (show $ f (x,t))
figureEqn axis xs = plot3d' 1 1 (0, ?nx - 2) (0, ?nt - 1) (show X) (show T) axis xs
dat = map outputFun [(0,0)..(?nx-2,?nt-1)]
heatImpl = plot3d' 1 1 (0, ?nx) (0, ?nt) (show X) (show T) (?name) (curry (implFast alpha))
heatLHS = figureEqn (toString $ lhs spec') (curry $ fst . f)
heatRHS = figureEqn (toString $ rhs spec') (curry $ snd . f)
heatErr = figureEqn "|err|" (\x t -> (abs . uncurry (-)) . f $ (x, t))
in do plotX11 heatImpl
plotX11 heatLHS
plotX11 heatRHS
plotX11 heatErr
writePlotPNG heatImpl "heatImpl"
writePlotPNG heatLHS "heatLHS"
writePlotPNG heatRHS "heatRHS"
writePlotPNG heatErr "heatErr" | 1,493 | experiment = let ?dx = 0.05
?dt = 0.05 :: Float
?nx = 40 :: Int
?nt = 20 :: Int
?name = "h" in
let alpha = 0.006
spec' = let ?nx = ?nx :: Int
?nt = ?nt :: Int
in spec (constant alpha) (implFast alpha)
f = check spec'
outputFun (x, t) = putStrLn $ "x = " ++ (show x) ++ " t = " ++ (show t)
++ " results = " ++ (show $ f (x,t))
figureEqn axis xs = plot3d' 1 1 (0, ?nx - 2) (0, ?nt - 1) (show X) (show T) axis xs
dat = map outputFun [(0,0)..(?nx-2,?nt-1)]
heatImpl = plot3d' 1 1 (0, ?nx) (0, ?nt) (show X) (show T) (?name) (curry (implFast alpha))
heatLHS = figureEqn (toString $ lhs spec') (curry $ fst . f)
heatRHS = figureEqn (toString $ rhs spec') (curry $ snd . f)
heatErr = figureEqn "|err|" (\x t -> (abs . uncurry (-)) . f $ (x, t))
in do plotX11 heatImpl
plotX11 heatLHS
plotX11 heatRHS
plotX11 heatErr
writePlotPNG heatImpl "heatImpl"
writePlotPNG heatLHS "heatLHS"
writePlotPNG heatRHS "heatRHS"
writePlotPNG heatErr "heatErr" | 1,493 | false | false | 0 | 18 | 745 | 494 | 255 | 239 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Asn1.hs | gpl-2.0 | list_keywords = Set.fromList $ words $ "DEFINITIONS BEGIN END EXPORTS IMPORTS FROM APPLICATION PRIVATE UNIVERSAL DEFAULT OPTIONAL FALSE TRUE" | 141 | list_keywords = Set.fromList $ words $ "DEFINITIONS BEGIN END EXPORTS IMPORTS FROM APPLICATION PRIVATE UNIVERSAL DEFAULT OPTIONAL FALSE TRUE" | 141 | list_keywords = Set.fromList $ words $ "DEFINITIONS BEGIN END EXPORTS IMPORTS FROM APPLICATION PRIVATE UNIVERSAL DEFAULT OPTIONAL FALSE TRUE" | 141 | false | false | 1 | 7 | 18 | 20 | 8 | 12 | null | null |
eiji-a/aya | src/Aya/Scene-balls_in_room.hs | bsd-3-clause | ball1 = Material intensityZero colorBlack colorWhite colorBlack colorBlack 0 0 | 79 | ball1 = Material intensityZero colorBlack colorWhite colorBlack colorBlack 0 0 | 79 | ball1 = Material intensityZero colorBlack colorWhite colorBlack colorBlack 0 0 | 79 | false | false | 0 | 5 | 10 | 21 | 10 | 11 | null | null |
nickbart1980/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | macron 'U' = "Ū" | 16 | macron 'U' = "Ū" | 16 | macron 'U' = "Ū" | 16 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ababkin/partial_inspector | src/Vim/Netbeans/Protocol.hs | mit | buttonReleaseParser :: BufId -> Parser VimMessage
buttonReleaseParser bufId = do
string "buttonRelease="
seqNo <- parseNumber
char ' '
button <- parseNumber
char ' '
lnum <- parseNumber
char ' '
col <- parseNumber
return $ EventMessage bufId seqNo $ ButtonRelease button lnum col | 315 | buttonReleaseParser :: BufId -> Parser VimMessage
buttonReleaseParser bufId = do
string "buttonRelease="
seqNo <- parseNumber
char ' '
button <- parseNumber
char ' '
lnum <- parseNumber
char ' '
col <- parseNumber
return $ EventMessage bufId seqNo $ ButtonRelease button lnum col | 315 | buttonReleaseParser bufId = do
string "buttonRelease="
seqNo <- parseNumber
char ' '
button <- parseNumber
char ' '
lnum <- parseNumber
char ' '
col <- parseNumber
return $ EventMessage bufId seqNo $ ButtonRelease button lnum col | 265 | false | true | 0 | 10 | 78 | 101 | 41 | 60 | null | null |
anttisalonen/freekick2 | src/Listings.hs | gpl-3.0 | showPlayerNation 34 = "Turkey" | 30 | showPlayerNation 34 = "Turkey" | 30 | showPlayerNation 34 = "Turkey" | 30 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
kawamuray/ganeti | test/hs/Test/Ganeti/Locking/Allocation.hs | gpl-2.0 | -- | Verify the property that every blocking owner is necessary, i.e., even
-- if we only keep the locks of one of the blocking owners, the request still
-- will be blocked. We deliberatly use the expensive variant of restraining
-- to ensure good coverage. To make sure the request can always be blocked
-- by two owners, for a shared request we request two different locks.
prop_BlockNecessary :: Property
prop_BlockNecessary =
forAll (arbitrary :: Gen TestOwner) $ \a ->
forAll (arbitrary :: Gen TestLock) $ \lock ->
forAll (arbitrary `suchThat` (/= lock)) $ \lock' ->
forAll (elements [ [requestShared lock, requestShared lock']
, [requestExclusive lock]]) $ \request ->
forAll ((arbitrary :: Gen (LockAllocation TestLock TestOwner))
`suchThat` (genericResult (const False) ((>= 2) . S.size)
. snd . updateLocks a request)) $ \state ->
let (_, result) = updateLocks a request state
blockers = genericResult (const S.empty) id result
in printTestCase "Each blocker alone must block the request"
. flip all (S.elems blockers) $ \blocker ->
(==) (Ok $ S.singleton blocker) . snd . updateLocks a request
. F.foldl freeLocks state
$ S.filter (/= blocker) blockers | 1,267 | prop_BlockNecessary :: Property
prop_BlockNecessary =
forAll (arbitrary :: Gen TestOwner) $ \a ->
forAll (arbitrary :: Gen TestLock) $ \lock ->
forAll (arbitrary `suchThat` (/= lock)) $ \lock' ->
forAll (elements [ [requestShared lock, requestShared lock']
, [requestExclusive lock]]) $ \request ->
forAll ((arbitrary :: Gen (LockAllocation TestLock TestOwner))
`suchThat` (genericResult (const False) ((>= 2) . S.size)
. snd . updateLocks a request)) $ \state ->
let (_, result) = updateLocks a request state
blockers = genericResult (const S.empty) id result
in printTestCase "Each blocker alone must block the request"
. flip all (S.elems blockers) $ \blocker ->
(==) (Ok $ S.singleton blocker) . snd . updateLocks a request
. F.foldl freeLocks state
$ S.filter (/= blocker) blockers | 891 | prop_BlockNecessary =
forAll (arbitrary :: Gen TestOwner) $ \a ->
forAll (arbitrary :: Gen TestLock) $ \lock ->
forAll (arbitrary `suchThat` (/= lock)) $ \lock' ->
forAll (elements [ [requestShared lock, requestShared lock']
, [requestExclusive lock]]) $ \request ->
forAll ((arbitrary :: Gen (LockAllocation TestLock TestOwner))
`suchThat` (genericResult (const False) ((>= 2) . S.size)
. snd . updateLocks a request)) $ \state ->
let (_, result) = updateLocks a request state
blockers = genericResult (const S.empty) id result
in printTestCase "Each blocker alone must block the request"
. flip all (S.elems blockers) $ \blocker ->
(==) (Ok $ S.singleton blocker) . snd . updateLocks a request
. F.foldl freeLocks state
$ S.filter (/= blocker) blockers | 859 | true | true | 0 | 27 | 290 | 333 | 176 | 157 | null | null |
jhance/llvm-untyped | LLVM/Untyped/Core.hs | gpl-3.0 | buildICmp :: Builder -> IntComparison -> Value -> Value -> String -> LLVM Value
buildICmp (Builder b) c (Value v1) (Value v2) name =
LLVM $ Value <$> withCString name (L.buildICmp b (convertIntCmp c) v1 v2) | 210 | buildICmp :: Builder -> IntComparison -> Value -> Value -> String -> LLVM Value
buildICmp (Builder b) c (Value v1) (Value v2) name =
LLVM $ Value <$> withCString name (L.buildICmp b (convertIntCmp c) v1 v2) | 210 | buildICmp (Builder b) c (Value v1) (Value v2) name =
LLVM $ Value <$> withCString name (L.buildICmp b (convertIntCmp c) v1 v2) | 130 | false | true | 0 | 10 | 39 | 96 | 47 | 49 | null | null |
pzel/slowotok | src/Lib.hs | bsd-3-clause | ngrams :: (a -> M.Map k v -> M.Map k v) -> ([b] -> [a]) -> [b] -> M.Map k v
ngrams add shift tokens = foldl' (flip add) M.empty (shift tokens) | 142 | ngrams :: (a -> M.Map k v -> M.Map k v) -> ([b] -> [a]) -> [b] -> M.Map k v
ngrams add shift tokens = foldl' (flip add) M.empty (shift tokens) | 142 | ngrams add shift tokens = foldl' (flip add) M.empty (shift tokens) | 66 | false | true | 0 | 10 | 31 | 104 | 51 | 53 | null | null |
psibi/yesod | yesod-core/Yesod/Core/Internal/TH.hs | mit | -- | If the generation of @'YesodDispatch'@ instance require finer
-- control of the types, contexts etc. using this combinator. You will
-- hardly need this generality. However, in certain situations, like
-- when writing library/plugin for yesod, this combinator becomes
-- handy.
mkDispatchInstance :: Type -- ^ The master site type
-> Cxt -- ^ Context of the instance
-> (Exp -> Q Exp) -- ^ Unwrap handler
-> [ResourceTree c] -- ^ The resource
-> DecsQ
mkDispatchInstance master cxt f res = do
clause' <- mkDispatchClause (mkMDS f [|yesodRunner|]) res
let thisDispatch = FunD 'yesodDispatch [clause']
return [instanceD cxt yDispatch [thisDispatch]]
where
yDispatch = ConT ''YesodDispatch `AppT` master | 862 | mkDispatchInstance :: Type -- ^ The master site type
-> Cxt -- ^ Context of the instance
-> (Exp -> Q Exp) -- ^ Unwrap handler
-> [ResourceTree c] -- ^ The resource
-> DecsQ
mkDispatchInstance master cxt f res = do
clause' <- mkDispatchClause (mkMDS f [|yesodRunner|]) res
let thisDispatch = FunD 'yesodDispatch [clause']
return [instanceD cxt yDispatch [thisDispatch]]
where
yDispatch = ConT ''YesodDispatch `AppT` master | 579 | mkDispatchInstance master cxt f res = do
clause' <- mkDispatchClause (mkMDS f [|yesodRunner|]) res
let thisDispatch = FunD 'yesodDispatch [clause']
return [instanceD cxt yDispatch [thisDispatch]]
where
yDispatch = ConT ''YesodDispatch `AppT` master | 266 | true | true | 0 | 11 | 266 | 140 | 75 | 65 | null | null |
GregorySchwartz/dotfiles | .config/taffybar/taffybar.hs | gpl-2.0 | colors "darkred" = "#cc241d" | 32 | colors "darkred" = "#cc241d" | 32 | colors "darkred" = "#cc241d" | 32 | false | false | 0 | 5 | 7 | 9 | 4 | 5 | null | null |
rfranek/duckling | Duckling/Quantity/PT/Rules.hs | bsd-3-clause | rules :: [Rule]
rules =
[ ruleNumeralUnits
, ruleQuantityOfProduct
] | 74 | rules :: [Rule]
rules =
[ ruleNumeralUnits
, ruleQuantityOfProduct
] | 74 | rules =
[ ruleNumeralUnits
, ruleQuantityOfProduct
] | 58 | false | true | 0 | 5 | 15 | 20 | 12 | 8 | null | null |
alphaHeavy/influxdb-haskell | tests/test-suite.hs | bsd-3-clause | prop_fromValue_toValue_identity_Word32 :: Word32 -> Bool
prop_fromValue_toValue_identity_Word32 = fromValueToValueIdentity | 122 | prop_fromValue_toValue_identity_Word32 :: Word32 -> Bool
prop_fromValue_toValue_identity_Word32 = fromValueToValueIdentity | 122 | prop_fromValue_toValue_identity_Word32 = fromValueToValueIdentity | 65 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
ChrisCoffey/haskell_sandbox | 99problems.hs | mit | --3
nth ls n = head (drop (n - 1) ls) | 37 | nth ls n = head (drop (n - 1) ls) | 33 | nth ls n = head (drop (n - 1) ls) | 33 | true | false | 1 | 9 | 10 | 34 | 15 | 19 | null | null |
plumlife/cabal | Cabal/Distribution/Simple/LHC.hs | bsd-3-clause | buildLib :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Library -> ComponentLocalBuildInfo -> IO ()
buildLib verbosity pkg_descr lbi lib clbi = do
libName <- case componentLibraries clbi of
[libName] -> return libName
[] -> die "No library name found when building library"
_ -> die "Multiple library names found when building library"
let pref = buildDir lbi
pkgid = packageId pkg_descr
runGhcProg = rawSystemProgramConf verbosity lhcProgram (withPrograms lbi)
ifVanillaLib forceVanilla = when (forceVanilla || withVanillaLib lbi)
ifProfLib = when (withProfLib lbi)
ifSharedLib = when (withSharedLib lbi)
ifGHCiLib = when (withGHCiLib lbi && withVanillaLib lbi)
libBi <- hackThreadedFlag verbosity
(compiler lbi) (withProfLib lbi) (libBuildInfo lib)
let libTargetDir = pref
forceVanillaLib = EnableExtension TemplateHaskell `elem` allExtensions libBi
-- TH always needs vanilla libs, even when building for profiling
createDirectoryIfMissingVerbose verbosity True libTargetDir
-- TODO: do we need to put hs-boot files into place for mutually recursive modules?
let ghcArgs =
["-package-name", display pkgid ]
++ constructGHCCmdLine lbi libBi clbi libTargetDir verbosity
++ map display (libModules lib)
lhcWrap x = ["--build-library", "--ghc-opts=" ++ unwords x]
ghcArgsProf = ghcArgs
++ ["-prof",
"-hisuf", "p_hi",
"-osuf", "p_o"
]
++ hcProfOptions GHC libBi
ghcArgsShared = ghcArgs
++ ["-dynamic",
"-hisuf", "dyn_hi",
"-osuf", "dyn_o", "-fPIC"
]
++ hcSharedOptions GHC libBi
unless (null (libModules lib)) $
do ifVanillaLib forceVanillaLib (runGhcProg $ lhcWrap ghcArgs)
ifProfLib (runGhcProg $ lhcWrap ghcArgsProf)
ifSharedLib (runGhcProg $ lhcWrap ghcArgsShared)
-- build any C sources
unless (null (cSources libBi)) $ do
info verbosity "Building C Sources..."
sequence_ [do let (odir,args) = constructCcCmdLine lbi libBi clbi pref
filename verbosity
createDirectoryIfMissingVerbose verbosity True odir
runGhcProg args
ifSharedLib (runGhcProg (args ++ ["-fPIC", "-osuf dyn_o"]))
| filename <- cSources libBi]
-- link:
info verbosity "Linking..."
let cObjs = map (`replaceExtension` objExtension) (cSources libBi)
cSharedObjs = map (`replaceExtension` ("dyn_" ++ objExtension)) (cSources libBi)
cid = compilerId (compiler lbi)
vanillaLibFilePath = libTargetDir </> mkLibName libName
profileLibFilePath = libTargetDir </> mkProfLibName libName
sharedLibFilePath = libTargetDir </> mkSharedLibName cid libName
ghciLibFilePath = libTargetDir </> mkGHCiLibName libName
stubObjs <- fmap catMaybes $ sequence
[ findFileWithExtension [objExtension] [libTargetDir]
(ModuleName.toFilePath x ++"_stub")
| x <- libModules lib ]
stubProfObjs <- fmap catMaybes $ sequence
[ findFileWithExtension ["p_" ++ objExtension] [libTargetDir]
(ModuleName.toFilePath x ++"_stub")
| x <- libModules lib ]
stubSharedObjs <- fmap catMaybes $ sequence
[ findFileWithExtension ["dyn_" ++ objExtension] [libTargetDir]
(ModuleName.toFilePath x ++"_stub")
| x <- libModules lib ]
hObjs <- getHaskellObjects lib lbi
pref objExtension True
hProfObjs <-
if (withProfLib lbi)
then getHaskellObjects lib lbi
pref ("p_" ++ objExtension) True
else return []
hSharedObjs <-
if (withSharedLib lbi)
then getHaskellObjects lib lbi
pref ("dyn_" ++ objExtension) False
else return []
unless (null hObjs && null cObjs && null stubObjs) $ do
-- first remove library files if they exists
sequence_
[ removeFile libFilePath `catchIO` \_ -> return ()
| libFilePath <- [vanillaLibFilePath, profileLibFilePath
,sharedLibFilePath, ghciLibFilePath] ]
let arVerbosity | verbosity >= deafening = "v"
| verbosity >= normal = ""
| otherwise = "c"
arArgs = ["q"++ arVerbosity]
++ [vanillaLibFilePath]
arObjArgs =
hObjs
++ map (pref </>) cObjs
++ stubObjs
arProfArgs = ["q"++ arVerbosity]
++ [profileLibFilePath]
arProfObjArgs =
hProfObjs
++ map (pref </>) cObjs
++ stubProfObjs
ldArgs = ["-r"]
++ ["-o", ghciLibFilePath <.> "tmp"]
ldObjArgs =
hObjs
++ map (pref </>) cObjs
++ stubObjs
ghcSharedObjArgs =
hSharedObjs
++ map (pref </>) cSharedObjs
++ stubSharedObjs
-- After the relocation lib is created we invoke ghc -shared
-- with the dependencies spelled out as -package arguments
-- and ghc invokes the linker with the proper library paths
ghcSharedLinkArgs =
[ "-no-auto-link-packages",
"-shared",
"-dynamic",
"-o", sharedLibFilePath ]
++ ghcSharedObjArgs
++ ["-package-name", display pkgid ]
++ ghcPackageFlags lbi clbi
++ ["-l"++extraLib | extraLib <- extraLibs libBi]
++ ["-L"++extraLibDir | extraLibDir <- extraLibDirs libBi]
runLd ldLibName args = do
exists <- doesFileExist ldLibName
-- This method is called iteratively by xargs. The
-- output goes to <ldLibName>.tmp, and any existing file
-- named <ldLibName> is included when linking. The
-- output is renamed to <libName>.
rawSystemProgramConf verbosity ldProgram (withPrograms lbi)
(args ++ if exists then [ldLibName] else [])
renameFile (ldLibName <.> "tmp") ldLibName
runAr = rawSystemProgramConf verbosity arProgram (withPrograms lbi)
--TODO: discover this at configure time or runtime on Unix
-- The value is 32k on Windows and POSIX specifies a minimum of 4k
-- but all sensible Unixes use more than 4k.
-- we could use getSysVar ArgumentLimit but that's in the Unix lib
maxCommandLineSize = 30 * 1024
ifVanillaLib False $ xargs maxCommandLineSize
runAr arArgs arObjArgs
ifProfLib $ xargs maxCommandLineSize
runAr arProfArgs arProfObjArgs
ifGHCiLib $ xargs maxCommandLineSize
(runLd ghciLibFilePath) ldArgs ldObjArgs
ifSharedLib $ runGhcProg ghcSharedLinkArgs
-- | Build an executable with LHC.
-- | 6,941 | buildLib :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Library -> ComponentLocalBuildInfo -> IO ()
buildLib verbosity pkg_descr lbi lib clbi = do
libName <- case componentLibraries clbi of
[libName] -> return libName
[] -> die "No library name found when building library"
_ -> die "Multiple library names found when building library"
let pref = buildDir lbi
pkgid = packageId pkg_descr
runGhcProg = rawSystemProgramConf verbosity lhcProgram (withPrograms lbi)
ifVanillaLib forceVanilla = when (forceVanilla || withVanillaLib lbi)
ifProfLib = when (withProfLib lbi)
ifSharedLib = when (withSharedLib lbi)
ifGHCiLib = when (withGHCiLib lbi && withVanillaLib lbi)
libBi <- hackThreadedFlag verbosity
(compiler lbi) (withProfLib lbi) (libBuildInfo lib)
let libTargetDir = pref
forceVanillaLib = EnableExtension TemplateHaskell `elem` allExtensions libBi
-- TH always needs vanilla libs, even when building for profiling
createDirectoryIfMissingVerbose verbosity True libTargetDir
-- TODO: do we need to put hs-boot files into place for mutually recursive modules?
let ghcArgs =
["-package-name", display pkgid ]
++ constructGHCCmdLine lbi libBi clbi libTargetDir verbosity
++ map display (libModules lib)
lhcWrap x = ["--build-library", "--ghc-opts=" ++ unwords x]
ghcArgsProf = ghcArgs
++ ["-prof",
"-hisuf", "p_hi",
"-osuf", "p_o"
]
++ hcProfOptions GHC libBi
ghcArgsShared = ghcArgs
++ ["-dynamic",
"-hisuf", "dyn_hi",
"-osuf", "dyn_o", "-fPIC"
]
++ hcSharedOptions GHC libBi
unless (null (libModules lib)) $
do ifVanillaLib forceVanillaLib (runGhcProg $ lhcWrap ghcArgs)
ifProfLib (runGhcProg $ lhcWrap ghcArgsProf)
ifSharedLib (runGhcProg $ lhcWrap ghcArgsShared)
-- build any C sources
unless (null (cSources libBi)) $ do
info verbosity "Building C Sources..."
sequence_ [do let (odir,args) = constructCcCmdLine lbi libBi clbi pref
filename verbosity
createDirectoryIfMissingVerbose verbosity True odir
runGhcProg args
ifSharedLib (runGhcProg (args ++ ["-fPIC", "-osuf dyn_o"]))
| filename <- cSources libBi]
-- link:
info verbosity "Linking..."
let cObjs = map (`replaceExtension` objExtension) (cSources libBi)
cSharedObjs = map (`replaceExtension` ("dyn_" ++ objExtension)) (cSources libBi)
cid = compilerId (compiler lbi)
vanillaLibFilePath = libTargetDir </> mkLibName libName
profileLibFilePath = libTargetDir </> mkProfLibName libName
sharedLibFilePath = libTargetDir </> mkSharedLibName cid libName
ghciLibFilePath = libTargetDir </> mkGHCiLibName libName
stubObjs <- fmap catMaybes $ sequence
[ findFileWithExtension [objExtension] [libTargetDir]
(ModuleName.toFilePath x ++"_stub")
| x <- libModules lib ]
stubProfObjs <- fmap catMaybes $ sequence
[ findFileWithExtension ["p_" ++ objExtension] [libTargetDir]
(ModuleName.toFilePath x ++"_stub")
| x <- libModules lib ]
stubSharedObjs <- fmap catMaybes $ sequence
[ findFileWithExtension ["dyn_" ++ objExtension] [libTargetDir]
(ModuleName.toFilePath x ++"_stub")
| x <- libModules lib ]
hObjs <- getHaskellObjects lib lbi
pref objExtension True
hProfObjs <-
if (withProfLib lbi)
then getHaskellObjects lib lbi
pref ("p_" ++ objExtension) True
else return []
hSharedObjs <-
if (withSharedLib lbi)
then getHaskellObjects lib lbi
pref ("dyn_" ++ objExtension) False
else return []
unless (null hObjs && null cObjs && null stubObjs) $ do
-- first remove library files if they exists
sequence_
[ removeFile libFilePath `catchIO` \_ -> return ()
| libFilePath <- [vanillaLibFilePath, profileLibFilePath
,sharedLibFilePath, ghciLibFilePath] ]
let arVerbosity | verbosity >= deafening = "v"
| verbosity >= normal = ""
| otherwise = "c"
arArgs = ["q"++ arVerbosity]
++ [vanillaLibFilePath]
arObjArgs =
hObjs
++ map (pref </>) cObjs
++ stubObjs
arProfArgs = ["q"++ arVerbosity]
++ [profileLibFilePath]
arProfObjArgs =
hProfObjs
++ map (pref </>) cObjs
++ stubProfObjs
ldArgs = ["-r"]
++ ["-o", ghciLibFilePath <.> "tmp"]
ldObjArgs =
hObjs
++ map (pref </>) cObjs
++ stubObjs
ghcSharedObjArgs =
hSharedObjs
++ map (pref </>) cSharedObjs
++ stubSharedObjs
-- After the relocation lib is created we invoke ghc -shared
-- with the dependencies spelled out as -package arguments
-- and ghc invokes the linker with the proper library paths
ghcSharedLinkArgs =
[ "-no-auto-link-packages",
"-shared",
"-dynamic",
"-o", sharedLibFilePath ]
++ ghcSharedObjArgs
++ ["-package-name", display pkgid ]
++ ghcPackageFlags lbi clbi
++ ["-l"++extraLib | extraLib <- extraLibs libBi]
++ ["-L"++extraLibDir | extraLibDir <- extraLibDirs libBi]
runLd ldLibName args = do
exists <- doesFileExist ldLibName
-- This method is called iteratively by xargs. The
-- output goes to <ldLibName>.tmp, and any existing file
-- named <ldLibName> is included when linking. The
-- output is renamed to <libName>.
rawSystemProgramConf verbosity ldProgram (withPrograms lbi)
(args ++ if exists then [ldLibName] else [])
renameFile (ldLibName <.> "tmp") ldLibName
runAr = rawSystemProgramConf verbosity arProgram (withPrograms lbi)
--TODO: discover this at configure time or runtime on Unix
-- The value is 32k on Windows and POSIX specifies a minimum of 4k
-- but all sensible Unixes use more than 4k.
-- we could use getSysVar ArgumentLimit but that's in the Unix lib
maxCommandLineSize = 30 * 1024
ifVanillaLib False $ xargs maxCommandLineSize
runAr arArgs arObjArgs
ifProfLib $ xargs maxCommandLineSize
runAr arProfArgs arProfObjArgs
ifGHCiLib $ xargs maxCommandLineSize
(runLd ghciLibFilePath) ldArgs ldObjArgs
ifSharedLib $ runGhcProg ghcSharedLinkArgs
-- | Build an executable with LHC.
-- | 6,941 | buildLib verbosity pkg_descr lbi lib clbi = do
libName <- case componentLibraries clbi of
[libName] -> return libName
[] -> die "No library name found when building library"
_ -> die "Multiple library names found when building library"
let pref = buildDir lbi
pkgid = packageId pkg_descr
runGhcProg = rawSystemProgramConf verbosity lhcProgram (withPrograms lbi)
ifVanillaLib forceVanilla = when (forceVanilla || withVanillaLib lbi)
ifProfLib = when (withProfLib lbi)
ifSharedLib = when (withSharedLib lbi)
ifGHCiLib = when (withGHCiLib lbi && withVanillaLib lbi)
libBi <- hackThreadedFlag verbosity
(compiler lbi) (withProfLib lbi) (libBuildInfo lib)
let libTargetDir = pref
forceVanillaLib = EnableExtension TemplateHaskell `elem` allExtensions libBi
-- TH always needs vanilla libs, even when building for profiling
createDirectoryIfMissingVerbose verbosity True libTargetDir
-- TODO: do we need to put hs-boot files into place for mutually recursive modules?
let ghcArgs =
["-package-name", display pkgid ]
++ constructGHCCmdLine lbi libBi clbi libTargetDir verbosity
++ map display (libModules lib)
lhcWrap x = ["--build-library", "--ghc-opts=" ++ unwords x]
ghcArgsProf = ghcArgs
++ ["-prof",
"-hisuf", "p_hi",
"-osuf", "p_o"
]
++ hcProfOptions GHC libBi
ghcArgsShared = ghcArgs
++ ["-dynamic",
"-hisuf", "dyn_hi",
"-osuf", "dyn_o", "-fPIC"
]
++ hcSharedOptions GHC libBi
unless (null (libModules lib)) $
do ifVanillaLib forceVanillaLib (runGhcProg $ lhcWrap ghcArgs)
ifProfLib (runGhcProg $ lhcWrap ghcArgsProf)
ifSharedLib (runGhcProg $ lhcWrap ghcArgsShared)
-- build any C sources
unless (null (cSources libBi)) $ do
info verbosity "Building C Sources..."
sequence_ [do let (odir,args) = constructCcCmdLine lbi libBi clbi pref
filename verbosity
createDirectoryIfMissingVerbose verbosity True odir
runGhcProg args
ifSharedLib (runGhcProg (args ++ ["-fPIC", "-osuf dyn_o"]))
| filename <- cSources libBi]
-- link:
info verbosity "Linking..."
let cObjs = map (`replaceExtension` objExtension) (cSources libBi)
cSharedObjs = map (`replaceExtension` ("dyn_" ++ objExtension)) (cSources libBi)
cid = compilerId (compiler lbi)
vanillaLibFilePath = libTargetDir </> mkLibName libName
profileLibFilePath = libTargetDir </> mkProfLibName libName
sharedLibFilePath = libTargetDir </> mkSharedLibName cid libName
ghciLibFilePath = libTargetDir </> mkGHCiLibName libName
stubObjs <- fmap catMaybes $ sequence
[ findFileWithExtension [objExtension] [libTargetDir]
(ModuleName.toFilePath x ++"_stub")
| x <- libModules lib ]
stubProfObjs <- fmap catMaybes $ sequence
[ findFileWithExtension ["p_" ++ objExtension] [libTargetDir]
(ModuleName.toFilePath x ++"_stub")
| x <- libModules lib ]
stubSharedObjs <- fmap catMaybes $ sequence
[ findFileWithExtension ["dyn_" ++ objExtension] [libTargetDir]
(ModuleName.toFilePath x ++"_stub")
| x <- libModules lib ]
hObjs <- getHaskellObjects lib lbi
pref objExtension True
hProfObjs <-
if (withProfLib lbi)
then getHaskellObjects lib lbi
pref ("p_" ++ objExtension) True
else return []
hSharedObjs <-
if (withSharedLib lbi)
then getHaskellObjects lib lbi
pref ("dyn_" ++ objExtension) False
else return []
unless (null hObjs && null cObjs && null stubObjs) $ do
-- first remove library files if they exists
sequence_
[ removeFile libFilePath `catchIO` \_ -> return ()
| libFilePath <- [vanillaLibFilePath, profileLibFilePath
,sharedLibFilePath, ghciLibFilePath] ]
let arVerbosity | verbosity >= deafening = "v"
| verbosity >= normal = ""
| otherwise = "c"
arArgs = ["q"++ arVerbosity]
++ [vanillaLibFilePath]
arObjArgs =
hObjs
++ map (pref </>) cObjs
++ stubObjs
arProfArgs = ["q"++ arVerbosity]
++ [profileLibFilePath]
arProfObjArgs =
hProfObjs
++ map (pref </>) cObjs
++ stubProfObjs
ldArgs = ["-r"]
++ ["-o", ghciLibFilePath <.> "tmp"]
ldObjArgs =
hObjs
++ map (pref </>) cObjs
++ stubObjs
ghcSharedObjArgs =
hSharedObjs
++ map (pref </>) cSharedObjs
++ stubSharedObjs
-- After the relocation lib is created we invoke ghc -shared
-- with the dependencies spelled out as -package arguments
-- and ghc invokes the linker with the proper library paths
ghcSharedLinkArgs =
[ "-no-auto-link-packages",
"-shared",
"-dynamic",
"-o", sharedLibFilePath ]
++ ghcSharedObjArgs
++ ["-package-name", display pkgid ]
++ ghcPackageFlags lbi clbi
++ ["-l"++extraLib | extraLib <- extraLibs libBi]
++ ["-L"++extraLibDir | extraLibDir <- extraLibDirs libBi]
runLd ldLibName args = do
exists <- doesFileExist ldLibName
-- This method is called iteratively by xargs. The
-- output goes to <ldLibName>.tmp, and any existing file
-- named <ldLibName> is included when linking. The
-- output is renamed to <libName>.
rawSystemProgramConf verbosity ldProgram (withPrograms lbi)
(args ++ if exists then [ldLibName] else [])
renameFile (ldLibName <.> "tmp") ldLibName
runAr = rawSystemProgramConf verbosity arProgram (withPrograms lbi)
--TODO: discover this at configure time or runtime on Unix
-- The value is 32k on Windows and POSIX specifies a minimum of 4k
-- but all sensible Unixes use more than 4k.
-- we could use getSysVar ArgumentLimit but that's in the Unix lib
maxCommandLineSize = 30 * 1024
ifVanillaLib False $ xargs maxCommandLineSize
runAr arArgs arObjArgs
ifProfLib $ xargs maxCommandLineSize
runAr arProfArgs arProfObjArgs
ifGHCiLib $ xargs maxCommandLineSize
(runLd ghciLibFilePath) ldArgs ldObjArgs
ifSharedLib $ runGhcProg ghcSharedLinkArgs
-- | Build an executable with LHC.
-- | 6,799 | false | true | 0 | 19 | 2,171 | 1,552 | 778 | 774 | null | null |
tmcdonell/hfx | src/haskell/Util/Misc.hs | bsd-3-clause | thd3 :: (a,b,c) -> c
thd3 (_,_,c) = c | 37 | thd3 :: (a,b,c) -> c
thd3 (_,_,c) = c | 37 | thd3 (_,_,c) = c | 16 | false | true | 0 | 8 | 8 | 42 | 22 | 20 | null | null |
brendanhay/gogol | gogol-dataflow/gen/Network/Google/Resource/Dataflow/Projects/Locations/Snapshots/Get.hs | mpl-2.0 | -- | V1 error format.
plsgXgafv :: Lens' ProjectsLocationsSnapshotsGet (Maybe Xgafv)
plsgXgafv
= lens _plsgXgafv (\ s a -> s{_plsgXgafv = a}) | 143 | plsgXgafv :: Lens' ProjectsLocationsSnapshotsGet (Maybe Xgafv)
plsgXgafv
= lens _plsgXgafv (\ s a -> s{_plsgXgafv = a}) | 121 | plsgXgafv
= lens _plsgXgafv (\ s a -> s{_plsgXgafv = a}) | 58 | true | true | 0 | 9 | 23 | 48 | 25 | 23 | null | null |
fmapfmapfmap/amazonka | amazonka-ml/test/Test/AWS/Gen/MachineLearning.hs | mpl-2.0 | testCreateDataSourceFromRedshiftResponse :: CreateDataSourceFromRedshiftResponse -> TestTree
testCreateDataSourceFromRedshiftResponse = res
"CreateDataSourceFromRedshiftResponse"
"fixture/CreateDataSourceFromRedshiftResponse.proto"
machineLearning
(Proxy :: Proxy CreateDataSourceFromRedshift) | 309 | testCreateDataSourceFromRedshiftResponse :: CreateDataSourceFromRedshiftResponse -> TestTree
testCreateDataSourceFromRedshiftResponse = res
"CreateDataSourceFromRedshiftResponse"
"fixture/CreateDataSourceFromRedshiftResponse.proto"
machineLearning
(Proxy :: Proxy CreateDataSourceFromRedshift) | 309 | testCreateDataSourceFromRedshiftResponse = res
"CreateDataSourceFromRedshiftResponse"
"fixture/CreateDataSourceFromRedshiftResponse.proto"
machineLearning
(Proxy :: Proxy CreateDataSourceFromRedshift) | 216 | false | true | 0 | 7 | 30 | 33 | 17 | 16 | null | null |
siddhanathan/ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | addTickHsIPBinds :: HsIPBinds Id -> TM (HsIPBinds Id)
addTickHsIPBinds (IPBinds ipbinds dictbinds) =
liftM2 IPBinds
(mapM (liftL (addTickIPBind)) ipbinds)
(return dictbinds) | 213 | addTickHsIPBinds :: HsIPBinds Id -> TM (HsIPBinds Id)
addTickHsIPBinds (IPBinds ipbinds dictbinds) =
liftM2 IPBinds
(mapM (liftL (addTickIPBind)) ipbinds)
(return dictbinds) | 213 | addTickHsIPBinds (IPBinds ipbinds dictbinds) =
liftM2 IPBinds
(mapM (liftL (addTickIPBind)) ipbinds)
(return dictbinds) | 159 | false | true | 0 | 10 | 60 | 68 | 33 | 35 | null | null |
zeekay/lambdabot | Plugin/Log.hs | mit | -- * Logging IO
--
-- | Open a file to write the log to.
openChannelFile :: Channel -> ClockTime -> Log Handle
openChannelFile chan ct =
io $ createDirectoryIfMissing True dir >> openFile file AppendMode
where dir = outputDir config </> "Log" </> Msg.nTag chan </> Msg.nName chan
date = dateStamp ct
file = dir </> (dateToString date) <.> "txt"
-- | Close and re-open a log file, and update the state. | 432 | openChannelFile :: Channel -> ClockTime -> Log Handle
openChannelFile chan ct =
io $ createDirectoryIfMissing True dir >> openFile file AppendMode
where dir = outputDir config </> "Log" </> Msg.nTag chan </> Msg.nName chan
date = dateStamp ct
file = dir </> (dateToString date) <.> "txt"
-- | Close and re-open a log file, and update the state. | 374 | openChannelFile chan ct =
io $ createDirectoryIfMissing True dir >> openFile file AppendMode
where dir = outputDir config </> "Log" </> Msg.nTag chan </> Msg.nName chan
date = dateStamp ct
file = dir </> (dateToString date) <.> "txt"
-- | Close and re-open a log file, and update the state. | 320 | true | true | 7 | 8 | 103 | 125 | 55 | 70 | null | null |
hguenther/gtl | lib/Data/Graph/Inductive/Query/MinSpanningPath.hs | bsd-3-clause | msp1 = minSpanningPath g | 24 | msp1 = minSpanningPath g | 24 | msp1 = minSpanningPath g | 24 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
snoyberg/yesodcms | Handler/Profile.hs | bsd-2-clause | postDeleteGroupR gid = do
requireAdmin
-- FIXME cascade
runDB $ delete gid >> fixGroups
setMessage "Group deleted"
redirect RedirectTemporary ProfileR | 170 | postDeleteGroupR gid = do
requireAdmin
-- FIXME cascade
runDB $ delete gid >> fixGroups
setMessage "Group deleted"
redirect RedirectTemporary ProfileR | 170 | postDeleteGroupR gid = do
requireAdmin
-- FIXME cascade
runDB $ delete gid >> fixGroups
setMessage "Group deleted"
redirect RedirectTemporary ProfileR | 170 | false | false | 1 | 10 | 39 | 45 | 17 | 28 | null | null |
silkapp/bloodhound | tests/tests.hs | bsd-3-clause | testServerBranch :: IO (Maybe ServerVersion)
testServerBranch = getServerVersion >>= \v -> return $ liftM serverBranch v | 120 | testServerBranch :: IO (Maybe ServerVersion)
testServerBranch = getServerVersion >>= \v -> return $ liftM serverBranch v | 120 | testServerBranch = getServerVersion >>= \v -> return $ liftM serverBranch v | 75 | false | true | 0 | 8 | 15 | 38 | 19 | 19 | null | null |
ksaveljev/hake-2 | src/Game/Monsters/MBoss32.hs | bsd-3-clause | framePain404 :: Int
framePain404 = 382 | 38 | framePain404 :: Int
framePain404 = 382 | 38 | framePain404 = 382 | 18 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
Taeradan/hahp | src/HAHP/Reporting.hs | gpl-3.0 | showAlternatives :: [Alternative] -- ^ AHP Alternatives
-> String -- ^ Report alternatives with indicator values
showAlternatives alts = unlines $
[ ""
, "## Alternatives values"
, ""
]
++
lines (concatMap (showAlternative 0) alts) | 279 | showAlternatives :: [Alternative] -- ^ AHP Alternatives
-> String
showAlternatives alts = unlines $
[ ""
, "## Alternatives values"
, ""
]
++
lines (concatMap (showAlternative 0) alts) | 225 | showAlternatives alts = unlines $
[ ""
, "## Alternatives values"
, ""
]
++
lines (concatMap (showAlternative 0) alts) | 142 | true | true | 2 | 9 | 83 | 58 | 31 | 27 | null | null |
zohl/postgresql-simple-bind | src/Database/PostgreSQL/Simple/Bind/Parser.hs | bsd-3-clause | -- | Parser for a non-quoted identifier.
pgNormalIdentifier :: Parser Text
pgNormalIdentifier = T.toLower <$> liftA2 T.cons
(satisfy $ inClass "a-zA-Z_")
(takeWhile $ inClass "a-zA-Z0-9_$") | 193 | pgNormalIdentifier :: Parser Text
pgNormalIdentifier = T.toLower <$> liftA2 T.cons
(satisfy $ inClass "a-zA-Z_")
(takeWhile $ inClass "a-zA-Z0-9_$") | 152 | pgNormalIdentifier = T.toLower <$> liftA2 T.cons
(satisfy $ inClass "a-zA-Z_")
(takeWhile $ inClass "a-zA-Z0-9_$") | 118 | true | true | 0 | 7 | 28 | 52 | 25 | 27 | null | null |
pxqr/ureader | src/UReader/Rendering.hs | bsd-3-clause | renderFeed :: Style -> [Generic.Feed] -> IO ()
renderFeed style feeds = do
Window {..} <- fromMaybe (Window 80 60) <$> Terminal.size
displayIO stdout $ renderPretty 0.8 width $ formatFeeds style feeds | 204 | renderFeed :: Style -> [Generic.Feed] -> IO ()
renderFeed style feeds = do
Window {..} <- fromMaybe (Window 80 60) <$> Terminal.size
displayIO stdout $ renderPretty 0.8 width $ formatFeeds style feeds | 204 | renderFeed style feeds = do
Window {..} <- fromMaybe (Window 80 60) <$> Terminal.size
displayIO stdout $ renderPretty 0.8 width $ formatFeeds style feeds | 157 | false | true | 0 | 11 | 35 | 88 | 41 | 47 | null | null |
iblumenfeld/cryptol | tests/Main.hs | bsd-3-clause | generateTests :: Options -> TestFiles -> [Test]
generateTests opts = loop ""
where
loop dir (TestFiles m fs) = as ++ grouped
where
as = map (generateAssertion opts dir) fs
grouped = [ testGroup path (loop (dir </> path) t)
| (path,t) <- Map.toList m ] | 286 | generateTests :: Options -> TestFiles -> [Test]
generateTests opts = loop ""
where
loop dir (TestFiles m fs) = as ++ grouped
where
as = map (generateAssertion opts dir) fs
grouped = [ testGroup path (loop (dir </> path) t)
| (path,t) <- Map.toList m ] | 286 | generateTests opts = loop ""
where
loop dir (TestFiles m fs) = as ++ grouped
where
as = map (generateAssertion opts dir) fs
grouped = [ testGroup path (loop (dir </> path) t)
| (path,t) <- Map.toList m ] | 238 | false | true | 2 | 11 | 80 | 136 | 62 | 74 | null | null |
brendanhay/gogol | gogol-compute/gen/Network/Google/Resource/Compute/Routers/Preview.hs | mpl-2.0 | -- | Creates a value of 'RoutersPreview' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rp1Project'
--
-- * 'rp1Router'
--
-- * 'rp1Payload'
--
-- * 'rp1Region'
routersPreview
:: Text -- ^ 'rp1Project'
-> Text -- ^ 'rp1Router'
-> Router -- ^ 'rp1Payload'
-> Text -- ^ 'rp1Region'
-> RoutersPreview
routersPreview pRp1Project_ pRp1Router_ pRp1Payload_ pRp1Region_ =
RoutersPreview'
{ _rp1Project = pRp1Project_
, _rp1Router = pRp1Router_
, _rp1Payload = pRp1Payload_
, _rp1Region = pRp1Region_
} | 623 | routersPreview
:: Text -- ^ 'rp1Project'
-> Text -- ^ 'rp1Router'
-> Router -- ^ 'rp1Payload'
-> Text -- ^ 'rp1Region'
-> RoutersPreview
routersPreview pRp1Project_ pRp1Router_ pRp1Payload_ pRp1Region_ =
RoutersPreview'
{ _rp1Project = pRp1Project_
, _rp1Router = pRp1Router_
, _rp1Payload = pRp1Payload_
, _rp1Region = pRp1Region_
} | 375 | routersPreview pRp1Project_ pRp1Router_ pRp1Payload_ pRp1Region_ =
RoutersPreview'
{ _rp1Project = pRp1Project_
, _rp1Router = pRp1Router_
, _rp1Payload = pRp1Payload_
, _rp1Region = pRp1Region_
} | 218 | true | true | 0 | 10 | 134 | 86 | 52 | 34 | null | null |
owst/Penrose | src/PEPParser.hs | bsd-3-clause | parseFile :: String -> IO LLNet
parseFile = TIO.readFile >=> parseLLNet | 71 | parseFile :: String -> IO LLNet
parseFile = TIO.readFile >=> parseLLNet | 71 | parseFile = TIO.readFile >=> parseLLNet | 39 | false | true | 0 | 6 | 10 | 24 | 12 | 12 | null | null |
kawu/skladnica-with-walenty | src/NLP/Skladnica/Walenty/Search.hs | bsd-2-clause | evaluate (IfThenElse b e1 e2) t = do
r <- evaluate b t
if r
then evaluate e1 t
else evaluate e2 t | 109 | evaluate (IfThenElse b e1 e2) t = do
r <- evaluate b t
if r
then evaluate e1 t
else evaluate e2 t | 109 | evaluate (IfThenElse b e1 e2) t = do
r <- evaluate b t
if r
then evaluate e1 t
else evaluate e2 t | 109 | false | false | 0 | 8 | 34 | 54 | 25 | 29 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_LOSE_CONTEXT_ON_RESET_EXT :: GLenum
gl_LOSE_CONTEXT_ON_RESET_EXT = 0x8252 | 76 | gl_LOSE_CONTEXT_ON_RESET_EXT :: GLenum
gl_LOSE_CONTEXT_ON_RESET_EXT = 0x8252 | 76 | gl_LOSE_CONTEXT_ON_RESET_EXT = 0x8252 | 37 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
sgillespie/ghc | compiler/basicTypes/Var.hs | bsd-3-clause | mkTyVar :: Name -> Kind -> TyVar
mkTyVar name kind = TyVar { varName = name
, realUnique = getKey (nameUnique name)
, varType = kind
} | 216 | mkTyVar :: Name -> Kind -> TyVar
mkTyVar name kind = TyVar { varName = name
, realUnique = getKey (nameUnique name)
, varType = kind
} | 216 | mkTyVar name kind = TyVar { varName = name
, realUnique = getKey (nameUnique name)
, varType = kind
} | 183 | false | true | 0 | 10 | 108 | 62 | 31 | 31 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Protocol.hs | bsd-3-clause | parseQueryResult (IfThenElseI32Float _ _ _) (IfThenElseFloatReply r) = Just $ ExprRight $ lit r | 95 | parseQueryResult (IfThenElseI32Float _ _ _) (IfThenElseFloatReply r) = Just $ ExprRight $ lit r | 95 | parseQueryResult (IfThenElseI32Float _ _ _) (IfThenElseFloatReply r) = Just $ ExprRight $ lit r | 95 | false | false | 0 | 7 | 13 | 38 | 18 | 20 | null | null |
trskop/cabal | Cabal/Distribution/System.hs | bsd-3-clause | archAliases _ PPC64 = ["powerpc64"] | 40 | archAliases _ PPC64 = ["powerpc64"] | 40 | archAliases _ PPC64 = ["powerpc64"] | 40 | false | false | 0 | 5 | 9 | 14 | 7 | 7 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT49.hs | gpl-3.0 | _ && _ = False | 17 | _ && _ = False | 17 | _ && _ = False | 17 | false | false | 0 | 5 | 7 | 12 | 5 | 7 | null | null |
hpacheco/HAAP | packages/snap-exports/Snap/Snaplet/Auth/Types/Exts.hs | mit | -------------------------------------------------------------------------------
-- | The underlying encryption function, in case you need it for
-- external processing.
encrypt :: ByteString -> IO ByteString
encrypt = flip makePassword defaultStrength | 251 | encrypt :: ByteString -> IO ByteString
encrypt = flip makePassword defaultStrength | 82 | encrypt = flip makePassword defaultStrength | 43 | true | true | 0 | 7 | 26 | 33 | 15 | 18 | null | null |
rainbowbismuth/go-analyze | src/Go/Lexer.hs | gpl-3.0 | decimal :: Parser Integer
decimal = do
s <- P.many1 $ PC.satisfy isDecimalDigit;
return (read s); | 101 | decimal :: Parser Integer
decimal = do
s <- P.many1 $ PC.satisfy isDecimalDigit;
return (read s); | 101 | decimal = do
s <- P.many1 $ PC.satisfy isDecimalDigit;
return (read s); | 75 | false | true | 1 | 11 | 19 | 50 | 22 | 28 | null | null |
trygvis/hledger | hledger-web/Settings.hs | gpl-3.0 | defhost :: String
defhost = "localhost" | 39 | defhost :: String
defhost = "localhost" | 39 | defhost = "localhost" | 21 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
AdityaKumarRavikanti/Boxes | src/SheetDB.hs | mit | makeQueryUrl :: Query -> API String
makeQueryUrl q = do
let
spreadsheet = sheet $ selection q
order = sort q
param1 = [("alt","json")] :: [(String,String)]
selectString = selectorQueryUrl $ selector $ selection q
encWithSp = encString False ok_param
param2 = [("sq", selectString) | not (null selectString)]
++ param1
let
params = case order of
NoOrder -> param2
Order col rev -> param2 ++
[ ("orderby", "column:" ++ T.unpack col)
, ("reverse", map toLower (show rev))
]
url <- formURL
(key spreadsheet)
(worksheetId spreadsheet)
params
return (exportURL url)
-- Converts Selector to String. example: Gtr "age" 25 -> age > 25 | 776 | makeQueryUrl :: Query -> API String
makeQueryUrl q = do
let
spreadsheet = sheet $ selection q
order = sort q
param1 = [("alt","json")] :: [(String,String)]
selectString = selectorQueryUrl $ selector $ selection q
encWithSp = encString False ok_param
param2 = [("sq", selectString) | not (null selectString)]
++ param1
let
params = case order of
NoOrder -> param2
Order col rev -> param2 ++
[ ("orderby", "column:" ++ T.unpack col)
, ("reverse", map toLower (show rev))
]
url <- formURL
(key spreadsheet)
(worksheetId spreadsheet)
params
return (exportURL url)
-- Converts Selector to String. example: Gtr "age" 25 -> age > 25 | 776 | makeQueryUrl q = do
let
spreadsheet = sheet $ selection q
order = sort q
param1 = [("alt","json")] :: [(String,String)]
selectString = selectorQueryUrl $ selector $ selection q
encWithSp = encString False ok_param
param2 = [("sq", selectString) | not (null selectString)]
++ param1
let
params = case order of
NoOrder -> param2
Order col rev -> param2 ++
[ ("orderby", "column:" ++ T.unpack col)
, ("reverse", map toLower (show rev))
]
url <- formURL
(key spreadsheet)
(worksheetId spreadsheet)
params
return (exportURL url)
-- Converts Selector to String. example: Gtr "age" 25 -> age > 25 | 740 | false | true | 0 | 18 | 251 | 239 | 123 | 116 | null | null |
tel/oauthenticated | src/Network/OAuth/ThreeLegged.hs | mit | -- | Request a 'Permanent 'Token' based on the parameters of
-- a 'ThreeLegged' protocol. This returns the raw response which should be
-- encoded as @www-form-urlencoded@.
--
-- Throws 'C.HttpException's.
requestPermanentTokenRaw
:: (MonadIO m, MonadRandom m) => O.Cred O.Temporary -> O.Server
-> P.Verifier
-> ThreeLegged -> C.Manager
-> m (C.Response SL.ByteString)
requestPermanentTokenRaw cr srv verifier (ThreeLegged {..}) man = do
oax <- O.freshOa cr
let req = O.sign (oax { P.workflow = P.PermanentTokenRequest verifier }) srv permanentTokenRequest
liftIO $ C.httpLbs req man
-- | Returns 'Nothing' if the response could not be decoded as a 'Token'.
-- See also 'requestPermanentTokenRaw'.
--
-- Throws 'C.HttpException's. | 835 | requestPermanentTokenRaw
:: (MonadIO m, MonadRandom m) => O.Cred O.Temporary -> O.Server
-> P.Verifier
-> ThreeLegged -> C.Manager
-> m (C.Response SL.ByteString)
requestPermanentTokenRaw cr srv verifier (ThreeLegged {..}) man = do
oax <- O.freshOa cr
let req = O.sign (oax { P.workflow = P.PermanentTokenRequest verifier }) srv permanentTokenRequest
liftIO $ C.httpLbs req man
-- | Returns 'Nothing' if the response could not be decoded as a 'Token'.
-- See also 'requestPermanentTokenRaw'.
--
-- Throws 'C.HttpException's. | 629 | requestPermanentTokenRaw cr srv verifier (ThreeLegged {..}) man = do
oax <- O.freshOa cr
let req = O.sign (oax { P.workflow = P.PermanentTokenRequest verifier }) srv permanentTokenRequest
liftIO $ C.httpLbs req man
-- | Returns 'Nothing' if the response could not be decoded as a 'Token'.
-- See also 'requestPermanentTokenRaw'.
--
-- Throws 'C.HttpException's. | 368 | true | true | 0 | 16 | 209 | 167 | 85 | 82 | null | null |
creswick/hsntp | HSNTP/Util/UDPServer.hs | bsd-3-clause | runUDPServer :: UDPServer s -> IO [ThreadId]
runUDPServer udpc = do sock <- listenUDP (port udpc)
par (threads udpc) $ withBufLoop udpc sock
-- Utility for clients | 187 | runUDPServer :: UDPServer s -> IO [ThreadId]
runUDPServer udpc = do sock <- listenUDP (port udpc)
par (threads udpc) $ withBufLoop udpc sock
-- Utility for clients | 187 | runUDPServer udpc = do sock <- listenUDP (port udpc)
par (threads udpc) $ withBufLoop udpc sock
-- Utility for clients | 142 | false | true | 0 | 10 | 50 | 65 | 30 | 35 | null | null |
AlexeyRaga/eta | compiler/ETA/Utils/Encoding.hs | bsd-3-clause | -- If a digit is at the start of a symbol then we need to encode it.
-- Otherwise package names like 9pH-0.1 give linker errors.
encode_digit_ch :: Char -> EncodedString
encode_digit_ch c | c >= '0' && c <= '9' = encode_as_unicode_char c | 237 | encode_digit_ch :: Char -> EncodedString
encode_digit_ch c | c >= '0' && c <= '9' = encode_as_unicode_char c | 108 | encode_digit_ch c | c >= '0' && c <= '9' = encode_as_unicode_char c | 67 | true | true | 0 | 10 | 43 | 41 | 20 | 21 | null | null |
roberth/uu-helium | src/Helium/StaticAnalysis/Miscellaneous/ConstraintInfo.hs | gpl-3.0 | variableConstraint :: String -> UHA_Source -> Properties -> ConstraintInfo
variableConstraint theLocation theSource theProperties =
CInfo_ { location = theLocation
, sources = (theSource, Nothing)
, localInfo = root LocalInfo { self = theSource, assignedType = Nothing {- ?? -}, monos = [] } []
, properties = theProperties
, errorMessage = Nothing
} | 403 | variableConstraint :: String -> UHA_Source -> Properties -> ConstraintInfo
variableConstraint theLocation theSource theProperties =
CInfo_ { location = theLocation
, sources = (theSource, Nothing)
, localInfo = root LocalInfo { self = theSource, assignedType = Nothing {- ?? -}, monos = [] } []
, properties = theProperties
, errorMessage = Nothing
} | 403 | variableConstraint theLocation theSource theProperties =
CInfo_ { location = theLocation
, sources = (theSource, Nothing)
, localInfo = root LocalInfo { self = theSource, assignedType = Nothing {- ?? -}, monos = [] } []
, properties = theProperties
, errorMessage = Nothing
} | 328 | false | true | 0 | 10 | 105 | 98 | 58 | 40 | null | null |
svenpanne/tiger | chapter05/src/ExpToDOT.hs | bsd-3-clause | expToDOT :: Exp -> String
expToDOT = toDOT . expToTree | 54 | expToDOT :: Exp -> String
expToDOT = toDOT . expToTree | 54 | expToDOT = toDOT . expToTree | 28 | false | true | 0 | 5 | 9 | 19 | 10 | 9 | null | null |
Oscarzhao/haskell | functional_program_design/ch05/sudoku_orig.hs | apache-2.0 | groupBy3 :: [a] -> [[a]]
groupBy3 [] = [] | 41 | groupBy3 :: [a] -> [[a]]
groupBy3 [] = [] | 41 | groupBy3 [] = [] | 16 | false | true | 0 | 9 | 8 | 37 | 18 | 19 | null | null |
olsner/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | typeSymbolTypeRepName = varQual tYPEABLE_INTERNAL (fsLit "typeSymbolTypeRep") typeSymbolTypeRepKey | 98 | typeSymbolTypeRepName = varQual tYPEABLE_INTERNAL (fsLit "typeSymbolTypeRep") typeSymbolTypeRepKey | 98 | typeSymbolTypeRepName = varQual tYPEABLE_INTERNAL (fsLit "typeSymbolTypeRep") typeSymbolTypeRepKey | 98 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
acieroid/kiwi | Kiwi/QueryAPI.hs | bsd-3-clause | readAll :: Streams.InputStream B.ByteString -> IO BL.ByteString
readAll i = BL.concat <$> applyWhileJust Streams.read i
where applyWhileJust :: (a -> IO (Maybe B.ByteString)) -> a -> IO [BL.ByteString]
applyWhileJust f x = f x >>=
maybe (return [])
(\y -> applyWhileJust f x >>=
return . ((BL.fromStrict y):)) | 435 | readAll :: Streams.InputStream B.ByteString -> IO BL.ByteString
readAll i = BL.concat <$> applyWhileJust Streams.read i
where applyWhileJust :: (a -> IO (Maybe B.ByteString)) -> a -> IO [BL.ByteString]
applyWhileJust f x = f x >>=
maybe (return [])
(\y -> applyWhileJust f x >>=
return . ((BL.fromStrict y):)) | 435 | readAll i = BL.concat <$> applyWhileJust Streams.read i
where applyWhileJust :: (a -> IO (Maybe B.ByteString)) -> a -> IO [BL.ByteString]
applyWhileJust f x = f x >>=
maybe (return [])
(\y -> applyWhileJust f x >>=
return . ((BL.fromStrict y):)) | 371 | false | true | 3 | 13 | 173 | 150 | 74 | 76 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.