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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bitemyapp/ganeti | src/Ganeti/OpParams.hs | bsd-2-clause | pStatic :: Field
pStatic =
withDoc "Whether to only return configuration data without querying nodes" $
defaultFalse "static" | 129 | pStatic :: Field
pStatic =
withDoc "Whether to only return configuration data without querying nodes" $
defaultFalse "static" | 129 | pStatic =
withDoc "Whether to only return configuration data without querying nodes" $
defaultFalse "static" | 112 | false | true | 0 | 6 | 21 | 21 | 10 | 11 | null | null |
yu-i9/HaSC | src/HaSC/Prim/ASTtoIntermed.hs | mit | showIProgram :: IProgram -> String
showIProgram prog = concat $ intersperse "\n" (map show prog) | 96 | showIProgram :: IProgram -> String
showIProgram prog = concat $ intersperse "\n" (map show prog) | 96 | showIProgram prog = concat $ intersperse "\n" (map show prog) | 61 | false | true | 0 | 8 | 14 | 35 | 17 | 18 | null | null |
spell-music/temporal-music-notation | src/Temporal/Music/Score.hs | bsd-3-clause | dqn = dot . qn | 14 | dqn = dot . qn | 14 | dqn = dot . qn | 14 | false | false | 0 | 5 | 4 | 10 | 5 | 5 | null | null |
spacekitteh/compdata | examples/Examples/Eval.hs | bsd-3-clause | evalEx :: Term Value
evalEx = eval (iConst 1 `iAdd` (iConst 2 `iMult` iConst 2) :: Term Sig) | 92 | evalEx :: Term Value
evalEx = eval (iConst 1 `iAdd` (iConst 2 `iMult` iConst 2) :: Term Sig) | 92 | evalEx = eval (iConst 1 `iAdd` (iConst 2 `iMult` iConst 2) :: Term Sig) | 71 | false | true | 0 | 10 | 17 | 50 | 26 | 24 | null | null |
vTurbine/ghc | compiler/main/DynFlags.hs | bsd-3-clause | mkFlag :: TurnOnFlag -- ^ True <=> it should be turned on
-> String -- ^ The flag prefix
-> (flag -> DynP ()) -- ^ What to do when the flag is found
-> (Deprecation, FlagSpec flag) -- ^ Specification of
-- this particular flag
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag turn_on flagPrefix f (dep, (FlagSpec name flag extra_action mode))
= (dep,
Flag (flagPrefix ++ name) (NoArg (f flag >> extra_action turn_on)) mode) | 534 | mkFlag :: TurnOnFlag -- ^ True <=> it should be turned on
-> String -- ^ The flag prefix
-> (flag -> DynP ()) -- ^ What to do when the flag is found
-> (Deprecation, FlagSpec flag) -- ^ Specification of
-- this particular flag
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag turn_on flagPrefix f (dep, (FlagSpec name flag extra_action mode))
= (dep,
Flag (flagPrefix ++ name) (NoArg (f flag >> extra_action turn_on)) mode) | 534 | mkFlag turn_on flagPrefix f (dep, (FlagSpec name flag extra_action mode))
= (dep,
Flag (flagPrefix ++ name) (NoArg (f flag >> extra_action turn_on)) mode) | 165 | false | true | 0 | 14 | 183 | 140 | 73 | 67 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxPREVIEW_LAST :: Int
wxPREVIEW_LAST = 32 | 41 | wxPREVIEW_LAST :: Int
wxPREVIEW_LAST = 32 | 41 | wxPREVIEW_LAST = 32 | 19 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
patperry/hs-linear-algebra | lib/Foreign/LAPACK/Types.hs | bsd-3-clause | withEigJob :: EigJob -> (LAEigJob -> IO a) -> IO a
withEigJob evjob f = flip withCString (f . LAEigJob) $ case evjob of
NoEigVectors -> "N"
EigVectors -> "V" | 167 | withEigJob :: EigJob -> (LAEigJob -> IO a) -> IO a
withEigJob evjob f = flip withCString (f . LAEigJob) $ case evjob of
NoEigVectors -> "N"
EigVectors -> "V" | 167 | withEigJob evjob f = flip withCString (f . LAEigJob) $ case evjob of
NoEigVectors -> "N"
EigVectors -> "V" | 116 | false | true | 0 | 9 | 39 | 74 | 35 | 39 | null | null |
nomeata/ghc | utils/genprimopcode/Main.hs | bsd-3-clause | ppType (TyApp "MutableByteArray#" [x]) = "mkMutableByteArrayPrimTy "
++ ppType x | 124 | ppType (TyApp "MutableByteArray#" [x]) = "mkMutableByteArrayPrimTy "
++ ppType x | 124 | ppType (TyApp "MutableByteArray#" [x]) = "mkMutableByteArrayPrimTy "
++ ppType x | 124 | false | false | 0 | 7 | 53 | 28 | 13 | 15 | null | null |
Copilot-Language/sbv-for-copilot | Data/SBV/Examples/Puzzles/Sudoku.hs | bsd-3-clause | -- | Given a series of elements, make sure they are all different
-- and they all are numbers between 1 and 9
check :: [SWord8] -> SBool
check grp = bAnd $ allDifferent grp : map rangeFine grp
where rangeFine x = x .> 0 &&& x .<= 9
-- | Given a full Sudoku board, check that it is valid | 289 | check :: [SWord8] -> SBool
check grp = bAnd $ allDifferent grp : map rangeFine grp
where rangeFine x = x .> 0 &&& x .<= 9
-- | Given a full Sudoku board, check that it is valid | 179 | check grp = bAnd $ allDifferent grp : map rangeFine grp
where rangeFine x = x .> 0 &&& x .<= 9
-- | Given a full Sudoku board, check that it is valid | 152 | true | true | 0 | 7 | 64 | 62 | 32 | 30 | null | null |
svenssonjoel/MonadObsidian | Obsidian/MonadObsidian/PureAPI.hs | bsd-3-clause | --------------------------------------------------------------------------------
{-
pair :: Arr s a -> Arr (a,a)
pair arr | odd (len arr) = error "Pair: Odd n"
| otherwise = mkArr (\ix -> (arr ! (ix * 2),
arr ! ((ix * 2) + 1))) nhalf
where
n = len arr
nhalf = div n 2
-}
pair :: Arr s a -> Arr s (a,a)
pair arr | odd (len arr) = error "Pair: Odd n"
| otherwise = mkArr (\ix -> (arr ! (ix * 2),
arr ! ((ix * 2 ) + 1))) nhalf
where
n = len arr
nhalf = div n 2
{-
unpair :: Choice a => Arr (a,a) -> Arr s a
unpair arr =
let n = len arr
in mkArr (\ix -> ifThenElse ((mod ix 2) ==* 0)
(fst (arr ! (div ix 2)))
(snd (arr ! (div (ix-1) 2)))) (2*n)
-} | 857 | pair :: Arr s a -> Arr s (a,a)
pair arr | odd (len arr) = error "Pair: Odd n"
| otherwise = mkArr (\ix -> (arr ! (ix * 2),
arr ! ((ix * 2 ) + 1))) nhalf
where
n = len arr
nhalf = div n 2
{-
unpair :: Choice a => Arr (a,a) -> Arr s a
unpair arr =
let n = len arr
in mkArr (\ix -> ifThenElse ((mod ix 2) ==* 0)
(fst (arr ! (div ix 2)))
(snd (arr ! (div (ix-1) 2)))) (2*n)
-} | 504 | pair arr | odd (len arr) = error "Pair: Odd n"
| otherwise = mkArr (\ix -> (arr ! (ix * 2),
arr ! ((ix * 2 ) + 1))) nhalf
where
n = len arr
nhalf = div n 2
{-
unpair :: Choice a => Arr (a,a) -> Arr s a
unpair arr =
let n = len arr
in mkArr (\ix -> ifThenElse ((mod ix 2) ==* 0)
(fst (arr ! (div ix 2)))
(snd (arr ! (div (ix-1) 2)))) (2*n)
-} | 473 | true | true | 2 | 14 | 358 | 145 | 70 | 75 | null | null |
nakaji-dayo/persistent | persistent-postgresql/Database/Persist/Postgresql.hs | mit | showColumn :: Column -> Text
showColumn (Column n nu sqlType' def _defConstraintName _maxLen _ref) = T.concat
[ escape n
, " "
, showSqlType sqlType'
, " "
, if nu then "NULL" else "NOT NULL"
, case def of
Nothing -> ""
Just s -> " DEFAULT " <> s
] | 292 | showColumn :: Column -> Text
showColumn (Column n nu sqlType' def _defConstraintName _maxLen _ref) = T.concat
[ escape n
, " "
, showSqlType sqlType'
, " "
, if nu then "NULL" else "NOT NULL"
, case def of
Nothing -> ""
Just s -> " DEFAULT " <> s
] | 292 | showColumn (Column n nu sqlType' def _defConstraintName _maxLen _ref) = T.concat
[ escape n
, " "
, showSqlType sqlType'
, " "
, if nu then "NULL" else "NOT NULL"
, case def of
Nothing -> ""
Just s -> " DEFAULT " <> s
] | 263 | false | true | 0 | 9 | 95 | 96 | 50 | 46 | null | null |
adunning/pandoc-citeproc | src/Text/CSL/Proc/Disamb.hs | bsd-3-clause | rmExtras :: GiveNameDisambiguation -> [Output] -> [Output]
rmExtras g os
| Output x _ : xs <- os = case rmExtras g x of
[] -> rmExtras g xs
ys -> ys ++ rmExtras g xs
| OContrib _ _ (y:ys) _ _ : xs <- os
= if g == PrimaryName
then OContrib [] [] [y] [] [] : rmExtras g xs
else OContrib [] [] (y:ys) [] [] : rmExtras g xs
| OYear{} : xs <- os = rmExtras g xs
| OYearSuf{} : xs <- os = rmExtras g xs
| OLabel{} : xs <- os = rmExtras g xs
| ODel _ : xs <- os = rmExtras g xs
| OLoc _ _ : xs <- os = rmExtras g xs
| x : xs <- os = x : rmExtras g xs
| otherwise = [] | 896 | rmExtras :: GiveNameDisambiguation -> [Output] -> [Output]
rmExtras g os
| Output x _ : xs <- os = case rmExtras g x of
[] -> rmExtras g xs
ys -> ys ++ rmExtras g xs
| OContrib _ _ (y:ys) _ _ : xs <- os
= if g == PrimaryName
then OContrib [] [] [y] [] [] : rmExtras g xs
else OContrib [] [] (y:ys) [] [] : rmExtras g xs
| OYear{} : xs <- os = rmExtras g xs
| OYearSuf{} : xs <- os = rmExtras g xs
| OLabel{} : xs <- os = rmExtras g xs
| ODel _ : xs <- os = rmExtras g xs
| OLoc _ _ : xs <- os = rmExtras g xs
| x : xs <- os = x : rmExtras g xs
| otherwise = [] | 896 | rmExtras g os
| Output x _ : xs <- os = case rmExtras g x of
[] -> rmExtras g xs
ys -> ys ++ rmExtras g xs
| OContrib _ _ (y:ys) _ _ : xs <- os
= if g == PrimaryName
then OContrib [] [] [y] [] [] : rmExtras g xs
else OContrib [] [] (y:ys) [] [] : rmExtras g xs
| OYear{} : xs <- os = rmExtras g xs
| OYearSuf{} : xs <- os = rmExtras g xs
| OLabel{} : xs <- os = rmExtras g xs
| ODel _ : xs <- os = rmExtras g xs
| OLoc _ _ : xs <- os = rmExtras g xs
| x : xs <- os = x : rmExtras g xs
| otherwise = [] | 837 | false | true | 1 | 12 | 478 | 384 | 181 | 203 | null | null |
AccelerateHS/accelerate-cuda | Data/Array/Accelerate/CUDA/Compile.hs | bsd-3-clause | getProcessID :: IO ProcessId
getProcessID = return 0xaaaa | 57 | getProcessID :: IO ProcessId
getProcessID = return 0xaaaa | 57 | getProcessID = return 0xaaaa | 28 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-printers/Language/Drasil/HTML/Helpers.hs | bsd-2-clause | -- | Head tag wrapper
headTag = wrap "head" [] | 48 | headTag = wrap "head" [] | 26 | headTag = wrap "head" [] | 26 | true | false | 0 | 6 | 11 | 14 | 7 | 7 | null | null |
brendanhay/gogol | gogol-tagmanager/gen/Network/Google/Resource/TagManager/Accounts/Containers/Environments/Update.hs | mpl-2.0 | -- | JSONP
aceuCallback :: Lens' AccountsContainersEnvironmentsUpdate (Maybe Text)
aceuCallback
= lens _aceuCallback (\ s a -> s{_aceuCallback = a}) | 150 | aceuCallback :: Lens' AccountsContainersEnvironmentsUpdate (Maybe Text)
aceuCallback
= lens _aceuCallback (\ s a -> s{_aceuCallback = a}) | 139 | aceuCallback
= lens _aceuCallback (\ s a -> s{_aceuCallback = a}) | 67 | true | true | 1 | 9 | 21 | 52 | 25 | 27 | null | null |
mrshannon/trees | src/Input/Keyboard/GLUT.hs | gpl-2.0 | changeAsciiKeyState 'f' ns k = k { fKey = ns } | 46 | changeAsciiKeyState 'f' ns k = k { fKey = ns } | 46 | changeAsciiKeyState 'f' ns k = k { fKey = ns } | 46 | false | false | 0 | 6 | 10 | 21 | 11 | 10 | null | null |
brendanhay/gogol | gogol-dialogflow/gen/Network/Google/Resource/DialogFlow/Projects/Locations/Agents/Sessions/FulfillIntent.hs | mpl-2.0 | -- | Creates a value of 'ProjectsLocationsAgentsSessionsFulfillIntent' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'plasfiXgafv'
--
-- * 'plasfiUploadProtocol'
--
-- * 'plasfiAccessToken'
--
-- * 'plasfiUploadType'
--
-- * 'plasfiPayload'
--
-- * 'plasfiSession'
--
-- * 'plasfiCallback'
projectsLocationsAgentsSessionsFulfillIntent
:: GoogleCloudDialogflowCxV3FulfillIntentRequest -- ^ 'plasfiPayload'
-> Text -- ^ 'plasfiSession'
-> ProjectsLocationsAgentsSessionsFulfillIntent
projectsLocationsAgentsSessionsFulfillIntent pPlasfiPayload_ pPlasfiSession_ =
ProjectsLocationsAgentsSessionsFulfillIntent'
{ _plasfiXgafv = Nothing
, _plasfiUploadProtocol = Nothing
, _plasfiAccessToken = Nothing
, _plasfiUploadType = Nothing
, _plasfiPayload = pPlasfiPayload_
, _plasfiSession = pPlasfiSession_
, _plasfiCallback = Nothing
} | 959 | projectsLocationsAgentsSessionsFulfillIntent
:: GoogleCloudDialogflowCxV3FulfillIntentRequest -- ^ 'plasfiPayload'
-> Text -- ^ 'plasfiSession'
-> ProjectsLocationsAgentsSessionsFulfillIntent
projectsLocationsAgentsSessionsFulfillIntent pPlasfiPayload_ pPlasfiSession_ =
ProjectsLocationsAgentsSessionsFulfillIntent'
{ _plasfiXgafv = Nothing
, _plasfiUploadProtocol = Nothing
, _plasfiAccessToken = Nothing
, _plasfiUploadType = Nothing
, _plasfiPayload = pPlasfiPayload_
, _plasfiSession = pPlasfiSession_
, _plasfiCallback = Nothing
} | 582 | projectsLocationsAgentsSessionsFulfillIntent pPlasfiPayload_ pPlasfiSession_ =
ProjectsLocationsAgentsSessionsFulfillIntent'
{ _plasfiXgafv = Nothing
, _plasfiUploadProtocol = Nothing
, _plasfiAccessToken = Nothing
, _plasfiUploadType = Nothing
, _plasfiPayload = pPlasfiPayload_
, _plasfiSession = pPlasfiSession_
, _plasfiCallback = Nothing
} | 378 | true | true | 0 | 8 | 150 | 96 | 62 | 34 | null | null |
adamse/haddock | haddock-api/src/Haddock/Backends/LaTeX.hs | bsd-2-clause | latexStripTrailingWhitespace other = other | 42 | latexStripTrailingWhitespace other = other | 42 | latexStripTrailingWhitespace other = other | 42 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
castaway/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | tok :: LP Inlines
tok = try $ grouped inline <|> inlineCommand <|> str <$> (count 1 $ inlineChar) | 97 | tok :: LP Inlines
tok = try $ grouped inline <|> inlineCommand <|> str <$> (count 1 $ inlineChar) | 97 | tok = try $ grouped inline <|> inlineCommand <|> str <$> (count 1 $ inlineChar) | 79 | false | true | 1 | 9 | 18 | 47 | 21 | 26 | null | null |
rrnewton/hgdata_trash | src/Network/Google/Storage.hs | mit | putBucketUsingManager ::
Manager -- ^ The conduit HTTP manager to use.
-> ProjectId -- ^ The project ID.
-> StorageAcl -- ^ The pre-defined access control.
-> BucketName -- ^ The bucket.
-> AccessToken -- ^ The OAuth 2.0 access token.
-> IO [(String, String)] -- ^ The action to put the object and return the response header.
putBucketUsingManager = putBucketImpl . doManagedRequest | 461 | putBucketUsingManager ::
Manager -- ^ The conduit HTTP manager to use.
-> ProjectId -- ^ The project ID.
-> StorageAcl -- ^ The pre-defined access control.
-> BucketName -- ^ The bucket.
-> AccessToken -- ^ The OAuth 2.0 access token.
-> IO [(String, String)]
putBucketUsingManager = putBucketImpl . doManagedRequest | 394 | putBucketUsingManager = putBucketImpl . doManagedRequest | 56 | true | true | 0 | 13 | 141 | 55 | 31 | 24 | null | null |
sebcrozet/falling3d | Physics/Falling3d/Shape3dNarrowPhase.hs | bsd-3-clause | collideDynamicDynamicShapes s1 s2 cm =
collideDynamicDynamicShapes s2 s1 rcm >>= return . revertCollisionDescr
where
rcm = map revertCollisionDescr cm | 270 | collideDynamicDynamicShapes s1 s2 cm =
collideDynamicDynamicShapes s2 s1 rcm >>= return . revertCollisionDescr
where
rcm = map revertCollisionDescr cm | 270 | collideDynamicDynamicShapes s1 s2 cm =
collideDynamicDynamicShapes s2 s1 rcm >>= return . revertCollisionDescr
where
rcm = map revertCollisionDescr cm | 270 | false | false | 0 | 7 | 138 | 40 | 19 | 21 | null | null |
bitemyapp/roshask | src/executable/Instances/Binary.hs | bsd-3-clause | deserialize :: MsgType -> MsgInfo ByteString
deserialize = getTypeInfo >=> return . getField | 92 | deserialize :: MsgType -> MsgInfo ByteString
deserialize = getTypeInfo >=> return . getField | 92 | deserialize = getTypeInfo >=> return . getField | 47 | false | true | 0 | 6 | 12 | 26 | 13 | 13 | null | null |
Arguggi/heed | heed-vty/src/Heed/Vty/MainWidget.hs | bsd-3-clause | appEvent s (BT.VtyEvent (V.EvKey (V.KChar 'O') [])) = openInBrowser s Firefox | 77 | appEvent s (BT.VtyEvent (V.EvKey (V.KChar 'O') [])) = openInBrowser s Firefox | 77 | appEvent s (BT.VtyEvent (V.EvKey (V.KChar 'O') [])) = openInBrowser s Firefox | 77 | false | false | 0 | 12 | 10 | 44 | 21 | 23 | null | null |
Ongy/monky | Monky/Outputs/I3.hs | lgpl-3.0 | doSegment [x] = do
putChar '{'
T.putStr $ getOut x
putChar '}' | 68 | doSegment [x] = do
putChar '{'
T.putStr $ getOut x
putChar '}' | 68 | doSegment [x] = do
putChar '{'
T.putStr $ getOut x
putChar '}' | 68 | false | false | 0 | 8 | 17 | 36 | 15 | 21 | null | null |
fredmorcos/attic | snippets/haskell/Tree.hs | isc | treeInsert :: (Ord a) => a -> Tree a -> Tree a
treeInsert x EmptyTree = singleton x | 83 | treeInsert :: (Ord a) => a -> Tree a -> Tree a
treeInsert x EmptyTree = singleton x | 83 | treeInsert x EmptyTree = singleton x | 36 | false | true | 0 | 8 | 17 | 42 | 20 | 22 | null | null |
shlevy/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | exprIsTopLevelBindable :: CoreExpr -> Type -> Bool
-- See Note [CoreSyn top-level string literals]
-- Precondition: exprType expr = ty
exprIsTopLevelBindable expr ty
= exprIsLiteralString expr
|| not (isUnliftedType ty) | 223 | exprIsTopLevelBindable :: CoreExpr -> Type -> Bool
exprIsTopLevelBindable expr ty
= exprIsLiteralString expr
|| not (isUnliftedType ty) | 139 | exprIsTopLevelBindable expr ty
= exprIsLiteralString expr
|| not (isUnliftedType ty) | 88 | true | true | 2 | 6 | 33 | 43 | 22 | 21 | null | null |
hausdorff/pyli | src/LexerUtils.hs | mit | decimalinteger :: Regex
decimalinteger = (nonzerodigit <.> star ni)
<|> (plus (seqOf "0")) | 105 | decimalinteger :: Regex
decimalinteger = (nonzerodigit <.> star ni)
<|> (plus (seqOf "0")) | 105 | decimalinteger = (nonzerodigit <.> star ni)
<|> (plus (seqOf "0")) | 81 | false | true | 0 | 9 | 27 | 37 | 19 | 18 | null | null |
brendanhay/gogol | gogol-partners/gen/Network/Google/Partners/Types/Product.hs | mpl-2.0 | -- | The user\'s primary country, an ISO 2-character code.
upfPrimaryCountryCode :: Lens' UserProFile (Maybe Text)
upfPrimaryCountryCode
= lens _upfPrimaryCountryCode
(\ s a -> s{_upfPrimaryCountryCode = a}) | 215 | upfPrimaryCountryCode :: Lens' UserProFile (Maybe Text)
upfPrimaryCountryCode
= lens _upfPrimaryCountryCode
(\ s a -> s{_upfPrimaryCountryCode = a}) | 156 | upfPrimaryCountryCode
= lens _upfPrimaryCountryCode
(\ s a -> s{_upfPrimaryCountryCode = a}) | 100 | true | true | 0 | 9 | 34 | 48 | 25 | 23 | null | null |
nzok/decimal | ScaledBinaryTest.hs | mit | is_power_of_2 n = n > 0 && n `mod` 2 == 0 && is_power_of_2 (n`div`2) | 68 | is_power_of_2 n = n > 0 && n `mod` 2 == 0 && is_power_of_2 (n`div`2) | 68 | is_power_of_2 n = n > 0 && n `mod` 2 == 0 && is_power_of_2 (n`div`2) | 68 | false | false | 0 | 9 | 14 | 43 | 23 | 20 | null | null |
matterhorn-chat/matterhorn | src/Matterhorn/Draw/Util.hs | bsd-3-clause | getTimeFormat :: ChatState -> Text
getTimeFormat st =
maybe defaultTimeFormat id (st^.csResources.crConfiguration.configTimeFormatL) | 136 | getTimeFormat :: ChatState -> Text
getTimeFormat st =
maybe defaultTimeFormat id (st^.csResources.crConfiguration.configTimeFormatL) | 136 | getTimeFormat st =
maybe defaultTimeFormat id (st^.csResources.crConfiguration.configTimeFormatL) | 101 | false | true | 0 | 9 | 15 | 36 | 18 | 18 | null | null |
sdiehl/ghc | compiler/GHC/StgToCmm/Utils.hs | bsd-3-clause | mk_float_switch :: Width -> CmmExpr -> BlockId
-> LitBound
-> [(Literal,BlockId)]
-> FCode CmmAGraph
mk_float_switch rep scrut deflt _bounds [(lit,blk)]
= do dflags <- getDynFlags
return $ mkCbranch (cond dflags) deflt blk Nothing
where
cond dflags = CmmMachOp ne [scrut, CmmLit cmm_lit]
where
cmm_lit = mkSimpleLit dflags lit
ne = MO_F_Ne rep | 427 | mk_float_switch :: Width -> CmmExpr -> BlockId
-> LitBound
-> [(Literal,BlockId)]
-> FCode CmmAGraph
mk_float_switch rep scrut deflt _bounds [(lit,blk)]
= do dflags <- getDynFlags
return $ mkCbranch (cond dflags) deflt blk Nothing
where
cond dflags = CmmMachOp ne [scrut, CmmLit cmm_lit]
where
cmm_lit = mkSimpleLit dflags lit
ne = MO_F_Ne rep | 427 | mk_float_switch rep scrut deflt _bounds [(lit,blk)]
= do dflags <- getDynFlags
return $ mkCbranch (cond dflags) deflt blk Nothing
where
cond dflags = CmmMachOp ne [scrut, CmmLit cmm_lit]
where
cmm_lit = mkSimpleLit dflags lit
ne = MO_F_Ne rep | 284 | false | true | 0 | 11 | 135 | 137 | 69 | 68 | null | null |
avh4/elm-format | elm-format-lib/src/Parse/Number.hs | bsd-3-clause | chompHexHelp :: (Integral i) => Ptr Word8 -> Ptr Word8 -> i -> i -> (# Ptr Word8, i #)
chompHexHelp pos end answer accumulator =
if pos >= end then
(# pos, answer #)
else
let
!newAnswer =
stepHex pos end (P.unsafeIndex pos) accumulator
in
if newAnswer < 0 then
(# pos, if newAnswer == -1 then answer else -2 #)
else
chompHexHelp (plusPtr pos 1) end newAnswer newAnswer | 418 | chompHexHelp :: (Integral i) => Ptr Word8 -> Ptr Word8 -> i -> i -> (# Ptr Word8, i #)
chompHexHelp pos end answer accumulator =
if pos >= end then
(# pos, answer #)
else
let
!newAnswer =
stepHex pos end (P.unsafeIndex pos) accumulator
in
if newAnswer < 0 then
(# pos, if newAnswer == -1 then answer else -2 #)
else
chompHexHelp (plusPtr pos 1) end newAnswer newAnswer | 418 | chompHexHelp pos end answer accumulator =
if pos >= end then
(# pos, answer #)
else
let
!newAnswer =
stepHex pos end (P.unsafeIndex pos) accumulator
in
if newAnswer < 0 then
(# pos, if newAnswer == -1 then answer else -2 #)
else
chompHexHelp (plusPtr pos 1) end newAnswer newAnswer | 331 | false | true | 0 | 13 | 119 | 156 | 79 | 77 | null | null |
mainland/dph | dph-lifted-base/Data/Array/Parallel/PArray/Reference.hs | bsd-3-clause | - | O(sum lengths). Wrapper for segmented replicate that takes replication counts
-- and uses them to build the `U.Segd`.
replicates' :: PArray Int -> PArray a -> PArray a
replicates' reps arr
= replicates (U.lengthsToSegd $ V.convert $ reps) arr
| 256 | replicates' :: PArray Int -> PArray a -> PArray a
replicates' reps arr
= replicates (U.lengthsToSegd $ V.convert $ reps) arr | 132 | replicates' reps arr
= replicates (U.lengthsToSegd $ V.convert $ reps) arr | 82 | true | true | 1 | 9 | 50 | 89 | 42 | 47 | null | null |
andorp/bead | src/Bead/Daemon/Logout.hs | bsd-3-clause | withQueue (Queue queue userMap) f = f queue userMap | 51 | withQueue (Queue queue userMap) f = f queue userMap | 51 | withQueue (Queue queue userMap) f = f queue userMap | 51 | false | false | 0 | 7 | 8 | 24 | 11 | 13 | null | null |
ekmett/search | src/Data/Search/Intensional.hs | bsd-2-clause | -- | What is the worst scoring answer by Hilbert's epsilon?
worst :: Hilbert (Down a) b => (b -> a) -> b
worst = pessimum epsilon | 129 | worst :: Hilbert (Down a) b => (b -> a) -> b
worst = pessimum epsilon | 69 | worst = pessimum epsilon | 24 | true | true | 0 | 8 | 26 | 41 | 21 | 20 | null | null |
acowley/ghc | compiler/types/Type.hs | bsd-3-clause | emptyTvSubst :: TvSubst
emptyTvSubst = TvSubst emptyInScopeSet emptyTvSubstEnv | 78 | emptyTvSubst :: TvSubst
emptyTvSubst = TvSubst emptyInScopeSet emptyTvSubstEnv | 78 | emptyTvSubst = TvSubst emptyInScopeSet emptyTvSubstEnv | 54 | false | true | 0 | 6 | 7 | 22 | 9 | 13 | null | null |
beni55/text | Data/Text/Internal/Encoding/Fusion.hs | bsd-2-clause | -- | /O(n)/ Convert a 'ByteString' into a 'Stream Char', using little
-- endian UTF-32 encoding.
streamUtf32LE :: OnDecodeError -> ByteString -> Stream Char
streamUtf32LE onErr bs = Stream next 0 (maxSize (l `shiftR` 2))
where
l = B.length bs
{-# INLINE next #-}
next i
| i >= l = Done
| i+3 < l && U32.validate x = Yield (unsafeChr32 x) (i+4)
| otherwise = decodeError "streamUtf32LE" "UTF-32LE" onErr Nothing (i+1)
where
x = shiftL x4 24 + shiftL x3 16 + shiftL x2 8 + x1
x1 = idx i
x2 = idx $ i+1
x3 = idx $ i+2
x4 = idx $ i+3
idx = fromIntegral . B.unsafeIndex bs :: Int -> Word32
| 754 | streamUtf32LE :: OnDecodeError -> ByteString -> Stream Char
streamUtf32LE onErr bs = Stream next 0 (maxSize (l `shiftR` 2))
where
l = B.length bs
{-# INLINE next #-}
next i
| i >= l = Done
| i+3 < l && U32.validate x = Yield (unsafeChr32 x) (i+4)
| otherwise = decodeError "streamUtf32LE" "UTF-32LE" onErr Nothing (i+1)
where
x = shiftL x4 24 + shiftL x3 16 + shiftL x2 8 + x1
x1 = idx i
x2 = idx $ i+1
x3 = idx $ i+2
x4 = idx $ i+3
idx = fromIntegral . B.unsafeIndex bs :: Int -> Word32
| 657 | streamUtf32LE onErr bs = Stream next 0 (maxSize (l `shiftR` 2))
where
l = B.length bs
{-# INLINE next #-}
next i
| i >= l = Done
| i+3 < l && U32.validate x = Yield (unsafeChr32 x) (i+4)
| otherwise = decodeError "streamUtf32LE" "UTF-32LE" onErr Nothing (i+1)
where
x = shiftL x4 24 + shiftL x3 16 + shiftL x2 8 + x1
x1 = idx i
x2 = idx $ i+1
x3 = idx $ i+2
x4 = idx $ i+3
idx = fromIntegral . B.unsafeIndex bs :: Int -> Word32
| 597 | true | true | 5 | 11 | 287 | 254 | 128 | 126 | null | null |
elfeck/elfeckcom | src/Web/BetterMdParser.hs | mit | isLn1 _ = False | 15 | isLn1 _ = False | 15 | isLn1 _ = False | 15 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSIGSYS :: Int
wxSIGSYS = 12 | 29 | wxSIGSYS :: Int
wxSIGSYS = 12 | 29 | wxSIGSYS = 12 | 13 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
technogeeky/d-A | include/containers-0.5.0.0/Data/IntMap/Base.hs | gpl-3.0 | updateMaxWithKey :: (Key -> a -> Maybe a) -> IntMap a -> IntMap a
updateMaxWithKey f t =
case t of Bin p m l r | m < 0 -> bin p m (go f l) r
_ -> go f t
where
go f' (Bin p m l r) = bin p m l (go f' r)
go f' (Tip k y) = case f' k y of
Just y' -> Tip k y'
Nothing -> Nil
go _ Nil = error "updateMaxWithKey Nil"
-- | /O(min(n,W))/. 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 [(5,"a"), (3,"b")]) == Just ((5,"a"), singleton 3 "b")
-- > maxViewWithKey empty == Nothing | 659 | updateMaxWithKey :: (Key -> a -> Maybe a) -> IntMap a -> IntMap a
updateMaxWithKey f t =
case t of Bin p m l r | m < 0 -> bin p m (go f l) r
_ -> go f t
where
go f' (Bin p m l r) = bin p m l (go f' r)
go f' (Tip k y) = case f' k y of
Just y' -> Tip k y'
Nothing -> Nil
go _ Nil = error "updateMaxWithKey Nil"
-- | /O(min(n,W))/. 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 [(5,"a"), (3,"b")]) == Just ((5,"a"), singleton 3 "b")
-- > maxViewWithKey empty == Nothing | 659 | updateMaxWithKey f t =
case t of Bin p m l r | m < 0 -> bin p m (go f l) r
_ -> go f t
where
go f' (Bin p m l r) = bin p m l (go f' r)
go f' (Tip k y) = case f' k y of
Just y' -> Tip k y'
Nothing -> Nil
go _ Nil = error "updateMaxWithKey Nil"
-- | /O(min(n,W))/. 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 [(5,"a"), (3,"b")]) == Just ((5,"a"), singleton 3 "b")
-- > maxViewWithKey empty == Nothing | 593 | false | true | 0 | 11 | 207 | 208 | 100 | 108 | null | null |
CarstenKoenig/AdventOfCode2016 | Day11/Main.hs | mit | puzzle :: IO State
puzzle = do
[ (_, f1), (_, f2), (_, f3), (_, f4)] <-
catMaybes . fmap (eval parseFloor) <$> input
return $ State 1 f1 f2 f3 f4 | 153 | puzzle :: IO State
puzzle = do
[ (_, f1), (_, f2), (_, f3), (_, f4)] <-
catMaybes . fmap (eval parseFloor) <$> input
return $ State 1 f1 f2 f3 f4 | 153 | puzzle = do
[ (_, f1), (_, f2), (_, f3), (_, f4)] <-
catMaybes . fmap (eval parseFloor) <$> input
return $ State 1 f1 f2 f3 f4 | 134 | false | true | 0 | 13 | 39 | 98 | 51 | 47 | null | null |
fumieval/artery | Control/Artery.hs | bsd-3-clause | -- | 'delay n' propagates a signal n beat behind.
delay :: Int -> a -> Artery m a a
delay n d = go (Seq.replicate n d) where
go buf = Artery $ \i cont -> case Seq.viewl buf of
a Seq.:< buf' -> cont a $ go $ buf' Seq.|> i
| 234 | delay :: Int -> a -> Artery m a a
delay n d = go (Seq.replicate n d) where
go buf = Artery $ \i cont -> case Seq.viewl buf of
a Seq.:< buf' -> cont a $ go $ buf' Seq.|> i
| 183 | delay n d = go (Seq.replicate n d) where
go buf = Artery $ \i cont -> case Seq.viewl buf of
a Seq.:< buf' -> cont a $ go $ buf' Seq.|> i
| 149 | true | true | 3 | 12 | 66 | 113 | 52 | 61 | null | null |
kawu/factorized-tag-parser | src/NLP/Partage/AStar/Deriv.hs | bsd-2-clause | hasNode :: (Monad m, Ord n) => A.Item n t -> DerivM c n t m Bool
hasNode item = do
rev <- RWS.gets doneReversed
return $ M.member item rev
-- | Add a node to the inversed representation of the hypergraph. Nothing about
-- the ingoing or outgoing arcs is known at this moment. | 281 | hasNode :: (Monad m, Ord n) => A.Item n t -> DerivM c n t m Bool
hasNode item = do
rev <- RWS.gets doneReversed
return $ M.member item rev
-- | Add a node to the inversed representation of the hypergraph. Nothing about
-- the ingoing or outgoing arcs is known at this moment. | 281 | hasNode item = do
rev <- RWS.gets doneReversed
return $ M.member item rev
-- | Add a node to the inversed representation of the hypergraph. Nothing about
-- the ingoing or outgoing arcs is known at this moment. | 216 | false | true | 0 | 9 | 60 | 79 | 38 | 41 | null | null |
Spawek/HCPParse | src/Data/Either/Unwrap.hs | mit | isRight _ = False | 26 | isRight _ = False | 26 | isRight _ = False | 26 | false | false | 0 | 5 | 12 | 9 | 4 | 5 | null | null |
txkaduo/hs-vdian-sdk | VDian/Order.hs | bsd-3-clause | fromOrderStatusStr "ship" = Just OrderStatusShipped | 63 | fromOrderStatusStr "ship" = Just OrderStatusShipped | 63 | fromOrderStatusStr "ship" = Just OrderStatusShipped | 63 | false | false | 0 | 5 | 16 | 12 | 5 | 7 | null | null |
nevrenato/Hets_Fork | HasCASL/DataAna.hs | gpl-2.0 | relatedTypeIds :: TypeMap -> Id -> Id -> Bool
relatedTypeIds tm i1 i2 =
not $ Set.null $ Set.intersection (allRelIds tm i1) $ allRelIds tm i2 | 145 | relatedTypeIds :: TypeMap -> Id -> Id -> Bool
relatedTypeIds tm i1 i2 =
not $ Set.null $ Set.intersection (allRelIds tm i1) $ allRelIds tm i2 | 145 | relatedTypeIds tm i1 i2 =
not $ Set.null $ Set.intersection (allRelIds tm i1) $ allRelIds tm i2 | 99 | false | true | 0 | 9 | 29 | 62 | 30 | 32 | null | null |
dahlia/nirum | src/Nirum/Constructs/Annotation.hs | gpl-3.0 | fromList :: [Annotation] -> Either NameDuplication AnnotationSet
fromList annotations' =
case findDup names S.empty of
Just duplication -> Left (AnnotationNameDuplication duplication)
_ -> Right . AnnotationSet . M.fromList $
[(n, a) | Annotation n a <- annotations']
where
names :: [Identifier]
names = [name a | a <- annotations']
findDup :: [Identifier] -> S.Set Identifier -> Maybe Identifier
findDup identifiers dups =
case identifiers of
x : xs -> if x `S.member` dups
then Just x
else findDup xs $ S.insert x dups
_ -> Nothing | 659 | fromList :: [Annotation] -> Either NameDuplication AnnotationSet
fromList annotations' =
case findDup names S.empty of
Just duplication -> Left (AnnotationNameDuplication duplication)
_ -> Right . AnnotationSet . M.fromList $
[(n, a) | Annotation n a <- annotations']
where
names :: [Identifier]
names = [name a | a <- annotations']
findDup :: [Identifier] -> S.Set Identifier -> Maybe Identifier
findDup identifiers dups =
case identifiers of
x : xs -> if x `S.member` dups
then Just x
else findDup xs $ S.insert x dups
_ -> Nothing | 659 | fromList annotations' =
case findDup names S.empty of
Just duplication -> Left (AnnotationNameDuplication duplication)
_ -> Right . AnnotationSet . M.fromList $
[(n, a) | Annotation n a <- annotations']
where
names :: [Identifier]
names = [name a | a <- annotations']
findDup :: [Identifier] -> S.Set Identifier -> Maybe Identifier
findDup identifiers dups =
case identifiers of
x : xs -> if x `S.member` dups
then Just x
else findDup xs $ S.insert x dups
_ -> Nothing | 594 | false | true | 0 | 12 | 211 | 228 | 111 | 117 | null | null |
wavewave/gnuplot | src/Graphics/Gnuplot/MultiPlot.hs | bsd-3-clause | simpleFromPartArray ::
(Ix i, Ix j) =>
Array (i,j) Part -> T
simpleFromPartArray arr =
let ((r0,c0), (r1,c1)) = bounds arr
in Cons Nothing
(rangeSize (r0,r1))
(rangeSize (c0,c1))
(elems arr) | 233 | simpleFromPartArray ::
(Ix i, Ix j) =>
Array (i,j) Part -> T
simpleFromPartArray arr =
let ((r0,c0), (r1,c1)) = bounds arr
in Cons Nothing
(rangeSize (r0,r1))
(rangeSize (c0,c1))
(elems arr) | 233 | simpleFromPartArray arr =
let ((r0,c0), (r1,c1)) = bounds arr
in Cons Nothing
(rangeSize (r0,r1))
(rangeSize (c0,c1))
(elems arr) | 166 | false | true | 0 | 10 | 72 | 116 | 62 | 54 | null | null |
triplepointfive/soten | src/Codec/Soten/Parser/ObjParser.hs | mit | -- | A parser for all implemented tokens.
modelTokens :: Parser [Token]
modelTokens = many $ choice $ map try availableTags | 123 | modelTokens :: Parser [Token]
modelTokens = many $ choice $ map try availableTags | 81 | modelTokens = many $ choice $ map try availableTags | 51 | true | true | 0 | 6 | 20 | 31 | 16 | 15 | null | null |
jhance/objection | Language/Objection/Parser/TokenStream.hs | gpl-3.0 | subtractToken :: (Stream s Identity (SourcePos, Token)) => Parsec s u ()
subtractToken = basicToken f
where f TSubtract = Just ()
f _ = Nothing | 157 | subtractToken :: (Stream s Identity (SourcePos, Token)) => Parsec s u ()
subtractToken = basicToken f
where f TSubtract = Just ()
f _ = Nothing | 157 | subtractToken = basicToken f
where f TSubtract = Just ()
f _ = Nothing | 84 | false | true | 0 | 8 | 39 | 65 | 33 | 32 | null | null |
DevJac/haskell-project-euler | src/Problem4.hs | mit | main :: IO ()
main = print . maximum $ [x*y | x <- [999,998..1],
y <- [x,x-1..1],
palidrome . digitsRev $ x*y] | 174 | main :: IO ()
main = print . maximum $ [x*y | x <- [999,998..1],
y <- [x,x-1..1],
palidrome . digitsRev $ x*y] | 174 | main = print . maximum $ [x*y | x <- [999,998..1],
y <- [x,x-1..1],
palidrome . digitsRev $ x*y] | 160 | false | true | 1 | 11 | 86 | 87 | 44 | 43 | null | null |
kim/amazonka | amazonka-elb/gen/Network/AWS/ELB/AddTags.hs | mpl-2.0 | -- | A list of tags for each load balancer.
atTags :: Lens' AddTags (NonEmpty Tag)
atTags = lens _atTags (\s a -> s { _atTags = a }) . _List1 | 141 | atTags :: Lens' AddTags (NonEmpty Tag)
atTags = lens _atTags (\s a -> s { _atTags = a }) . _List1 | 97 | atTags = lens _atTags (\s a -> s { _atTags = a }) . _List1 | 58 | true | true | 0 | 10 | 30 | 50 | 27 | 23 | null | null |
BartAdv/idris-cil | src/IRTS/CodegenCil.hs | bsd-3-clause | exportedTypes :: CodegenInfo -> [TypeDef]
exportedTypes ci = concatMap exports (exportDecls ci)
where exports :: ExportIFace -> [TypeDef]
exports (Export (NS (UN (T.unpack -> "FFI_CIL")) _) exportedDataType es) =
let cilExports = map cilExport es
(cilFuns, cilTypes) = partition isCilFun cilExports
methods = map (\(CilFun m) -> m) cilFuns
types = map (\(CilType t) -> t) cilTypes
in publicClass exportedDataType methods : types
where isCilFun (CilFun _) = True
isCilFun _ = False
publicClass name methods = classDef [CaPublic] name noExtends noImplements [] methods []
exports e = error $ "Unsupported Export: " ++ show e | 765 | exportedTypes :: CodegenInfo -> [TypeDef]
exportedTypes ci = concatMap exports (exportDecls ci)
where exports :: ExportIFace -> [TypeDef]
exports (Export (NS (UN (T.unpack -> "FFI_CIL")) _) exportedDataType es) =
let cilExports = map cilExport es
(cilFuns, cilTypes) = partition isCilFun cilExports
methods = map (\(CilFun m) -> m) cilFuns
types = map (\(CilType t) -> t) cilTypes
in publicClass exportedDataType methods : types
where isCilFun (CilFun _) = True
isCilFun _ = False
publicClass name methods = classDef [CaPublic] name noExtends noImplements [] methods []
exports e = error $ "Unsupported Export: " ++ show e | 765 | exportedTypes ci = concatMap exports (exportDecls ci)
where exports :: ExportIFace -> [TypeDef]
exports (Export (NS (UN (T.unpack -> "FFI_CIL")) _) exportedDataType es) =
let cilExports = map cilExport es
(cilFuns, cilTypes) = partition isCilFun cilExports
methods = map (\(CilFun m) -> m) cilFuns
types = map (\(CilType t) -> t) cilTypes
in publicClass exportedDataType methods : types
where isCilFun (CilFun _) = True
isCilFun _ = False
publicClass name methods = classDef [CaPublic] name noExtends noImplements [] methods []
exports e = error $ "Unsupported Export: " ++ show e | 723 | false | true | 1 | 13 | 238 | 266 | 130 | 136 | null | null |
kim/amazonka | amazonka-ec2/gen/Network/AWS/EC2/CreateSnapshot.hs | mpl-2.0 | -- | The AWS account ID of the Amazon EBS snapshot owner.
csr1OwnerId :: Lens' CreateSnapshotResponse Text
csr1OwnerId = lens _csr1OwnerId (\s a -> s { _csr1OwnerId = a }) | 171 | csr1OwnerId :: Lens' CreateSnapshotResponse Text
csr1OwnerId = lens _csr1OwnerId (\s a -> s { _csr1OwnerId = a }) | 113 | csr1OwnerId = lens _csr1OwnerId (\s a -> s { _csr1OwnerId = a }) | 64 | true | true | 0 | 9 | 29 | 40 | 22 | 18 | null | null |
mfpi/OpenGL | Graphics/Rendering/OpenGL/GL/PerFragment.hs | bsd-3-clause | --------------------------------------------------------------------------------
activeStencilFace :: StateVar (Maybe Face)
activeStencilFace =
makeStateVarMaybe
(return CapStencilTestTwoSide)
(getEnum1 unmarshalFace GetActiveStencilFace)
(glActiveStencilFace . marshalFace) | 296 | activeStencilFace :: StateVar (Maybe Face)
activeStencilFace =
makeStateVarMaybe
(return CapStencilTestTwoSide)
(getEnum1 unmarshalFace GetActiveStencilFace)
(glActiveStencilFace . marshalFace) | 214 | activeStencilFace =
makeStateVarMaybe
(return CapStencilTestTwoSide)
(getEnum1 unmarshalFace GetActiveStencilFace)
(glActiveStencilFace . marshalFace) | 171 | true | true | 0 | 7 | 38 | 49 | 25 | 24 | null | null |
gridaphobe/ghc | compiler/deSugar/DsUtils.hs | bsd-3-clause | mkPArrCase :: DynFlags -> Id -> Type -> [CaseAlt DataCon] -> CoreExpr -> DsM CoreExpr
mkPArrCase dflags var ty sorted_alts fail = do
lengthP <- dsDPHBuiltin lengthPVar
alt <- unboxAlt
return (mkWildCase (len lengthP) intTy ty [alt])
where
elemTy = case splitTyConApp (idType var) of
(_, [elemTy]) -> elemTy
_ -> panic panicMsg
panicMsg = "DsUtils.mkCoAlgCaseMatchResult: not a parallel array?"
len lengthP = mkApps (Var lengthP) [Type elemTy, Var var]
--
unboxAlt = do
l <- newSysLocalDs intPrimTy
indexP <- dsDPHBuiltin indexPVar
alts <- mapM (mkAlt indexP) sorted_alts
return (DataAlt intDataCon, [l], mkWildCase (Var l) intPrimTy ty (dft : alts))
where
dft = (DEFAULT, [], fail)
--
-- each alternative matches one array length (corresponding to one
-- fake array constructor), so the match is on a literal; each
-- alternative's body is extended by a local binding for each
-- constructor argument, which are bound to array elements starting
-- with the first
--
mkAlt indexP alt@MkCaseAlt{alt_result = MatchResult _ bodyFun} = do
body <- bodyFun fail
return (LitAlt lit, [], mkCoreLets binds body)
where
lit = MachInt $ toInteger (dataConSourceArity (alt_pat alt))
binds = [NonRec arg (indexExpr i) | (i, arg) <- zip [1..] (alt_bndrs alt)]
--
indexExpr i = mkApps (Var indexP) [Type elemTy, Var var, mkIntExpr dflags i]
{-
************************************************************************
* *
\subsection{Desugarer's versions of some Core functions}
* *
************************************************************************
-} | 1,892 | mkPArrCase :: DynFlags -> Id -> Type -> [CaseAlt DataCon] -> CoreExpr -> DsM CoreExpr
mkPArrCase dflags var ty sorted_alts fail = do
lengthP <- dsDPHBuiltin lengthPVar
alt <- unboxAlt
return (mkWildCase (len lengthP) intTy ty [alt])
where
elemTy = case splitTyConApp (idType var) of
(_, [elemTy]) -> elemTy
_ -> panic panicMsg
panicMsg = "DsUtils.mkCoAlgCaseMatchResult: not a parallel array?"
len lengthP = mkApps (Var lengthP) [Type elemTy, Var var]
--
unboxAlt = do
l <- newSysLocalDs intPrimTy
indexP <- dsDPHBuiltin indexPVar
alts <- mapM (mkAlt indexP) sorted_alts
return (DataAlt intDataCon, [l], mkWildCase (Var l) intPrimTy ty (dft : alts))
where
dft = (DEFAULT, [], fail)
--
-- each alternative matches one array length (corresponding to one
-- fake array constructor), so the match is on a literal; each
-- alternative's body is extended by a local binding for each
-- constructor argument, which are bound to array elements starting
-- with the first
--
mkAlt indexP alt@MkCaseAlt{alt_result = MatchResult _ bodyFun} = do
body <- bodyFun fail
return (LitAlt lit, [], mkCoreLets binds body)
where
lit = MachInt $ toInteger (dataConSourceArity (alt_pat alt))
binds = [NonRec arg (indexExpr i) | (i, arg) <- zip [1..] (alt_bndrs alt)]
--
indexExpr i = mkApps (Var indexP) [Type elemTy, Var var, mkIntExpr dflags i]
{-
************************************************************************
* *
\subsection{Desugarer's versions of some Core functions}
* *
************************************************************************
-} | 1,892 | mkPArrCase dflags var ty sorted_alts fail = do
lengthP <- dsDPHBuiltin lengthPVar
alt <- unboxAlt
return (mkWildCase (len lengthP) intTy ty [alt])
where
elemTy = case splitTyConApp (idType var) of
(_, [elemTy]) -> elemTy
_ -> panic panicMsg
panicMsg = "DsUtils.mkCoAlgCaseMatchResult: not a parallel array?"
len lengthP = mkApps (Var lengthP) [Type elemTy, Var var]
--
unboxAlt = do
l <- newSysLocalDs intPrimTy
indexP <- dsDPHBuiltin indexPVar
alts <- mapM (mkAlt indexP) sorted_alts
return (DataAlt intDataCon, [l], mkWildCase (Var l) intPrimTy ty (dft : alts))
where
dft = (DEFAULT, [], fail)
--
-- each alternative matches one array length (corresponding to one
-- fake array constructor), so the match is on a literal; each
-- alternative's body is extended by a local binding for each
-- constructor argument, which are bound to array elements starting
-- with the first
--
mkAlt indexP alt@MkCaseAlt{alt_result = MatchResult _ bodyFun} = do
body <- bodyFun fail
return (LitAlt lit, [], mkCoreLets binds body)
where
lit = MachInt $ toInteger (dataConSourceArity (alt_pat alt))
binds = [NonRec arg (indexExpr i) | (i, arg) <- zip [1..] (alt_bndrs alt)]
--
indexExpr i = mkApps (Var indexP) [Type elemTy, Var var, mkIntExpr dflags i]
{-
************************************************************************
* *
\subsection{Desugarer's versions of some Core functions}
* *
************************************************************************
-} | 1,806 | false | true | 11 | 11 | 577 | 507 | 237 | 270 | null | null |
jhickner/fay-three | Language/Fay/Three.hs | bsd-3-clause | mkMesh :: Geometry -> Material -> Fay Object3D
mkMesh = ffi "new THREE.Mesh(%1,%2)" | 83 | mkMesh :: Geometry -> Material -> Fay Object3D
mkMesh = ffi "new THREE.Mesh(%1,%2)" | 83 | mkMesh = ffi "new THREE.Mesh(%1,%2)" | 36 | false | true | 0 | 7 | 12 | 25 | 12 | 13 | null | null |
gumgl/project-euler | 40/40.hs | mit | main = print answer | 19 | main = print answer | 19 | main = print answer | 19 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
CindyLinz/Haskell.js | trans/src/Desugar/CaseReorder.hs | mit | deCaseReorderStmt a1 (LetStmt l binds) = LetStmt (id l) (deCaseReorderBinds a1 binds) | 85 | deCaseReorderStmt a1 (LetStmt l binds) = LetStmt (id l) (deCaseReorderBinds a1 binds) | 85 | deCaseReorderStmt a1 (LetStmt l binds) = LetStmt (id l) (deCaseReorderBinds a1 binds) | 85 | false | false | 0 | 7 | 11 | 38 | 18 | 20 | null | null |
shockkolate/etch | src/Etch/CodeGen.hs | apache-2.0 | topLevelDefBuilder :: Typed Def -> ModuleBuilder (Maybe L.AST.Operand)
topLevelDefBuilder (Def name (FunctionExpr function `As` _) `As` _) = do
fn <- topLevelFunctionBuilder lName function
modify (contextInsert name fn)
pure (Just fn)
where lName = (L.AST.Name . ShortBS.toShort . encodeUtf8) name | 311 | topLevelDefBuilder :: Typed Def -> ModuleBuilder (Maybe L.AST.Operand)
topLevelDefBuilder (Def name (FunctionExpr function `As` _) `As` _) = do
fn <- topLevelFunctionBuilder lName function
modify (contextInsert name fn)
pure (Just fn)
where lName = (L.AST.Name . ShortBS.toShort . encodeUtf8) name | 311 | topLevelDefBuilder (Def name (FunctionExpr function `As` _) `As` _) = do
fn <- topLevelFunctionBuilder lName function
modify (contextInsert name fn)
pure (Just fn)
where lName = (L.AST.Name . ShortBS.toShort . encodeUtf8) name | 240 | false | true | 1 | 10 | 53 | 131 | 62 | 69 | null | null |
m-alvarez/jhc | lib/haskell-extras/System/IO/Error.hs | mit | -- | An error indicating that an 'IO' operation failed because
-- the end of file has been reached.
isEOFError :: IOError -> Bool
isEOFError = check EOF | 171 | isEOFError :: IOError -> Bool
isEOFError = check EOF | 71 | isEOFError = check EOF | 32 | true | true | 0 | 5 | 46 | 20 | 11 | 9 | null | null |
frp-arduino/frp-arduino | src/Arduino/Nano.hs | gpl-3.0 | a5 :: AnalogInput
a5 = AnalogInput "a5" 5 | 41 | a5 :: AnalogInput
a5 = AnalogInput "a5" 5 | 41 | a5 = AnalogInput "a5" 5 | 23 | false | true | 0 | 6 | 7 | 24 | 9 | 15 | null | null |
rCEx/feldspar-lang-small | src/Feldspar/Core/Constructs/Binding.hs | bsd-3-clause | optimizeLet opts opt info ([], e) = optimizeFunction opts opt info e | 68 | optimizeLet opts opt info ([], e) = optimizeFunction opts opt info e | 68 | optimizeLet opts opt info ([], e) = optimizeFunction opts opt info e | 68 | false | false | 0 | 7 | 11 | 32 | 16 | 16 | null | null |
tfausak/wuss | source/library/Wuss.hs | mit | -- | The default 'Config' value used by 'runSecureClientWith'.
defaultConfig :: Config
defaultConfig = do
Config { connectionGet = Connection.connectionGetChunk }
-- | Runs a secure WebSockets client with the given 'Config'. | 228 | defaultConfig :: Config
defaultConfig = do
Config { connectionGet = Connection.connectionGetChunk }
-- | Runs a secure WebSockets client with the given 'Config'. | 165 | defaultConfig = do
Config { connectionGet = Connection.connectionGetChunk }
-- | Runs a secure WebSockets client with the given 'Config'. | 141 | true | true | 0 | 9 | 35 | 26 | 15 | 11 | null | null |
nevrenato/Hets_Fork | Comorphisms/SoftFOL2CommonLogic.hs | gpl-2.0 | isNullary :: FOLSign.SPTerm -> Bool
isNullary t = case t of
FOLSign.SPComplexTerm _ [] -> True
_ -> False
-- representation for true in CL | 143 | isNullary :: FOLSign.SPTerm -> Bool
isNullary t = case t of
FOLSign.SPComplexTerm _ [] -> True
_ -> False
-- representation for true in CL | 143 | isNullary t = case t of
FOLSign.SPComplexTerm _ [] -> True
_ -> False
-- representation for true in CL | 107 | false | true | 0 | 9 | 29 | 52 | 24 | 28 | null | null |
DanielRS/marquee | app/Minimal.hs | mit | sourceCss :: String
sourceCss = "minimal.css" | 45 | sourceCss :: String
sourceCss = "minimal.css" | 45 | sourceCss = "minimal.css" | 25 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
Philonous/hs-otr | source/Otr.hs | mit | checkAndSaveAuthMessage :: AuthKeys -> OtrSignatureMessage -> Otr g ()
checkAndSaveAuthMessage keyType (SM (DATA xEncrypted) (MAC xSha256Mac)) = do
DHKeyPair gx x <- OtrT $ gets ourCurrentKey
Just gy <- OtrT $ gets theirCurrentKey
let s = makeDHSharedSecret x gy prime
KD{..} = keyDerivs s
(macKey1, macKey2, aesKey) = case keyType of
KeysRSM -> (kdM1 , kdM2 , kdC )
KeysSM -> (kdM1', kdM2', kdC')
xEncryptedD = Serialize.encode $ DATA xEncrypted
xSha256Mac' = HMAC.hmac' (HMAC.MacKey macKey2) xEncryptedD :: Crypto.SHA256
protocolGuard MACFailure (BS.take 20 (Serialize.encode xSha256Mac') =~= xSha256Mac)
let (Right (SD (DsaP theirPub) theirKeyID (DsaS sig))) =
Serialize.decode $ aesCtrZero aesKey xEncrypted
theirM = m gy gx theirPub theirKeyID macKey1
-- check that the public key they present is the one we have stored (if any)
storedPubkey <- OtrT $ gets theirPublicKey
case storedPubkey of
Nothing -> return ()
Just sp -> protocolGuard PubkeyMismatch (sp == theirPub)
protocolGuard SignatureMismatch $ DSA.verify id theirPub sig theirM
OtrT . modify $ \s' -> s'{ theirKeyID = theirKeyID
, theirPublicKey = Just theirPub
} | 1,325 | checkAndSaveAuthMessage :: AuthKeys -> OtrSignatureMessage -> Otr g ()
checkAndSaveAuthMessage keyType (SM (DATA xEncrypted) (MAC xSha256Mac)) = do
DHKeyPair gx x <- OtrT $ gets ourCurrentKey
Just gy <- OtrT $ gets theirCurrentKey
let s = makeDHSharedSecret x gy prime
KD{..} = keyDerivs s
(macKey1, macKey2, aesKey) = case keyType of
KeysRSM -> (kdM1 , kdM2 , kdC )
KeysSM -> (kdM1', kdM2', kdC')
xEncryptedD = Serialize.encode $ DATA xEncrypted
xSha256Mac' = HMAC.hmac' (HMAC.MacKey macKey2) xEncryptedD :: Crypto.SHA256
protocolGuard MACFailure (BS.take 20 (Serialize.encode xSha256Mac') =~= xSha256Mac)
let (Right (SD (DsaP theirPub) theirKeyID (DsaS sig))) =
Serialize.decode $ aesCtrZero aesKey xEncrypted
theirM = m gy gx theirPub theirKeyID macKey1
-- check that the public key they present is the one we have stored (if any)
storedPubkey <- OtrT $ gets theirPublicKey
case storedPubkey of
Nothing -> return ()
Just sp -> protocolGuard PubkeyMismatch (sp == theirPub)
protocolGuard SignatureMismatch $ DSA.verify id theirPub sig theirM
OtrT . modify $ \s' -> s'{ theirKeyID = theirKeyID
, theirPublicKey = Just theirPub
} | 1,325 | checkAndSaveAuthMessage keyType (SM (DATA xEncrypted) (MAC xSha256Mac)) = do
DHKeyPair gx x <- OtrT $ gets ourCurrentKey
Just gy <- OtrT $ gets theirCurrentKey
let s = makeDHSharedSecret x gy prime
KD{..} = keyDerivs s
(macKey1, macKey2, aesKey) = case keyType of
KeysRSM -> (kdM1 , kdM2 , kdC )
KeysSM -> (kdM1', kdM2', kdC')
xEncryptedD = Serialize.encode $ DATA xEncrypted
xSha256Mac' = HMAC.hmac' (HMAC.MacKey macKey2) xEncryptedD :: Crypto.SHA256
protocolGuard MACFailure (BS.take 20 (Serialize.encode xSha256Mac') =~= xSha256Mac)
let (Right (SD (DsaP theirPub) theirKeyID (DsaS sig))) =
Serialize.decode $ aesCtrZero aesKey xEncrypted
theirM = m gy gx theirPub theirKeyID macKey1
-- check that the public key they present is the one we have stored (if any)
storedPubkey <- OtrT $ gets theirPublicKey
case storedPubkey of
Nothing -> return ()
Just sp -> protocolGuard PubkeyMismatch (sp == theirPub)
protocolGuard SignatureMismatch $ DSA.verify id theirPub sig theirM
OtrT . modify $ \s' -> s'{ theirKeyID = theirKeyID
, theirPublicKey = Just theirPub
} | 1,254 | false | true | 0 | 15 | 364 | 409 | 200 | 209 | null | null |
NickAger/LearningHaskell | HaskellProgrammingFromFirstPrinciples/Chapter22.hsproj/ReaderPractice.hs | mit | -- one that returns Nothing
zs :: Maybe Integer
zs = lookup 4 $ zip x y | 71 | zs :: Maybe Integer
zs = lookup 4 $ zip x y | 43 | zs = lookup 4 $ zip x y | 23 | true | true | 1 | 6 | 16 | 30 | 13 | 17 | null | null |
randen/cabal | cabal-install/Distribution/Client/Setup.hs | bsd-3-clause | defaultSDistExFlags :: SDistExFlags
defaultSDistExFlags = SDistExFlags {
sDistFormat = Flag TargzFormat
} | 112 | defaultSDistExFlags :: SDistExFlags
defaultSDistExFlags = SDistExFlags {
sDistFormat = Flag TargzFormat
} | 112 | defaultSDistExFlags = SDistExFlags {
sDistFormat = Flag TargzFormat
} | 76 | false | true | 0 | 7 | 18 | 22 | 12 | 10 | null | null |
xmonad/xmonad-contrib | XMonad/Actions/CycleWS.hs | bsd-3-clause | swapNextScreen :: X ()
swapNextScreen = swapScreen 1 | 52 | swapNextScreen :: X ()
swapNextScreen = swapScreen 1 | 52 | swapNextScreen = swapScreen 1 | 29 | false | true | 0 | 7 | 7 | 24 | 10 | 14 | null | null |
frantisekfarka/ghc-dsi | compiler/utils/BooleanFormula.hs | bsd-3-clause | simplify f (Or xs) = mkOr (map (simplify f) xs) | 47 | simplify f (Or xs) = mkOr (map (simplify f) xs) | 47 | simplify f (Or xs) = mkOr (map (simplify f) xs) | 47 | false | false | 0 | 9 | 9 | 34 | 16 | 18 | null | null |
lykahb/aeson | Data/Aeson/Functions.hs | bsd-3-clause | -- | Transform the keys of a 'H.HashMap'.
mapKey :: (Eq k2, Hashable k2) => (k1 -> k2) -> H.HashMap k1 v -> H.HashMap k2 v
mapKey fk = mapKeyVal fk id | 150 | mapKey :: (Eq k2, Hashable k2) => (k1 -> k2) -> H.HashMap k1 v -> H.HashMap k2 v
mapKey fk = mapKeyVal fk id | 108 | mapKey fk = mapKeyVal fk id | 27 | true | true | 0 | 10 | 31 | 69 | 33 | 36 | null | null |
christiaanb/clash-compiler | clash-lib/src/CLaSH/Normalize/Util.hs | bsd-2-clause | specializeNorm :: Bool -> NormRewrite
specializeNorm = specialise specialisationCache specialisationHistory specialisationLimit | 127 | specializeNorm :: Bool -> NormRewrite
specializeNorm = specialise specialisationCache specialisationHistory specialisationLimit | 127 | specializeNorm = specialise specialisationCache specialisationHistory specialisationLimit | 89 | false | true | 0 | 7 | 10 | 28 | 12 | 16 | null | null |
tokiwoousaka/bucephalus-base | src/Game/Bucephalus.hs | bsd-3-clause | modifyObjects :: (M.Map a (Object i) -> M.Map a (Object i)) -> BucephalusState a i s ()
modifyObjects f = modify $ \s -> let
objs = buceObjects s
in s { buceObjects = f objs } | 181 | modifyObjects :: (M.Map a (Object i) -> M.Map a (Object i)) -> BucephalusState a i s ()
modifyObjects f = modify $ \s -> let
objs = buceObjects s
in s { buceObjects = f objs } | 181 | modifyObjects f = modify $ \s -> let
objs = buceObjects s
in s { buceObjects = f objs } | 93 | false | true | 0 | 11 | 42 | 96 | 47 | 49 | null | null |
dylanmc/cryptol | src/Cryptol/TypeCheck/Solver/InfNat.hs | bsd-3-clause | {-| Some algeibraic properties of interest:
> x ^ 0 = 1
> x ^ (n + 1) = x * (x ^ n)
> x ^ (m + n) = (x ^ m) * (x ^ n)
> x ^ (m * n) = (x ^ m) ^ n
-}
nExp :: Nat' -> Nat' -> Nat'
nExp _ (Nat 0) = Nat 1 | 218 | nExp :: Nat' -> Nat' -> Nat'
nExp _ (Nat 0) = Nat 1 | 57 | nExp _ (Nat 0) = Nat 1 | 28 | true | true | 0 | 7 | 82 | 34 | 17 | 17 | null | null |
zhiyuanshi/fcore | backend/archive/CoreNew.hs | bsd-2-clause | coreTypeToNew C.Unit = Unit | 35 | coreTypeToNew C.Unit = Unit | 35 | coreTypeToNew C.Unit = Unit | 35 | false | false | 0 | 6 | 11 | 11 | 5 | 6 | null | null |
nikita-volkov/hasql-transaction | library/Hasql/Transaction/Private/Sessions.hs | mit | tryTransaction :: IsolationLevel -> Mode -> Session (a, Bool) -> Bool -> Session (Maybe a)
tryTransaction level mode body preparable = do
statement () (Statements.beginTransaction level mode preparable)
bodyRes <- catchError (fmap Just body) $ \ error -> do
statement () (Statements.abortTransaction preparable)
handleTransactionError error $ return Nothing
case bodyRes of
Just (res, commit) -> catchError (commitOrAbort commit preparable $> Just res) $ \ error -> do
handleTransactionError error $ return Nothing
Nothing -> return Nothing | 571 | tryTransaction :: IsolationLevel -> Mode -> Session (a, Bool) -> Bool -> Session (Maybe a)
tryTransaction level mode body preparable = do
statement () (Statements.beginTransaction level mode preparable)
bodyRes <- catchError (fmap Just body) $ \ error -> do
statement () (Statements.abortTransaction preparable)
handleTransactionError error $ return Nothing
case bodyRes of
Just (res, commit) -> catchError (commitOrAbort commit preparable $> Just res) $ \ error -> do
handleTransactionError error $ return Nothing
Nothing -> return Nothing | 571 | tryTransaction level mode body preparable = do
statement () (Statements.beginTransaction level mode preparable)
bodyRes <- catchError (fmap Just body) $ \ error -> do
statement () (Statements.abortTransaction preparable)
handleTransactionError error $ return Nothing
case bodyRes of
Just (res, commit) -> catchError (commitOrAbort commit preparable $> Just res) $ \ error -> do
handleTransactionError error $ return Nothing
Nothing -> return Nothing | 480 | false | true | 0 | 16 | 106 | 210 | 97 | 113 | null | null |
pgj/bead | src/Bead/Persistence/NoSQLDir.hs | bsd-3-clause | saveScore :: Username -> AssessmentKey -> Score -> Persist ScoreKey
saveScore u ak s = do
dirName <- createTmpDir scoreDataDir "sc"
let key = ScoreKey $ takeBaseName dirName
save dirName s
link key u "score"
link u key "user"
link ak key "assessment"
link key ak "score"
return key | 298 | saveScore :: Username -> AssessmentKey -> Score -> Persist ScoreKey
saveScore u ak s = do
dirName <- createTmpDir scoreDataDir "sc"
let key = ScoreKey $ takeBaseName dirName
save dirName s
link key u "score"
link u key "user"
link ak key "assessment"
link key ak "score"
return key | 298 | saveScore u ak s = do
dirName <- createTmpDir scoreDataDir "sc"
let key = ScoreKey $ takeBaseName dirName
save dirName s
link key u "score"
link u key "user"
link ak key "assessment"
link key ak "score"
return key | 230 | false | true | 0 | 11 | 65 | 115 | 49 | 66 | null | null |
haskell-distributed/distributed-process | src/Control/Distributed/Process/Internal/CQueue.hs | bsd-3-clause | mkWeakCQueue :: CQueue a -> IO () -> IO (Weak (CQueue a))
mkWeakCQueue m@(CQueue (StrictMVar (MVar m#)) _ _) f = IO $ \s ->
#if MIN_VERSION_base(4,9,0)
case mkWeak# m# m (unIO f) s of (# s1, w #) -> (# s1, Weak w #)
#else
case mkWeak# m# m f s of (# s1, w #) -> (# s1, Weak w #)
#endif | 289 | mkWeakCQueue :: CQueue a -> IO () -> IO (Weak (CQueue a))
mkWeakCQueue m@(CQueue (StrictMVar (MVar m#)) _ _) f = IO $ \s ->
#if MIN_VERSION_base(4,9,0)
case mkWeak# m# m (unIO f) s of (# s1, w #) -> (# s1, Weak w #)
#else
case mkWeak# m# m f s of (# s1, w #) -> (# s1, Weak w #)
#endif | 289 | mkWeakCQueue m@(CQueue (StrictMVar (MVar m#)) _ _) f = IO $ \s ->
#if MIN_VERSION_base(4,9,0)
case mkWeak# m# m (unIO f) s of (# s1, w #) -> (# s1, Weak w #)
#else
case mkWeak# m# m f s of (# s1, w #) -> (# s1, Weak w #)
#endif | 231 | false | true | 0 | 12 | 67 | 121 | 61 | 60 | null | null |
diminishedprime/.org | programmey_stuff/write_yourself_a_scheme/ch_07/wyas/app/Eval.hs | mit | stringToSymbol :: LispVal -> LispVal
stringToSymbol (String str) = Atom str | 75 | stringToSymbol :: LispVal -> LispVal
stringToSymbol (String str) = Atom str | 75 | stringToSymbol (String str) = Atom str | 38 | false | true | 0 | 9 | 10 | 32 | 14 | 18 | null | null |
mitchellwrosen/Sloch | src/sloch/Dirent.hs | bsd-3-clause | makeDirents :: Bool -> [FilePath] -> IO [Dirent]
makeDirents include_dotfiles = fmap catMaybes . mapM (makeDirent include_dotfiles) | 131 | makeDirents :: Bool -> [FilePath] -> IO [Dirent]
makeDirents include_dotfiles = fmap catMaybes . mapM (makeDirent include_dotfiles) | 131 | makeDirents include_dotfiles = fmap catMaybes . mapM (makeDirent include_dotfiles) | 82 | false | true | 0 | 9 | 16 | 51 | 24 | 27 | null | null |
mikeizbicki/dominion | src/Engine/Ratings.hs | bsd-3-clause | getRating :: PlayerName -> Ratings -> Rating
getRating p (Ratings rs) = case lookup p rs of
Nothing -> unrated
Just r -> r | 131 | getRating :: PlayerName -> Ratings -> Rating
getRating p (Ratings rs) = case lookup p rs of
Nothing -> unrated
Just r -> r | 131 | getRating p (Ratings rs) = case lookup p rs of
Nothing -> unrated
Just r -> r | 86 | false | true | 0 | 8 | 32 | 60 | 27 | 33 | null | null |
beni55/haste-compiler | libraries/ghc-7.8/base/Data/Data.hs | bsd-3-clause | mkRealConstr :: (Real a, Show a) => DataType -> a -> Constr
mkRealConstr dt f = case datarep dt of
FloatRep -> mkPrimCon dt (show f) (FloatConstr (toRational f))
_ -> error "Data.Data.mkRealConstr"
-- | This function is now deprecated. Please use 'mkCharConstr' instead.
| 312 | mkRealConstr :: (Real a, Show a) => DataType -> a -> Constr
mkRealConstr dt f = case datarep dt of
FloatRep -> mkPrimCon dt (show f) (FloatConstr (toRational f))
_ -> error "Data.Data.mkRealConstr"
-- | This function is now deprecated. Please use 'mkCharConstr' instead.
| 312 | mkRealConstr dt f = case datarep dt of
FloatRep -> mkPrimCon dt (show f) (FloatConstr (toRational f))
_ -> error "Data.Data.mkRealConstr"
-- | This function is now deprecated. Please use 'mkCharConstr' instead.
| 252 | false | true | 0 | 12 | 85 | 92 | 44 | 48 | null | null |
chriseidhof/objc-value-objects | Example.hs | mit | driver = case parse (T.pack exampleStr) of
Left err -> error err
Right ast -> (implementation (C.implementation ast), interface (C.interface ast)) | 168 | driver = case parse (T.pack exampleStr) of
Left err -> error err
Right ast -> (implementation (C.implementation ast), interface (C.interface ast)) | 168 | driver = case parse (T.pack exampleStr) of
Left err -> error err
Right ast -> (implementation (C.implementation ast), interface (C.interface ast)) | 168 | false | false | 1 | 13 | 42 | 74 | 33 | 41 | null | null |
yusent/cfdis | test/unit/CFDI/V3_2Spec.hs | mit | originalChain' :: Text
originalChain' =
"||3.2|2017-06-12T12:00:00|ingreso|Way To Pay|Payment Conditions|536.192\
\|24.36|17.1212|USD|536.216|99|Issued In|1212|3636|B|2017-01-12T12:12:12\
\|1200.00|XAXX010101000|Issuer Name|Fiscal Street|Fiscal External Number\
\|Fiscal Internal Number|Fiscal Suburb|Fiscal Locality|Fiscal Reference\
\|Fiscal Municipality|Fiscal State|Fiscal Country|22000|Branch Street\
\|Branch External Number|Branch Internal Number|Branch Suburb|Branch Locality\
\|Branch Reference|Branch Municipality|Branch State|Branch Country|22114\
\|Fiscal Regime|XEXX010101000|Recipient Name|Recipient Street\
\|Recipient External Number|Recipient Internal Number|Recipient Suburb\
\|Recipient Locality|Recipient Reference|Recipient Municipality\
\|Recipient State|Recipient Country|22116|1.00|Product 1 Unit|Product 1 ID\
\|Product 1 Description|112.00|112.00|Product 1 Import Number|1986-08-22\
\|Product 1 Custom|2.00|Product 2 Unit|Product 2 ID|Product 2 Description\
\|212.12|424.24|ISR|12.144|12.144|IVA|16|12.12|12.12||" | 1,067 | originalChain' :: Text
originalChain' =
"||3.2|2017-06-12T12:00:00|ingreso|Way To Pay|Payment Conditions|536.192\
\|24.36|17.1212|USD|536.216|99|Issued In|1212|3636|B|2017-01-12T12:12:12\
\|1200.00|XAXX010101000|Issuer Name|Fiscal Street|Fiscal External Number\
\|Fiscal Internal Number|Fiscal Suburb|Fiscal Locality|Fiscal Reference\
\|Fiscal Municipality|Fiscal State|Fiscal Country|22000|Branch Street\
\|Branch External Number|Branch Internal Number|Branch Suburb|Branch Locality\
\|Branch Reference|Branch Municipality|Branch State|Branch Country|22114\
\|Fiscal Regime|XEXX010101000|Recipient Name|Recipient Street\
\|Recipient External Number|Recipient Internal Number|Recipient Suburb\
\|Recipient Locality|Recipient Reference|Recipient Municipality\
\|Recipient State|Recipient Country|22116|1.00|Product 1 Unit|Product 1 ID\
\|Product 1 Description|112.00|112.00|Product 1 Import Number|1986-08-22\
\|Product 1 Custom|2.00|Product 2 Unit|Product 2 ID|Product 2 Description\
\|212.12|424.24|ISR|12.144|12.144|IVA|16|12.12|12.12||" | 1,067 | originalChain' =
"||3.2|2017-06-12T12:00:00|ingreso|Way To Pay|Payment Conditions|536.192\
\|24.36|17.1212|USD|536.216|99|Issued In|1212|3636|B|2017-01-12T12:12:12\
\|1200.00|XAXX010101000|Issuer Name|Fiscal Street|Fiscal External Number\
\|Fiscal Internal Number|Fiscal Suburb|Fiscal Locality|Fiscal Reference\
\|Fiscal Municipality|Fiscal State|Fiscal Country|22000|Branch Street\
\|Branch External Number|Branch Internal Number|Branch Suburb|Branch Locality\
\|Branch Reference|Branch Municipality|Branch State|Branch Country|22114\
\|Fiscal Regime|XEXX010101000|Recipient Name|Recipient Street\
\|Recipient External Number|Recipient Internal Number|Recipient Suburb\
\|Recipient Locality|Recipient Reference|Recipient Municipality\
\|Recipient State|Recipient Country|22116|1.00|Product 1 Unit|Product 1 ID\
\|Product 1 Description|112.00|112.00|Product 1 Import Number|1986-08-22\
\|Product 1 Custom|2.00|Product 2 Unit|Product 2 ID|Product 2 Description\
\|212.12|424.24|ISR|12.144|12.144|IVA|16|12.12|12.12||" | 1,044 | false | true | 0 | 4 | 103 | 11 | 6 | 5 | null | null |
hsyl20/ViperVM | haskus-system/src/lib/Haskus/Arch/X86_64/ISA/Encoding.hs | bsd-3-clause | -- | Test R bit of REX prefix
rexR :: Rex -> Word8
rexR (Rex v) = if testBit v 2 then 1 else 0 | 94 | rexR :: Rex -> Word8
rexR (Rex v) = if testBit v 2 then 1 else 0 | 64 | rexR (Rex v) = if testBit v 2 then 1 else 0 | 43 | true | true | 0 | 7 | 24 | 38 | 20 | 18 | null | null |
runjak/projectEuler | src/Problem27.hs | mit | main = print solution | 21 | main = print solution | 21 | main = print solution | 21 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/ElasticsearchDomain.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#cfn-elasticsearch-domain-accesspolicies
edAccessPolicies :: Lens' ElasticsearchDomain (Maybe Object)
edAccessPolicies = lens _elasticsearchDomainAccessPolicies (\s a -> s { _elasticsearchDomainAccessPolicies = a }) | 320 | edAccessPolicies :: Lens' ElasticsearchDomain (Maybe Object)
edAccessPolicies = lens _elasticsearchDomainAccessPolicies (\s a -> s { _elasticsearchDomainAccessPolicies = a }) | 174 | edAccessPolicies = lens _elasticsearchDomainAccessPolicies (\s a -> s { _elasticsearchDomainAccessPolicies = a }) | 113 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
frp-arduino/frp-arduino | src/Arduino/DSL.hs | gpl-3.0 | mapS :: (Expression a -> Expression b) -> Stream a -> Stream b
mapS fn stream = Stream $ do
streamName <- unStream stream
expressionStreamName <- addAnonymousStream (DAG.Map expression)
addDependency streamName expressionStreamName
where
expression = unExpression $ fn $ Expression $ DAG.Input 0
-- | Contrast with 'flattenS'. | 351 | mapS :: (Expression a -> Expression b) -> Stream a -> Stream b
mapS fn stream = Stream $ do
streamName <- unStream stream
expressionStreamName <- addAnonymousStream (DAG.Map expression)
addDependency streamName expressionStreamName
where
expression = unExpression $ fn $ Expression $ DAG.Input 0
-- | Contrast with 'flattenS'. | 351 | mapS fn stream = Stream $ do
streamName <- unStream stream
expressionStreamName <- addAnonymousStream (DAG.Map expression)
addDependency streamName expressionStreamName
where
expression = unExpression $ fn $ Expression $ DAG.Input 0
-- | Contrast with 'flattenS'. | 288 | false | true | 3 | 11 | 72 | 117 | 51 | 66 | null | null |
snoyberg/yesodcms | FormatHandler/Html.hs | bsd-2-clause | htmlFormatHandler :: (YesodAloha master, YesodJquery master) => FormatHandler master
htmlFormatHandler = FormatHandler
{ fhExts = Set.singleton "html"
, fhName = "HTML"
, fhForm = titleForm alohaHtmlField id id (return ())
, fhWidget = widget
, fhFilter = Just . enumList 8 . L.toChunks . TLE.encodeUtf8 . TL.fromStrict . sanitizeBalance . TL.toStrict . TLE.decodeUtf8With lenientDecode
, fhRefersTo = const $ const $ return []
, fhTitle = \sm uri -> fmap (fst . splitTitle) $ liftIO $ uriToText sm uri
, fhFlatWidget = widget
, fhToText = \sm uri -> fmap (Just . plain) $ liftIO $ uriToText sm uri
, fhExtraParents = \_ _ -> return []
}
where
widget sm uri = do
t <- fmap (snd . splitTitle) $ liftIO $ uriToText sm uri
toWidget $ preEscapedText t
plain = T.concat . mapMaybe plain' . parseTags
plain' (TagText t) = Just t
plain' _ = Nothing | 919 | htmlFormatHandler :: (YesodAloha master, YesodJquery master) => FormatHandler master
htmlFormatHandler = FormatHandler
{ fhExts = Set.singleton "html"
, fhName = "HTML"
, fhForm = titleForm alohaHtmlField id id (return ())
, fhWidget = widget
, fhFilter = Just . enumList 8 . L.toChunks . TLE.encodeUtf8 . TL.fromStrict . sanitizeBalance . TL.toStrict . TLE.decodeUtf8With lenientDecode
, fhRefersTo = const $ const $ return []
, fhTitle = \sm uri -> fmap (fst . splitTitle) $ liftIO $ uriToText sm uri
, fhFlatWidget = widget
, fhToText = \sm uri -> fmap (Just . plain) $ liftIO $ uriToText sm uri
, fhExtraParents = \_ _ -> return []
}
where
widget sm uri = do
t <- fmap (snd . splitTitle) $ liftIO $ uriToText sm uri
toWidget $ preEscapedText t
plain = T.concat . mapMaybe plain' . parseTags
plain' (TagText t) = Just t
plain' _ = Nothing | 919 | htmlFormatHandler = FormatHandler
{ fhExts = Set.singleton "html"
, fhName = "HTML"
, fhForm = titleForm alohaHtmlField id id (return ())
, fhWidget = widget
, fhFilter = Just . enumList 8 . L.toChunks . TLE.encodeUtf8 . TL.fromStrict . sanitizeBalance . TL.toStrict . TLE.decodeUtf8With lenientDecode
, fhRefersTo = const $ const $ return []
, fhTitle = \sm uri -> fmap (fst . splitTitle) $ liftIO $ uriToText sm uri
, fhFlatWidget = widget
, fhToText = \sm uri -> fmap (Just . plain) $ liftIO $ uriToText sm uri
, fhExtraParents = \_ _ -> return []
}
where
widget sm uri = do
t <- fmap (snd . splitTitle) $ liftIO $ uriToText sm uri
toWidget $ preEscapedText t
plain = T.concat . mapMaybe plain' . parseTags
plain' (TagText t) = Just t
plain' _ = Nothing | 834 | false | true | 0 | 14 | 225 | 342 | 175 | 167 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/llvmGen/LlvmCodeGen/CodeGen.hs | bsd-3-clause | genCall (PrimTarget (MO_AtomicRead _)) [dst] [addr] = do
dstV <- getCmmReg (CmmLocal dst)
(v1, stmts, top) <- genLoad True addr (localRegType dst)
let stmt1 = Store v1 dstV
return (stmts `snocOL` stmt1, top)
-- TODO: implement these properly rather than calling to RTS functions.
-- genCall t@(PrimTarget (MO_AtomicWrite width)) [] [addr, val] = undefined
-- genCall t@(PrimTarget (MO_AtomicRMW width amop)) [dst] [addr, n] = undefined
-- genCall t@(PrimTarget (MO_Cmpxchg width)) [dst] [addr, old, new] = undefined
-- Handle memcpy function specifically since llvm's intrinsic version takes
-- some extra parameters. | 627 | genCall (PrimTarget (MO_AtomicRead _)) [dst] [addr] = do
dstV <- getCmmReg (CmmLocal dst)
(v1, stmts, top) <- genLoad True addr (localRegType dst)
let stmt1 = Store v1 dstV
return (stmts `snocOL` stmt1, top)
-- TODO: implement these properly rather than calling to RTS functions.
-- genCall t@(PrimTarget (MO_AtomicWrite width)) [] [addr, val] = undefined
-- genCall t@(PrimTarget (MO_AtomicRMW width amop)) [dst] [addr, n] = undefined
-- genCall t@(PrimTarget (MO_Cmpxchg width)) [dst] [addr, old, new] = undefined
-- Handle memcpy function specifically since llvm's intrinsic version takes
-- some extra parameters. | 627 | genCall (PrimTarget (MO_AtomicRead _)) [dst] [addr] = do
dstV <- getCmmReg (CmmLocal dst)
(v1, stmts, top) <- genLoad True addr (localRegType dst)
let stmt1 = Store v1 dstV
return (stmts `snocOL` stmt1, top)
-- TODO: implement these properly rather than calling to RTS functions.
-- genCall t@(PrimTarget (MO_AtomicWrite width)) [] [addr, val] = undefined
-- genCall t@(PrimTarget (MO_AtomicRMW width amop)) [dst] [addr, n] = undefined
-- genCall t@(PrimTarget (MO_Cmpxchg width)) [dst] [addr, old, new] = undefined
-- Handle memcpy function specifically since llvm's intrinsic version takes
-- some extra parameters. | 627 | false | false | 0 | 10 | 99 | 114 | 60 | 54 | null | null |
spechub/Hets | CommonLogic/AS_CommonLogic.der.hs | gpl-2.0 | {- space needed. without space the comma (from printSymbMapItems)
would be part of the name @dest@ -}
printSymbMapItems :: SYMB_MAP_ITEMS -> Doc
printSymbMapItems (Symb_map_items xs _) = ppWithCommas xs | 203 | printSymbMapItems :: SYMB_MAP_ITEMS -> Doc
printSymbMapItems (Symb_map_items xs _) = ppWithCommas xs | 100 | printSymbMapItems (Symb_map_items xs _) = ppWithCommas xs | 57 | true | true | 0 | 7 | 29 | 30 | 15 | 15 | null | null |
dgvncsz0f/iyql | src/main/haskell/Yql/Core/LocalFunction.hs | gpl-3.0 | man (Transform doc _) = doc | 28 | man (Transform doc _) = doc | 28 | man (Transform doc _) = doc | 28 | false | false | 0 | 6 | 6 | 18 | 8 | 10 | null | null |
slpopejoy/fadno-xml | src/Fadno/MusicXml/MusicXml20.hs | bsd-2-clause | parseFret :: P.XParse Fret
parseFret =
Fret
<$> (P.xtext >>= parseNonNegativeInteger)
<*> P.optional (P.xattr (P.name "font-family") >>= parseCommaSeparatedText)
<*> P.optional (P.xattr (P.name "font-style") >>= parseFontStyle)
<*> P.optional (P.xattr (P.name "font-size") >>= parseFontSize)
<*> P.optional (P.xattr (P.name "font-weight") >>= parseFontWeight)
<*> P.optional (P.xattr (P.name "color") >>= parseColor) | 471 | parseFret :: P.XParse Fret
parseFret =
Fret
<$> (P.xtext >>= parseNonNegativeInteger)
<*> P.optional (P.xattr (P.name "font-family") >>= parseCommaSeparatedText)
<*> P.optional (P.xattr (P.name "font-style") >>= parseFontStyle)
<*> P.optional (P.xattr (P.name "font-size") >>= parseFontSize)
<*> P.optional (P.xattr (P.name "font-weight") >>= parseFontWeight)
<*> P.optional (P.xattr (P.name "color") >>= parseColor) | 471 | parseFret =
Fret
<$> (P.xtext >>= parseNonNegativeInteger)
<*> P.optional (P.xattr (P.name "font-family") >>= parseCommaSeparatedText)
<*> P.optional (P.xattr (P.name "font-style") >>= parseFontStyle)
<*> P.optional (P.xattr (P.name "font-size") >>= parseFontSize)
<*> P.optional (P.xattr (P.name "font-weight") >>= parseFontWeight)
<*> P.optional (P.xattr (P.name "color") >>= parseColor) | 444 | false | true | 17 | 11 | 100 | 196 | 96 | 100 | null | null |
esmolanka/sexp-grammar | invertible-grammar/src/Data/InvertibleGrammar/Combinators.hs | bsd-3-clause | -- | Swap two topmost stack elements.
swap :: Grammar p (a :- b :- t) (b :- a :- t)
swap = Iso
(\(a :- b :- t) -> (b :- a :- t))
(\(b :- a :- t) -> (a :- b :- t)) | 166 | swap :: Grammar p (a :- b :- t) (b :- a :- t)
swap = Iso
(\(a :- b :- t) -> (b :- a :- t))
(\(b :- a :- t) -> (a :- b :- t)) | 128 | swap = Iso
(\(a :- b :- t) -> (b :- a :- t))
(\(b :- a :- t) -> (a :- b :- t)) | 82 | true | true | 0 | 9 | 49 | 107 | 58 | 49 | null | null |
sonyandy/tnt | Control/Monad/Code/Opcode.hs | bsd-3-clause | lload :: Word8
lload = 0x16 | 27 | lload :: Word8
lload = 0x16 | 27 | lload = 0x16 | 12 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/enumFrom_4.hs | mit | primPlusInt (Neg x) (Neg y) = Neg (primPlusNat x y) | 51 | primPlusInt (Neg x) (Neg y) = Neg (primPlusNat x y) | 51 | primPlusInt (Neg x) (Neg y) = Neg (primPlusNat x y) | 51 | false | false | 0 | 7 | 9 | 34 | 16 | 18 | null | null |
alexander-at-github/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | returnIOIdKey = mkPreludeMiscIdUnique 35 | 56 | returnIOIdKey = mkPreludeMiscIdUnique 35 | 56 | returnIOIdKey = mkPreludeMiscIdUnique 35 | 56 | false | false | 0 | 5 | 19 | 9 | 4 | 5 | null | null |
lukexi/ghc | compiler/main/DynFlags.hs | bsd-3-clause | addOptc f = alterSettings (\s -> s { sOpt_c = f : sOpt_c s}) | 64 | addOptc f = alterSettings (\s -> s { sOpt_c = f : sOpt_c s}) | 64 | addOptc f = alterSettings (\s -> s { sOpt_c = f : sOpt_c s}) | 64 | false | false | 0 | 11 | 17 | 35 | 18 | 17 | null | null |
GaloisInc/saw-script | saw-core/src/Verifier/SAW/Term/Functor.hs | bsd-3-clause | combine :: Int -> Int -> Int
combine h1 h2 = (h1 * 0x01000193) `xor` h2 | 71 | combine :: Int -> Int -> Int
combine h1 h2 = (h1 * 0x01000193) `xor` h2 | 71 | combine h1 h2 = (h1 * 0x01000193) `xor` h2 | 42 | false | true | 0 | 7 | 15 | 37 | 20 | 17 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.