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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
laszlopandy/elm-compiler
|
src/Generate/JavaScript/Helpers.hs
|
bsd-3-clause
|
(<|) :: Expression () -> Expression () -> Expression ()
(<|) f x =
CallExpr () f [x]
| 88
|
(<|) :: Expression () -> Expression () -> Expression ()
(<|) f x =
CallExpr () f [x]
| 88
|
(<|) f x =
CallExpr () f [x]
| 32
| false
| true
| 0
| 8
| 21
| 55
| 28
| 27
| null | null |
phadej/range-set-list
|
src/Data/RangeSet/IntMap.hs
|
mit
|
-- | /O(n*r)/. Convert the set to an ascending list of elements.
toAscList :: RIntSet -> [Int]
toAscList (RSet xm) = Map.foldrWithKey (\a -> (++) . enumFromTo a) [] xm
| 167
|
toAscList :: RIntSet -> [Int]
toAscList (RSet xm) = Map.foldrWithKey (\a -> (++) . enumFromTo a) [] xm
| 102
|
toAscList (RSet xm) = Map.foldrWithKey (\a -> (++) . enumFromTo a) [] xm
| 72
| true
| true
| 0
| 9
| 29
| 56
| 30
| 26
| null | null |
Zimmi48/gps-bank-data-analysis
|
JsonInputReader.hs
|
mpl-2.0
|
getJSONPositions :: BS.ByteString -> NominalDiffTime -> Double -> Day -> Day -> [Position]
-- the input data is already sorted
getJSONPositions input timeDiff minAccuracy =
filter_track $ do
point <- getPoints input
let tMs = timestampMs point
let t = take (length tMs - 3) tMs
let pos = return $ Position
(toLocation
(normalizeE7 $ latitudeE7 point)
(normalizeE7 $ longitudeE7 point))
(addUTCTime timeDiff $ parseTimeOrError True defaultTimeLocale "%s" t)
if accuracy point <= minAccuracy then pos else []
| 738
|
getJSONPositions :: BS.ByteString -> NominalDiffTime -> Double -> Day -> Day -> [Position]
getJSONPositions input timeDiff minAccuracy =
filter_track $ do
point <- getPoints input
let tMs = timestampMs point
let t = take (length tMs - 3) tMs
let pos = return $ Position
(toLocation
(normalizeE7 $ latitudeE7 point)
(normalizeE7 $ longitudeE7 point))
(addUTCTime timeDiff $ parseTimeOrError True defaultTimeLocale "%s" t)
if accuracy point <= minAccuracy then pos else []
| 702
|
getJSONPositions input timeDiff minAccuracy =
filter_track $ do
point <- getPoints input
let tMs = timestampMs point
let t = take (length tMs - 3) tMs
let pos = return $ Position
(toLocation
(normalizeE7 $ latitudeE7 point)
(normalizeE7 $ longitudeE7 point))
(addUTCTime timeDiff $ parseTimeOrError True defaultTimeLocale "%s" t)
if accuracy point <= minAccuracy then pos else []
| 611
| true
| true
| 0
| 17
| 309
| 179
| 86
| 93
| null | null |
ocramz/monad-bayes
|
src/Control/Monad/Bayes/Conditional.hs
|
mit
|
unsafeConditional :: Monad m => Conditional m a -> Trace (CustomReal m) -> m a
unsafeConditional m t = unsafeTraceShape $ maybeConditional m t
| 142
|
unsafeConditional :: Monad m => Conditional m a -> Trace (CustomReal m) -> m a
unsafeConditional m t = unsafeTraceShape $ maybeConditional m t
| 142
|
unsafeConditional m t = unsafeTraceShape $ maybeConditional m t
| 63
| false
| true
| 0
| 10
| 23
| 57
| 26
| 31
| null | null |
olsner/ghc
|
compiler/specialise/Rules.hs
|
bsd-3-clause
|
ruleCheck _ (Lit _) = emptyBag
| 38
|
ruleCheck _ (Lit _) = emptyBag
| 38
|
ruleCheck _ (Lit _) = emptyBag
| 38
| false
| false
| 1
| 6
| 13
| 20
| 8
| 12
| null | null |
tsurucapital/frp-benchmarks
|
src/Benchmark/Netwire.hs
|
bsd-3-clause
|
wire2
:: Monad m
=> Int
-> Wire e m (Int, ()) Int
wire2 netsize = unicastWithSwitch 10 wires (pure 0)
where
wires = IntMap.fromList $ zip [0..] (replicate netsize counter)
| 195
|
wire2
:: Monad m
=> Int
-> Wire e m (Int, ()) Int
wire2 netsize = unicastWithSwitch 10 wires (pure 0)
where
wires = IntMap.fromList $ zip [0..] (replicate netsize counter)
| 195
|
wire2 netsize = unicastWithSwitch 10 wires (pure 0)
where
wires = IntMap.fromList $ zip [0..] (replicate netsize counter)
| 133
| false
| true
| 1
| 10
| 54
| 92
| 43
| 49
| null | null |
haskell-distributed/distributed-process
|
src/Control/Distributed/Process/Management/Internal/Trace/Primitives.hs
|
bsd-3-clause
|
withRegisteredTracer :: (ProcessId -> Process a) -> Process a
withRegisteredTracer act = do
(sp, rp) <- newChan
withLocalTracer $ \t -> liftIO $ Tracer.getCurrentTraceClient t sp
currentTracer <- receiveChan rp
case currentTracer of
Nothing -> do mTP <- whereis "tracer.initial"
-- NB: this should NOT ever happen, but forcing pattern matches
-- is not considered cool in later versions of MonadFail
case mTP of
Just p' -> act p'
Nothing -> die $ "System Invariant Violation: Tracer Process "
++ "Name Not Found (whereis tracer.initial)"
(Just p) -> act p
| 710
|
withRegisteredTracer :: (ProcessId -> Process a) -> Process a
withRegisteredTracer act = do
(sp, rp) <- newChan
withLocalTracer $ \t -> liftIO $ Tracer.getCurrentTraceClient t sp
currentTracer <- receiveChan rp
case currentTracer of
Nothing -> do mTP <- whereis "tracer.initial"
-- NB: this should NOT ever happen, but forcing pattern matches
-- is not considered cool in later versions of MonadFail
case mTP of
Just p' -> act p'
Nothing -> die $ "System Invariant Violation: Tracer Process "
++ "Name Not Found (whereis tracer.initial)"
(Just p) -> act p
| 710
|
withRegisteredTracer act = do
(sp, rp) <- newChan
withLocalTracer $ \t -> liftIO $ Tracer.getCurrentTraceClient t sp
currentTracer <- receiveChan rp
case currentTracer of
Nothing -> do mTP <- whereis "tracer.initial"
-- NB: this should NOT ever happen, but forcing pattern matches
-- is not considered cool in later versions of MonadFail
case mTP of
Just p' -> act p'
Nothing -> die $ "System Invariant Violation: Tracer Process "
++ "Name Not Found (whereis tracer.initial)"
(Just p) -> act p
| 648
| false
| true
| 0
| 16
| 244
| 151
| 71
| 80
| null | null |
ezyang/ghc
|
testsuite/tests/codeGen/should_run/CmmSwitchTest64.hs
|
bsd-3-clause
|
aw :: Word# -> Word#
aw 1## = 42##
| 34
|
aw :: Word# -> Word#
aw 1## = 42##
| 34
|
aw 1## = 42##
| 13
| false
| true
| 0
| 5
| 8
| 18
| 9
| 9
| null | null |
li-zhirui/EoplLangs
|
src/CallByNeed/Parser.hs
|
bsd-3-clause
|
binOp :: Parser BinOp
binOp = do
opStr <- foldl1 (<|>) (fmap (try . symbol . fst) binOpsMap)
return $ fromMaybe
(error ("Unknown operator '" `mappend` opStr `mappend` "'"))
(lookup opStr binOpsMap)
| 209
|
binOp :: Parser BinOp
binOp = do
opStr <- foldl1 (<|>) (fmap (try . symbol . fst) binOpsMap)
return $ fromMaybe
(error ("Unknown operator '" `mappend` opStr `mappend` "'"))
(lookup opStr binOpsMap)
| 209
|
binOp = do
opStr <- foldl1 (<|>) (fmap (try . symbol . fst) binOpsMap)
return $ fromMaybe
(error ("Unknown operator '" `mappend` opStr `mappend` "'"))
(lookup opStr binOpsMap)
| 187
| false
| true
| 0
| 13
| 43
| 88
| 46
| 42
| null | null |
sdiehl/ghc
|
testsuite/tests/array/should_run/arr013.hs
|
bsd-3-clause
|
(=:) a b = (a,b)
| 16
|
(=:) a b = (a,b)
| 16
|
(=:) a b = (a,b)
| 16
| false
| false
| 0
| 5
| 4
| 20
| 11
| 9
| null | null |
brendanhay/gogol
|
gogol-alertcenter/gen/Network/Google/AlertCenter/Types/Product.hs
|
mpl-2.0
|
-- | The serial number of the device.
dcsdSerialNumber :: Lens' DeviceCompromisedSecurityDetail (Maybe Text)
dcsdSerialNumber
= lens _dcsdSerialNumber
(\ s a -> s{_dcsdSerialNumber = a})
| 194
|
dcsdSerialNumber :: Lens' DeviceCompromisedSecurityDetail (Maybe Text)
dcsdSerialNumber
= lens _dcsdSerialNumber
(\ s a -> s{_dcsdSerialNumber = a})
| 156
|
dcsdSerialNumber
= lens _dcsdSerialNumber
(\ s a -> s{_dcsdSerialNumber = a})
| 85
| true
| true
| 0
| 9
| 32
| 48
| 25
| 23
| null | null |
pascal-knodel/haskell-craft
|
_/links/E'10''6.hs
|
mit
|
arePositive2 :: ( Num t , Ord t ) => [t] -> Bool
arePositive2 numbers
= Prelude.and ( map positive numbers )
where
positive :: ( Num t , Ord t ) => t -> Bool
positive number = number > 0
| 195
|
arePositive2 :: ( Num t , Ord t ) => [t] -> Bool
arePositive2 numbers
= Prelude.and ( map positive numbers )
where
positive :: ( Num t , Ord t ) => t -> Bool
positive number = number > 0
| 195
|
arePositive2 numbers
= Prelude.and ( map positive numbers )
where
positive :: ( Num t , Ord t ) => t -> Bool
positive number = number > 0
| 146
| false
| true
| 0
| 7
| 50
| 88
| 45
| 43
| null | null |
sherwoodwang/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxSYS_ANSI_VAR_FONT :: Int
wxSYS_ANSI_VAR_FONT = 12
| 51
|
wxSYS_ANSI_VAR_FONT :: Int
wxSYS_ANSI_VAR_FONT = 12
| 51
|
wxSYS_ANSI_VAR_FONT = 12
| 24
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
jthornber/xdrgen
|
Data/XDR/PrettyPrinter.hs
|
gpl-3.0
|
ppDecl (Decl n (DeclArray t c)) = ppType t <+> text n <> (brackets . ppConstant $ c)
| 84
|
ppDecl (Decl n (DeclArray t c)) = ppType t <+> text n <> (brackets . ppConstant $ c)
| 84
|
ppDecl (Decl n (DeclArray t c)) = ppType t <+> text n <> (brackets . ppConstant $ c)
| 84
| false
| false
| 0
| 9
| 17
| 50
| 24
| 26
| null | null |
naoto-ogawa/h-xproto-mysql
|
src/DataBase/MySQLX/Model.hs
|
mit
|
-- PRODUCED_MESSAGE = 10;
getProducedMessage :: (MonadIO m, MonadThrow m, Scalarable a) => PSSC.SessionStateChanged -> m a
getProducedMessage = getSessionStateChangedVal PSSCP.PRODUCED_MESSAGE "PRODUCED_MESSAGE"
| 216
|
getProducedMessage :: (MonadIO m, MonadThrow m, Scalarable a) => PSSC.SessionStateChanged -> m a
getProducedMessage = getSessionStateChangedVal PSSCP.PRODUCED_MESSAGE "PRODUCED_MESSAGE"
| 186
|
getProducedMessage = getSessionStateChangedVal PSSCP.PRODUCED_MESSAGE "PRODUCED_MESSAGE"
| 88
| true
| true
| 0
| 8
| 26
| 54
| 26
| 28
| null | null |
lexml/lexml-linker
|
src/main/haskell/LexML/Linker.hs
|
gpl-2.0
|
makeContext (RC_AutoridadeLocal autoridade mlocal) =
URNLexML (Local Brasil mlocal)
(Documento autoridade
(TipoDocumento1 (STD1_Norma (TipoNorma (Nome ["lei"]))) Nothing)
(Descritor (TD_Datas (Datas $ Left (Data 2008 10 5)) (Just (ID_Ids [IdDocumento $ NormalID $ "123"]))) [] Nothing))
Nothing
Nothing
Nothing
| 434
|
makeContext (RC_AutoridadeLocal autoridade mlocal) =
URNLexML (Local Brasil mlocal)
(Documento autoridade
(TipoDocumento1 (STD1_Norma (TipoNorma (Nome ["lei"]))) Nothing)
(Descritor (TD_Datas (Datas $ Left (Data 2008 10 5)) (Just (ID_Ids [IdDocumento $ NormalID $ "123"]))) [] Nothing))
Nothing
Nothing
Nothing
| 434
|
makeContext (RC_AutoridadeLocal autoridade mlocal) =
URNLexML (Local Brasil mlocal)
(Documento autoridade
(TipoDocumento1 (STD1_Norma (TipoNorma (Nome ["lei"]))) Nothing)
(Descritor (TD_Datas (Datas $ Left (Data 2008 10 5)) (Just (ID_Ids [IdDocumento $ NormalID $ "123"]))) [] Nothing))
Nothing
Nothing
Nothing
| 434
| false
| false
| 0
| 18
| 161
| 138
| 69
| 69
| null | null |
ghcjs/jsaddle-dom
|
src/JSDOM/Generated/WebGL2RenderingContext.hs
|
mit
|
-- | <https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext.getSyncParameter Mozilla WebGL2RenderingContext.getSyncParameter documentation>
getSyncParameter_ ::
(MonadDOM m) =>
WebGL2RenderingContext -> Maybe WebGLSync -> GLenum -> m ()
getSyncParameter_ self sync pname
= liftDOM
(void
(self ^. jsf "getSyncParameter" [toJSVal sync, toJSVal pname]))
| 424
|
getSyncParameter_ ::
(MonadDOM m) =>
WebGL2RenderingContext -> Maybe WebGLSync -> GLenum -> m ()
getSyncParameter_ self sync pname
= liftDOM
(void
(self ^. jsf "getSyncParameter" [toJSVal sync, toJSVal pname]))
| 265
|
getSyncParameter_ self sync pname
= liftDOM
(void
(self ^. jsf "getSyncParameter" [toJSVal sync, toJSVal pname]))
| 130
| true
| true
| 0
| 11
| 90
| 81
| 40
| 41
| null | null |
lukexi/gl-pal
|
src/Graphics/GL/Pal/Uniforms.hs
|
bsd-3-clause
|
uniformF :: MonadIO m => UniformLocation GLfloat -> GLfloat -> m ()
uniformF uniform float = glUniform1f (unUniformLocation uniform) float
| 138
|
uniformF :: MonadIO m => UniformLocation GLfloat -> GLfloat -> m ()
uniformF uniform float = glUniform1f (unUniformLocation uniform) float
| 138
|
uniformF uniform float = glUniform1f (unUniformLocation uniform) float
| 70
| false
| true
| 0
| 9
| 19
| 54
| 24
| 30
| null | null |
fossilet/supercalifragilisticexpialidocious
|
kill_dr_wright.hs
|
mit
|
main = do
-- FIXME: this does not wait for the process to terminate.
liftM waitForProcess (runCommand cmd)
| 114
|
main = do
-- FIXME: this does not wait for the process to terminate.
liftM waitForProcess (runCommand cmd)
| 114
|
main = do
-- FIXME: this does not wait for the process to terminate.
liftM waitForProcess (runCommand cmd)
| 114
| false
| false
| 1
| 10
| 25
| 25
| 10
| 15
| null | null |
google/codeworld
|
codeworld-base/src/Extras/Colors.hs
|
apache-2.0
|
byName ("lightblue") = colorNamed' ("#add8e6")
| 46
|
byName ("lightblue") = colorNamed' ("#add8e6")
| 46
|
byName ("lightblue") = colorNamed' ("#add8e6")
| 46
| false
| false
| 0
| 6
| 4
| 18
| 9
| 9
| null | null |
jimcrayne/jhc
|
src/E/Values.hs
|
mit
|
isSmall ELit {} = True
| 22
|
isSmall ELit {} = True
| 22
|
isSmall ELit {} = True
| 22
| false
| false
| 1
| 5
| 4
| 15
| 6
| 9
| null | null |
bitc/hs-watchman
|
src/System/Directory/Watchman/Fields.hs
|
mit
|
renderFileFieldLabel FLcclock = "cclock"
| 40
|
renderFileFieldLabel FLcclock = "cclock"
| 40
|
renderFileFieldLabel FLcclock = "cclock"
| 40
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
li-zhirui/EoplLangs
|
src/LetRecLang/Evaluator.hs
|
bsd-3-clause
|
evalLetStarExpr :: [(String, Expression)] -> Expression -> Environment
-> EvaluateResult
evalLetStarExpr [] body env = valueOf body env
| 151
|
evalLetStarExpr :: [(String, Expression)] -> Expression -> Environment
-> EvaluateResult
evalLetStarExpr [] body env = valueOf body env
| 151
|
evalLetStarExpr [] body env = valueOf body env
| 46
| false
| true
| 0
| 7
| 33
| 46
| 24
| 22
| null | null |
dbp/analyze
|
src/State/Sites.hs
|
bsd-3-clause
|
newErrorExample :: ErrorExample -> AppHandler (Maybe Int)
newErrorExample (ErrorExample _ e url time uid) = do
r <- idQuery "insert into errors_examples (error_id, url, time, user_id) values (?,?,?,?) returning id" (e, url, time, uid)
when (isNothing r) (registerError "newErrorExample: Could not create new error example." (Just $ tshow (e, url, time, uid)))
return r
| 374
|
newErrorExample :: ErrorExample -> AppHandler (Maybe Int)
newErrorExample (ErrorExample _ e url time uid) = do
r <- idQuery "insert into errors_examples (error_id, url, time, user_id) values (?,?,?,?) returning id" (e, url, time, uid)
when (isNothing r) (registerError "newErrorExample: Could not create new error example." (Just $ tshow (e, url, time, uid)))
return r
| 374
|
newErrorExample (ErrorExample _ e url time uid) = do
r <- idQuery "insert into errors_examples (error_id, url, time, user_id) values (?,?,?,?) returning id" (e, url, time, uid)
when (isNothing r) (registerError "newErrorExample: Could not create new error example." (Just $ tshow (e, url, time, uid)))
return r
| 316
| false
| true
| 0
| 13
| 59
| 115
| 58
| 57
| null | null |
ekmett/containers
|
tests/intmap-properties.hs
|
bsd-3-clause
|
prop_foldr :: Int -> [(Int, Int)] -> Property
prop_foldr n ys = length ys > 0 ==>
let xs = List.nubBy ((==) `on` fst) ys
m = fromList xs
in foldr (+) n m == List.foldr (+) n (List.map snd xs) &&
foldr (:) [] m == List.map snd (List.sort xs) &&
foldrWithKey (\_ a b -> a + b) n m == List.foldr (+) n (List.map snd xs) &&
foldrWithKey (\k _ b -> k + b) n m == List.foldr (+) n (List.map fst xs) &&
foldrWithKey (\k x xs -> (k,x):xs) [] m == List.sort xs
| 487
|
prop_foldr :: Int -> [(Int, Int)] -> Property
prop_foldr n ys = length ys > 0 ==>
let xs = List.nubBy ((==) `on` fst) ys
m = fromList xs
in foldr (+) n m == List.foldr (+) n (List.map snd xs) &&
foldr (:) [] m == List.map snd (List.sort xs) &&
foldrWithKey (\_ a b -> a + b) n m == List.foldr (+) n (List.map snd xs) &&
foldrWithKey (\k _ b -> k + b) n m == List.foldr (+) n (List.map fst xs) &&
foldrWithKey (\k x xs -> (k,x):xs) [] m == List.sort xs
| 487
|
prop_foldr n ys = length ys > 0 ==>
let xs = List.nubBy ((==) `on` fst) ys
m = fromList xs
in foldr (+) n m == List.foldr (+) n (List.map snd xs) &&
foldr (:) [] m == List.map snd (List.sort xs) &&
foldrWithKey (\_ a b -> a + b) n m == List.foldr (+) n (List.map snd xs) &&
foldrWithKey (\k _ b -> k + b) n m == List.foldr (+) n (List.map fst xs) &&
foldrWithKey (\k x xs -> (k,x):xs) [] m == List.sort xs
| 441
| false
| true
| 0
| 20
| 134
| 297
| 155
| 142
| null | null |
loganbraga/hunch
|
app/Hunch/Language/Error.hs
|
mit
|
parseError :: Int -> String -> String
parseError col msg = intercalate "\n" [title, indent msg']
where
title = "Parse error at column " ++ show col ++ ":"
msg' = intercalate "\n" . map addDot $ filter (not . null) $ lines msg
addDot s = if last s == '.' then s else s ++ "."
-- Components used by Parsec showErrorMessages to generate error messages
| 370
|
parseError :: Int -> String -> String
parseError col msg = intercalate "\n" [title, indent msg']
where
title = "Parse error at column " ++ show col ++ ":"
msg' = intercalate "\n" . map addDot $ filter (not . null) $ lines msg
addDot s = if last s == '.' then s else s ++ "."
-- Components used by Parsec showErrorMessages to generate error messages
| 370
|
parseError col msg = intercalate "\n" [title, indent msg']
where
title = "Parse error at column " ++ show col ++ ":"
msg' = intercalate "\n" . map addDot $ filter (not . null) $ lines msg
addDot s = if last s == '.' then s else s ++ "."
-- Components used by Parsec showErrorMessages to generate error messages
| 332
| false
| true
| 2
| 10
| 89
| 122
| 60
| 62
| null | null |
nobsun/oi
|
src/Data/OI/Combinator.hs
|
bsd-3-clause
|
(|/|) :: (a :-> c) -> (c -> (b :-> d)) -> ((a,b) :-> d)
(f |/| g) o = case dePair o of (a,b) -> g (f a) b
| 105
|
(|/|) :: (a :-> c) -> (c -> (b :-> d)) -> ((a,b) :-> d)
(f |/| g) o = case dePair o of (a,b) -> g (f a) b
| 105
|
(|/|) :: (a :-> c) -> (c -> (b :-> d)) -> ((a,b) :-> d)
(f |/| g) o = case dePair o of (a,b) -> g (f a) b
| 105
| false
| false
| 0
| 11
| 29
| 97
| 52
| 45
| null | null |
sheyll/b9-vm-image-builder
|
src/lib/B9/DiskImageBuilder.hs
|
mit
|
convert :: IsB9 e => Bool -> Image -> Image -> Eff e ()
convert doMove (Image imgIn fmtIn _) (Image imgOut fmtOut _)
| imgIn == imgOut = do
ensureDir imgOut
dbgL (printf "No need to convert: '%s'" imgIn)
| doMove && fmtIn == fmtOut = do
ensureDir imgOut
dbgL (printf "Moving '%s' to '%s'" imgIn imgOut)
liftIO $ do
let exdev e =
if IO.ioe_errno e == Just ((\(IO.Errno a) -> a) IO.eXDEV)
then copyFile imgIn imgOut >> removeFile imgIn
else IO.throw e
renameFile imgIn imgOut `IO.catch` exdev
| otherwise = do
ensureDir imgOut
dbgL
( printf
"Converting %s to %s: '%s' to '%s'"
(imageFileExtension fmtIn)
(imageFileExtension fmtOut)
imgIn
imgOut
)
cmd
( printf
"qemu-img convert -q -f %s -O %s %s '%s' '%s'"
(imageFileExtension fmtIn)
(imageFileExtension fmtOut)
(conversionOptions fmtOut)
imgIn
imgOut
)
when doMove $ do
dbgL (printf "Removing '%s'" imgIn)
liftIO (removeFile imgIn)
| 1,120
|
convert :: IsB9 e => Bool -> Image -> Image -> Eff e ()
convert doMove (Image imgIn fmtIn _) (Image imgOut fmtOut _)
| imgIn == imgOut = do
ensureDir imgOut
dbgL (printf "No need to convert: '%s'" imgIn)
| doMove && fmtIn == fmtOut = do
ensureDir imgOut
dbgL (printf "Moving '%s' to '%s'" imgIn imgOut)
liftIO $ do
let exdev e =
if IO.ioe_errno e == Just ((\(IO.Errno a) -> a) IO.eXDEV)
then copyFile imgIn imgOut >> removeFile imgIn
else IO.throw e
renameFile imgIn imgOut `IO.catch` exdev
| otherwise = do
ensureDir imgOut
dbgL
( printf
"Converting %s to %s: '%s' to '%s'"
(imageFileExtension fmtIn)
(imageFileExtension fmtOut)
imgIn
imgOut
)
cmd
( printf
"qemu-img convert -q -f %s -O %s %s '%s' '%s'"
(imageFileExtension fmtIn)
(imageFileExtension fmtOut)
(conversionOptions fmtOut)
imgIn
imgOut
)
when doMove $ do
dbgL (printf "Removing '%s'" imgIn)
liftIO (removeFile imgIn)
| 1,120
|
convert doMove (Image imgIn fmtIn _) (Image imgOut fmtOut _)
| imgIn == imgOut = do
ensureDir imgOut
dbgL (printf "No need to convert: '%s'" imgIn)
| doMove && fmtIn == fmtOut = do
ensureDir imgOut
dbgL (printf "Moving '%s' to '%s'" imgIn imgOut)
liftIO $ do
let exdev e =
if IO.ioe_errno e == Just ((\(IO.Errno a) -> a) IO.eXDEV)
then copyFile imgIn imgOut >> removeFile imgIn
else IO.throw e
renameFile imgIn imgOut `IO.catch` exdev
| otherwise = do
ensureDir imgOut
dbgL
( printf
"Converting %s to %s: '%s' to '%s'"
(imageFileExtension fmtIn)
(imageFileExtension fmtOut)
imgIn
imgOut
)
cmd
( printf
"qemu-img convert -q -f %s -O %s %s '%s' '%s'"
(imageFileExtension fmtIn)
(imageFileExtension fmtOut)
(conversionOptions fmtOut)
imgIn
imgOut
)
when doMove $ do
dbgL (printf "Removing '%s'" imgIn)
liftIO (removeFile imgIn)
| 1,064
| false
| true
| 1
| 25
| 386
| 356
| 162
| 194
| null | null |
phadej/streaming-commons
|
Data/Streaming/Zlib.hs
|
mit
|
initDeflateWithDictionary :: Int -- ^ Compression level
-> S.ByteString -- ^ Deflate dictionary
-> WindowBits -> IO Deflate
initDeflateWithDictionary level bs w = do
zstr <- zstreamNew
deflateInit2 zstr level w 8 StrategyDefault
fzstr <- newForeignPtr c_free_z_stream_deflate zstr
fbuff <- mallocForeignPtrBytes defaultChunkSize
unsafeUseAsCStringLen bs $ \(cstr, len) -> do
c_call_deflate_set_dictionary zstr cstr $ fromIntegral len
withForeignPtr fbuff $ \buff ->
c_set_avail_out zstr buff $ fromIntegral defaultChunkSize
return $ Deflate (fzstr, fbuff)
-- | Feed the given 'S.ByteString' to the inflater. Return a 'Popper',
-- an IO action that returns the decompressed data a chunk at a time.
-- The 'Popper' must be called to exhaustion before using the 'Inflate'
-- object again.
--
-- Note that this function automatically buffers the output to
-- 'defaultChunkSize', and therefore you won't get any data from the popper
-- until that much decompressed data is available. After you have fed all of
-- the compressed data to this function, you can extract your final chunk of
-- decompressed data using 'finishInflate'.
| 1,224
|
initDeflateWithDictionary :: Int -- ^ Compression level
-> S.ByteString -- ^ Deflate dictionary
-> WindowBits -> IO Deflate
initDeflateWithDictionary level bs w = do
zstr <- zstreamNew
deflateInit2 zstr level w 8 StrategyDefault
fzstr <- newForeignPtr c_free_z_stream_deflate zstr
fbuff <- mallocForeignPtrBytes defaultChunkSize
unsafeUseAsCStringLen bs $ \(cstr, len) -> do
c_call_deflate_set_dictionary zstr cstr $ fromIntegral len
withForeignPtr fbuff $ \buff ->
c_set_avail_out zstr buff $ fromIntegral defaultChunkSize
return $ Deflate (fzstr, fbuff)
-- | Feed the given 'S.ByteString' to the inflater. Return a 'Popper',
-- an IO action that returns the decompressed data a chunk at a time.
-- The 'Popper' must be called to exhaustion before using the 'Inflate'
-- object again.
--
-- Note that this function automatically buffers the output to
-- 'defaultChunkSize', and therefore you won't get any data from the popper
-- until that much decompressed data is available. After you have fed all of
-- the compressed data to this function, you can extract your final chunk of
-- decompressed data using 'finishInflate'.
| 1,224
|
initDeflateWithDictionary level bs w = do
zstr <- zstreamNew
deflateInit2 zstr level w 8 StrategyDefault
fzstr <- newForeignPtr c_free_z_stream_deflate zstr
fbuff <- mallocForeignPtrBytes defaultChunkSize
unsafeUseAsCStringLen bs $ \(cstr, len) -> do
c_call_deflate_set_dictionary zstr cstr $ fromIntegral len
withForeignPtr fbuff $ \buff ->
c_set_avail_out zstr buff $ fromIntegral defaultChunkSize
return $ Deflate (fzstr, fbuff)
-- | Feed the given 'S.ByteString' to the inflater. Return a 'Popper',
-- an IO action that returns the decompressed data a chunk at a time.
-- The 'Popper' must be called to exhaustion before using the 'Inflate'
-- object again.
--
-- Note that this function automatically buffers the output to
-- 'defaultChunkSize', and therefore you won't get any data from the popper
-- until that much decompressed data is available. After you have fed all of
-- the compressed data to this function, you can extract your final chunk of
-- decompressed data using 'finishInflate'.
| 1,048
| false
| true
| 0
| 12
| 266
| 169
| 84
| 85
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/Prelude/PrimOp.hs
|
bsd-3-clause
|
primOpInfo FloatLogOp = mkMonadic (fsLit "logFloat#") floatPrimTy
| 65
|
primOpInfo FloatLogOp = mkMonadic (fsLit "logFloat#") floatPrimTy
| 65
|
primOpInfo FloatLogOp = mkMonadic (fsLit "logFloat#") floatPrimTy
| 65
| false
| false
| 0
| 7
| 6
| 20
| 9
| 11
| null | null |
mfpi/OpenGL
|
Graphics/Rendering/OpenGL/GL/PerFragment.hs
|
bsd-3-clause
|
--------------------------------------------------------------------------------
blendFuncSeparate ::
StateVar ((BlendingFactor, BlendingFactor), (BlendingFactor, BlendingFactor))
blendFuncSeparate =
makeStateVar
(do srcRGB <- getEnum1 unmarshalBlendingFactor GetBlendSrcRGB
srcAlpha <- getEnum1 unmarshalBlendingFactor GetBlendSrcAlpha
dstRGB <- getEnum1 unmarshalBlendingFactor GetBlendDstRGB
dstAlpha <- getEnum1 unmarshalBlendingFactor GetBlendDstAlpha
return ((srcRGB, srcAlpha), (dstRGB, dstAlpha)))
(\((srcRGB, srcAlpha), (dstRGB, dstAlpha)) ->
glBlendFuncSeparate (marshalBlendingFactor srcRGB)
(marshalBlendingFactor srcAlpha)
(marshalBlendingFactor dstRGB)
(marshalBlendingFactor dstAlpha))
| 859
|
blendFuncSeparate ::
StateVar ((BlendingFactor, BlendingFactor), (BlendingFactor, BlendingFactor))
blendFuncSeparate =
makeStateVar
(do srcRGB <- getEnum1 unmarshalBlendingFactor GetBlendSrcRGB
srcAlpha <- getEnum1 unmarshalBlendingFactor GetBlendSrcAlpha
dstRGB <- getEnum1 unmarshalBlendingFactor GetBlendDstRGB
dstAlpha <- getEnum1 unmarshalBlendingFactor GetBlendDstAlpha
return ((srcRGB, srcAlpha), (dstRGB, dstAlpha)))
(\((srcRGB, srcAlpha), (dstRGB, dstAlpha)) ->
glBlendFuncSeparate (marshalBlendingFactor srcRGB)
(marshalBlendingFactor srcAlpha)
(marshalBlendingFactor dstRGB)
(marshalBlendingFactor dstAlpha))
| 777
|
blendFuncSeparate =
makeStateVar
(do srcRGB <- getEnum1 unmarshalBlendingFactor GetBlendSrcRGB
srcAlpha <- getEnum1 unmarshalBlendingFactor GetBlendSrcAlpha
dstRGB <- getEnum1 unmarshalBlendingFactor GetBlendDstRGB
dstAlpha <- getEnum1 unmarshalBlendingFactor GetBlendDstAlpha
return ((srcRGB, srcAlpha), (dstRGB, dstAlpha)))
(\((srcRGB, srcAlpha), (dstRGB, dstAlpha)) ->
glBlendFuncSeparate (marshalBlendingFactor srcRGB)
(marshalBlendingFactor srcAlpha)
(marshalBlendingFactor dstRGB)
(marshalBlendingFactor dstAlpha))
| 675
| true
| true
| 0
| 11
| 209
| 172
| 91
| 81
| null | null |
bamboo/idris-cil
|
src/IRTS/Cil/MaxStack.hs
|
bsd-3-clause
|
netStackChange _ Div = -1
| 35
|
netStackChange _ Div = -1
| 35
|
netStackChange _ Div = -1
| 35
| false
| false
| 0
| 5
| 14
| 13
| 6
| 7
| null | null |
HairyDude/heal
|
EveApi/Types.hs
|
bsd-2-clause
|
corpSAG CorpSAG5 = Just 5
| 25
|
corpSAG CorpSAG5 = Just 5
| 25
|
corpSAG CorpSAG5 = Just 5
| 25
| false
| false
| 1
| 5
| 4
| 16
| 5
| 11
| null | null |
keera-studios/hsQt
|
Qtc/Gui/QPainter.hs
|
bsd-2-clause
|
qsetViewport :: QPainter a -> ((QRect t1)) -> IO ()
qsetViewport x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withObjectPtr x1 $ \cobj_x1 ->
qtc_QPainter_setViewport cobj_x0 cobj_x1
| 187
|
qsetViewport :: QPainter a -> ((QRect t1)) -> IO ()
qsetViewport x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withObjectPtr x1 $ \cobj_x1 ->
qtc_QPainter_setViewport cobj_x0 cobj_x1
| 187
|
qsetViewport x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withObjectPtr x1 $ \cobj_x1 ->
qtc_QPainter_setViewport cobj_x0 cobj_x1
| 135
| false
| true
| 0
| 9
| 36
| 73
| 36
| 37
| null | null |
fmapfmapfmap/amazonka
|
amazonka-autoscaling/gen/Network/AWS/AutoScaling/Types/Product.hs
|
mpl-2.0
|
-- | The date and time that the action is scheduled to end. This date and
-- time can be up to one month in the future.
sugaEndTime :: Lens' ScheduledUpdateGroupAction (Maybe UTCTime)
sugaEndTime = lens _sugaEndTime (\ s a -> s{_sugaEndTime = a}) . mapping _Time
| 262
|
sugaEndTime :: Lens' ScheduledUpdateGroupAction (Maybe UTCTime)
sugaEndTime = lens _sugaEndTime (\ s a -> s{_sugaEndTime = a}) . mapping _Time
| 142
|
sugaEndTime = lens _sugaEndTime (\ s a -> s{_sugaEndTime = a}) . mapping _Time
| 78
| true
| true
| 1
| 10
| 46
| 59
| 29
| 30
| null | null |
jfischoff/generic-maybe
|
src/Data/Generics/Maybe.hs
|
bsd-3-clause
|
maybeToList :: (Generic maybe, MaybeLike (Rep maybe) a)
=> maybe -> [a]
maybeToList = maybeToList' . toGSimple
| 122
|
maybeToList :: (Generic maybe, MaybeLike (Rep maybe) a)
=> maybe -> [a]
maybeToList = maybeToList' . toGSimple
| 122
|
maybeToList = maybeToList' . toGSimple
| 38
| false
| true
| 0
| 8
| 28
| 45
| 24
| 21
| null | null |
AlexeyRaga/eta
|
compiler/ETA/Prelude/PrimOp.hs
|
bsd-3-clause
|
tagOf_PrimOp ReallyUnsafePtrEqualityOp = _ILIT(376)
| 51
|
tagOf_PrimOp ReallyUnsafePtrEqualityOp = _ILIT(376)
| 51
|
tagOf_PrimOp ReallyUnsafePtrEqualityOp = _ILIT(376)
| 51
| false
| false
| 0
| 6
| 3
| 16
| 7
| 9
| null | null |
codemac/yi-editor
|
src/Yi/Syntax/Haskell.hs
|
gpl-2.0
|
pConstrs :: Parser TT (Exp TT)
pConstrs = Bin <$> (Bin <$> pOpt pContext <*> pConstr)
<*> pMany (pOP [ReservedOp Pipe]
(Bin <$> pOpt pContext <*> please pConstr))
| 187
|
pConstrs :: Parser TT (Exp TT)
pConstrs = Bin <$> (Bin <$> pOpt pContext <*> pConstr)
<*> pMany (pOP [ReservedOp Pipe]
(Bin <$> pOpt pContext <*> please pConstr))
| 187
|
pConstrs = Bin <$> (Bin <$> pOpt pContext <*> pConstr)
<*> pMany (pOP [ReservedOp Pipe]
(Bin <$> pOpt pContext <*> please pConstr))
| 156
| false
| true
| 7
| 11
| 52
| 90
| 40
| 50
| null | null |
jmaessen/Data.FastSequence
|
src/Data/FastSequence.hs
|
bsd-3-clause
|
replicate' :: (Sized a) => Size -> Size -> a -> FTree a
replicate' n size_t t
| n <= maxSimple = Simple (N.replicate sz n t)
| even sides = Root sz l m l
| otherwise = Root sz l m r
where sz = n * size_t
(q,rm) = n `quotRem` maxInner
deepSize = maxInner * size_t
deep = N.replicate deepSize maxInner t
sides = rm + 2 * maxInner
half = sides `quot` 2
rest = sides - half
l = N.replicate (half * size_t) half t
r = N.replicate (rest * size_t) rest t
m = replicate' (q-2) deepSize deep
| 562
|
replicate' :: (Sized a) => Size -> Size -> a -> FTree a
replicate' n size_t t
| n <= maxSimple = Simple (N.replicate sz n t)
| even sides = Root sz l m l
| otherwise = Root sz l m r
where sz = n * size_t
(q,rm) = n `quotRem` maxInner
deepSize = maxInner * size_t
deep = N.replicate deepSize maxInner t
sides = rm + 2 * maxInner
half = sides `quot` 2
rest = sides - half
l = N.replicate (half * size_t) half t
r = N.replicate (rest * size_t) rest t
m = replicate' (q-2) deepSize deep
| 562
|
replicate' n size_t t
| n <= maxSimple = Simple (N.replicate sz n t)
| even sides = Root sz l m l
| otherwise = Root sz l m r
where sz = n * size_t
(q,rm) = n `quotRem` maxInner
deepSize = maxInner * size_t
deep = N.replicate deepSize maxInner t
sides = rm + 2 * maxInner
half = sides `quot` 2
rest = sides - half
l = N.replicate (half * size_t) half t
r = N.replicate (rest * size_t) rest t
m = replicate' (q-2) deepSize deep
| 506
| false
| true
| 9
| 9
| 184
| 287
| 132
| 155
| null | null |
k0001/seldom
|
src/Seldom/Internal/Parsing.hs
|
bsd-3-clause
|
------------------------------------------------------------------------------
unsafeFromInt :: (Enum a, Num a, Bits a) => ByteString -> a
unsafeFromInt = S.foldl' f 0
where
f !cnt !i = cnt * 10 + toEnum (digitToInt i)
| 225
|
unsafeFromInt :: (Enum a, Num a, Bits a) => ByteString -> a
unsafeFromInt = S.foldl' f 0
where
f !cnt !i = cnt * 10 + toEnum (digitToInt i)
| 146
|
unsafeFromInt = S.foldl' f 0
where
f !cnt !i = cnt * 10 + toEnum (digitToInt i)
| 86
| true
| true
| 3
| 8
| 36
| 88
| 39
| 49
| null | null |
mokus0/monad-loops
|
src/Control/Monad/Loops.hs
|
bsd-3-clause
|
-- |See 'Data.List.unfoldr'. This is a monad-friendly version of that.
unfoldrM :: (Monad m) => (a -> m (Maybe (b,a))) -> a -> m [b]
unfoldrM = unfoldrM'
| 154
|
unfoldrM :: (Monad m) => (a -> m (Maybe (b,a))) -> a -> m [b]
unfoldrM = unfoldrM'
| 82
|
unfoldrM = unfoldrM'
| 20
| true
| true
| 0
| 12
| 28
| 57
| 31
| 26
| null | null |
sdiehl/ghc
|
testsuite/tests/pmcheck/should_compile/EmptyCase010.hs
|
bsd-3-clause
|
-- Non-exhaustive. Missing: Baz f a (a and f unknown (and the kind too))
f31 :: Baz f a -> ()
f31 x = case x of {}
| 114
|
f31 :: Baz f a -> ()
f31 x = case x of {}
| 41
|
f31 x = case x of {}
| 20
| true
| true
| 0
| 6
| 27
| 32
| 17
| 15
| null | null |
tomjefferys/fuligite
|
src/Scripting/Fuligite/FileLoader.hs
|
mit
|
-- loads a file.
-- removes comments
-- checks indentation rules
-- parses output
loadFile :: String -> IO Object
loadFile fileName = do
content <- readFile fileName
let coords = toCharCoords content
let coords' = stripComments coords
let content' = fromCharCoords coords'
let check = checkPunctuation coords' []
case check of
Left err -> error err
Right _ -> return $ doParse content'
-- | Strip comments (anything after a semicolon)
| 472
|
loadFile :: String -> IO Object
loadFile fileName = do
content <- readFile fileName
let coords = toCharCoords content
let coords' = stripComments coords
let content' = fromCharCoords coords'
let check = checkPunctuation coords' []
case check of
Left err -> error err
Right _ -> return $ doParse content'
-- | Strip comments (anything after a semicolon)
| 390
|
loadFile fileName = do
content <- readFile fileName
let coords = toCharCoords content
let coords' = stripComments coords
let content' = fromCharCoords coords'
let check = checkPunctuation coords' []
case check of
Left err -> error err
Right _ -> return $ doParse content'
-- | Strip comments (anything after a semicolon)
| 358
| true
| true
| 0
| 11
| 109
| 123
| 56
| 67
| null | null |
SneakingCat/rcli
|
tests/CommandHandlerTest.hs
|
gpl-3.0
|
pHelpShallDisplayAllCommands :: OnlyHelp -> Bool
pHelpShallDisplayAllCommands (OnlyHelp commandLine state) =
case applyPureHandler commandLine state of
Right (x:xs, state', _) ->
-- The first row shall read
x == "The available commands are:"
-- The rest of the rows shall contain all registered commands
-- with their synopsis. First the locals and then the
-- remotes. The command list shall be sorted ascending on the
-- command name
&& xs == (sorted $ localCommands state)
++(sorted $ remoteCommands state)
-- State shall not have been modified
&& state' == state
-- Fail when applying the handler
Right ([], _, _) -> False
Left _ -> False
where
sorted :: [CommandHandlerEntry] -> Printout
sorted = map toLine . sortBy key
key :: CommandHandlerEntry -> CommandHandlerEntry -> Ordering
key c1 c2 = fst c1 `compare` fst c2
toLine :: CommandHandlerEntry -> String
toLine (k, (s, _, _)) = printf "%-20s%s" k s
| 1,091
|
pHelpShallDisplayAllCommands :: OnlyHelp -> Bool
pHelpShallDisplayAllCommands (OnlyHelp commandLine state) =
case applyPureHandler commandLine state of
Right (x:xs, state', _) ->
-- The first row shall read
x == "The available commands are:"
-- The rest of the rows shall contain all registered commands
-- with their synopsis. First the locals and then the
-- remotes. The command list shall be sorted ascending on the
-- command name
&& xs == (sorted $ localCommands state)
++(sorted $ remoteCommands state)
-- State shall not have been modified
&& state' == state
-- Fail when applying the handler
Right ([], _, _) -> False
Left _ -> False
where
sorted :: [CommandHandlerEntry] -> Printout
sorted = map toLine . sortBy key
key :: CommandHandlerEntry -> CommandHandlerEntry -> Ordering
key c1 c2 = fst c1 `compare` fst c2
toLine :: CommandHandlerEntry -> String
toLine (k, (s, _, _)) = printf "%-20s%s" k s
| 1,091
|
pHelpShallDisplayAllCommands (OnlyHelp commandLine state) =
case applyPureHandler commandLine state of
Right (x:xs, state', _) ->
-- The first row shall read
x == "The available commands are:"
-- The rest of the rows shall contain all registered commands
-- with their synopsis. First the locals and then the
-- remotes. The command list shall be sorted ascending on the
-- command name
&& xs == (sorted $ localCommands state)
++(sorted $ remoteCommands state)
-- State shall not have been modified
&& state' == state
-- Fail when applying the handler
Right ([], _, _) -> False
Left _ -> False
where
sorted :: [CommandHandlerEntry] -> Printout
sorted = map toLine . sortBy key
key :: CommandHandlerEntry -> CommandHandlerEntry -> Ordering
key c1 c2 = fst c1 `compare` fst c2
toLine :: CommandHandlerEntry -> String
toLine (k, (s, _, _)) = printf "%-20s%s" k s
| 1,042
| false
| true
| 0
| 14
| 331
| 240
| 128
| 112
| null | null |
acowley/ghc
|
compiler/typecheck/TcSplice.hs
|
bsd-3-clause
|
quotationCtxtDoc :: HsBracket Name -> SDoc
quotationCtxtDoc br_body
= hang (ptext (sLit "In the Template Haskell quotation"))
2 (ppr br_body)
| 152
|
quotationCtxtDoc :: HsBracket Name -> SDoc
quotationCtxtDoc br_body
= hang (ptext (sLit "In the Template Haskell quotation"))
2 (ppr br_body)
| 152
|
quotationCtxtDoc br_body
= hang (ptext (sLit "In the Template Haskell quotation"))
2 (ppr br_body)
| 109
| false
| true
| 0
| 8
| 30
| 54
| 23
| 31
| null | null |
bergey/diagrams-opengl
|
examples/lineForm.hs
|
bsd-3-clause
|
example :: Diagram OpenGL R2
example = centerXY . vcat' (with & sep .~ 0.1 )
$ map (path #)
[ lineCap LineCapButt . lineJoin LineJoinMiter
, lineCap LineCapRound . lineJoin LineJoinRound
, lineCap LineCapSquare . lineJoin LineJoinBevel
, dashing [0.1,0.2,0.3,0.1] 0
]
| 340
|
example :: Diagram OpenGL R2
example = centerXY . vcat' (with & sep .~ 0.1 )
$ map (path #)
[ lineCap LineCapButt . lineJoin LineJoinMiter
, lineCap LineCapRound . lineJoin LineJoinRound
, lineCap LineCapSquare . lineJoin LineJoinBevel
, dashing [0.1,0.2,0.3,0.1] 0
]
| 340
|
example = centerXY . vcat' (with & sep .~ 0.1 )
$ map (path #)
[ lineCap LineCapButt . lineJoin LineJoinMiter
, lineCap LineCapRound . lineJoin LineJoinRound
, lineCap LineCapSquare . lineJoin LineJoinBevel
, dashing [0.1,0.2,0.3,0.1] 0
]
| 311
| false
| true
| 3
| 8
| 115
| 115
| 55
| 60
| null | null |
kavigupta/Infsabot
|
Infsabot/Strategy/BasicStrategy.hs
|
gpl-3.0
|
basicProgram :: Team -> RobotProgram
basicProgram team state
| mat == SpotMaterial
= (Dig, stateMemory state)
| stateAge state `mod` 9 /= 0
= if stateAge state `mod` 2 == 0 then
(MoveIn N, stateMemory state) else
(MoveIn E, stateMemory state)
| otherwise
= if stateAge state `mod` 2 == 0 then
(createSpawn N, stateMemory state) else
(createSpawn E, stateMemory state)
where
mat
= case peekAtSpot state [] of
Nothing -> SpotEmpty
Just (SeenSpot current _) -> current
createSpawn dir = Spawn SpawnAction {
newDirection = dir,
newProgram = basicProgram team,
newAppearance = RobotAppearance $ colorOf team,
newMaterial = makeNatural $ material state `div` 3,
newMemory = stateMemory state
}
| 859
|
basicProgram :: Team -> RobotProgram
basicProgram team state
| mat == SpotMaterial
= (Dig, stateMemory state)
| stateAge state `mod` 9 /= 0
= if stateAge state `mod` 2 == 0 then
(MoveIn N, stateMemory state) else
(MoveIn E, stateMemory state)
| otherwise
= if stateAge state `mod` 2 == 0 then
(createSpawn N, stateMemory state) else
(createSpawn E, stateMemory state)
where
mat
= case peekAtSpot state [] of
Nothing -> SpotEmpty
Just (SeenSpot current _) -> current
createSpawn dir = Spawn SpawnAction {
newDirection = dir,
newProgram = basicProgram team,
newAppearance = RobotAppearance $ colorOf team,
newMaterial = makeNatural $ material state `div` 3,
newMemory = stateMemory state
}
| 859
|
basicProgram team state
| mat == SpotMaterial
= (Dig, stateMemory state)
| stateAge state `mod` 9 /= 0
= if stateAge state `mod` 2 == 0 then
(MoveIn N, stateMemory state) else
(MoveIn E, stateMemory state)
| otherwise
= if stateAge state `mod` 2 == 0 then
(createSpawn N, stateMemory state) else
(createSpawn E, stateMemory state)
where
mat
= case peekAtSpot state [] of
Nothing -> SpotEmpty
Just (SeenSpot current _) -> current
createSpawn dir = Spawn SpawnAction {
newDirection = dir,
newProgram = basicProgram team,
newAppearance = RobotAppearance $ colorOf team,
newMaterial = makeNatural $ material state `div` 3,
newMemory = stateMemory state
}
| 822
| false
| true
| 2
| 10
| 281
| 287
| 143
| 144
| null | null |
ledyba/language-krkr
|
lib/Language/TJS/Parser.hs
|
gpl-3.0
|
numLit :: Parser Expr
numLit = choice [octLit, binLit, hexLit, decLit]
| 70
|
numLit :: Parser Expr
numLit = choice [octLit, binLit, hexLit, decLit]
| 70
|
numLit = choice [octLit, binLit, hexLit, decLit]
| 48
| false
| true
| 1
| 6
| 10
| 32
| 16
| 16
| null | null |
gcross/habit-of-fate
|
sources/library/HabitOfFate/Quests/DarkLord/Part2/Rogue.hs
|
agpl-3.0
|
conclusion = [outcomes|
= Common Title =
The Final Test
= Common Story =
The Dark Lord says, "Really? Is that the best you can do? Standing there as I
throw attack after attack at you? Soon you will be worn down and victory will be
mine, you pathetic fool!" The Dark Lord throws back his head and gives a mighty
guffaw, followed by making a choking sound. He looks down and sees several
knives protruding from his body. "No... NOOO!!!" the Dark Lord screams as his body
starts to disintegrate; eventually the scream turns into a gurgle and then could
no longer be heard. Nothing remains of the Dark Lord but a pile of ashes on top
of which was a gleaming golden necklace.
"Finally!" thinks the rogue to himself/herself|. "The necklace is now mine, and
selling it will make me a fortune!" He/she| walks over and picks it up from the
ground. Suddenly he/she| has the thought, "Wait... why give this to someone else
to use, when I could use it myself!" He/she| puts on the necklace, and sees gold
as far as the eye could see. All the gold in the world... after all, why settle
for just the gold someone would give him/her| for the necklace when he/she|
could take all the gold in the world for himself/herself!!!
The rogue imagined sending forth vast armies of dark creatures, conquering all
the lands on the map and demanding tribute from each one. He/she| would not be a
picky ruler; all of their gold would suffice, and they could keep most of
everything else--their young men and women, their crops, etc.
= Common Question =
What does the rogue do next?
= Success Choice =
Throw off the necklace.
= Success Title =
The Rogue's Will is Too Strong
= Success Story =
The rogue throws off the necklace. No, this is silly. He/she| has no interest in
ruling or conquest; he/she| just wants to be rich, and selling this necklace
would do just that. Oh, of course, whoever bought it would probably use it for
great evil or something but that really wasn't the rogue's problem.
He/she| carefully places the necklace in a bag of containment so that he/she|
wouldn't touch it by accident, and started making his/her| way home.
= Failure Choice =
Roar in maniacal laughter.
= Failure Title =
A Pull Too Strong to Resist
= Failure Story =
Yes... YES! This is the way it should be! The rogue had worked hard his/her| whole
life to get to this point--surely ruling the world is nothing less than what
he/she| deserves! The rogue cries out, "Servants of the castle, come to me!" All
of the monsters of the castle are compelled to go to the great hall; a short
while later all arrive. The rogue proclaims to them, "Your old lord was
unambitious, settling for just these puny lands, but we shall collect tribute
from every corner of the world!" The prospect of further conquest and oppression
was so exciting that everyone present gave a loud round of applause (to the
extent their appendages allowed), with shouts of applause using voices that
would have driven a sane man or woman to insanity if any were nearby.
The peasants heard the echos of the cries of the monsters and the roar of the
thunder, and saw the rising of the storm, and they were afraid. Who could save
them now?
= Shame =
|'s will was too weak to resist the allure of the Dark Lord's necklage.
|]
| 3,253
|
conclusion = [outcomes|
= Common Title =
The Final Test
= Common Story =
The Dark Lord says, "Really? Is that the best you can do? Standing there as I
throw attack after attack at you? Soon you will be worn down and victory will be
mine, you pathetic fool!" The Dark Lord throws back his head and gives a mighty
guffaw, followed by making a choking sound. He looks down and sees several
knives protruding from his body. "No... NOOO!!!" the Dark Lord screams as his body
starts to disintegrate; eventually the scream turns into a gurgle and then could
no longer be heard. Nothing remains of the Dark Lord but a pile of ashes on top
of which was a gleaming golden necklace.
"Finally!" thinks the rogue to himself/herself|. "The necklace is now mine, and
selling it will make me a fortune!" He/she| walks over and picks it up from the
ground. Suddenly he/she| has the thought, "Wait... why give this to someone else
to use, when I could use it myself!" He/she| puts on the necklace, and sees gold
as far as the eye could see. All the gold in the world... after all, why settle
for just the gold someone would give him/her| for the necklace when he/she|
could take all the gold in the world for himself/herself!!!
The rogue imagined sending forth vast armies of dark creatures, conquering all
the lands on the map and demanding tribute from each one. He/she| would not be a
picky ruler; all of their gold would suffice, and they could keep most of
everything else--their young men and women, their crops, etc.
= Common Question =
What does the rogue do next?
= Success Choice =
Throw off the necklace.
= Success Title =
The Rogue's Will is Too Strong
= Success Story =
The rogue throws off the necklace. No, this is silly. He/she| has no interest in
ruling or conquest; he/she| just wants to be rich, and selling this necklace
would do just that. Oh, of course, whoever bought it would probably use it for
great evil or something but that really wasn't the rogue's problem.
He/she| carefully places the necklace in a bag of containment so that he/she|
wouldn't touch it by accident, and started making his/her| way home.
= Failure Choice =
Roar in maniacal laughter.
= Failure Title =
A Pull Too Strong to Resist
= Failure Story =
Yes... YES! This is the way it should be! The rogue had worked hard his/her| whole
life to get to this point--surely ruling the world is nothing less than what
he/she| deserves! The rogue cries out, "Servants of the castle, come to me!" All
of the monsters of the castle are compelled to go to the great hall; a short
while later all arrive. The rogue proclaims to them, "Your old lord was
unambitious, settling for just these puny lands, but we shall collect tribute
from every corner of the world!" The prospect of further conquest and oppression
was so exciting that everyone present gave a loud round of applause (to the
extent their appendages allowed), with shouts of applause using voices that
would have driven a sane man or woman to insanity if any were nearby.
The peasants heard the echos of the cries of the monsters and the roar of the
thunder, and saw the rising of the storm, and they were afraid. Who could save
them now?
= Shame =
|'s will was too weak to resist the allure of the Dark Lord's necklage.
|]
| 3,253
|
conclusion = [outcomes|
= Common Title =
The Final Test
= Common Story =
The Dark Lord says, "Really? Is that the best you can do? Standing there as I
throw attack after attack at you? Soon you will be worn down and victory will be
mine, you pathetic fool!" The Dark Lord throws back his head and gives a mighty
guffaw, followed by making a choking sound. He looks down and sees several
knives protruding from his body. "No... NOOO!!!" the Dark Lord screams as his body
starts to disintegrate; eventually the scream turns into a gurgle and then could
no longer be heard. Nothing remains of the Dark Lord but a pile of ashes on top
of which was a gleaming golden necklace.
"Finally!" thinks the rogue to himself/herself|. "The necklace is now mine, and
selling it will make me a fortune!" He/she| walks over and picks it up from the
ground. Suddenly he/she| has the thought, "Wait... why give this to someone else
to use, when I could use it myself!" He/she| puts on the necklace, and sees gold
as far as the eye could see. All the gold in the world... after all, why settle
for just the gold someone would give him/her| for the necklace when he/she|
could take all the gold in the world for himself/herself!!!
The rogue imagined sending forth vast armies of dark creatures, conquering all
the lands on the map and demanding tribute from each one. He/she| would not be a
picky ruler; all of their gold would suffice, and they could keep most of
everything else--their young men and women, their crops, etc.
= Common Question =
What does the rogue do next?
= Success Choice =
Throw off the necklace.
= Success Title =
The Rogue's Will is Too Strong
= Success Story =
The rogue throws off the necklace. No, this is silly. He/she| has no interest in
ruling or conquest; he/she| just wants to be rich, and selling this necklace
would do just that. Oh, of course, whoever bought it would probably use it for
great evil or something but that really wasn't the rogue's problem.
He/she| carefully places the necklace in a bag of containment so that he/she|
wouldn't touch it by accident, and started making his/her| way home.
= Failure Choice =
Roar in maniacal laughter.
= Failure Title =
A Pull Too Strong to Resist
= Failure Story =
Yes... YES! This is the way it should be! The rogue had worked hard his/her| whole
life to get to this point--surely ruling the world is nothing less than what
he/she| deserves! The rogue cries out, "Servants of the castle, come to me!" All
of the monsters of the castle are compelled to go to the great hall; a short
while later all arrive. The rogue proclaims to them, "Your old lord was
unambitious, settling for just these puny lands, but we shall collect tribute
from every corner of the world!" The prospect of further conquest and oppression
was so exciting that everyone present gave a loud round of applause (to the
extent their appendages allowed), with shouts of applause using voices that
would have driven a sane man or woman to insanity if any were nearby.
The peasants heard the echos of the cries of the monsters and the roar of the
thunder, and saw the rising of the storm, and they were afraid. Who could save
them now?
= Shame =
|'s will was too weak to resist the allure of the Dark Lord's necklage.
|]
| 3,253
| false
| false
| 1
| 5
| 596
| 14
| 7
| 7
| null | null |
drhodes/jade2hdl
|
src/Jade/Vhdl.hs
|
bsd-3-clause
|
mkValAssign :: JMM.ValAssign -> J T.Text
mkValAssign (JMM.ValAssign src tgt) = "Vhdl.mkValAssign" <? do
srcTxt <- mkValName src
tgtTxt <- mkValName tgt
return $ T.concat [ tgtTxt , T.pack " <= " , srcTxt ]
| 211
|
mkValAssign :: JMM.ValAssign -> J T.Text
mkValAssign (JMM.ValAssign src tgt) = "Vhdl.mkValAssign" <? do
srcTxt <- mkValName src
tgtTxt <- mkValName tgt
return $ T.concat [ tgtTxt , T.pack " <= " , srcTxt ]
| 211
|
mkValAssign (JMM.ValAssign src tgt) = "Vhdl.mkValAssign" <? do
srcTxt <- mkValName src
tgtTxt <- mkValName tgt
return $ T.concat [ tgtTxt , T.pack " <= " , srcTxt ]
| 170
| false
| true
| 0
| 12
| 40
| 85
| 40
| 45
| null | null |
DaMSL/K3
|
src/Language/K3/Runtime/Engine.hs
|
apache-2.0
|
readEBContents (Multiple x _) = if null x then Nothing else Just $ head x
| 73
|
readEBContents (Multiple x _) = if null x then Nothing else Just $ head x
| 73
|
readEBContents (Multiple x _) = if null x then Nothing else Just $ head x
| 73
| false
| false
| 0
| 7
| 14
| 35
| 17
| 18
| null | null |
VictorDenisov/vim-netbeans
|
src/Test/AllTests.hs
|
gpl-2.0
|
printSetDot :: Assertion
printSetDot = "0:setDot!1 10"
@?=
(N.printMessage $ N.CommandMessage (N.BufId 0) 1 $ N.SetDot 10)
| 150
|
printSetDot :: Assertion
printSetDot = "0:setDot!1 10"
@?=
(N.printMessage $ N.CommandMessage (N.BufId 0) 1 $ N.SetDot 10)
| 150
|
printSetDot = "0:setDot!1 10"
@?=
(N.printMessage $ N.CommandMessage (N.BufId 0) 1 $ N.SetDot 10)
| 125
| false
| true
| 0
| 12
| 44
| 48
| 24
| 24
| null | null |
jsavatgy/hatupist
|
hatupist-104.hs
|
gpl-2.0
|
rSpeed mrks =
f01 (speed mrks (intToDouble rDuration))
| 57
|
rSpeed mrks =
f01 (speed mrks (intToDouble rDuration))
| 57
|
rSpeed mrks =
f01 (speed mrks (intToDouble rDuration))
| 57
| false
| false
| 0
| 9
| 10
| 26
| 12
| 14
| null | null |
phaazon/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
|
bsd-3-clause
|
gl_LUMINANCE_ALPHA32F_ARB :: GLenum
gl_LUMINANCE_ALPHA32F_ARB = 0x8819
| 70
|
gl_LUMINANCE_ALPHA32F_ARB :: GLenum
gl_LUMINANCE_ALPHA32F_ARB = 0x8819
| 70
|
gl_LUMINANCE_ALPHA32F_ARB = 0x8819
| 34
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
m-alvarez/jhc
|
drift_processed/Options.hs
|
mit
|
optInis_s v = optInis_u (const v)
| 35
|
optInis_s v = optInis_u (const v)
| 35
|
optInis_s v = optInis_u (const v)
| 35
| false
| false
| 0
| 7
| 7
| 18
| 8
| 10
| null | null |
brendanhay/gogol
|
gogol-alertcenter/gen/Network/Google/AlertCenter/Types/Product.hs
|
mpl-2.0
|
-- | List of alert IDs superseded by this alert. It is used to indicate that
-- this alert is essentially extension of superseded alerts and we found
-- the relationship after creating these alerts.
arSupersededAlerts :: Lens' ActivityRule [Text]
arSupersededAlerts
= lens _arSupersededAlerts
(\ s a -> s{_arSupersededAlerts = a})
. _Default
. _Coerce
| 371
|
arSupersededAlerts :: Lens' ActivityRule [Text]
arSupersededAlerts
= lens _arSupersededAlerts
(\ s a -> s{_arSupersededAlerts = a})
. _Default
. _Coerce
| 172
|
arSupersededAlerts
= lens _arSupersededAlerts
(\ s a -> s{_arSupersededAlerts = a})
. _Default
. _Coerce
| 124
| true
| true
| 0
| 11
| 74
| 55
| 30
| 25
| null | null |
keitax/lupo
|
src/Lupo/Util.hs
|
lgpl-3.0
|
textParam :: MonadSnap m => BS.ByteString -> m T.Text
textParam name = maybe (error "missing param") TE.decodeUtf8 <$> getParam name
| 132
|
textParam :: MonadSnap m => BS.ByteString -> m T.Text
textParam name = maybe (error "missing param") TE.decodeUtf8 <$> getParam name
| 132
|
textParam name = maybe (error "missing param") TE.decodeUtf8 <$> getParam name
| 78
| false
| true
| 0
| 8
| 19
| 52
| 24
| 28
| null | null |
np/hlatex
|
examples/template.hs
|
bsd-3-clause
|
body = B.document <!
tell B.tableofcontents
| 45
|
body = B.document <!
tell B.tableofcontents
| 45
|
body = B.document <!
tell B.tableofcontents
| 45
| false
| false
| 0
| 7
| 7
| 17
| 8
| 9
| null | null |
brendanhay/gogol
|
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
|
mpl-2.0
|
-- | Whether the broadcast is made for kids or not, decided by YouTube
-- instead of the creator. This field is read only.
lbsMadeForKids :: Lens' LiveBroadcastStatus (Maybe Bool)
lbsMadeForKids
= lens _lbsMadeForKids
(\ s a -> s{_lbsMadeForKids = a})
| 259
|
lbsMadeForKids :: Lens' LiveBroadcastStatus (Maybe Bool)
lbsMadeForKids
= lens _lbsMadeForKids
(\ s a -> s{_lbsMadeForKids = a})
| 136
|
lbsMadeForKids
= lens _lbsMadeForKids
(\ s a -> s{_lbsMadeForKids = a})
| 79
| true
| true
| 0
| 9
| 48
| 49
| 26
| 23
| null | null |
juodaspaulius/clafer-old-customBNFC
|
src/Language/Clafer/Comments.hs
|
mit
|
readBlock' :: String -> Integer
-> Integer -> (String -> String)
-> (Pos, String,String)
readBlock' ('*':'/':xs) row col comment = ((Pos row $ col + 2), comment "*/", xs)
| 198
|
readBlock' :: String -> Integer
-> Integer -> (String -> String)
-> (Pos, String,String)
readBlock' ('*':'/':xs) row col comment = ((Pos row $ col + 2), comment "*/", xs)
| 198
|
readBlock' ('*':'/':xs) row col comment = ((Pos row $ col + 2), comment "*/", xs)
| 81
| false
| true
| 0
| 10
| 56
| 89
| 48
| 41
| null | null |
brow/noise
|
src/Text/Noise/Parser.hs
|
mit
|
functionDefStatement :: Parser AST.Statement
functionDefStatement = ranged $ AST.DefinitionStatement
<$> reserved "let"
<*> functionPrototype <* Token.symbol "="
<*> expression
| 182
|
functionDefStatement :: Parser AST.Statement
functionDefStatement = ranged $ AST.DefinitionStatement
<$> reserved "let"
<*> functionPrototype <* Token.symbol "="
<*> expression
| 182
|
functionDefStatement = ranged $ AST.DefinitionStatement
<$> reserved "let"
<*> functionPrototype <* Token.symbol "="
<*> expression
| 137
| false
| true
| 11
| 6
| 24
| 59
| 27
| 32
| null | null |
vladfi1/hs-misc
|
Sudoku.hs
|
mit
|
showNum :: Maybe Number -> String
showNum Nothing = " "
| 55
|
showNum :: Maybe Number -> String
showNum Nothing = " "
| 55
|
showNum Nothing = " "
| 21
| false
| true
| 0
| 6
| 10
| 21
| 10
| 11
| null | null |
michaelficarra/purescript
|
src/Language/PureScript/Docs/RenderedCode/Types.hs
|
mit
|
maybeToContainingModule (Just mn) = OtherModule mn
| 50
|
maybeToContainingModule (Just mn) = OtherModule mn
| 50
|
maybeToContainingModule (Just mn) = OtherModule mn
| 50
| false
| false
| 0
| 7
| 5
| 18
| 8
| 10
| null | null |
potomak/haskell-player
|
src/Sound/Player/AudioPlay.hs
|
bsd-3-clause
|
-- | Sends a @19@ signal to @ph@'s process. If @ph@ is the handle of a running
-- @afplay@ process it will resume playback.
resume :: ProcessHandle -> IO ()
resume ph =
maybe (return ()) (signalProcess 19) =<< getPid ph
| 221
|
resume :: ProcessHandle -> IO ()
resume ph =
maybe (return ()) (signalProcess 19) =<< getPid ph
| 97
|
resume ph =
maybe (return ()) (signalProcess 19) =<< getPid ph
| 64
| true
| true
| 0
| 9
| 42
| 55
| 26
| 29
| null | null |
acowley/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
randomClassKey = mkPreludeClassUnique 31
| 49
|
randomClassKey = mkPreludeClassUnique 31
| 49
|
randomClassKey = mkPreludeClassUnique 31
| 49
| false
| false
| 0
| 5
| 12
| 9
| 4
| 5
| null | null |
tsurucapital/elerea-network
|
example.hs
|
bsd-3-clause
|
main :: IO ()
main = do
args <- getArgs
case args of
("server" : _) -> server
("client" : _) -> client
_ -> error "Specify either 'server' or 'client'"
| 196
|
main :: IO ()
main = do
args <- getArgs
case args of
("server" : _) -> server
("client" : _) -> client
_ -> error "Specify either 'server' or 'client'"
| 196
|
main = do
args <- getArgs
case args of
("server" : _) -> server
("client" : _) -> client
_ -> error "Specify either 'server' or 'client'"
| 182
| false
| true
| 0
| 11
| 75
| 65
| 32
| 33
| null | null |
ihc/futhark
|
src/Futhark/CodeGen/Backends/GenericPython.hs
|
isc
|
compileCode (Imp.If cond tb fb) = do
cond' <- compileExp cond
tb' <- collect $ compileCode tb
fb' <- collect $ compileCode fb
stm $ If cond' tb' fb'
| 156
|
compileCode (Imp.If cond tb fb) = do
cond' <- compileExp cond
tb' <- collect $ compileCode tb
fb' <- collect $ compileCode fb
stm $ If cond' tb' fb'
| 156
|
compileCode (Imp.If cond tb fb) = do
cond' <- compileExp cond
tb' <- collect $ compileCode tb
fb' <- collect $ compileCode fb
stm $ If cond' tb' fb'
| 156
| false
| false
| 0
| 9
| 36
| 73
| 32
| 41
| null | null |
gridaphobe/ghc
|
compiler/coreSyn/CoreUtils.hs
|
bsd-3-clause
|
isDivOp FloatDivOp = True
| 31
|
isDivOp FloatDivOp = True
| 31
|
isDivOp FloatDivOp = True
| 31
| false
| false
| 0
| 5
| 9
| 9
| 4
| 5
| null | null |
lukexi/stack
|
src/Stack/Build/ConstructPlan.hs
|
bsd-3-clause
|
addDep'' :: Bool -- ^ is this being used by a dependency?
-> PackageName -> M (Either ConstructPlanException AddDepRes)
addDep'' treatAsDep name = do
ctx <- ask
case Map.lookup name $ combinedMap ctx of
-- TODO look up in the package index and see if there's a
-- recommendation available
Nothing -> return $ Left $ UnknownPackage name
Just (PIOnlyInstalled loc installed) -> do
let version = installedVersion installed
tellExecutablesUpstream name version loc Map.empty -- slightly hacky, no flags since they likely won't affect executable names
return $ Right $ ADRFound loc version installed
Just (PIOnlySource ps) -> do
tellExecutables name ps
installPackage treatAsDep name ps
Just (PIBoth ps installed) -> do
tellExecutables name ps
needInstall <- checkNeedInstall treatAsDep name ps installed (wanted ctx)
if needInstall
then installPackage treatAsDep name ps
else return $ Right $ ADRFound (piiLocation ps) (piiVersion ps) installed
| 1,133
|
addDep'' :: Bool -- ^ is this being used by a dependency?
-> PackageName -> M (Either ConstructPlanException AddDepRes)
addDep'' treatAsDep name = do
ctx <- ask
case Map.lookup name $ combinedMap ctx of
-- TODO look up in the package index and see if there's a
-- recommendation available
Nothing -> return $ Left $ UnknownPackage name
Just (PIOnlyInstalled loc installed) -> do
let version = installedVersion installed
tellExecutablesUpstream name version loc Map.empty -- slightly hacky, no flags since they likely won't affect executable names
return $ Right $ ADRFound loc version installed
Just (PIOnlySource ps) -> do
tellExecutables name ps
installPackage treatAsDep name ps
Just (PIBoth ps installed) -> do
tellExecutables name ps
needInstall <- checkNeedInstall treatAsDep name ps installed (wanted ctx)
if needInstall
then installPackage treatAsDep name ps
else return $ Right $ ADRFound (piiLocation ps) (piiVersion ps) installed
| 1,133
|
addDep'' treatAsDep name = do
ctx <- ask
case Map.lookup name $ combinedMap ctx of
-- TODO look up in the package index and see if there's a
-- recommendation available
Nothing -> return $ Left $ UnknownPackage name
Just (PIOnlyInstalled loc installed) -> do
let version = installedVersion installed
tellExecutablesUpstream name version loc Map.empty -- slightly hacky, no flags since they likely won't affect executable names
return $ Right $ ADRFound loc version installed
Just (PIOnlySource ps) -> do
tellExecutables name ps
installPackage treatAsDep name ps
Just (PIBoth ps installed) -> do
tellExecutables name ps
needInstall <- checkNeedInstall treatAsDep name ps installed (wanted ctx)
if needInstall
then installPackage treatAsDep name ps
else return $ Right $ ADRFound (piiLocation ps) (piiVersion ps) installed
| 1,004
| false
| true
| 0
| 16
| 334
| 270
| 125
| 145
| null | null |
markus1189/xmonad-contrib-710
|
XMonad/Prompt/DirExec.hs
|
bsd-3-clause
|
econst :: Monad m => a -> IOException -> m a
econst = const . return
| 68
|
econst :: Monad m => a -> IOException -> m a
econst = const . return
| 68
|
econst = const . return
| 23
| false
| true
| 0
| 8
| 15
| 33
| 16
| 17
| null | null |
stephane-rolland/aastraal
|
aastraal-client-brick/src/Command.hs
|
gpl-3.0
|
parseElems ("task-select-parent" : _) = parseTaskSelectParent []
| 64
|
parseElems ("task-select-parent" : _) = parseTaskSelectParent []
| 64
|
parseElems ("task-select-parent" : _) = parseTaskSelectParent []
| 64
| false
| false
| 0
| 6
| 6
| 22
| 10
| 12
| null | null |
TOSPIO/yi
|
src/library/Yi/Rectangle.hs
|
gpl-2.0
|
alignRegion :: T.Text -> BufferM ()
alignRegion str = do
s <- getSelectRegionB >>= unitWiseRegion Line
modifyRegionB (R.fromText . alignText str . R.toText) s
where
regexSplit :: T.Text -> T.Text -> [T.Text]
regexSplit pattern l = case ICU.find (ICU.regex [] pattern) l of
Nothing -> error "regexSplit: text does not match"
Just m -> drop 1 $ ICU.unfold ICU.group m
alignText :: T.Text -> T.Text -> T.Text
alignText regex text = unlines' ls'
where ls, ls' :: [T.Text]
ls = lines' text
columns :: [[T.Text]]
columns = regexSplit regex <$> ls
columnsWidth :: [Int]
columnsWidth = fmap (maximum . fmap T.length) $ transpose columns
columns' :: [[T.Text]]
columns' = fmap (zipWith (`T.justifyLeft` ' ') columnsWidth) columns
ls' = T.concat <$> columns'
-- | Align each line of the region on the given regex.
-- Fails if it is not found in any line.
| 990
|
alignRegion :: T.Text -> BufferM ()
alignRegion str = do
s <- getSelectRegionB >>= unitWiseRegion Line
modifyRegionB (R.fromText . alignText str . R.toText) s
where
regexSplit :: T.Text -> T.Text -> [T.Text]
regexSplit pattern l = case ICU.find (ICU.regex [] pattern) l of
Nothing -> error "regexSplit: text does not match"
Just m -> drop 1 $ ICU.unfold ICU.group m
alignText :: T.Text -> T.Text -> T.Text
alignText regex text = unlines' ls'
where ls, ls' :: [T.Text]
ls = lines' text
columns :: [[T.Text]]
columns = regexSplit regex <$> ls
columnsWidth :: [Int]
columnsWidth = fmap (maximum . fmap T.length) $ transpose columns
columns' :: [[T.Text]]
columns' = fmap (zipWith (`T.justifyLeft` ' ') columnsWidth) columns
ls' = T.concat <$> columns'
-- | Align each line of the region on the given regex.
-- Fails if it is not found in any line.
| 990
|
alignRegion str = do
s <- getSelectRegionB >>= unitWiseRegion Line
modifyRegionB (R.fromText . alignText str . R.toText) s
where
regexSplit :: T.Text -> T.Text -> [T.Text]
regexSplit pattern l = case ICU.find (ICU.regex [] pattern) l of
Nothing -> error "regexSplit: text does not match"
Just m -> drop 1 $ ICU.unfold ICU.group m
alignText :: T.Text -> T.Text -> T.Text
alignText regex text = unlines' ls'
where ls, ls' :: [T.Text]
ls = lines' text
columns :: [[T.Text]]
columns = regexSplit regex <$> ls
columnsWidth :: [Int]
columnsWidth = fmap (maximum . fmap T.length) $ transpose columns
columns' :: [[T.Text]]
columns' = fmap (zipWith (`T.justifyLeft` ' ') columnsWidth) columns
ls' = T.concat <$> columns'
-- | Align each line of the region on the given regex.
-- Fails if it is not found in any line.
| 954
| false
| true
| 25
| 11
| 288
| 319
| 164
| 155
| null | null |
sinelaw/lamdu
|
test/InferTests.hs
|
gpl-3.0
|
testCase name = plusTestOptions defaultTestOptions . HUnitProvider.testCase name
| 80
|
testCase name = plusTestOptions defaultTestOptions . HUnitProvider.testCase name
| 80
|
testCase name = plusTestOptions defaultTestOptions . HUnitProvider.testCase name
| 80
| false
| false
| 0
| 7
| 7
| 21
| 9
| 12
| null | null |
nikivazou/verified_string_matching
|
src/Proofs/emptyIndices.hs
|
bsd-3-clause
|
emptyIndices :: forall (target :: Symbol). (KnownSymbol target) => SM target -> List Integer -> Proof
{-@ emptyIndices :: mi:SM target
-> is:{List (GoodIndex (inputSM mi) target) | is == indicesSM mi && stringLen (inputSM mi) < stringLen target}
-> { is == N } @-}
emptyIndices (SM _ _) N
= trivial
| 336
|
emptyIndices :: forall (target :: Symbol). (KnownSymbol target) => SM target -> List Integer -> Proof
emptyIndices (SM _ _) N
= trivial
| 139
|
emptyIndices (SM _ _) N
= trivial
| 36
| true
| true
| 0
| 9
| 90
| 59
| 31
| 28
| null | null |
myuon/FuncFormat
|
Text/FuncFormat/Internal.hs
|
bsd-3-clause
|
fmString :: Parser Format
fmString = Normal <$> (many1 $ noneOf "{}")
| 69
|
fmString :: Parser Format
fmString = Normal <$> (many1 $ noneOf "{}")
| 69
|
fmString = Normal <$> (many1 $ noneOf "{}")
| 43
| false
| true
| 0
| 8
| 11
| 28
| 14
| 14
| null | null |
elkorn/d20
|
src/D20/Dice.hs
|
mit
|
roll :: Roll -> IO Int
roll theRoll =
fmap (applyModifiers theRoll) $
draw 1 $
fromJust $ sides $ rollDie theRoll
| 119
|
roll :: Roll -> IO Int
roll theRoll =
fmap (applyModifiers theRoll) $
draw 1 $
fromJust $ sides $ rollDie theRoll
| 119
|
roll theRoll =
fmap (applyModifiers theRoll) $
draw 1 $
fromJust $ sides $ rollDie theRoll
| 96
| false
| true
| 0
| 11
| 27
| 52
| 24
| 28
| null | null |
green-haskell/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
gHC_READ = mkBaseModule (fsLit "GHC.Read")
| 49
|
gHC_READ = mkBaseModule (fsLit "GHC.Read")
| 49
|
gHC_READ = mkBaseModule (fsLit "GHC.Read")
| 49
| false
| false
| 0
| 7
| 11
| 15
| 7
| 8
| null | null |
snoyberg/photosorter
|
fay/Language/Fay/JQuery.hs
|
bsd-2-clause
|
parents :: JQuery -> Fay JQuery
parents = ffi "%1['parents']()"
| 63
|
parents :: JQuery -> Fay JQuery
parents = ffi "%1['parents']()"
| 63
|
parents = ffi "%1['parents']()"
| 31
| false
| true
| 0
| 6
| 9
| 21
| 10
| 11
| null | null |
bovinespirit/enummapmap
|
Data/EnumMapSet/Base.hs
|
bsd-3-clause
|
lowestBitMask :: Nat -> Nat
lowestBitMask x = x .&. negate x
| 60
|
lowestBitMask :: Nat -> Nat
lowestBitMask x = x .&. negate x
| 60
|
lowestBitMask x = x .&. negate x
| 32
| false
| true
| 0
| 6
| 11
| 25
| 12
| 13
| null | null |
ezyang/ghc
|
compiler/nativeGen/PPC/Regs.hs
|
bsd-3-clause
|
argRegs 3 = map regSingle [3..5]
| 32
|
argRegs 3 = map regSingle [3..5]
| 32
|
argRegs 3 = map regSingle [3..5]
| 32
| false
| false
| 0
| 6
| 5
| 19
| 9
| 10
| null | null |
vedgar/mlr
|
2016 Kolokvij/Z3.hs
|
unlicense
|
test1 = tally (p[x] & fa x (q[f[x1,y],x]))
| 42
|
test1 = tally (p[x] & fa x (q[f[x1,y],x]))
| 42
|
test1 = tally (p[x] & fa x (q[f[x1,y],x]))
| 42
| false
| false
| 0
| 13
| 7
| 48
| 25
| 23
| null | null |
sethfowler/pygmalion
|
tools/Pygmalion.hs
|
bsd-3-clause
|
parseArgs c wd ["inclusions", f] = asSourceFile wd f >>= printInclusions c
| 74
|
parseArgs c wd ["inclusions", f] = asSourceFile wd f >>= printInclusions c
| 74
|
parseArgs c wd ["inclusions", f] = asSourceFile wd f >>= printInclusions c
| 74
| false
| false
| 0
| 6
| 11
| 31
| 15
| 16
| null | null |
ozgurakgun/Idris-dev
|
src/Idris/Core/TT.hs
|
bsd-3-clause
|
isInjective (Bind _ (Pi _ _ _) sc) = True
| 41
|
isInjective (Bind _ (Pi _ _ _) sc) = True
| 41
|
isInjective (Bind _ (Pi _ _ _) sc) = True
| 41
| false
| false
| 0
| 8
| 9
| 30
| 14
| 16
| null | null |
Axure/elm-compiler
|
src/Elm/Utils.hs
|
bsd-3-clause
|
{-| Run a command, throw an error if the command is not found or if something
goes wrong.
-}
run :: (MonadError String m, MonadIO m) => String -> [String] -> m String
run command args =
do result <- liftIO (unwrappedRun command args)
case result of
Right out -> return out
Left err ->
throwError (context (message err))
where
context msg =
"failure when running:" ++ concatMap (' ':) (command:args) ++ "\n" ++ msg
message err =
case err of
CommandFailed stderr stdout ->
stdout ++ stderr
MissingExe msg ->
msg
| 603
|
run :: (MonadError String m, MonadIO m) => String -> [String] -> m String
run command args =
do result <- liftIO (unwrappedRun command args)
case result of
Right out -> return out
Left err ->
throwError (context (message err))
where
context msg =
"failure when running:" ++ concatMap (' ':) (command:args) ++ "\n" ++ msg
message err =
case err of
CommandFailed stderr stdout ->
stdout ++ stderr
MissingExe msg ->
msg
| 510
|
run command args =
do result <- liftIO (unwrappedRun command args)
case result of
Right out -> return out
Left err ->
throwError (context (message err))
where
context msg =
"failure when running:" ++ concatMap (' ':) (command:args) ++ "\n" ++ msg
message err =
case err of
CommandFailed stderr stdout ->
stdout ++ stderr
MissingExe msg ->
msg
| 436
| true
| true
| 2
| 14
| 185
| 195
| 90
| 105
| null | null |
ksaveljev/hake-2
|
src/Server/SVGame.hs
|
bsd-3-clause
|
writeByte :: Int -> Quake ()
writeByte c = MSG.writeByteI (svGlobals.svServer.sMulticast) c
| 91
|
writeByte :: Int -> Quake ()
writeByte c = MSG.writeByteI (svGlobals.svServer.sMulticast) c
| 91
|
writeByte c = MSG.writeByteI (svGlobals.svServer.sMulticast) c
| 62
| false
| true
| 0
| 8
| 11
| 37
| 18
| 19
| null | null |
beni55/hermit
|
src/HERMIT/Dictionary/Reasoning.hs
|
bsd-2-clause
|
getLemmaByNameT :: (LemmaContext c, HasLemmas m, Monad m) => LemmaName -> Transform c m x Lemma
getLemmaByNameT nm = getLemmasT >>= maybe (fail $ "No lemma named: " ++ show nm) return . Map.lookup nm
| 199
|
getLemmaByNameT :: (LemmaContext c, HasLemmas m, Monad m) => LemmaName -> Transform c m x Lemma
getLemmaByNameT nm = getLemmasT >>= maybe (fail $ "No lemma named: " ++ show nm) return . Map.lookup nm
| 199
|
getLemmaByNameT nm = getLemmasT >>= maybe (fail $ "No lemma named: " ++ show nm) return . Map.lookup nm
| 103
| false
| true
| 2
| 9
| 34
| 86
| 41
| 45
| null | null |
WraithM/prosper
|
src/Prosper/Internal/Request.hs
|
bsd-3-clause
|
apiUrl :: ByteString
apiUrl = "api.prosper.com"
| 47
|
apiUrl :: ByteString
apiUrl = "api.prosper.com"
| 47
|
apiUrl = "api.prosper.com"
| 26
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
wavewave/lhc-analysis-collection
|
analysis/atlas0l26j.hs
|
gpl-3.0
|
--
main = do
xs <- mapM go [1..10]
let lst = (concat . map srFlag2Num . concatMap snd) xs
lst2 = map (\x->(x,1)) lst
lst3 = foldr (\(k,v) m->M.insertWith (+) k v m) M.empty lst2
-- (print . sum . map fst) xs
putStr (showAsATLASPaper . fmap ((*1.979) . fromIntegral ) $ lst3)
-- print . foldr (\k -> M.insertWith (+) k ) empty . map snd $ xs
| 374
|
main = do
xs <- mapM go [1..10]
let lst = (concat . map srFlag2Num . concatMap snd) xs
lst2 = map (\x->(x,1)) lst
lst3 = foldr (\(k,v) m->M.insertWith (+) k v m) M.empty lst2
-- (print . sum . map fst) xs
putStr (showAsATLASPaper . fmap ((*1.979) . fromIntegral ) $ lst3)
-- print . foldr (\k -> M.insertWith (+) k ) empty . map snd $ xs
| 368
|
main = do
xs <- mapM go [1..10]
let lst = (concat . map srFlag2Num . concatMap snd) xs
lst2 = map (\x->(x,1)) lst
lst3 = foldr (\(k,v) m->M.insertWith (+) k v m) M.empty lst2
-- (print . sum . map fst) xs
putStr (showAsATLASPaper . fmap ((*1.979) . fromIntegral ) $ lst3)
-- print . foldr (\k -> M.insertWith (+) k ) empty . map snd $ xs
| 368
| true
| false
| 0
| 14
| 103
| 153
| 81
| 72
| null | null |
jean-edouard/manager
|
upgrade-db/JSONTrees.hs
|
gpl-2.0
|
jsCp :: String -> String -> Tree -> Tree
jsCp from to tree =
case jsGet from tree of
Nothing -> tree
Just src -> jsSet to src tree
| 147
|
jsCp :: String -> String -> Tree -> Tree
jsCp from to tree =
case jsGet from tree of
Nothing -> tree
Just src -> jsSet to src tree
| 147
|
jsCp from to tree =
case jsGet from tree of
Nothing -> tree
Just src -> jsSet to src tree
| 106
| false
| true
| 0
| 9
| 45
| 66
| 30
| 36
| null | null |
ianclement/dzen-utils
|
System/Dzen/Padding.hs
|
gpl-3.0
|
chopR :: Transform a => Int -> (a -> a)
chopR = chop ChopRight
| 62
|
chopR :: Transform a => Int -> (a -> a)
chopR = chop ChopRight
| 62
|
chopR = chop ChopRight
| 22
| false
| true
| 0
| 10
| 13
| 39
| 17
| 22
| null | null |
facebook/fbthrift
|
thrift/compiler/test/fixtures/namespace/gen-hs/My/Namespacing/Test/HsTestService.hs
|
apache-2.0
|
-- | 'TypeMap' for the 'Init_result' struct
typemap_Init_result :: Types.TypeMap
typemap_Init_result = Map.fromList [("success",(0,Types.T_I64))]
| 145
|
typemap_Init_result :: Types.TypeMap
typemap_Init_result = Map.fromList [("success",(0,Types.T_I64))]
| 101
|
typemap_Init_result = Map.fromList [("success",(0,Types.T_I64))]
| 64
| true
| true
| 0
| 9
| 13
| 42
| 22
| 20
| null | null |
ddssff/pandoc
|
src/Text/Pandoc/Readers/LaTeX.hs
|
gpl-2.0
|
dot 'Z' = "Ż"
| 13
|
dot 'Z' = "Ż"
| 13
|
dot 'Z' = "Ż"
| 13
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
kwibus/myLang
|
tests/TestEval.hs
|
bsd-3-clause
|
testEvalUtils :: TestTree
testEvalUtils = testGroup "eval utils"
[ testProperty "d1ToBruijnl (incFreeD1 5 d1) == incFreeOfset 5 (d1ToBruijn d1)" $
forAll genD1 $ \d1 ->
d1ToBruijn (incFreeD1 5 (d1::D1)) === incFree 5 (d1ToBruijn d1)
, testProperty "test GenD1" $
forAll genD1 $ \d1 ->
case d1 of
(Closure defs _ _) -> all (\d -> 0 <length d )defs
_ -> True
, testCase "incFreeD1 5 (D1 [[01234,1234][01234,01234]] 01234)" $
let app1234 = bvar 0 `appl` bvar 1 `appl` bvar 2 `appl` bvar 3 `appl` bvar 4
d1app1234 = Closure [] (Name "a") app1234
d1 = Closure [[def "a" d1app1234, def "b" d1app1234],[def "c" d1app1234,def "d" d1app1234]] (Name "a")app1234
in d1ToBruijn (incFreeD1 5 d1 ) @?= incFree 5 ( d1ToBruijn d1)
]
| 793
|
testEvalUtils :: TestTree
testEvalUtils = testGroup "eval utils"
[ testProperty "d1ToBruijnl (incFreeD1 5 d1) == incFreeOfset 5 (d1ToBruijn d1)" $
forAll genD1 $ \d1 ->
d1ToBruijn (incFreeD1 5 (d1::D1)) === incFree 5 (d1ToBruijn d1)
, testProperty "test GenD1" $
forAll genD1 $ \d1 ->
case d1 of
(Closure defs _ _) -> all (\d -> 0 <length d )defs
_ -> True
, testCase "incFreeD1 5 (D1 [[01234,1234][01234,01234]] 01234)" $
let app1234 = bvar 0 `appl` bvar 1 `appl` bvar 2 `appl` bvar 3 `appl` bvar 4
d1app1234 = Closure [] (Name "a") app1234
d1 = Closure [[def "a" d1app1234, def "b" d1app1234],[def "c" d1app1234,def "d" d1app1234]] (Name "a")app1234
in d1ToBruijn (incFreeD1 5 d1 ) @?= incFree 5 ( d1ToBruijn d1)
]
| 793
|
testEvalUtils = testGroup "eval utils"
[ testProperty "d1ToBruijnl (incFreeD1 5 d1) == incFreeOfset 5 (d1ToBruijn d1)" $
forAll genD1 $ \d1 ->
d1ToBruijn (incFreeD1 5 (d1::D1)) === incFree 5 (d1ToBruijn d1)
, testProperty "test GenD1" $
forAll genD1 $ \d1 ->
case d1 of
(Closure defs _ _) -> all (\d -> 0 <length d )defs
_ -> True
, testCase "incFreeD1 5 (D1 [[01234,1234][01234,01234]] 01234)" $
let app1234 = bvar 0 `appl` bvar 1 `appl` bvar 2 `appl` bvar 3 `appl` bvar 4
d1app1234 = Closure [] (Name "a") app1234
d1 = Closure [[def "a" d1app1234, def "b" d1app1234],[def "c" d1app1234,def "d" d1app1234]] (Name "a")app1234
in d1ToBruijn (incFreeD1 5 d1 ) @?= incFree 5 ( d1ToBruijn d1)
]
| 767
| false
| true
| 0
| 16
| 198
| 308
| 152
| 156
| null | null |
kim/amazonka
|
amazonka-storagegateway/gen/Network/AWS/StorageGateway/ListVolumes.hs
|
mpl-2.0
|
-- | A string that indicates the position at which to begin the returned list of
-- volumes. Obtain the marker from the response of a previous List iSCSI Volumes
-- request.
lvMarker :: Lens' ListVolumes (Maybe Text)
lvMarker = lens _lvMarker (\s a -> s { _lvMarker = a })
| 272
|
lvMarker :: Lens' ListVolumes (Maybe Text)
lvMarker = lens _lvMarker (\s a -> s { _lvMarker = a })
| 98
|
lvMarker = lens _lvMarker (\s a -> s { _lvMarker = a })
| 55
| true
| true
| 0
| 9
| 50
| 48
| 27
| 21
| null | null |
tomgr/webcspm
|
src/Site.hs
|
bsd-3-clause
|
blockCSPMSplice :: SnapletSplice b App
blockCSPMSplice = do
node <- liftHeist $ getParamNode
syntaxFile <- gets _cspmSynytaxFile
return $ sourceCodeNode syntaxFile (X.getAttribute "id" node) (M.fromList []) $
case X.childElementTag "script" node of
Just n -> T.unpack $ X.nodeText $ n
Nothing -> T.unpack $ X.nodeText $ node
| 368
|
blockCSPMSplice :: SnapletSplice b App
blockCSPMSplice = do
node <- liftHeist $ getParamNode
syntaxFile <- gets _cspmSynytaxFile
return $ sourceCodeNode syntaxFile (X.getAttribute "id" node) (M.fromList []) $
case X.childElementTag "script" node of
Just n -> T.unpack $ X.nodeText $ n
Nothing -> T.unpack $ X.nodeText $ node
| 368
|
blockCSPMSplice = do
node <- liftHeist $ getParamNode
syntaxFile <- gets _cspmSynytaxFile
return $ sourceCodeNode syntaxFile (X.getAttribute "id" node) (M.fromList []) $
case X.childElementTag "script" node of
Just n -> T.unpack $ X.nodeText $ n
Nothing -> T.unpack $ X.nodeText $ node
| 329
| false
| true
| 0
| 13
| 90
| 125
| 59
| 66
| null | null |
tomahawkins/trs
|
attic/PIC/Compiler.hs
|
bsd-3-clause
|
codeRules :: Int -> (Reg -> Address) -> (Expr -> Address) -> [Instruction] -> [Rule] -> [Instruction]
codeRules dataWidth regAddr exprAddr assertInstrs rules = ruleInstrs ++ [GOTO (0 - length ruleInstrs)]
where
ruleInstrs = concatMap codeRule rules
codeRule :: Rule -> [Instruction]
codeRule (Rule _ condition action) = assertInstrs ++ ruleInstrs
where
conditionInstrs = concatMap (codeExpr dataWidth exprAddr) (topological [condition])
assigns = regsAssigned action
(_,assignExprs) = unzip assigns
actionExprInstrs = concatMap (codeExpr dataWidth exprAddr) (topological assignExprs)
actionAssignInstrs = concatMap codeAssign assigns
actionInstrs = actionExprInstrs ++ actionAssignInstrs
ruleInstrs = conditionInstrs ++ [BTFSS (exprAddr condition) 0, GOTO (length actionInstrs + 1)] ++ actionInstrs
codeAssign :: (Reg,Expr) -> [Instruction]
codeAssign (reg,expr) = instrs
where
words = wordCount dataWidth (width reg)
instrs = move words (regAddr reg) (exprAddr expr)
| 1,024
|
codeRules :: Int -> (Reg -> Address) -> (Expr -> Address) -> [Instruction] -> [Rule] -> [Instruction]
codeRules dataWidth regAddr exprAddr assertInstrs rules = ruleInstrs ++ [GOTO (0 - length ruleInstrs)]
where
ruleInstrs = concatMap codeRule rules
codeRule :: Rule -> [Instruction]
codeRule (Rule _ condition action) = assertInstrs ++ ruleInstrs
where
conditionInstrs = concatMap (codeExpr dataWidth exprAddr) (topological [condition])
assigns = regsAssigned action
(_,assignExprs) = unzip assigns
actionExprInstrs = concatMap (codeExpr dataWidth exprAddr) (topological assignExprs)
actionAssignInstrs = concatMap codeAssign assigns
actionInstrs = actionExprInstrs ++ actionAssignInstrs
ruleInstrs = conditionInstrs ++ [BTFSS (exprAddr condition) 0, GOTO (length actionInstrs + 1)] ++ actionInstrs
codeAssign :: (Reg,Expr) -> [Instruction]
codeAssign (reg,expr) = instrs
where
words = wordCount dataWidth (width reg)
instrs = move words (regAddr reg) (exprAddr expr)
| 1,024
|
codeRules dataWidth regAddr exprAddr assertInstrs rules = ruleInstrs ++ [GOTO (0 - length ruleInstrs)]
where
ruleInstrs = concatMap codeRule rules
codeRule :: Rule -> [Instruction]
codeRule (Rule _ condition action) = assertInstrs ++ ruleInstrs
where
conditionInstrs = concatMap (codeExpr dataWidth exprAddr) (topological [condition])
assigns = regsAssigned action
(_,assignExprs) = unzip assigns
actionExprInstrs = concatMap (codeExpr dataWidth exprAddr) (topological assignExprs)
actionAssignInstrs = concatMap codeAssign assigns
actionInstrs = actionExprInstrs ++ actionAssignInstrs
ruleInstrs = conditionInstrs ++ [BTFSS (exprAddr condition) 0, GOTO (length actionInstrs + 1)] ++ actionInstrs
codeAssign :: (Reg,Expr) -> [Instruction]
codeAssign (reg,expr) = instrs
where
words = wordCount dataWidth (width reg)
instrs = move words (regAddr reg) (exprAddr expr)
| 922
| false
| true
| 0
| 11
| 181
| 346
| 180
| 166
| null | null |
zinfra/khan
|
khan/src/Khan/Model/IAM/ServerCertificate.hs
|
mpl-2.0
|
delete :: Text -> AWS ()
delete dom = do
say "Deleting Certificate {}" [dom]
send_ (DeleteServerCertificate dom)
| 120
|
delete :: Text -> AWS ()
delete dom = do
say "Deleting Certificate {}" [dom]
send_ (DeleteServerCertificate dom)
| 120
|
delete dom = do
say "Deleting Certificate {}" [dom]
send_ (DeleteServerCertificate dom)
| 95
| false
| true
| 0
| 10
| 25
| 50
| 22
| 28
| null | null |
NCrashed/hjass
|
src/library/Language/Jass/JIT/Calling.hs
|
mit
|
callFunc3 exModule funcName funcMaker arg1 arg2 arg3 = callFunc exModule funcName $ \ptr -> liftIO $ (funcMaker $ castFunPtr ptr) arg1 arg2 arg3
| 144
|
callFunc3 exModule funcName funcMaker arg1 arg2 arg3 = callFunc exModule funcName $ \ptr -> liftIO $ (funcMaker $ castFunPtr ptr) arg1 arg2 arg3
| 144
|
callFunc3 exModule funcName funcMaker arg1 arg2 arg3 = callFunc exModule funcName $ \ptr -> liftIO $ (funcMaker $ castFunPtr ptr) arg1 arg2 arg3
| 144
| false
| false
| 0
| 11
| 22
| 54
| 26
| 28
| null | null |
JacksonGariety/euler.hs
|
050.hs
|
bsd-3-clause
|
main :: IO ()
main = print . consecutivePrimeSum $ 1000000
| 58
|
main :: IO ()
main = print . consecutivePrimeSum $ 1000000
| 58
|
main = print . consecutivePrimeSum $ 1000000
| 44
| false
| true
| 1
| 6
| 10
| 28
| 12
| 16
| null | null |
ekmett/transients
|
src/Data/Transient/Primitive/SmallArray.hs
|
bsd-2-clause
|
cloneSmallArray (SmallArray arr#) (I# off#) (I# len#)
= case cloneSmallArray# arr# off# len# of arr'# -> SmallArray arr'#
-- | Return a newly allocated SmallMutableArray. with the specified subrange of
-- the provided SmallMutableArray. The provided SmallMutableArray should contain the
-- full subrange specified by the two Ints, but this is not checked.
| 358
|
cloneSmallArray (SmallArray arr#) (I# off#) (I# len#)
= case cloneSmallArray# arr# off# len# of arr'# -> SmallArray arr'#
-- | Return a newly allocated SmallMutableArray. with the specified subrange of
-- the provided SmallMutableArray. The provided SmallMutableArray should contain the
-- full subrange specified by the two Ints, but this is not checked.
| 358
|
cloneSmallArray (SmallArray arr#) (I# off#) (I# len#)
= case cloneSmallArray# arr# off# len# of arr'# -> SmallArray arr'#
-- | Return a newly allocated SmallMutableArray. with the specified subrange of
-- the provided SmallMutableArray. The provided SmallMutableArray should contain the
-- full subrange specified by the two Ints, but this is not checked.
| 358
| false
| false
| 0
| 8
| 55
| 54
| 27
| 27
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.