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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
triffon/lcpt-2013-14
|
num_types.hs
|
mit
|
cdr :: Pair t -> t
cdr = \z -> z false
| 38 |
cdr :: Pair t -> t
cdr = \z -> z false
| 38 |
cdr = \z -> z false
| 19 | false | true | 0 | 6 | 11 | 26 | 13 | 13 | null | null |
athanclark/Idris-dev
|
src/Idris/IBC.hs
|
bsd-3-clause
|
ibc i (IBCStatic n) f
= case lookupCtxtExact n (idris_statics i) of
Just v -> return f { ibc_statics = (n,v): ibc_statics f }
_ -> ifail "IBC write failed"
| 226 |
ibc i (IBCStatic n) f
= case lookupCtxtExact n (idris_statics i) of
Just v -> return f { ibc_statics = (n,v): ibc_statics f }
_ -> ifail "IBC write failed"
| 226 |
ibc i (IBCStatic n) f
= case lookupCtxtExact n (idris_statics i) of
Just v -> return f { ibc_statics = (n,v): ibc_statics f }
_ -> ifail "IBC write failed"
| 226 | false | false | 4 | 8 | 100 | 78 | 37 | 41 | null | null |
peti/postmaster
|
src/Postmaster/Rfc2821.hs
|
agpl-3.0
|
help = try (mkCmd0 "HELP" (Help [])) <|> mkCmd1 "HELP" Help (option [] word)
| 76 |
help = try (mkCmd0 "HELP" (Help [])) <|> mkCmd1 "HELP" Help (option [] word)
| 76 |
help = try (mkCmd0 "HELP" (Help [])) <|> mkCmd1 "HELP" Help (option [] word)
| 76 | false | false | 1 | 10 | 13 | 49 | 22 | 27 | null | null |
RayRacine/aws
|
Aws/Core/Time.hs
|
bsd-3-clause
|
fmtISO8601UTC :: UTCTime -> B.ByteString
fmtISO8601UTC = fmtTime iso8601UtcDate
| 79 |
fmtISO8601UTC :: UTCTime -> B.ByteString
fmtISO8601UTC = fmtTime iso8601UtcDate
| 79 |
fmtISO8601UTC = fmtTime iso8601UtcDate
| 38 | false | true | 0 | 8 | 8 | 26 | 11 | 15 | null | null |
np/hlatex
|
Language/LaTeX/Types.hs
|
bsd-3-clause
|
lengthCst (LengthCmdRatArg _ _) = Nothing
| 44 |
lengthCst (LengthCmdRatArg _ _) = Nothing
| 44 |
lengthCst (LengthCmdRatArg _ _) = Nothing
| 44 | false | false | 0 | 7 | 8 | 17 | 8 | 9 | null | null |
dmwit/pi-eta-epsilon
|
src/Language/PiEtaEpsilon/Pi.hs
|
bsd-3-clause
|
-- A partial function that will delete a False. Only defined on input
-- False
deleteFalse :: Bool :<=> ()
deleteFalse = adjoint introFalse
| 140 |
deleteFalse :: Bool :<=> ()
deleteFalse = adjoint introFalse
| 60 |
deleteFalse = adjoint introFalse
| 32 | true | true | 0 | 8 | 24 | 29 | 13 | 16 | null | null |
spechub/Hets
|
utils/itcor/GenItCorrections.hs
|
gpl-2.0
|
output :: [(String, Int)] -> String -> IO String
output [] str = return (init str)
| 82 |
output :: [(String, Int)] -> String -> IO String
output [] str = return (init str)
| 82 |
output [] str = return (init str)
| 33 | false | true | 0 | 7 | 15 | 47 | 24 | 23 | null | null |
adinapoli/xmonad
|
XMonad/Operations.hs
|
bsd-3-clause
|
-- ---------------------------------------------------------------------
-- |
-- Window manager operations
-- manage. Add a new window to be managed in the current workspace.
-- Bring it into focus.
--
-- Whether the window is already managed, or not, it is mapped, has its
-- border set, and its event mask set.
--
manage :: Window -> X ()
manage w = whenX (not <$> isClient w) $ withDisplay $ \d -> do
sh <- io $ getWMNormalHints d w
let isFixedSize = sh_min_size sh /= Nothing && sh_min_size sh == sh_max_size sh
isTransient <- isJust <$> io (getTransientForHint d w)
rr <- snd `fmap` floatLocation w
-- ensure that float windows don't go over the edge of the screen
let adjust (W.RationalRect x y wid h) | x + wid > 1 || y + h > 1 || x < 0 || y < 0
= W.RationalRect (0.5 - wid/2) (0.5 - h/2) wid h
adjust r = r
f ws | isFixedSize || isTransient = W.float w (adjust rr) . W.insertUp w . W.view i $ ws
| otherwise = W.insertUp w ws
where i = W.tag $ W.workspace $ W.current ws
mh <- asks (manageHook . config)
g <- appEndo <$> userCodeDef (Endo id) (runQuery mh w)
windows (g . f)
-- | unmanage. A window no longer exists, remove it from the window
-- list, on whatever workspace it is.
--
| 1,336 |
manage :: Window -> X ()
manage w = whenX (not <$> isClient w) $ withDisplay $ \d -> do
sh <- io $ getWMNormalHints d w
let isFixedSize = sh_min_size sh /= Nothing && sh_min_size sh == sh_max_size sh
isTransient <- isJust <$> io (getTransientForHint d w)
rr <- snd `fmap` floatLocation w
-- ensure that float windows don't go over the edge of the screen
let adjust (W.RationalRect x y wid h) | x + wid > 1 || y + h > 1 || x < 0 || y < 0
= W.RationalRect (0.5 - wid/2) (0.5 - h/2) wid h
adjust r = r
f ws | isFixedSize || isTransient = W.float w (adjust rr) . W.insertUp w . W.view i $ ws
| otherwise = W.insertUp w ws
where i = W.tag $ W.workspace $ W.current ws
mh <- asks (manageHook . config)
g <- appEndo <$> userCodeDef (Endo id) (runQuery mh w)
windows (g . f)
-- | unmanage. A window no longer exists, remove it from the window
-- list, on whatever workspace it is.
--
| 1,020 |
manage w = whenX (not <$> isClient w) $ withDisplay $ \d -> do
sh <- io $ getWMNormalHints d w
let isFixedSize = sh_min_size sh /= Nothing && sh_min_size sh == sh_max_size sh
isTransient <- isJust <$> io (getTransientForHint d w)
rr <- snd `fmap` floatLocation w
-- ensure that float windows don't go over the edge of the screen
let adjust (W.RationalRect x y wid h) | x + wid > 1 || y + h > 1 || x < 0 || y < 0
= W.RationalRect (0.5 - wid/2) (0.5 - h/2) wid h
adjust r = r
f ws | isFixedSize || isTransient = W.float w (adjust rr) . W.insertUp w . W.view i $ ws
| otherwise = W.insertUp w ws
where i = W.tag $ W.workspace $ W.current ws
mh <- asks (manageHook . config)
g <- appEndo <$> userCodeDef (Endo id) (runQuery mh w)
windows (g . f)
-- | unmanage. A window no longer exists, remove it from the window
-- list, on whatever workspace it is.
--
| 995 | true | true | 0 | 23 | 377 | 408 | 199 | 209 | null | null |
geraldus/yesod
|
yesod-core/src/Yesod/Routes/Parse.hs
|
mit
|
parseType :: String -> Type
parseType orig =
maybe (error $ "Invalid type: " ++ show orig) ttToType $ parseTypeTree orig
| 124 |
parseType :: String -> Type
parseType orig =
maybe (error $ "Invalid type: " ++ show orig) ttToType $ parseTypeTree orig
| 124 |
parseType orig =
maybe (error $ "Invalid type: " ++ show orig) ttToType $ parseTypeTree orig
| 96 | false | true | 0 | 9 | 24 | 44 | 21 | 23 | null | null |
kevinjcliao/bb
|
src/Parse.hs
|
bsd-3-clause
|
succDay Friday = Monday
| 23 |
succDay Friday = Monday
| 23 |
succDay Friday = Monday
| 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
sinelaw/buildsome
|
src/Lib/Directory.hs
|
gpl-2.0
|
catchDoesNotExist :: IO a -> IO a -> IO a
catchDoesNotExist = catchErrorPred isDoesNotExistErrorType
| 100 |
catchDoesNotExist :: IO a -> IO a -> IO a
catchDoesNotExist = catchErrorPred isDoesNotExistErrorType
| 100 |
catchDoesNotExist = catchErrorPred isDoesNotExistErrorType
| 58 | false | true | 0 | 7 | 13 | 31 | 14 | 17 | null | null |
forgit/Rosalind
|
lia.hs
|
gpl-2.0
|
lia :: Int -> Int -> Double
lia k n = 1 - (sum $ map (binomial 0.25 (2^k)) [0..n-1])
| 84 |
lia :: Int -> Int -> Double
lia k n = 1 - (sum $ map (binomial 0.25 (2^k)) [0..n-1])
| 84 |
lia k n = 1 - (sum $ map (binomial 0.25 (2^k)) [0..n-1])
| 56 | false | true | 0 | 12 | 19 | 70 | 34 | 36 | null | null |
andrewthad/persistent
|
persistent-mysql/Database/Persist/MySQL.hs
|
mit
|
showSqlType SqlString Nothing True = "TEXT CHARACTER SET utf8"
| 67 |
showSqlType SqlString Nothing True = "TEXT CHARACTER SET utf8"
| 67 |
showSqlType SqlString Nothing True = "TEXT CHARACTER SET utf8"
| 67 | false | false | 0 | 5 | 13 | 13 | 6 | 7 | null | null |
mdipirro/functional-languages-homeworks
|
Project/Parser.hs
|
gpl-3.0
|
symbol :: String -> Parser String
symbol xs = token (string xs)
| 63 |
symbol :: String -> Parser String
symbol xs = token (string xs)
| 63 |
symbol xs = token (string xs)
| 29 | false | true | 0 | 7 | 11 | 35 | 15 | 20 | null | null |
nevrenato/Hets_Fork
|
CASL/QuickCheck.hs
|
gpl-2.0
|
-- | get the carrier set for a specific sort
getCarrier :: QModel -> SORT -> Result [CASLTERM]
getCarrier qm s =
case Map.lookup s (carrierSens qm) of
Nothing -> fail ("sort " ++ show s ++ " is not generated")
Just sens -> case mapMaybe termSort sens of
[] -> fail ("sort " ++ show s ++ " is not generated by constants")
(_, terms) : _ -> return terms
-- todo: generalise this
-- * Interfacing to Hets prover interface
{- | The Prover implementation. First runs the batch prover (with
graphical feedback), then starts the GUI prover. -}
| 564 |
getCarrier :: QModel -> SORT -> Result [CASLTERM]
getCarrier qm s =
case Map.lookup s (carrierSens qm) of
Nothing -> fail ("sort " ++ show s ++ " is not generated")
Just sens -> case mapMaybe termSort sens of
[] -> fail ("sort " ++ show s ++ " is not generated by constants")
(_, terms) : _ -> return terms
-- todo: generalise this
-- * Interfacing to Hets prover interface
{- | The Prover implementation. First runs the batch prover (with
graphical feedback), then starts the GUI prover. -}
| 519 |
getCarrier qm s =
case Map.lookup s (carrierSens qm) of
Nothing -> fail ("sort " ++ show s ++ " is not generated")
Just sens -> case mapMaybe termSort sens of
[] -> fail ("sort " ++ show s ++ " is not generated by constants")
(_, terms) : _ -> return terms
-- todo: generalise this
-- * Interfacing to Hets prover interface
{- | The Prover implementation. First runs the batch prover (with
graphical feedback), then starts the GUI prover. -}
| 469 | true | true | 0 | 15 | 128 | 136 | 68 | 68 | null | null |
mitsuji/aha
|
app/Main.hs
|
bsd-3-clause
|
contentTypeJsonHeader :: H.Header
contentTypeJsonHeader = ("Content-Type","application/json")
| 93 |
contentTypeJsonHeader :: H.Header
contentTypeJsonHeader = ("Content-Type","application/json")
| 93 |
contentTypeJsonHeader = ("Content-Type","application/json")
| 59 | false | true | 0 | 5 | 5 | 19 | 11 | 8 | null | null |
tjakway/ghcjvm
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
-- Primitive types and values
gHC_TYPES = mkPrimModule (fsLit "GHC.Types")
| 80 |
gHC_TYPES = mkPrimModule (fsLit "GHC.Types")
| 50 |
gHC_TYPES = mkPrimModule (fsLit "GHC.Types")
| 50 | true | false | 0 | 7 | 15 | 16 | 8 | 8 | null | null |
oahziur/yige-pass
|
src/VaultData.hs
|
bsd-3-clause
|
prettyPrintedStr :: Data a => a -> String
prettyPrintedStr = render . pp_value . toJSON
| 87 |
prettyPrintedStr :: Data a => a -> String
prettyPrintedStr = render . pp_value . toJSON
| 87 |
prettyPrintedStr = render . pp_value . toJSON
| 45 | false | true | 0 | 6 | 14 | 30 | 15 | 15 | null | null |
bombpersons/HaskellAsteroids
|
src/World.hs
|
bsd-3-clause
|
addComponent :: Entity -> c -> ASetter' World (ComponentMap c) -> WorldState ()
addComponent e c l = l %= Map.insert e c
| 120 |
addComponent :: Entity -> c -> ASetter' World (ComponentMap c) -> WorldState ()
addComponent e c l = l %= Map.insert e c
| 120 |
addComponent e c l = l %= Map.insert e c
| 40 | false | true | 0 | 10 | 22 | 57 | 27 | 30 | null | null |
gigavinyl/ordermage
|
src/Models/Item.hs
|
mit
|
itemTable :: O.Table ItemColWrite ItemColRead
itemTable = O.Table "items" (pItem Item { _itemId = O.optional "id"
, _itemName = O.required "name"
, _itemDesc = O.required "description"
, _itemVendor = O.required "vendor"
{-, _numTimesOrdered = O.required "numTimesOrdered"-}
{-, _mostRecentOrder = O.optional "mostRecentOrder"-}
})
| 599 |
itemTable :: O.Table ItemColWrite ItemColRead
itemTable = O.Table "items" (pItem Item { _itemId = O.optional "id"
, _itemName = O.required "name"
, _itemDesc = O.required "description"
, _itemVendor = O.required "vendor"
{-, _numTimesOrdered = O.required "numTimesOrdered"-}
{-, _mostRecentOrder = O.optional "mostRecentOrder"-}
})
| 599 |
itemTable = O.Table "items" (pItem Item { _itemId = O.optional "id"
, _itemName = O.required "name"
, _itemDesc = O.required "description"
, _itemVendor = O.required "vendor"
{-, _numTimesOrdered = O.required "numTimesOrdered"-}
{-, _mostRecentOrder = O.optional "mostRecentOrder"-}
})
| 553 | false | true | 1 | 11 | 309 | 84 | 42 | 42 | null | null |
markus-git/imperative-edsl-vhdl
|
src/Language/Embedded/Hardware/Command/Frontend.hs
|
bsd-3-clause
|
-- | Create an initialized virtual array.
initVArray :: (VArrayCMD :<: instr, pred a)
=> [a] -> ProgramT instr (Param2 exp pred) m (VArray a)
initVArray = initNamedVArray "a"
| 176 |
initVArray :: (VArrayCMD :<: instr, pred a)
=> [a] -> ProgramT instr (Param2 exp pred) m (VArray a)
initVArray = initNamedVArray "a"
| 134 |
initVArray = initNamedVArray "a"
| 32 | true | true | 0 | 10 | 30 | 68 | 33 | 35 | null | null |
timjb/diagrams-rubiks-cube
|
src/Diagrams/RubiksCube/Model.hs
|
mit
|
_rotateLeft' :: Aut (Cube a)
_rotateLeft' = from rotateRight'
| 61 |
_rotateLeft' :: Aut (Cube a)
_rotateLeft' = from rotateRight'
| 61 |
_rotateLeft' = from rotateRight'
| 32 | false | true | 0 | 7 | 8 | 23 | 11 | 12 | null | null |
lpeterse/koka
|
src/Lib/JSON.hs
|
apache-2.0
|
pArray :: Parser JsValue
pArray
= do token $ string "["
xs <- pValue `sepBy` (token (string ","))
token $ string "]"
return (JsArray xs)
-----------------------------------------------------------
-- Numbers
-----------------------------------------------------------
| 293 |
pArray :: Parser JsValue
pArray
= do token $ string "["
xs <- pValue `sepBy` (token (string ","))
token $ string "]"
return (JsArray xs)
-----------------------------------------------------------
-- Numbers
-----------------------------------------------------------
| 293 |
pArray
= do token $ string "["
xs <- pValue `sepBy` (token (string ","))
token $ string "]"
return (JsArray xs)
-----------------------------------------------------------
-- Numbers
-----------------------------------------------------------
| 268 | false | true | 1 | 13 | 54 | 78 | 36 | 42 | null | null |
d0kt0r0/Tidal
|
src/Sound/Tidal/Params.hs
|
gpl-3.0
|
bpf = bandf
| 11 |
bpf = bandf
| 11 |
bpf = bandf
| 11 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
nomeata/ghc
|
compiler/codeGen/CgParallel.hs
|
bsd-3-clause
|
-- Was: absC (CMacroStmt GRAN_RESCHEDULE [
-- mkIntCLit (I# (word2Int# liveness_mask)),
-- mkIntCLit (if node_reqd then 1 else 0)])
-------------------------
-- The @GRAN_YIELD@ macro is taken from JSM's code for Concurrent Haskell. It
-- allows to context-switch at places where @node@ is not alive (it uses the
-- @Continue@ rather than the @EnterNodeCode@ function in the RTS). We emit
-- this kind of macro at the beginning of the following kinds of basic bocks:
-- \begin{itemize}
-- \item Slow entry code where node is not alive (see @CgClosure.lhs@). Normally
-- we use @fetchAndReschedule@ at a slow entry code.
-- \item Fast entry code (see @CgClosure.lhs@).
-- \item Alternatives in case expressions (@CLabelledCode@ structures), provided
-- that they are not inlined (see @CgCases.lhs@). These alternatives will
-- be turned into separate functions.
granYield :: [(Id,GlobalReg)] -- Live registers
-> Bool -- Node reqd?
-> Code
granYield regs node_reqd
= do dflags <- getDynFlags
when (dopt Opt_GranMacros dflags && node_reqd) $ yield liveness
where
liveness = mkRegLiveness regs 0 0
| 1,227 |
granYield :: [(Id,GlobalReg)] -- Live registers
-> Bool -- Node reqd?
-> Code
granYield regs node_reqd
= do dflags <- getDynFlags
when (dopt Opt_GranMacros dflags && node_reqd) $ yield liveness
where
liveness = mkRegLiveness regs 0 0
| 285 |
granYield regs node_reqd
= do dflags <- getDynFlags
when (dopt Opt_GranMacros dflags && node_reqd) $ yield liveness
where
liveness = mkRegLiveness regs 0 0
| 171 | true | true | 1 | 11 | 300 | 105 | 57 | 48 | null | null |
tjunier/mlgsc
|
test/TestAlign.hs
|
mit
|
exp10 = "MDIPKMPKIIVK-----VFINRIRELVS"
| 38 |
exp10 = "MDIPKMPKIIVK-----VFINRIRELVS"
| 38 |
exp10 = "MDIPKMPKIIVK-----VFINRIRELVS"
| 38 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
li-zhirui/EoplLangs
|
src/ProcLang/Parser.hs
|
bsd-3-clause
|
-- | Many1Exprs ::= Expression
-- ::= Expression , Many1Exprs
many1Exprs :: Parser [Expression]
many1Exprs = sepBy1 expression comma
| 145 |
many1Exprs :: Parser [Expression]
many1Exprs = sepBy1 expression comma
| 70 |
many1Exprs = sepBy1 expression comma
| 36 | true | true | 1 | 6 | 31 | 27 | 13 | 14 | null | null |
copumpkin/charm
|
src/Architecture/ARM/Pretty.hs
|
bsd-3-clause
|
showDataOp :: DataOp -> String
showDataOp (Imm i) = printf "#%d" i
| 66 |
showDataOp :: DataOp -> String
showDataOp (Imm i) = printf "#%d" i
| 66 |
showDataOp (Imm i) = printf "#%d" i
| 35 | false | true | 0 | 7 | 11 | 29 | 14 | 15 | null | null |
randen/cabal
|
cabal-install/Distribution/Client/Dependency/Modular/Preference.hs
|
bsd-3-clause
|
enforceManualFlags :: Tree QGoalReasonChain -> Tree QGoalReasonChain
enforceManualFlags = trav go
where
go (FChoiceF qfn gr tr True ts) = FChoiceF qfn gr tr True $
let c = toConflictSet (Goal (F qfn) gr)
in case span isDisabled (P.toList ts) of
([], y : ys) -> P.fromList (y : L.map (\ (b, _) -> (b, Fail c ManualFlag)) ys)
_ -> ts -- something has been manually selected, leave things alone
where
isDisabled (_, Fail _ (GlobalConstraintFlag _)) = True
isDisabled _ = False
go x = x
-- | Prefer installed packages over non-installed packages, generally.
-- All installed packages or non-installed packages are treated as
-- equivalent.
| 801 |
enforceManualFlags :: Tree QGoalReasonChain -> Tree QGoalReasonChain
enforceManualFlags = trav go
where
go (FChoiceF qfn gr tr True ts) = FChoiceF qfn gr tr True $
let c = toConflictSet (Goal (F qfn) gr)
in case span isDisabled (P.toList ts) of
([], y : ys) -> P.fromList (y : L.map (\ (b, _) -> (b, Fail c ManualFlag)) ys)
_ -> ts -- something has been manually selected, leave things alone
where
isDisabled (_, Fail _ (GlobalConstraintFlag _)) = True
isDisabled _ = False
go x = x
-- | Prefer installed packages over non-installed packages, generally.
-- All installed packages or non-installed packages are treated as
-- equivalent.
| 801 |
enforceManualFlags = trav go
where
go (FChoiceF qfn gr tr True ts) = FChoiceF qfn gr tr True $
let c = toConflictSet (Goal (F qfn) gr)
in case span isDisabled (P.toList ts) of
([], y : ys) -> P.fromList (y : L.map (\ (b, _) -> (b, Fail c ManualFlag)) ys)
_ -> ts -- something has been manually selected, leave things alone
where
isDisabled (_, Fail _ (GlobalConstraintFlag _)) = True
isDisabled _ = False
go x = x
-- | Prefer installed packages over non-installed packages, generally.
-- All installed packages or non-installed packages are treated as
-- equivalent.
| 732 | false | true | 0 | 18 | 274 | 232 | 114 | 118 | null | null |
marcellussiegburg/autotool
|
server-implementation/src/Util/Task.hs
|
gpl-2.0
|
lookupTaskM :: Monad m => String -> m Make
lookupTaskM = maybe (fail "invalid task type") return . lookupTask
| 109 |
lookupTaskM :: Monad m => String -> m Make
lookupTaskM = maybe (fail "invalid task type") return . lookupTask
| 109 |
lookupTaskM = maybe (fail "invalid task type") return . lookupTask
| 66 | false | true | 0 | 8 | 18 | 40 | 19 | 21 | null | null |
olsner/ghc
|
compiler/codeGen/StgCmmUtils.hs
|
bsd-3-clause
|
baseRegOffset dflags HpAlloc = oFFSET_StgRegTable_rHpAlloc dflags
| 72 |
baseRegOffset dflags HpAlloc = oFFSET_StgRegTable_rHpAlloc dflags
| 72 |
baseRegOffset dflags HpAlloc = oFFSET_StgRegTable_rHpAlloc dflags
| 72 | false | false | 0 | 5 | 12 | 14 | 6 | 8 | null | null |
facebookincubator/duckling
|
Duckling/Rules/FA.hs
|
bsd-3-clause
|
langRules (Seal CreditCardNumber) = []
| 38 |
langRules (Seal CreditCardNumber) = []
| 38 |
langRules (Seal CreditCardNumber) = []
| 38 | false | false | 0 | 7 | 4 | 17 | 8 | 9 | null | null |
grnet/snf-ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
secureFileMode :: Int
secureFileMode = 0o600
| 44 |
secureFileMode :: Int
secureFileMode = 0o600
| 44 |
secureFileMode = 0o600
| 22 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
geraldus/yesod
|
yesod-core/src/Yesod/Core/Internal/Request.hs
|
mit
|
textQueryString :: W.Request -> [(Text, Text)]
textQueryString = map (second $ fromMaybe "") . queryToQueryText . W.queryString
| 127 |
textQueryString :: W.Request -> [(Text, Text)]
textQueryString = map (second $ fromMaybe "") . queryToQueryText . W.queryString
| 127 |
textQueryString = map (second $ fromMaybe "") . queryToQueryText . W.queryString
| 80 | false | true | 0 | 10 | 16 | 49 | 26 | 23 | null | null |
kalouantonis/kriek
|
src/hs/Kriek/Runtime.hs
|
mit
|
namedImport :: String -> Context -> ALens' Context (Maybe String)
namedImport n c = current c . imports . at n
| 110 |
namedImport :: String -> Context -> ALens' Context (Maybe String)
namedImport n c = current c . imports . at n
| 110 |
namedImport n c = current c . imports . at n
| 44 | false | true | 0 | 9 | 20 | 49 | 23 | 26 | null | null |
dec9ue/jhc_copygc
|
src/FrontEnd/TypeSyns.hs
|
gpl-2.0
|
expandTypeSynsStmt :: MonadWarn m => TypeSynonyms -> Module -> HsStmt -> m HsStmt
expandTypeSynsStmt syns mod m = ans where
startState = ScopeState {
errors = [],
synonyms = syns,
srcLoc = bogusASrcLoc,
currentModule = mod
}
(rm, fs) = runState (renameHsStmt m ()) startState
ans = do
mapM_ addWarning (errors fs)
return rm
-- This is Bryn's modification to make the code a bit easier to understand for
-- functions like renameHsNames, renameHsFileUpdates
| 549 |
expandTypeSynsStmt :: MonadWarn m => TypeSynonyms -> Module -> HsStmt -> m HsStmt
expandTypeSynsStmt syns mod m = ans where
startState = ScopeState {
errors = [],
synonyms = syns,
srcLoc = bogusASrcLoc,
currentModule = mod
}
(rm, fs) = runState (renameHsStmt m ()) startState
ans = do
mapM_ addWarning (errors fs)
return rm
-- This is Bryn's modification to make the code a bit easier to understand for
-- functions like renameHsNames, renameHsFileUpdates
| 549 |
expandTypeSynsStmt syns mod m = ans where
startState = ScopeState {
errors = [],
synonyms = syns,
srcLoc = bogusASrcLoc,
currentModule = mod
}
(rm, fs) = runState (renameHsStmt m ()) startState
ans = do
mapM_ addWarning (errors fs)
return rm
-- This is Bryn's modification to make the code a bit easier to understand for
-- functions like renameHsNames, renameHsFileUpdates
| 467 | false | true | 0 | 9 | 167 | 128 | 68 | 60 | null | null |
lally/libmet
|
src/Ppt/Generate/CpPrim.hs
|
bsd-3-clause
|
classDecl :: String -> [MemberData] -> Decl
classDecl n [] = ClassDecl n Nothing [] [] [] []
| 92 |
classDecl :: String -> [MemberData] -> Decl
classDecl n [] = ClassDecl n Nothing [] [] [] []
| 92 |
classDecl n [] = ClassDecl n Nothing [] [] [] []
| 48 | false | true | 0 | 7 | 17 | 50 | 25 | 25 | null | null |
gcampax/ghc
|
compiler/basicTypes/Id.hs
|
bsd-3-clause
|
-- | This predicate says whether the 'Id' has a strict demand placed on it or
-- has a type such that it can always be evaluated strictly (i.e an
-- unlifted type, as of GHC 7.6). We need to
-- check separately whether the 'Id' has a so-called \"strict type\" because if
-- the demand for the given @id@ hasn't been computed yet but @id@ has a strict
-- type, we still want @isStrictId id@ to be @True@.
isStrictId :: Id -> Bool
isStrictId id
= ASSERT2( isId id, text "isStrictId: not an id: " <+> ppr id )
(isStrictType (idType id)) ||
-- Take the best of both strictnesses - old and new
(isStrictDmd (idDemandInfo id))
| 656 |
isStrictId :: Id -> Bool
isStrictId id
= ASSERT2( isId id, text "isStrictId: not an id: " <+> ppr id )
(isStrictType (idType id)) ||
-- Take the best of both strictnesses - old and new
(isStrictDmd (idDemandInfo id))
| 251 |
isStrictId id
= ASSERT2( isId id, text "isStrictId: not an id: " <+> ppr id )
(isStrictType (idType id)) ||
-- Take the best of both strictnesses - old and new
(isStrictDmd (idDemandInfo id))
| 226 | true | true | 0 | 10 | 153 | 77 | 41 | 36 | null | null |
sdiehl/ghc
|
compiler/basicTypes/VarSet.hs
|
bsd-3-clause
|
minusVarSet = minusUniqSet
| 30 |
minusVarSet = minusUniqSet
| 30 |
minusVarSet = minusUniqSet
| 30 | false | false | 0 | 4 | 6 | 6 | 3 | 3 | null | null |
GaloisInc/halvm-ghc
|
compiler/stgSyn/CoreToStg.hs
|
bsd-3-clause
|
coreToStgExpr (Let bind body) = do
(new_let, fvs, escs, _)
<- mfix (\ ~(_, _, _, no_binder_escapes) ->
coreToStgLet no_binder_escapes bind body
)
return (new_let, fvs, escs)
| 212 |
coreToStgExpr (Let bind body) = do
(new_let, fvs, escs, _)
<- mfix (\ ~(_, _, _, no_binder_escapes) ->
coreToStgLet no_binder_escapes bind body
)
return (new_let, fvs, escs)
| 212 |
coreToStgExpr (Let bind body) = do
(new_let, fvs, escs, _)
<- mfix (\ ~(_, _, _, no_binder_escapes) ->
coreToStgLet no_binder_escapes bind body
)
return (new_let, fvs, escs)
| 212 | false | false | 0 | 12 | 65 | 82 | 44 | 38 | null | null |
amal029/haskell-tests
|
test1.hs
|
mit
|
map2Shortest f (x:xs) (y:ys) = (f x y) : map2Shortest f xs ys
| 61 |
map2Shortest f (x:xs) (y:ys) = (f x y) : map2Shortest f xs ys
| 61 |
map2Shortest f (x:xs) (y:ys) = (f x y) : map2Shortest f xs ys
| 61 | false | false | 0 | 7 | 12 | 49 | 23 | 26 | null | null |
wxwxwwxxx/ghc
|
testsuite/tests/typecheck/should_run/church.hs
|
bsd-3-clause
|
succ :: Ch -> Ch
succ n = Ch (\f z -> f (apply n f z))
| 54 |
succ :: Ch -> Ch
succ n = Ch (\f z -> f (apply n f z))
| 54 |
succ n = Ch (\f z -> f (apply n f z))
| 37 | false | true | 0 | 10 | 16 | 47 | 23 | 24 | null | null |
romanb/amazonka
|
amazonka-opsworks/gen/Network/AWS/OpsWorks/GrantAccess.hs
|
mpl-2.0
|
-- | The instance's AWS OpsWorks ID.
gaInstanceId :: Lens' GrantAccess Text
gaInstanceId = lens _gaInstanceId (\s a -> s { _gaInstanceId = a })
| 143 |
gaInstanceId :: Lens' GrantAccess Text
gaInstanceId = lens _gaInstanceId (\s a -> s { _gaInstanceId = a })
| 106 |
gaInstanceId = lens _gaInstanceId (\s a -> s { _gaInstanceId = a })
| 67 | true | true | 1 | 9 | 24 | 45 | 22 | 23 | null | null |
lettier/gifcurry
|
src/gui/GuiKeyboard.hs
|
bsd-3-clause
|
isSeekRightKey
:: Word32
-> Bool
isSeekRightKey GI.Gdk.KEY_greater = True
| 79 |
isSeekRightKey
:: Word32
-> Bool
isSeekRightKey GI.Gdk.KEY_greater = True
| 79 |
isSeekRightKey GI.Gdk.KEY_greater = True
| 40 | false | true | 0 | 8 | 14 | 27 | 12 | 15 | null | null |
ancientlanguage/haskell-analysis
|
grammar/src/Grammar/Common/Decompose.hs
|
mit
|
decomposeChar '\x1FC3' = "\x03B7\x0345"
| 39 |
decomposeChar '\x1FC3' = "\x03B7\x0345"
| 39 |
decomposeChar '\x1FC3' = "\x03B7\x0345"
| 39 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
olsner/ghc
|
compiler/typecheck/TcEvidence.hs
|
bsd-3-clause
|
collectHsWrapBinders :: HsWrapper -> ([Var], HsWrapper)
-- Collect the outer lambda binders of a HsWrapper,
-- stopping as soon as you get to a non-lambda binder
collectHsWrapBinders wrap = go wrap []
where
-- go w ws = collectHsWrapBinders (w <.> w1 <.> ... <.> wn)
go :: HsWrapper -> [HsWrapper] -> ([Var], HsWrapper)
go (WpEvLam v) wraps = add_lam v (gos wraps)
go (WpTyLam v) wraps = add_lam v (gos wraps)
go (WpCompose w1 w2) wraps = go w1 (w2:wraps)
go wrap wraps = ([], foldl (<.>) wrap wraps)
gos [] = ([], WpHole)
gos (w:ws) = go w ws
add_lam v (vs,w) = (v:vs, w)
{-
************************************************************************
* *
Evidence bindings
* *
************************************************************************
-}
| 976 |
collectHsWrapBinders :: HsWrapper -> ([Var], HsWrapper)
collectHsWrapBinders wrap = go wrap []
where
-- go w ws = collectHsWrapBinders (w <.> w1 <.> ... <.> wn)
go :: HsWrapper -> [HsWrapper] -> ([Var], HsWrapper)
go (WpEvLam v) wraps = add_lam v (gos wraps)
go (WpTyLam v) wraps = add_lam v (gos wraps)
go (WpCompose w1 w2) wraps = go w1 (w2:wraps)
go wrap wraps = ([], foldl (<.>) wrap wraps)
gos [] = ([], WpHole)
gos (w:ws) = go w ws
add_lam v (vs,w) = (v:vs, w)
{-
************************************************************************
* *
Evidence bindings
* *
************************************************************************
-}
| 870 |
collectHsWrapBinders wrap = go wrap []
where
-- go w ws = collectHsWrapBinders (w <.> w1 <.> ... <.> wn)
go :: HsWrapper -> [HsWrapper] -> ([Var], HsWrapper)
go (WpEvLam v) wraps = add_lam v (gos wraps)
go (WpTyLam v) wraps = add_lam v (gos wraps)
go (WpCompose w1 w2) wraps = go w1 (w2:wraps)
go wrap wraps = ([], foldl (<.>) wrap wraps)
gos [] = ([], WpHole)
gos (w:ws) = go w ws
add_lam v (vs,w) = (v:vs, w)
{-
************************************************************************
* *
Evidence bindings
* *
************************************************************************
-}
| 814 | true | true | 9 | 7 | 342 | 238 | 129 | 109 | null | null |
Zielon/Bounce
|
src/Collision/VectorOperations.hs
|
bsd-3-clause
|
-- | Calculate the distance between [minA, maxA] and [minB, maxB]
-- The distance will be negative if the intervals overlap
--
calculateIntervalDistance :: (GLfloat, GLfloat) -> (GLfloat, GLfloat) -> GLfloat
calculateIntervalDistance (minA, maxA) (minB, maxB) = minA < minB ? (minB - maxA) :? (minA - maxB)
| 308 |
calculateIntervalDistance :: (GLfloat, GLfloat) -> (GLfloat, GLfloat) -> GLfloat
calculateIntervalDistance (minA, maxA) (minB, maxB) = minA < minB ? (minB - maxA) :? (minA - maxB)
| 179 |
calculateIntervalDistance (minA, maxA) (minB, maxB) = minA < minB ? (minB - maxA) :? (minA - maxB)
| 98 | true | true | 0 | 8 | 49 | 77 | 45 | 32 | null | null |
write-you-a-scheme-v2/scheme
|
src/Parser.hs
|
mit
|
lexer :: Tok.GenTokenParser T.Text () Identity
lexer = Tok.makeTokenParser style
| 80 |
lexer :: Tok.GenTokenParser T.Text () Identity
lexer = Tok.makeTokenParser style
| 80 |
lexer = Tok.makeTokenParser style
| 33 | false | true | 0 | 6 | 9 | 29 | 14 | 15 | null | null |
audreyt/stringtable-atom
|
src/StringTable/AtomMap.hs
|
bsd-3-clause
|
differenceWith :: (a -> b -> Maybe a) -> AtomMap a -> AtomMap b -> AtomMap a
differenceWith x y z = MkAtomMap (IM.differenceWith ( x) (fromAtomMap y) (fromAtomMap z))
| 166 |
differenceWith :: (a -> b -> Maybe a) -> AtomMap a -> AtomMap b -> AtomMap a
differenceWith x y z = MkAtomMap (IM.differenceWith ( x) (fromAtomMap y) (fromAtomMap z))
| 166 |
differenceWith x y z = MkAtomMap (IM.differenceWith ( x) (fromAtomMap y) (fromAtomMap z))
| 89 | false | true | 0 | 9 | 29 | 83 | 40 | 43 | null | null |
nevrenato/HetsAlloy
|
CSL/Reduce_Interface.hs
|
gpl-2.0
|
casask :: Session a => a -> Named CMD -> IO (ProofStatus [EXPRESSION],
[(Named CMD, ProofStatus [EXPRESSION])])
casask sess cmd = do
proofstatus <- procString sess (senAttr cmd) $ exportReduce cmd ++ ";"
return (proofstatus, [exportLemmaAsk cmd proofstatus])
-- | computes the remainder of a division
| 317 |
casask :: Session a => a -> Named CMD -> IO (ProofStatus [EXPRESSION],
[(Named CMD, ProofStatus [EXPRESSION])])
casask sess cmd = do
proofstatus <- procString sess (senAttr cmd) $ exportReduce cmd ++ ";"
return (proofstatus, [exportLemmaAsk cmd proofstatus])
-- | computes the remainder of a division
| 317 |
casask sess cmd = do
proofstatus <- procString sess (senAttr cmd) $ exportReduce cmd ++ ";"
return (proofstatus, [exportLemmaAsk cmd proofstatus])
-- | computes the remainder of a division
| 194 | false | true | 0 | 13 | 62 | 117 | 58 | 59 | null | null |
shlevy/arithmoi
|
Math/NumberTheory/Powers/General.hs
|
mit
|
rawOddPower mx n = case P3.exactCubeRoot n of
Just r -> case rawOddPower (mx `quot` 3) r of
(m,e) -> (m, 3*e)
Nothing -> badPower mx n
| 209 |
rawOddPower mx n = case P3.exactCubeRoot n of
Just r -> case rawOddPower (mx `quot` 3) r of
(m,e) -> (m, 3*e)
Nothing -> badPower mx n
| 209 |
rawOddPower mx n = case P3.exactCubeRoot n of
Just r -> case rawOddPower (mx `quot` 3) r of
(m,e) -> (m, 3*e)
Nothing -> badPower mx n
| 209 | false | false | 1 | 12 | 101 | 84 | 41 | 43 | null | null |
anton-dessiatov/stack
|
src/Stack/Types/Config.hs
|
bsd-3-clause
|
configMonoidPackageIndicesName :: Text
configMonoidPackageIndicesName = "package-indices"
| 89 |
configMonoidPackageIndicesName :: Text
configMonoidPackageIndicesName = "package-indices"
| 89 |
configMonoidPackageIndicesName = "package-indices"
| 50 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
taojang/haskell-programming-book-exercise
|
src/ch28/Chapter28.hs
|
bsd-3-clause
|
toList :: DList a -> [a]
toList (DL f) = f []
| 45 |
toList :: DList a -> [a]
toList (DL f) = f []
| 45 |
toList (DL f) = f []
| 20 | false | true | 0 | 6 | 11 | 39 | 18 | 21 | null | null |
llllllllll/h16cc
|
Assembler.hs
|
gpl-2.0
|
-- | The version message.
versionString :: String
versionString =
"The Haskell 16candles assembler: version 0.2.0.1 (2016.01.11)\n\
\Copyright (C) 2014 Joe Jevnik.\n\
\This is free software; see the source for copying \
\conditions. There is NO\nwarranty; not even for MERCHANTABILITY\
\ or FITNESS FOR A PARTICULAR PURPOSE."
| 346 |
versionString :: String
versionString =
"The Haskell 16candles assembler: version 0.2.0.1 (2016.01.11)\n\
\Copyright (C) 2014 Joe Jevnik.\n\
\This is free software; see the source for copying \
\conditions. There is NO\nwarranty; not even for MERCHANTABILITY\
\ or FITNESS FOR A PARTICULAR PURPOSE."
| 320 |
versionString =
"The Haskell 16candles assembler: version 0.2.0.1 (2016.01.11)\n\
\Copyright (C) 2014 Joe Jevnik.\n\
\This is free software; see the source for copying \
\conditions. There is NO\nwarranty; not even for MERCHANTABILITY\
\ or FITNESS FOR A PARTICULAR PURPOSE."
| 296 | true | true | 0 | 4 | 67 | 12 | 7 | 5 | null | null |
rfranek/duckling
|
Duckling/Time/FR/Rules.hs
|
bsd-3-clause
|
ruleEnSemaine :: Rule
ruleEnSemaine = Rule
{ name = "en semaine"
, pattern =
[ regex "(pendant la |en )?semaine"
]
, prod = \_ -> Token Time <$>
interval TTime.Open (dayOfWeek 1) (dayOfWeek 5)
}
| 216 |
ruleEnSemaine :: Rule
ruleEnSemaine = Rule
{ name = "en semaine"
, pattern =
[ regex "(pendant la |en )?semaine"
]
, prod = \_ -> Token Time <$>
interval TTime.Open (dayOfWeek 1) (dayOfWeek 5)
}
| 216 |
ruleEnSemaine = Rule
{ name = "en semaine"
, pattern =
[ regex "(pendant la |en )?semaine"
]
, prod = \_ -> Token Time <$>
interval TTime.Open (dayOfWeek 1) (dayOfWeek 5)
}
| 194 | false | true | 0 | 12 | 57 | 80 | 40 | 40 | null | null |
antalsz/hs-to-coq
|
examples/containers/extraction/SetProperties.hs
|
mit
|
prop_toSame :: Set Int -> Bool
prop_toSame xs = (toDataSet xs) `equalSets` xs
| 77 |
prop_toSame :: Set Int -> Bool
prop_toSame xs = (toDataSet xs) `equalSets` xs
| 77 |
prop_toSame xs = (toDataSet xs) `equalSets` xs
| 46 | false | true | 0 | 7 | 12 | 33 | 17 | 16 | null | null |
Melvar/Idris-dev
|
src/Idris/AbsSyntaxTree.hs
|
bsd-3-clause
|
initEState :: EState
initEState = EState [] [] [] []
| 52 |
initEState :: EState
initEState = EState [] [] [] []
| 52 |
initEState = EState [] [] [] []
| 31 | false | true | 0 | 6 | 9 | 35 | 15 | 20 | null | null |
DaMSL/K3
|
src/Language/K3/Metaprogram/Evaluation.hs
|
apache-2.0
|
expectLiteralSplicer :: String -> LiteralGenerator
expectLiteralSplicer i = generatorWithSCtxt $! \sctxt -> liftParser i literalEmbedding >>= evalLiteralSplice sctxt
| 165 |
expectLiteralSplicer :: String -> LiteralGenerator
expectLiteralSplicer i = generatorWithSCtxt $! \sctxt -> liftParser i literalEmbedding >>= evalLiteralSplice sctxt
| 165 |
expectLiteralSplicer i = generatorWithSCtxt $! \sctxt -> liftParser i literalEmbedding >>= evalLiteralSplice sctxt
| 114 | false | true | 0 | 8 | 17 | 39 | 19 | 20 | null | null |
rbonifacio/funsat
|
src/Funsat/Solver.hs
|
bsd-3-clause
|
backJump :: MAssignment s
-> (Lit, Clause, ClauseId)
-- ^ @(l, c)@, where attempting to assign @l@ conflicted with
-- clause @c@.
-> FunMonad s (Maybe (MAssignment s))
backJump m c@(_, _conflict, _) = get >>= \(SC{dl=dl, reason=_reason}) -> do
_theTrail <- gets trail
-- trace ("********** conflict = " ++ show c) $ return ()
-- trace ("trail = " ++ show _theTrail) $ return ()
-- trace ("dlits (" ++ show (length dl) ++ ") = " ++ show dl) $ return ()
-- ++ "reason: " ++ Map.showTree _reason
-- ) (
incNumConfl ; incNumConflTotal
levelArr :: FrozenLevelArray <- do s <- get
liftST $ unsafeFreeze (level s)
(learntCl, learntClId, newLevel) <-
do mFr <- unsafeFreezeAss m
analyse mFr levelArr dl c
s <- get
let numDecisionsToUndo = length dl - newLevel
dl' = drop numDecisionsToUndo dl
undoneLits = takeWhile (\lit -> levelArr ! (var lit) > newLevel) (trail s)
forM_ undoneLits $ const (undoOne m) -- backtrack
mFr <- unsafeFreezeAss m
assert (numDecisionsToUndo > 0) $
assert (not (null learntCl)) $
assert (learntCl `isUnitUnder` mFr) $
modify $ \s -> s{ dl = dl' } -- undo decisions
mFr <- unsafeFreezeAss m
-- trace ("new mFr: " ++ showAssignment mFr) $ return ()
-- TODO once I'm sure this works I don't need getUnit, I can just use the
-- uip of the cut.
_ <- watchClause m (learntCl, learntClId) True
_ <- enqueue m (getUnit learntCl mFr) (Just (learntCl, learntClId))
-- learntCl is asserting
return $ Just m
-- | @doWhile cmd test@ first runs @cmd@, then loops testing @test@ and
-- executing @cmd@. The traditional @do-while@ semantics, in other words.
| 1,800 |
backJump :: MAssignment s
-> (Lit, Clause, ClauseId)
-- ^ @(l, c)@, where attempting to assign @l@ conflicted with
-- clause @c@.
-> FunMonad s (Maybe (MAssignment s))
backJump m c@(_, _conflict, _) = get >>= \(SC{dl=dl, reason=_reason}) -> do
_theTrail <- gets trail
-- trace ("********** conflict = " ++ show c) $ return ()
-- trace ("trail = " ++ show _theTrail) $ return ()
-- trace ("dlits (" ++ show (length dl) ++ ") = " ++ show dl) $ return ()
-- ++ "reason: " ++ Map.showTree _reason
-- ) (
incNumConfl ; incNumConflTotal
levelArr :: FrozenLevelArray <- do s <- get
liftST $ unsafeFreeze (level s)
(learntCl, learntClId, newLevel) <-
do mFr <- unsafeFreezeAss m
analyse mFr levelArr dl c
s <- get
let numDecisionsToUndo = length dl - newLevel
dl' = drop numDecisionsToUndo dl
undoneLits = takeWhile (\lit -> levelArr ! (var lit) > newLevel) (trail s)
forM_ undoneLits $ const (undoOne m) -- backtrack
mFr <- unsafeFreezeAss m
assert (numDecisionsToUndo > 0) $
assert (not (null learntCl)) $
assert (learntCl `isUnitUnder` mFr) $
modify $ \s -> s{ dl = dl' } -- undo decisions
mFr <- unsafeFreezeAss m
-- trace ("new mFr: " ++ showAssignment mFr) $ return ()
-- TODO once I'm sure this works I don't need getUnit, I can just use the
-- uip of the cut.
_ <- watchClause m (learntCl, learntClId) True
_ <- enqueue m (getUnit learntCl mFr) (Just (learntCl, learntClId))
-- learntCl is asserting
return $ Just m
-- | @doWhile cmd test@ first runs @cmd@, then loops testing @test@ and
-- executing @cmd@. The traditional @do-while@ semantics, in other words.
| 1,800 |
backJump m c@(_, _conflict, _) = get >>= \(SC{dl=dl, reason=_reason}) -> do
_theTrail <- gets trail
-- trace ("********** conflict = " ++ show c) $ return ()
-- trace ("trail = " ++ show _theTrail) $ return ()
-- trace ("dlits (" ++ show (length dl) ++ ") = " ++ show dl) $ return ()
-- ++ "reason: " ++ Map.showTree _reason
-- ) (
incNumConfl ; incNumConflTotal
levelArr :: FrozenLevelArray <- do s <- get
liftST $ unsafeFreeze (level s)
(learntCl, learntClId, newLevel) <-
do mFr <- unsafeFreezeAss m
analyse mFr levelArr dl c
s <- get
let numDecisionsToUndo = length dl - newLevel
dl' = drop numDecisionsToUndo dl
undoneLits = takeWhile (\lit -> levelArr ! (var lit) > newLevel) (trail s)
forM_ undoneLits $ const (undoOne m) -- backtrack
mFr <- unsafeFreezeAss m
assert (numDecisionsToUndo > 0) $
assert (not (null learntCl)) $
assert (learntCl `isUnitUnder` mFr) $
modify $ \s -> s{ dl = dl' } -- undo decisions
mFr <- unsafeFreezeAss m
-- trace ("new mFr: " ++ showAssignment mFr) $ return ()
-- TODO once I'm sure this works I don't need getUnit, I can just use the
-- uip of the cut.
_ <- watchClause m (learntCl, learntClId) True
_ <- enqueue m (getUnit learntCl mFr) (Just (learntCl, learntClId))
-- learntCl is asserting
return $ Just m
-- | @doWhile cmd test@ first runs @cmd@, then loops testing @test@ and
-- executing @cmd@. The traditional @do-while@ semantics, in other words.
| 1,590 | false | true | 0 | 18 | 514 | 439 | 224 | 215 | null | null |
seereason/ghcjs-jquery
|
JavaScript/JQuery.hs
|
mit
|
focus :: JQuery -> IO JQuery
focus = jq_focus
| 45 |
focus :: JQuery -> IO JQuery
focus = jq_focus
| 45 |
focus = jq_focus
| 16 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
wilbowma/accelerate
|
Data/Array/Accelerate/Interpreter.hs
|
bsd-3-clause
|
scanr'Op :: forall e. (e -> e -> e)
-> e
-> Delayed (Vector e)
-> Delayed (Vector e, Scalar e)
scanr'Op f e (DelayedArray sh rf)
= DelayedPair (delay $ adata `seq` Array sh adata)
(unitOp (Sugar.toElt final))
where
n = size sh
f' = Sugar.sinkFromElt2 f
--
(adata, final) = runArrayData $ do
arr <- newArrayData n
sum <- traverse arr (n-1) (Sugar.fromElt e)
return (arr, sum)
traverse :: MutableArrayData s (Sugar.EltRepr e) -> Int -> (Sugar.EltRepr e) -> ST s (Sugar.EltRepr e)
traverse arr i v
| i < 0 = return v
| otherwise = do
writeArrayData arr i v
traverse arr (i - 1) (f' v (rf ((), i)))
| 796 |
scanr'Op :: forall e. (e -> e -> e)
-> e
-> Delayed (Vector e)
-> Delayed (Vector e, Scalar e)
scanr'Op f e (DelayedArray sh rf)
= DelayedPair (delay $ adata `seq` Array sh adata)
(unitOp (Sugar.toElt final))
where
n = size sh
f' = Sugar.sinkFromElt2 f
--
(adata, final) = runArrayData $ do
arr <- newArrayData n
sum <- traverse arr (n-1) (Sugar.fromElt e)
return (arr, sum)
traverse :: MutableArrayData s (Sugar.EltRepr e) -> Int -> (Sugar.EltRepr e) -> ST s (Sugar.EltRepr e)
traverse arr i v
| i < 0 = return v
| otherwise = do
writeArrayData arr i v
traverse arr (i - 1) (f' v (rf ((), i)))
| 796 |
scanr'Op f e (DelayedArray sh rf)
= DelayedPair (delay $ adata `seq` Array sh adata)
(unitOp (Sugar.toElt final))
where
n = size sh
f' = Sugar.sinkFromElt2 f
--
(adata, final) = runArrayData $ do
arr <- newArrayData n
sum <- traverse arr (n-1) (Sugar.fromElt e)
return (arr, sum)
traverse :: MutableArrayData s (Sugar.EltRepr e) -> Int -> (Sugar.EltRepr e) -> ST s (Sugar.EltRepr e)
traverse arr i v
| i < 0 = return v
| otherwise = do
writeArrayData arr i v
traverse arr (i - 1) (f' v (rf ((), i)))
| 674 | false | true | 2 | 14 | 315 | 339 | 166 | 173 | null | null |
d-day/relation
|
include/pointfree-style/pointfree-1.0.4.3/Plugin/Pl/Rules.hs
|
bsd-3-clause
|
unaryBuiltins :: [(String,Unary)]
unaryBuiltins = [
("not", UA (not :: Bool -> Bool)),
("negate", UA (negate :: Integer -> Integer)),
("signum", UA (signum :: Integer -> Integer)),
("abs", UA (abs :: Integer -> Integer))
]
| 252 |
unaryBuiltins :: [(String,Unary)]
unaryBuiltins = [
("not", UA (not :: Bool -> Bool)),
("negate", UA (negate :: Integer -> Integer)),
("signum", UA (signum :: Integer -> Integer)),
("abs", UA (abs :: Integer -> Integer))
]
| 252 |
unaryBuiltins = [
("not", UA (not :: Bool -> Bool)),
("negate", UA (negate :: Integer -> Integer)),
("signum", UA (signum :: Integer -> Integer)),
("abs", UA (abs :: Integer -> Integer))
]
| 218 | false | true | 0 | 9 | 64 | 108 | 64 | 44 | null | null |
mrjones/workouts
|
src/Workouts.hs
|
mit
|
editRunFormPage :: Connection -> User -> ServerPartT IO Response
editRunFormPage conn user = do
userid <- queryString $ look "id"
runs <- liftIO $ (query conn "SELECT miles, duration_sec, date, incline, comment, id, user_id FROM happstack.runs WHERE id = (?)" [userid])
ok $ toResponse $ runDataHtml user (Just (head runs)) (fromGregorian 2014 1 1)
| 354 |
editRunFormPage :: Connection -> User -> ServerPartT IO Response
editRunFormPage conn user = do
userid <- queryString $ look "id"
runs <- liftIO $ (query conn "SELECT miles, duration_sec, date, incline, comment, id, user_id FROM happstack.runs WHERE id = (?)" [userid])
ok $ toResponse $ runDataHtml user (Just (head runs)) (fromGregorian 2014 1 1)
| 354 |
editRunFormPage conn user = do
userid <- queryString $ look "id"
runs <- liftIO $ (query conn "SELECT miles, duration_sec, date, incline, comment, id, user_id FROM happstack.runs WHERE id = (?)" [userid])
ok $ toResponse $ runDataHtml user (Just (head runs)) (fromGregorian 2014 1 1)
| 289 | false | true | 0 | 12 | 59 | 107 | 51 | 56 | null | null |
hguenther/smtlib2
|
Language/SMTLib2/Internals/Expression.hs
|
gpl-3.0
|
functionType _ (ConstArray idx el) = return (el ::: Nil,ArrayRepr idx el)
| 73 |
functionType _ (ConstArray idx el) = return (el ::: Nil,ArrayRepr idx el)
| 73 |
functionType _ (ConstArray idx el) = return (el ::: Nil,ArrayRepr idx el)
| 73 | false | false | 1 | 7 | 11 | 39 | 18 | 21 | null | null |
Philonous/pontarius-xmpp
|
source/Network/Xmpp/Lens.hs
|
bsd-3-clause
|
clientSupportedL :: Lens ClientParams Supported
clientSupportedL inj cp@ClientParams{clientSupported = x}
= (\x' -> cp{clientSupported = x'}) <$> inj x
| 156 |
clientSupportedL :: Lens ClientParams Supported
clientSupportedL inj cp@ClientParams{clientSupported = x}
= (\x' -> cp{clientSupported = x'}) <$> inj x
| 156 |
clientSupportedL inj cp@ClientParams{clientSupported = x}
= (\x' -> cp{clientSupported = x'}) <$> inj x
| 107 | false | true | 0 | 9 | 23 | 56 | 30 | 26 | null | null |
kishoredbn/barrelfish
|
tools/mackerel/BitFieldDriver.hs
|
mit
|
loc_array_off Space.VALUEWISE off (ArrayStepLoc num 0) _ =
printf "(0x%0x) + (_i)" off
| 91 |
loc_array_off Space.VALUEWISE off (ArrayStepLoc num 0) _ =
printf "(0x%0x) + (_i)" off
| 91 |
loc_array_off Space.VALUEWISE off (ArrayStepLoc num 0) _ =
printf "(0x%0x) + (_i)" off
| 91 | false | false | 0 | 7 | 17 | 30 | 14 | 16 | null | null |
mietek/stack
|
src/Stack/Types/PackageName.hs
|
bsd-3-clause
|
parsePackageNameFromString :: MonadThrow m => String -> m PackageName
parsePackageNameFromString =
parsePackageName . S8.pack
| 127 |
parsePackageNameFromString :: MonadThrow m => String -> m PackageName
parsePackageNameFromString =
parsePackageName . S8.pack
| 127 |
parsePackageNameFromString =
parsePackageName . S8.pack
| 57 | false | true | 1 | 7 | 15 | 33 | 15 | 18 | null | null |
Bodigrim/arithmoi
|
benchmark/Math/NumberTheory/SequenceBench.hs
|
mit
|
residues :: UArray Int Int
residues = listArray (0,7) [7,11,13,17,19,23,29,31]
| 78 |
residues :: UArray Int Int
residues = listArray (0,7) [7,11,13,17,19,23,29,31]
| 78 |
residues = listArray (0,7) [7,11,13,17,19,23,29,31]
| 51 | false | true | 0 | 6 | 9 | 51 | 30 | 21 | null | null |
ecaustin/haskhol-deductive
|
src/HaskHOL/Lib/Equal.hs
|
bsd-2-clause
|
convSUB :: Conversion cls thry -> Conversion cls thry
convSUB conv = Conv $ \ tm -> note "convSUB" $
case tm of
Comb{} -> runConv (convCOMB conv) tm
Abs{} -> runConv (convABS conv) tm
TyComb{} -> runConv (convTYAPP conv) tm
TyAbs{} -> runConv (convTYABS conv) tm
_ -> primREFL tm
{-|
The 'convBINOP' conversional applies a given conversion to both the left and
right hand sides of a binary operator combination, returning a theorem of the
form @|- l op r = l' op r'@. It throws a 'HOLException' in the following
cases:
* The term the resultant conversion is applied to is not a binary operator
combination.
* The original conversion fails.
-}
| 700 |
convSUB :: Conversion cls thry -> Conversion cls thry
convSUB conv = Conv $ \ tm -> note "convSUB" $
case tm of
Comb{} -> runConv (convCOMB conv) tm
Abs{} -> runConv (convABS conv) tm
TyComb{} -> runConv (convTYAPP conv) tm
TyAbs{} -> runConv (convTYABS conv) tm
_ -> primREFL tm
{-|
The 'convBINOP' conversional applies a given conversion to both the left and
right hand sides of a binary operator combination, returning a theorem of the
form @|- l op r = l' op r'@. It throws a 'HOLException' in the following
cases:
* The term the resultant conversion is applied to is not a binary operator
combination.
* The original conversion fails.
-}
| 700 |
convSUB conv = Conv $ \ tm -> note "convSUB" $
case tm of
Comb{} -> runConv (convCOMB conv) tm
Abs{} -> runConv (convABS conv) tm
TyComb{} -> runConv (convTYAPP conv) tm
TyAbs{} -> runConv (convTYABS conv) tm
_ -> primREFL tm
{-|
The 'convBINOP' conversional applies a given conversion to both the left and
right hand sides of a binary operator combination, returning a theorem of the
form @|- l op r = l' op r'@. It throws a 'HOLException' in the following
cases:
* The term the resultant conversion is applied to is not a binary operator
combination.
* The original conversion fails.
-}
| 646 | false | true | 2 | 12 | 172 | 147 | 69 | 78 | null | null |
diminishedprime/.org
|
reading-list/haskell_programming_from_first_principles/07_11.hs
|
mit
|
-- a) f True :: Bool
-- b) f True :: String
-- c) f True :: Bool -> Bool
-- d) f True :: a
-- a
-- Let’s write code
-- 1. The following function returns the tens digit of an integral argument.
tensDigit :: Integral a => a -> a
tensDigit x = d
where xLast = x `div` 10
d = xLast `mod` 10
-- a) First, rewrite it using divMod.
| 337 |
tensDigit :: Integral a => a -> a
tensDigit x = d
where xLast = x `div` 10
d = xLast `mod` 10
-- a) First, rewrite it using divMod.
| 141 |
tensDigit x = d
where xLast = x `div` 10
d = xLast `mod` 10
-- a) First, rewrite it using divMod.
| 107 | true | true | 1 | 7 | 87 | 60 | 35 | 25 | null | null |
alexisVallet/deep-banana
|
src/DeepBanana/Layer/CUDA/Monad.hs
|
bsd-3-clause
|
runCudaErrorT :: (Monad m)
=> CudaErrorT m a -> m (Either CudaExceptions a)
runCudaErrorT = runExceptT
| 116 |
runCudaErrorT :: (Monad m)
=> CudaErrorT m a -> m (Either CudaExceptions a)
runCudaErrorT = runExceptT
| 116 |
runCudaErrorT = runExceptT
| 26 | false | true | 0 | 10 | 29 | 46 | 21 | 25 | null | null |
nushio3/ghc
|
compiler/prelude/TysWiredIn.hs
|
bsd-3-clause
|
levityTyCon :: TyCon
levityTyCon = pcTyCon True NonRecursive levityTyConName
Nothing [] [liftedDataCon, unliftedDataCon]
| 142 |
levityTyCon :: TyCon
levityTyCon = pcTyCon True NonRecursive levityTyConName
Nothing [] [liftedDataCon, unliftedDataCon]
| 142 |
levityTyCon = pcTyCon True NonRecursive levityTyConName
Nothing [] [liftedDataCon, unliftedDataCon]
| 121 | false | true | 0 | 6 | 34 | 32 | 17 | 15 | null | null |
Mattiemus/LaneWars
|
Game/Server/Object.hs
|
mit
|
-- |Generates a blank game object from the object input
defaultGameObject objInput = basicGameObject {
goId = oiId objInput
}
| 140 |
defaultGameObject objInput = basicGameObject {
goId = oiId objInput
}
| 81 |
defaultGameObject objInput = basicGameObject {
goId = oiId objInput
}
| 81 | true | false | 0 | 7 | 34 | 21 | 11 | 10 | null | null |
GaloisInc/halvm-ghc
|
compiler/deSugar/DsUtils.hs
|
bsd-3-clause
|
selectMatchVar (VarPat var) = return (localiseId (unLoc var))
| 62 |
selectMatchVar (VarPat var) = return (localiseId (unLoc var))
| 62 |
selectMatchVar (VarPat var) = return (localiseId (unLoc var))
| 62 | false | false | 0 | 9 | 8 | 30 | 14 | 16 | null | null |
donomii/srt-collector
|
srt2json.hs
|
gpl-3.0
|
time2int strs = let h = readInt (strs !! 0)
m = readInt (strs !! 1)
s = readInt (strs !! 2)
in
3600*h + 60*m + s
| 200 |
time2int strs = let h = readInt (strs !! 0)
m = readInt (strs !! 1)
s = readInt (strs !! 2)
in
3600*h + 60*m + s
| 200 |
time2int strs = let h = readInt (strs !! 0)
m = readInt (strs !! 1)
s = readInt (strs !! 2)
in
3600*h + 60*m + s
| 200 | false | false | 4 | 11 | 115 | 83 | 38 | 45 | null | null |
thoughtpolice/hs-whistlepig
|
src/Text/Search/Whistlepig/Index.hs
|
bsd-3-clause
|
-- | Check if an 'Index' exists at a particular @FilePath@
indexExists :: FilePath -- ^ Base path
-> IO Bool
indexExists = flip withCString $ \path -> do
err <- c_wp_index_exists path
return $! err /= 0
-- | Create an 'Index' on the filesystem with a base path.
| 278 |
indexExists :: FilePath -- ^ Base path
-> IO Bool
indexExists = flip withCString $ \path -> do
err <- c_wp_index_exists path
return $! err /= 0
-- | Create an 'Index' on the filesystem with a base path.
| 219 |
indexExists = flip withCString $ \path -> do
err <- c_wp_index_exists path
return $! err /= 0
-- | Create an 'Index' on the filesystem with a base path.
| 157 | true | true | 0 | 10 | 66 | 54 | 27 | 27 | null | null |
badp/ganeti
|
src/Ganeti/Objects.hs
|
gpl-2.0
|
nextIp4Address :: Ip4Address -> Ip4Address
nextIp4Address (Ip4Address a b c d) =
let inc xs y = if all (==0) xs then y + 1 else y
d' = d + 1
c' = inc [d'] c
b' = inc [c', d'] b
a' = inc [b', c', d'] a
in Ip4Address a' b' c' d'
| 254 |
nextIp4Address :: Ip4Address -> Ip4Address
nextIp4Address (Ip4Address a b c d) =
let inc xs y = if all (==0) xs then y + 1 else y
d' = d + 1
c' = inc [d'] c
b' = inc [c', d'] b
a' = inc [b', c', d'] a
in Ip4Address a' b' c' d'
| 254 |
nextIp4Address (Ip4Address a b c d) =
let inc xs y = if all (==0) xs then y + 1 else y
d' = d + 1
c' = inc [d'] c
b' = inc [c', d'] b
a' = inc [b', c', d'] a
in Ip4Address a' b' c' d'
| 211 | false | true | 0 | 11 | 83 | 142 | 71 | 71 | null | null |
jaalonso/I1M-Cod-Temas
|
src/Tema_19/ArbolBinPropiedades.hs
|
gpl-2.0
|
-- Comprobación:
-- λ> quickCheck prop_listaOrdenada_correcta
-- +++ OK, passed 100 tests.
-- Propiedad. Al eliminar las repeticiones en las listas producidas por el
-- generador orderedList se obtienen listas ordenadas.
prop_orderedList_correcta :: [Int] -> Property
prop_orderedList_correcta _ =
forAll orderedList (ordenada . nub)
| 342 |
prop_orderedList_correcta :: [Int] -> Property
prop_orderedList_correcta _ =
forAll orderedList (ordenada . nub)
| 114 |
prop_orderedList_correcta _ =
forAll orderedList (ordenada . nub)
| 67 | true | true | 0 | 7 | 52 | 44 | 23 | 21 | null | null |
skogsbaer/HTF
|
tests/TestHTF.hs
|
lgpl-2.1
|
test_diff_FAIL =
assertEqual (mkExpr 1) (mkExpr 2)
where
mkExpr i =
PlusExpr (PlusExpr (MultExpr (PlusExpr (Variable "foo")
(MultExpr (Literal 42) (Variable "bar")))
(PlusExpr (Literal i) (Literal 2)))
(Literal 581))
(Variable "egg")
| 397 |
test_diff_FAIL =
assertEqual (mkExpr 1) (mkExpr 2)
where
mkExpr i =
PlusExpr (PlusExpr (MultExpr (PlusExpr (Variable "foo")
(MultExpr (Literal 42) (Variable "bar")))
(PlusExpr (Literal i) (Literal 2)))
(Literal 581))
(Variable "egg")
| 397 |
test_diff_FAIL =
assertEqual (mkExpr 1) (mkExpr 2)
where
mkExpr i =
PlusExpr (PlusExpr (MultExpr (PlusExpr (Variable "foo")
(MultExpr (Literal 42) (Variable "bar")))
(PlusExpr (Literal i) (Literal 2)))
(Literal 581))
(Variable "egg")
| 397 | false | false | 0 | 15 | 194 | 120 | 59 | 61 | null | null |
svenssonjoel/GCDObsidian
|
ArrowTest.hs
|
bsd-3-clause
|
test5 :: Array (Exp Int) -> Kernel (Array (Exp Int))
test5 = pure rev ->- (runArrow (two ((Pure rev) . aSync . (Pure rev))))
| 125 |
test5 :: Array (Exp Int) -> Kernel (Array (Exp Int))
test5 = pure rev ->- (runArrow (two ((Pure rev) . aSync . (Pure rev))))
| 124 |
test5 = pure rev ->- (runArrow (two ((Pure rev) . aSync . (Pure rev))))
| 71 | false | true | 0 | 14 | 24 | 81 | 40 | 41 | null | null |
oldmanmike/ghc
|
libraries/base/GHC/IO/Handle/Text.hs
|
bsd-3-clause
|
writeBlocks :: Handle -> Bool -> Bool -> Newline -> Buffer CharBufElem -> String -> IO ()
writeBlocks hdl line_buffered add_nl nl
buf@Buffer{ bufRaw=raw, bufSize=len } s =
let
shoveString :: Int -> [Char] -> [Char] -> IO ()
shoveString !n [] [] = do
commitBuffer hdl raw len n False{-no flush-} True{-release-}
shoveString !n [] rest = do
shoveString n rest []
shoveString !n (c:cs) rest
-- n+1 so we have enough room to write '\r\n' if necessary
| n + 1 >= len = do
commitBuffer hdl raw len n False{-flush-} False
shoveString 0 (c:cs) rest
| c == '\n' = do
n' <- if nl == CRLF
then do
n1 <- writeCharBuf raw n '\r'
writeCharBuf raw n1 '\n'
else do
writeCharBuf raw n c
if line_buffered
then do
-- end of line, so write and flush
commitBuffer hdl raw len n' True{-flush-} False
shoveString 0 cs rest
else do
shoveString n' cs rest
| otherwise = do
n' <- writeCharBuf raw n c
shoveString n' cs rest
in
shoveString 0 s (if add_nl then "\n" else "")
| 1,240 |
writeBlocks :: Handle -> Bool -> Bool -> Newline -> Buffer CharBufElem -> String -> IO ()
writeBlocks hdl line_buffered add_nl nl
buf@Buffer{ bufRaw=raw, bufSize=len } s =
let
shoveString :: Int -> [Char] -> [Char] -> IO ()
shoveString !n [] [] = do
commitBuffer hdl raw len n False{-no flush-} True{-release-}
shoveString !n [] rest = do
shoveString n rest []
shoveString !n (c:cs) rest
-- n+1 so we have enough room to write '\r\n' if necessary
| n + 1 >= len = do
commitBuffer hdl raw len n False{-flush-} False
shoveString 0 (c:cs) rest
| c == '\n' = do
n' <- if nl == CRLF
then do
n1 <- writeCharBuf raw n '\r'
writeCharBuf raw n1 '\n'
else do
writeCharBuf raw n c
if line_buffered
then do
-- end of line, so write and flush
commitBuffer hdl raw len n' True{-flush-} False
shoveString 0 cs rest
else do
shoveString n' cs rest
| otherwise = do
n' <- writeCharBuf raw n c
shoveString n' cs rest
in
shoveString 0 s (if add_nl then "\n" else "")
| 1,240 |
writeBlocks hdl line_buffered add_nl nl
buf@Buffer{ bufRaw=raw, bufSize=len } s =
let
shoveString :: Int -> [Char] -> [Char] -> IO ()
shoveString !n [] [] = do
commitBuffer hdl raw len n False{-no flush-} True{-release-}
shoveString !n [] rest = do
shoveString n rest []
shoveString !n (c:cs) rest
-- n+1 so we have enough room to write '\r\n' if necessary
| n + 1 >= len = do
commitBuffer hdl raw len n False{-flush-} False
shoveString 0 (c:cs) rest
| c == '\n' = do
n' <- if nl == CRLF
then do
n1 <- writeCharBuf raw n '\r'
writeCharBuf raw n1 '\n'
else do
writeCharBuf raw n c
if line_buffered
then do
-- end of line, so write and flush
commitBuffer hdl raw len n' True{-flush-} False
shoveString 0 cs rest
else do
shoveString n' cs rest
| otherwise = do
n' <- writeCharBuf raw n c
shoveString n' cs rest
in
shoveString 0 s (if add_nl then "\n" else "")
| 1,150 | false | true | 0 | 17 | 474 | 405 | 194 | 211 | null | null |
edwardwas/FRPNow-Vty
|
src/Lib/Control/FRPNow/Vty/Widgets.hs
|
mit
|
tabbingWidget :: EvStream a -> EvStream b -> [MakeWidget] -> MakeWidget
tabbingWidget eUp eDown ws bDis bVis = do
let sz = length ws
eNum <- fmap (\x -> mod x sz) <$> foldEs (+) 0 ((1 <$ eDown) <> ((-1) <$ eUp))
children <- sequence $ zipWith (\f n -> f bDis ((== n) <$> eNum)) ws [0..]
return $ originWidget <$> sequence children <*> pure mempty <*> bDis <*> bVis
| 382 |
tabbingWidget :: EvStream a -> EvStream b -> [MakeWidget] -> MakeWidget
tabbingWidget eUp eDown ws bDis bVis = do
let sz = length ws
eNum <- fmap (\x -> mod x sz) <$> foldEs (+) 0 ((1 <$ eDown) <> ((-1) <$ eUp))
children <- sequence $ zipWith (\f n -> f bDis ((== n) <$> eNum)) ws [0..]
return $ originWidget <$> sequence children <*> pure mempty <*> bDis <*> bVis
| 382 |
tabbingWidget eUp eDown ws bDis bVis = do
let sz = length ws
eNum <- fmap (\x -> mod x sz) <$> foldEs (+) 0 ((1 <$ eDown) <> ((-1) <$ eUp))
children <- sequence $ zipWith (\f n -> f bDis ((== n) <$> eNum)) ws [0..]
return $ originWidget <$> sequence children <*> pure mempty <*> bDis <*> bVis
| 310 | false | true | 0 | 15 | 89 | 193 | 97 | 96 | null | null |
abakst/symmetry
|
checker/src/Symmetry/IL/Unfold.hs
|
mit
|
unfoldAbs :: Config a -> Config a
unfoldAbs c@(Config {cProcs = ps, cSets = bs})
= c { cUnfold = us ++ cUnfold c }
where
us = [ Conc s 1 | (PAbs _ s, _) <- ps, not (isBound s bs) ]
| 188 |
unfoldAbs :: Config a -> Config a
unfoldAbs c@(Config {cProcs = ps, cSets = bs})
= c { cUnfold = us ++ cUnfold c }
where
us = [ Conc s 1 | (PAbs _ s, _) <- ps, not (isBound s bs) ]
| 188 |
unfoldAbs c@(Config {cProcs = ps, cSets = bs})
= c { cUnfold = us ++ cUnfold c }
where
us = [ Conc s 1 | (PAbs _ s, _) <- ps, not (isBound s bs) ]
| 154 | false | true | 1 | 10 | 51 | 117 | 58 | 59 | null | null |
chemist/passports
|
src/Check.hs
|
bsd-3-clause
|
boolToInt :: Bool -> Int
boolToInt True = 1
| 43 |
boolToInt :: Bool -> Int
boolToInt True = 1
| 43 |
boolToInt True = 1
| 18 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
lukexi/ghc-7.8-arm64
|
compiler/llvmGen/LlvmCodeGen/CodeGen.hs
|
bsd-3-clause
|
allocReg :: CmmReg -> (LlvmVar, LlvmStatements)
allocReg (CmmLocal (LocalReg un ty))
= let ty' = cmmToLlvmType ty
var = LMLocalVar un (LMPointer ty')
alc = Alloca ty' 1
in (var, unitOL $ Assignment var alc)
| 228 |
allocReg :: CmmReg -> (LlvmVar, LlvmStatements)
allocReg (CmmLocal (LocalReg un ty))
= let ty' = cmmToLlvmType ty
var = LMLocalVar un (LMPointer ty')
alc = Alloca ty' 1
in (var, unitOL $ Assignment var alc)
| 228 |
allocReg (CmmLocal (LocalReg un ty))
= let ty' = cmmToLlvmType ty
var = LMLocalVar un (LMPointer ty')
alc = Alloca ty' 1
in (var, unitOL $ Assignment var alc)
| 180 | false | true | 0 | 11 | 56 | 93 | 47 | 46 | null | null |
UoYCS-plasma/LazySmallCheck2012
|
Test/LazySmallCheck2012/Stats.hs
|
bsd-3-clause
|
ratio x y = fromIntegral x * 100 / fromIntegral y
| 49 |
ratio x y = fromIntegral x * 100 / fromIntegral y
| 49 |
ratio x y = fromIntegral x * 100 / fromIntegral y
| 49 | false | false | 0 | 7 | 10 | 25 | 11 | 14 | null | null |
zanesterling/haskell-compiler
|
src/NanoParsec/NanoParsec.hs
|
bsd-3-clause
|
-- Concat the results of parsing with each of two parsers.
combine :: Parser a -> Parser a -> Parser a
combine p q = Parser $ \s -> parse p s ++ parse q s
| 154 |
combine :: Parser a -> Parser a -> Parser a
combine p q = Parser $ \s -> parse p s ++ parse q s
| 95 |
combine p q = Parser $ \s -> parse p s ++ parse q s
| 51 | true | true | 0 | 8 | 35 | 61 | 28 | 33 | null | null |
abakst/symmetry
|
checker/src/Symmetry/SymbEx.hs
|
mit
|
symLookup :: SymbEx (Pid RMulti)
-> SymbEx Int
-> SymbEx (Pid RSing)
-------------------------------------------------
symLookup p i
= SE $ do APidMulti _ (Pid (Just r)) <- runSE p
AInt _ _ <- runSE i
return $ APid Nothing (Pid (Just (RElem r)))
-------------------------------------------------
| 380 |
symLookup :: SymbEx (Pid RMulti)
-> SymbEx Int
-> SymbEx (Pid RSing)
symLookup p i
= SE $ do APidMulti _ (Pid (Just r)) <- runSE p
AInt _ _ <- runSE i
return $ APid Nothing (Pid (Just (RElem r)))
-------------------------------------------------
| 330 |
symLookup p i
= SE $ do APidMulti _ (Pid (Just r)) <- runSE p
AInt _ _ <- runSE i
return $ APid Nothing (Pid (Just (RElem r)))
-------------------------------------------------
| 241 | true | true | 2 | 15 | 127 | 129 | 58 | 71 | null | null |
tolysz/Haxl
|
Haxl/Core/Monad.hs
|
bsd-3-clause
|
toHaxl ((f :<$> i) :<*> (g :<$> j)) =
toHaxl (((\x y -> f x (g y)) :<$> i) :<*> j)
| 84 |
toHaxl ((f :<$> i) :<*> (g :<$> j)) =
toHaxl (((\x y -> f x (g y)) :<$> i) :<*> j)
| 84 |
toHaxl ((f :<$> i) :<*> (g :<$> j)) =
toHaxl (((\x y -> f x (g y)) :<$> i) :<*> j)
| 84 | false | false | 0 | 14 | 22 | 68 | 36 | 32 | null | null |
keera-studios/hsQt
|
Qtc/Gui/QTreeWidget.hs
|
bsd-2-clause
|
setHeaderLabels :: QTreeWidget a -> (([String])) -> IO ()
setHeaderLabels x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withQListString x1 $ \cqlistlen_x1 cqliststr_x1 ->
qtc_QTreeWidget_setHeaderLabels cobj_x0 cqlistlen_x1 cqliststr_x1
| 241 |
setHeaderLabels :: QTreeWidget a -> (([String])) -> IO ()
setHeaderLabels x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withQListString x1 $ \cqlistlen_x1 cqliststr_x1 ->
qtc_QTreeWidget_setHeaderLabels cobj_x0 cqlistlen_x1 cqliststr_x1
| 241 |
setHeaderLabels x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withQListString x1 $ \cqlistlen_x1 cqliststr_x1 ->
qtc_QTreeWidget_setHeaderLabels cobj_x0 cqlistlen_x1 cqliststr_x1
| 183 | false | true | 0 | 9 | 37 | 77 | 39 | 38 | null | null |
luinix/haskell_snail
|
.cabal-sandbox/share/x86_64-osx-ghc-7.6.3/hlint-1.8.59/Default.hs
|
gpl-3.0
|
error = hPutStr stdout ==> putStr
| 33 |
error = hPutStr stdout ==> putStr
| 33 |
error = hPutStr stdout ==> putStr
| 33 | false | false | 0 | 6 | 5 | 13 | 6 | 7 | null | null |
chwarr/bond
|
compiler/tests/Tests/Codegen.hs
|
mit
|
cppExpandAliases :: Bool -> TypeMapping -> TypeMapping
cppExpandAliases type_aliases_enabled = if type_aliases_enabled
then id
else cppExpandAliasesTypeMapping
| 167 |
cppExpandAliases :: Bool -> TypeMapping -> TypeMapping
cppExpandAliases type_aliases_enabled = if type_aliases_enabled
then id
else cppExpandAliasesTypeMapping
| 167 |
cppExpandAliases type_aliases_enabled = if type_aliases_enabled
then id
else cppExpandAliasesTypeMapping
| 112 | false | true | 0 | 6 | 23 | 30 | 16 | 14 | null | null |
adnelson/Idris-dev
|
src/Idris/Reflection.hs
|
bsd-3-clause
|
reifyRawApp t [f, x]
| t == reflm "RApp" = liftM2 RApp (reifyRaw f) (reifyRaw x)
| 92 |
reifyRawApp t [f, x]
| t == reflm "RApp" = liftM2 RApp (reifyRaw f) (reifyRaw x)
| 92 |
reifyRawApp t [f, x]
| t == reflm "RApp" = liftM2 RApp (reifyRaw f) (reifyRaw x)
| 92 | false | false | 0 | 9 | 27 | 49 | 23 | 26 | null | null |
cjlarose/advent-2016
|
src/TwoStepsForward.hs
|
bsd-3-clause
|
neighbors :: GridDimensions -> Position -> [Direction]
neighbors gd (i, j) = map fst . filter (inBounds gd . snd) . zip [U, D, L, R] $ adjacents
where
adjacents = [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]
| 217 |
neighbors :: GridDimensions -> Position -> [Direction]
neighbors gd (i, j) = map fst . filter (inBounds gd . snd) . zip [U, D, L, R] $ adjacents
where
adjacents = [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]
| 217 |
neighbors gd (i, j) = map fst . filter (inBounds gd . snd) . zip [U, D, L, R] $ adjacents
where
adjacents = [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]
| 162 | false | true | 0 | 11 | 52 | 136 | 76 | 60 | null | null |
kyren/hsgb
|
lib/Gameboy/Instructions.hs
|
unlicense
|
encodeInstruction (BIT_B_R Bit6 ERegister) = [0xcb, 0x73]
| 57 |
encodeInstruction (BIT_B_R Bit6 ERegister) = [0xcb, 0x73]
| 57 |
encodeInstruction (BIT_B_R Bit6 ERegister) = [0xcb, 0x73]
| 57 | false | false | 0 | 6 | 6 | 24 | 12 | 12 | null | null |
cpettitt/tamien
|
Tamien/TI/Eval.hs
|
mit
|
buildInitialHeap :: CoreProgram -> (TiHeap, TiGlobals)
buildInitialHeap scs = (heap2, sc_addrs ++ prim_addrs)
where (heap1, sc_addrs) = mapAccumL allocSc H.empty scs
(heap2, prim_addrs) = mapAccumL allocPrim heap1 primitives
| 240 |
buildInitialHeap :: CoreProgram -> (TiHeap, TiGlobals)
buildInitialHeap scs = (heap2, sc_addrs ++ prim_addrs)
where (heap1, sc_addrs) = mapAccumL allocSc H.empty scs
(heap2, prim_addrs) = mapAccumL allocPrim heap1 primitives
| 240 |
buildInitialHeap scs = (heap2, sc_addrs ++ prim_addrs)
where (heap1, sc_addrs) = mapAccumL allocSc H.empty scs
(heap2, prim_addrs) = mapAccumL allocPrim heap1 primitives
| 185 | false | true | 0 | 8 | 43 | 82 | 42 | 40 | null | null |
michalkonecny/aern2
|
aern2-erc/src/ERC/Examples.hs
|
bsd-3-clause
|
-- Alpha: det({{1,5,-2,1},{3,1,1,3},{3,2,1,3},{-7,2,1,5}})
{- Executing the above in GHCi:
*ERC.Examples> run_erc_Pivot (Proxy::Proxy 2) [[1,0],[-2,1]] 0
(0,1)
(0.01 secs, 856,064 bytes)
*ERC.Examples> run_erc_Pivot (Proxy::Proxy 2) [[1,3],[-2,1]] 0
(1,0)
(0.01 secs, 867,248 bytes)
*ERC.Examples> run_erc_Det (Proxy::Proxy 3) [[1,2,1],[1,2,0],[2,2,1]] 10
a=[[[1 ± 0],[2 ± 0],[1 ± 0]],[[1 ± 0],[2 ± 0],[0 ± 0]],[[2 ± 0],[2 ± 0],[1 ± 0]]]
k=0
pi=1
pj=2
after swap 1: a=[[[2 ± 0],[1 ± 0],[1 ± 0]],[[2 ± 0],[1 ± 0],[0 ± 0]],[[2 ± 0],[2 ± 0],[1 ± 0]]]
after swap 2: a=[[[2 ± 0],[2 ± 0],[1 ± 0]],[[2 ± 0],[1 ± 0],[0 ± 0]],[[2 ± 0],[1 ± 0],[1 ± 0]]]
j=1
a=[[[2 ± 0],[2 ± 0],[1 ± 0]],[[1 ± 0],[1 ± 0],[0 ± 0]],[[2 ± 0],[1 ± 0],[1 ± 0]]]
i=1
a=[[[2 ± 0],[2 ± 0],[1 ± 0]],[[1 ± 0],[-1 ± 0],[0 ± 0]],[[2 ± 0],[1 ± 0],[1 ± 0]]]
i=2
a=[[[2 ± 0],[2 ± 0],[1 ± 0]],[[1 ± 0],[-1 ± 0],[-1 ± 0]],[[2 ± 0],[1 ± 0],[1 ± 0]]]
j=2
a=[[[2 ± 0],[2 ± 0],[1 ± 0]],[[1 ± 0],[-1 ± 0],[-1 ± 0]],[[1 ± 0],[1 ± 0],[1 ± 0]]]
i=1
a=[[[2 ± 0],[2 ± 0],[1 ± 0]],[[1 ± 0],[-1 ± 0],[-1 ± 0]],[[1 ± 0],[-1 ± 0],[1 ± 0]]]
i=2
a=[[[2 ± 0],[2 ± 0],[1 ± 0]],[[1 ± 0],[-1 ± 0],[-1 ± 0]],[[1 ± 0],[-1 ± 0],[0 ± 0]]]
a=[[[1 ± 0],[0 ± 0],[0 ± 0]],[[1 ± 0],[-1 ± 0],[-1 ± 0]],[[1 ± 0],[-1 ± 0],[0 ± 0]]]
k=1
pi=2
pj=1
after swap 1: a=[[[1 ± 0],[0 ± 0],[0 ± 0]],[[1 ± 0],[-1 ± 0],[-1 ± 0]],[[1 ± 0],[0 ± 0],[-1 ± 0]]]
after swap 2: a=[[[1 ± 0],[0 ± 0],[0 ± 0]],[[1 ± 0],[-1 ± 0],[-1 ± 0]],[[1 ± 0],[0 ± 0],[-1 ± 0]]]
j=2
a=[[[1 ± 0],[0 ± 0],[0 ± 0]],[[1 ± 0],[-1 ± 0],[-1 ± 0]],[[1 ± 0],[0 ± 0],[-1 ± 0]]]
i=2
a=[[[1 ± 0],[0 ± 0],[0 ± 0]],[[1 ± 0],[-1 ± 0],[-1 ± 0]],[[1 ± 0],[0 ± 0],[-1 ± 0]]]
a=[[[1 ± 0],[0 ± 0],[0 ± 0]],[[1 ± 0],[1 ± 0],[0 ± 0]],[[1 ± 0],[0 ± 0],[-1 ± 0]]]
[-2 ± 0]
(0.01 secs, 4,121,360 bytes)
-}
----------------------------------------------------------------------
-- Enclosing the unique root of a continuous function using trisection
----------------------------------------------------------------------
erc_Root_p :: ERC s INTEGER -> (ERC s REAL -> ERC s REAL) -> ERC s REAL
erc_Root_p p f =
do
a <- declareREAL $ 0
b <- declareREAL $ 1
while_ (choose [iota(p) >* (b?)-(a?), (b?)-(a?) >* iota(p-1)] ==# 1) $ do
ifThenElse_ (choose [0 >* f((b?)/3 + 2*(a?)/3) * f((b?)), 0 >* f((a?))*f(2*(b?)/3 + (a?)/3)] ==# 1) $ do
b .= 2*(b?)/3 + (a?)/3
`else_` do
a .= (b?)/3 + 2*(a?)/3
return_ (a?)
| 2,491 |
erc_Root_p :: ERC s INTEGER -> (ERC s REAL -> ERC s REAL) -> ERC s REAL
erc_Root_p p f =
do
a <- declareREAL $ 0
b <- declareREAL $ 1
while_ (choose [iota(p) >* (b?)-(a?), (b?)-(a?) >* iota(p-1)] ==# 1) $ do
ifThenElse_ (choose [0 >* f((b?)/3 + 2*(a?)/3) * f((b?)), 0 >* f((a?))*f(2*(b?)/3 + (a?)/3)] ==# 1) $ do
b .= 2*(b?)/3 + (a?)/3
`else_` do
a .= (b?)/3 + 2*(a?)/3
return_ (a?)
| 416 |
erc_Root_p p f =
do
a <- declareREAL $ 0
b <- declareREAL $ 1
while_ (choose [iota(p) >* (b?)-(a?), (b?)-(a?) >* iota(p-1)] ==# 1) $ do
ifThenElse_ (choose [0 >* f((b?)/3 + 2*(a?)/3) * f((b?)), 0 >* f((a?))*f(2*(b?)/3 + (a?)/3)] ==# 1) $ do
b .= 2*(b?)/3 + (a?)/3
`else_` do
a .= (b?)/3 + 2*(a?)/3
return_ (a?)
| 344 | true | true | 0 | 25 | 570 | 352 | 190 | 162 | null | null |
forked-upstream-packages-for-ghcjs/ghc
|
compiler/types/TyCon.hs
|
bsd-3-clause
|
isOpenTypeFamilyTyCon _ = False
| 77 |
isOpenTypeFamilyTyCon _ = False
| 77 |
isOpenTypeFamilyTyCon _ = False
| 77 | false | false | 0 | 5 | 49 | 9 | 4 | 5 | null | null |
kishoredbn/barrelfish
|
tools/flounder/LMP.hs
|
mit
|
-- Name of the init function
lmp_init_fn_name n = ifscope n "lmp_init"
| 70 |
lmp_init_fn_name n = ifscope n "lmp_init"
| 41 |
lmp_init_fn_name n = ifscope n "lmp_init"
| 41 | true | false | 0 | 5 | 11 | 15 | 7 | 8 | null | null |
facebookincubator/duckling
|
Duckling/Time/KO/Rules.hs
|
bsd-3-clause
|
ruleThisDayofweek :: Rule
ruleThisDayofweek = Rule
{ name = "this <day-of-week>"
, pattern =
[ regex "이번(주)?|금주"
, Predicate isADayOfWeek
]
, prod = \tokens -> case tokens of
(_:Token Time td:_) ->
tt $ predNth 0 False td
_ -> Nothing
}
| 276 |
ruleThisDayofweek :: Rule
ruleThisDayofweek = Rule
{ name = "this <day-of-week>"
, pattern =
[ regex "이번(주)?|금주"
, Predicate isADayOfWeek
]
, prod = \tokens -> case tokens of
(_:Token Time td:_) ->
tt $ predNth 0 False td
_ -> Nothing
}
| 276 |
ruleThisDayofweek = Rule
{ name = "this <day-of-week>"
, pattern =
[ regex "이번(주)?|금주"
, Predicate isADayOfWeek
]
, prod = \tokens -> case tokens of
(_:Token Time td:_) ->
tt $ predNth 0 False td
_ -> Nothing
}
| 250 | false | true | 0 | 15 | 82 | 95 | 50 | 45 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.