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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tolysz/hs-tls
|
core/Network/TLS/Extra/Cipher.hs
|
bsd-3-clause
|
tripledes_iv :: BulkIV -> IV DES_EDE3
tripledes_iv iv = maybe (error "tripledes cipher iv internal error") id $ makeIV iv
| 121
|
tripledes_iv :: BulkIV -> IV DES_EDE3
tripledes_iv iv = maybe (error "tripledes cipher iv internal error") id $ makeIV iv
| 121
|
tripledes_iv iv = maybe (error "tripledes cipher iv internal error") id $ makeIV iv
| 83
| false
| true
| 0
| 8
| 19
| 39
| 18
| 21
| null | null |
isomorphism/csound-expression
|
src/Csound/Air/Live.hs
|
bsd-3-clause
|
-- | The flanger widget. The arguments are
--
-- > uiFlanger isOn mix feedback rate depth delay
uiFlanger :: Bool -> Double -> Double -> Double -> Double -> Double -> Source FxFun
uiFlanger isOn mix fback rate depth delay = sourceColor2 C.indigo $ fxBox "Flanger" fxFlanger2 isOn
[("mix", mix), ("fback", fback), ("rate",rate), ("depth",depth), ("delay",delay)]
| 365
|
uiFlanger :: Bool -> Double -> Double -> Double -> Double -> Double -> Source FxFun
uiFlanger isOn mix fback rate depth delay = sourceColor2 C.indigo $ fxBox "Flanger" fxFlanger2 isOn
[("mix", mix), ("fback", fback), ("rate",rate), ("depth",depth), ("delay",delay)]
| 269
|
uiFlanger isOn mix fback rate depth delay = sourceColor2 C.indigo $ fxBox "Flanger" fxFlanger2 isOn
[("mix", mix), ("fback", fback), ("rate",rate), ("depth",depth), ("delay",delay)]
| 185
| true
| true
| 0
| 11
| 59
| 117
| 66
| 51
| null | null |
dcreager/cabal
|
Distribution/Simple/Program.hs
|
bsd-3-clause
|
-- | Like 'userSpecifyPath' but for a list of progs and their paths.
--
userSpecifyPaths :: [(String, FilePath)]
-> ProgramConfiguration
-> ProgramConfiguration
userSpecifyPaths paths conf =
foldl' (\conf' (prog, path) -> userSpecifyPath prog path conf') conf paths
| 301
|
userSpecifyPaths :: [(String, FilePath)]
-> ProgramConfiguration
-> ProgramConfiguration
userSpecifyPaths paths conf =
foldl' (\conf' (prog, path) -> userSpecifyPath prog path conf') conf paths
| 229
|
userSpecifyPaths paths conf =
foldl' (\conf' (prog, path) -> userSpecifyPath prog path conf') conf paths
| 106
| true
| true
| 0
| 8
| 72
| 71
| 37
| 34
| null | null |
lordi/flowskell
|
src/Flowskell/Lib/GL.hs
|
gpl-2.0
|
doPop [] = glPopMatrix >> return (Bool True)
| 44
|
doPop [] = glPopMatrix >> return (Bool True)
| 44
|
doPop [] = glPopMatrix >> return (Bool True)
| 44
| false
| false
| 3
| 6
| 7
| 28
| 11
| 17
| null | null |
Siprj/mmum
|
src/Img.hs
|
bsd-3-clause
|
toDpcm :: YCbCr a -> YCbCr a
toDpcm YCbCr{..} = YCbCr
{ y = y * m
, cB = cB * m
, cR = cR * m
}
where
m = generateDpcmCoderMatrix (nrows y)
| 161
|
toDpcm :: YCbCr a -> YCbCr a
toDpcm YCbCr{..} = YCbCr
{ y = y * m
, cB = cB * m
, cR = cR * m
}
where
m = generateDpcmCoderMatrix (nrows y)
| 161
|
toDpcm YCbCr{..} = YCbCr
{ y = y * m
, cB = cB * m
, cR = cR * m
}
where
m = generateDpcmCoderMatrix (nrows y)
| 132
| false
| true
| 10
| 8
| 57
| 87
| 42
| 45
| null | null |
johanneshilden/liquid-epsilon
|
Util/HTML.hs
|
bsd-3-clause
|
parent :: String -> String -> String -> String -> Html -> Html
parent = Parent
| 78
|
parent :: String -> String -> String -> String -> Html -> Html
parent = Parent
| 78
|
parent = Parent
| 15
| false
| true
| 0
| 9
| 15
| 31
| 16
| 15
| null | null |
jameshales/voltorb-flip
|
src/PartialBoard.hs
|
bsd-3-clause
|
-- Tests whether the PartialBoard has flipped all of the non-trivial Tiles in
-- the given Board.
isCompleteWith :: PartialBoard -> Board -> Bool
isCompleteWith pb b = all (\p -> maybeTileAt pb p == Just (tileAt b p)) $ findRequiredTiles b
| 240
|
isCompleteWith :: PartialBoard -> Board -> Bool
isCompleteWith pb b = all (\p -> maybeTileAt pb p == Just (tileAt b p)) $ findRequiredTiles b
| 142
|
isCompleteWith pb b = all (\p -> maybeTileAt pb p == Just (tileAt b p)) $ findRequiredTiles b
| 94
| true
| true
| 0
| 12
| 42
| 64
| 32
| 32
| null | null |
fffej/HS-Poker
|
LookupPatternMatch.hs
|
bsd-3-clause
|
getValueFromProduct 48807 = 5896
| 32
|
getValueFromProduct 48807 = 5896
| 32
|
getValueFromProduct 48807 = 5896
| 32
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
tonyday567/maths-extended
|
src/Data/Histogram/Util.hs
|
mit
|
pdfBinLaplace _ _ = mempty
| 26
|
pdfBinLaplace _ _ = mempty
| 26
|
pdfBinLaplace _ _ = mempty
| 26
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
beni55/LambdaHack
|
Game/LambdaHack/Server/LoopServer.hs
|
bsd-3-clause
|
applyPeriodicLevel :: (MonadAtomic m, MonadServer m) => LevelId -> m ()
applyPeriodicLevel lid = do
discoEffect <- getsServer sdiscoEffect
let applyPeriodicItem c aid iid =
case EM.lookup iid discoEffect of
Just ItemAspectEffect{jeffects, jaspects} ->
when (IK.Periodic `elem` jaspects) $ do
-- Check if the item is still in the bag (previous items act!).
bag <- getsState $ getCBag c
case iid `EM.lookup` bag of
Nothing -> return () -- item dropped
Just kit ->
-- In periodic activation, consider *only* recharging effects.
effectAndDestroy aid aid iid c True
(allRecharging jeffects) jaspects kit
_ -> assert `failure` (lid, aid, c, iid)
applyPeriodicCStore aid cstore = do
let c = CActor aid cstore
bag <- getsState $ getCBag c
mapM_ (applyPeriodicItem c aid) $ EM.keys bag
applyPeriodicActor aid = do
applyPeriodicCStore aid COrgan
applyPeriodicCStore aid CEqp
allActors <- getsState $ actorRegularAssocs (const True) lid
mapM_ (\(aid, _) -> applyPeriodicActor aid) allActors
-- | Perform moves for individual actors, as long as there are actors
-- with the next move time less or equal to the end of current cut-off.
| 1,368
|
applyPeriodicLevel :: (MonadAtomic m, MonadServer m) => LevelId -> m ()
applyPeriodicLevel lid = do
discoEffect <- getsServer sdiscoEffect
let applyPeriodicItem c aid iid =
case EM.lookup iid discoEffect of
Just ItemAspectEffect{jeffects, jaspects} ->
when (IK.Periodic `elem` jaspects) $ do
-- Check if the item is still in the bag (previous items act!).
bag <- getsState $ getCBag c
case iid `EM.lookup` bag of
Nothing -> return () -- item dropped
Just kit ->
-- In periodic activation, consider *only* recharging effects.
effectAndDestroy aid aid iid c True
(allRecharging jeffects) jaspects kit
_ -> assert `failure` (lid, aid, c, iid)
applyPeriodicCStore aid cstore = do
let c = CActor aid cstore
bag <- getsState $ getCBag c
mapM_ (applyPeriodicItem c aid) $ EM.keys bag
applyPeriodicActor aid = do
applyPeriodicCStore aid COrgan
applyPeriodicCStore aid CEqp
allActors <- getsState $ actorRegularAssocs (const True) lid
mapM_ (\(aid, _) -> applyPeriodicActor aid) allActors
-- | Perform moves for individual actors, as long as there are actors
-- with the next move time less or equal to the end of current cut-off.
| 1,368
|
applyPeriodicLevel lid = do
discoEffect <- getsServer sdiscoEffect
let applyPeriodicItem c aid iid =
case EM.lookup iid discoEffect of
Just ItemAspectEffect{jeffects, jaspects} ->
when (IK.Periodic `elem` jaspects) $ do
-- Check if the item is still in the bag (previous items act!).
bag <- getsState $ getCBag c
case iid `EM.lookup` bag of
Nothing -> return () -- item dropped
Just kit ->
-- In periodic activation, consider *only* recharging effects.
effectAndDestroy aid aid iid c True
(allRecharging jeffects) jaspects kit
_ -> assert `failure` (lid, aid, c, iid)
applyPeriodicCStore aid cstore = do
let c = CActor aid cstore
bag <- getsState $ getCBag c
mapM_ (applyPeriodicItem c aid) $ EM.keys bag
applyPeriodicActor aid = do
applyPeriodicCStore aid COrgan
applyPeriodicCStore aid CEqp
allActors <- getsState $ actorRegularAssocs (const True) lid
mapM_ (\(aid, _) -> applyPeriodicActor aid) allActors
-- | Perform moves for individual actors, as long as there are actors
-- with the next move time less or equal to the end of current cut-off.
| 1,296
| false
| true
| 0
| 21
| 423
| 344
| 168
| 176
| null | null |
mbakke/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
ispecsMin :: String
ispecsMin = "min"
| 37
|
ispecsMin :: String
ispecsMin = "min"
| 37
|
ispecsMin = "min"
| 17
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
allanderek/ipclib
|
Ipc/DrawGraph.hs
|
gpl-2.0
|
getPlottingFunction :: Graph -> [ Gnuplot.Attribute ] -> IO ()
getPlottingFunction graph attributes =
case graphData graph of
LineGraph glines ->
Gnuplot.plotPathsStyle attributes $ map makeGnuLine glines
SGraph sgraph ->plotSurfaces (sgraphSurfaces sgraph)
(sgraphView sgraph)
where
plotSurfaces :: [ Surface ] -> Maybe (Int, Int, Int, Int) -> IO ()
plotSurfaces [ gsurf ] mView =
Gnuplot.plotMesh3d allAttributes [] $ makeGnuSurface gsurf
where
allAttributes = attributes ++ (viewAttributes mView)
viewAttributes Nothing = []
viewAttributes (Just (a,b,c,d)) =
[ Gnuplot.Custom "view" [ viewArgs ] ]
where
viewArgs = intercalate "," [ show a
, show b
, show c
, show d
]
plotSurfaces _ _mView =
error "Unimplemented multiple surface graphs"
| 1,002
|
getPlottingFunction :: Graph -> [ Gnuplot.Attribute ] -> IO ()
getPlottingFunction graph attributes =
case graphData graph of
LineGraph glines ->
Gnuplot.plotPathsStyle attributes $ map makeGnuLine glines
SGraph sgraph ->plotSurfaces (sgraphSurfaces sgraph)
(sgraphView sgraph)
where
plotSurfaces :: [ Surface ] -> Maybe (Int, Int, Int, Int) -> IO ()
plotSurfaces [ gsurf ] mView =
Gnuplot.plotMesh3d allAttributes [] $ makeGnuSurface gsurf
where
allAttributes = attributes ++ (viewAttributes mView)
viewAttributes Nothing = []
viewAttributes (Just (a,b,c,d)) =
[ Gnuplot.Custom "view" [ viewArgs ] ]
where
viewArgs = intercalate "," [ show a
, show b
, show c
, show d
]
plotSurfaces _ _mView =
error "Unimplemented multiple surface graphs"
| 1,002
|
getPlottingFunction graph attributes =
case graphData graph of
LineGraph glines ->
Gnuplot.plotPathsStyle attributes $ map makeGnuLine glines
SGraph sgraph ->plotSurfaces (sgraphSurfaces sgraph)
(sgraphView sgraph)
where
plotSurfaces :: [ Surface ] -> Maybe (Int, Int, Int, Int) -> IO ()
plotSurfaces [ gsurf ] mView =
Gnuplot.plotMesh3d allAttributes [] $ makeGnuSurface gsurf
where
allAttributes = attributes ++ (viewAttributes mView)
viewAttributes Nothing = []
viewAttributes (Just (a,b,c,d)) =
[ Gnuplot.Custom "view" [ viewArgs ] ]
where
viewArgs = intercalate "," [ show a
, show b
, show c
, show d
]
plotSurfaces _ _mView =
error "Unimplemented multiple surface graphs"
| 939
| false
| true
| 3
| 9
| 370
| 247
| 129
| 118
| null | null |
DanBurton/polylens
|
examples/kmett.hs
|
bsd-3-clause
|
plus, times :: Num a => Setter a a a
plus = setting (+)
| 55
|
plus, times :: Num a => Setter a a a
plus = setting (+)
| 55
|
plus = setting (+)
| 18
| false
| true
| 2
| 7
| 13
| 42
| 18
| 24
| null | null |
barrucadu/irc-ctcp
|
Network/IRC/CTCP.hs
|
mit
|
-- |Check if a bytestring looks like a CTCP, and if so, wrap it up in
-- the 'CTCPByteString' type.
--
-- This uses 'isCTCP', and so is lenient with escapes.
asCTCP :: ByteString -> Maybe CTCPByteString
asCTCP bs =
if isCTCP bs
then Just $ CBS bs
else Nothing
| 265
|
asCTCP :: ByteString -> Maybe CTCPByteString
asCTCP bs =
if isCTCP bs
then Just $ CBS bs
else Nothing
| 107
|
asCTCP bs =
if isCTCP bs
then Just $ CBS bs
else Nothing
| 62
| true
| true
| 0
| 7
| 55
| 48
| 24
| 24
| null | null |
glguy/hpaste
|
src/Utils/URL.hs
|
bsd-3-clause
|
decStrBytes p (c : cs) = let b = if p && c == '+'
then 32 -- space
else fromIntegral (fromEnum c)
in (b :) `fmap` decStrBytes p cs
| 242
|
decStrBytes p (c : cs) = let b = if p && c == '+'
then 32 -- space
else fromIntegral (fromEnum c)
in (b :) `fmap` decStrBytes p cs
| 242
|
decStrBytes p (c : cs) = let b = if p && c == '+'
then 32 -- space
else fromIntegral (fromEnum c)
in (b :) `fmap` decStrBytes p cs
| 242
| false
| false
| 0
| 12
| 141
| 70
| 37
| 33
| null | null |
wellposed/hblas
|
tests/HBLAS/BLAS/Level2Spec.hs
|
bsd-3-clause
|
matmatTest1SGEMV :: IO ()
matmatTest1SGEMV = do
left <- Matrix.generateMutableDenseMatrix (Matrix.SRow) (2,2) (\_ -> (1.0::Float))
right <- Matrix.generateMutableDenseVector 2 (\_ -> (1.0 :: Float))
res <- Matrix.generateMutableDenseVector 2 (\_ -> (0.0 :: Float))
BLAS.sgemv Matrix.NoTranspose 1.0 1.0 left right res
resList <- Matrix.mutableVectorToList $ _bufferMutDenseVector res
resList `shouldBe` [2,2]
| 437
|
matmatTest1SGEMV :: IO ()
matmatTest1SGEMV = do
left <- Matrix.generateMutableDenseMatrix (Matrix.SRow) (2,2) (\_ -> (1.0::Float))
right <- Matrix.generateMutableDenseVector 2 (\_ -> (1.0 :: Float))
res <- Matrix.generateMutableDenseVector 2 (\_ -> (0.0 :: Float))
BLAS.sgemv Matrix.NoTranspose 1.0 1.0 left right res
resList <- Matrix.mutableVectorToList $ _bufferMutDenseVector res
resList `shouldBe` [2,2]
| 437
|
matmatTest1SGEMV = do
left <- Matrix.generateMutableDenseMatrix (Matrix.SRow) (2,2) (\_ -> (1.0::Float))
right <- Matrix.generateMutableDenseVector 2 (\_ -> (1.0 :: Float))
res <- Matrix.generateMutableDenseVector 2 (\_ -> (0.0 :: Float))
BLAS.sgemv Matrix.NoTranspose 1.0 1.0 left right res
resList <- Matrix.mutableVectorToList $ _bufferMutDenseVector res
resList `shouldBe` [2,2]
| 411
| false
| true
| 0
| 11
| 77
| 164
| 86
| 78
| null | null |
PrattFall/Snek
|
src/Snek.hs
|
bsd-3-clause
|
createMap :: MapSize -> Snake -> Food -> GameMap
createMap (MapSize xb yb) (Snake _ sb) fd =
GameMap (MapSize xb yb) row
where row = [createMapRow xb y sb fd | y <- [0..(yb-1)]]
| 185
|
createMap :: MapSize -> Snake -> Food -> GameMap
createMap (MapSize xb yb) (Snake _ sb) fd =
GameMap (MapSize xb yb) row
where row = [createMapRow xb y sb fd | y <- [0..(yb-1)]]
| 185
|
createMap (MapSize xb yb) (Snake _ sb) fd =
GameMap (MapSize xb yb) row
where row = [createMapRow xb y sb fd | y <- [0..(yb-1)]]
| 136
| false
| true
| 1
| 11
| 42
| 109
| 51
| 58
| null | null |
jmitchell/Idris-dev
|
src/Idris/IBC.hs
|
bsd-3-clause
|
processNameHints :: Archive -> Idris ()
processNameHints ar = do
ns <- getEntry [] "ibc_namehints" ar
mapM_ (\ (n, ty) -> addNameHint n ty) ns
| 150
|
processNameHints :: Archive -> Idris ()
processNameHints ar = do
ns <- getEntry [] "ibc_namehints" ar
mapM_ (\ (n, ty) -> addNameHint n ty) ns
| 150
|
processNameHints ar = do
ns <- getEntry [] "ibc_namehints" ar
mapM_ (\ (n, ty) -> addNameHint n ty) ns
| 110
| false
| true
| 0
| 10
| 32
| 66
| 32
| 34
| null | null |
rtorr/elm-package
|
src/Diff.hs
|
bsd-3-clause
|
computeDiff
:: N.Name
-> V.Version
-> [Docs.Documentation]
-> Maybe V.Version
-> Manager.Manager ()
computeDiff name oldVersion newDocs maybeNewVersion =
do Cmd.out msg
changes <- Compare.computeChanges newDocs name oldVersion
Cmd.out (Display.packageChanges changes)
where
msg =
"Comparing " ++ N.toString name ++ " " ++ V.toString oldVersion ++ " to " ++ newStuff ++ "..."
newStuff =
case maybeNewVersion of
Nothing -> "local changes"
Just version -> V.toString version
| 589
|
computeDiff
:: N.Name
-> V.Version
-> [Docs.Documentation]
-> Maybe V.Version
-> Manager.Manager ()
computeDiff name oldVersion newDocs maybeNewVersion =
do Cmd.out msg
changes <- Compare.computeChanges newDocs name oldVersion
Cmd.out (Display.packageChanges changes)
where
msg =
"Comparing " ++ N.toString name ++ " " ++ V.toString oldVersion ++ " to " ++ newStuff ++ "..."
newStuff =
case maybeNewVersion of
Nothing -> "local changes"
Just version -> V.toString version
| 589
|
computeDiff name oldVersion newDocs maybeNewVersion =
do Cmd.out msg
changes <- Compare.computeChanges newDocs name oldVersion
Cmd.out (Display.packageChanges changes)
where
msg =
"Comparing " ++ N.toString name ++ " " ++ V.toString oldVersion ++ " to " ++ newStuff ++ "..."
newStuff =
case maybeNewVersion of
Nothing -> "local changes"
Just version -> V.toString version
| 469
| false
| true
| 1
| 12
| 184
| 174
| 80
| 94
| null | null |
kubkon/gnuplot
|
src/Graphics/Gnuplot/Frame/OptionSet.hs
|
bsd-3-clause
|
key :: Graph.C graph => Bool -> T graph -> T graph
key = OptionSet.boolean Option.keyShow
| 89
|
key :: Graph.C graph => Bool -> T graph -> T graph
key = OptionSet.boolean Option.keyShow
| 89
|
key = OptionSet.boolean Option.keyShow
| 38
| false
| true
| 0
| 9
| 15
| 46
| 20
| 26
| null | null |
choener/BiobaseFasta
|
tests/properties.hs
|
gpl-3.0
|
-- -- * golden tests
--
-- eachFasta (HeaderSize h) (OverlapSize o) (CurrentSize c p) = SP.yield (h,o,c)
--
-- readFastaFile ∷ FilePath → IO [(BS.ByteString,BS.ByteString,BS.ByteString)]
-- readFastaFile f = do
-- let s = 1000000
-- xs :> r ← runResourceT
-- $ SP.toList
-- $ streamingFasta (HeaderSize s) (OverlapSize 0) (CurrentSize s) eachFasta
-- $ S8.readFile f
-- return xs
--
-- lazyFastaOut = BL8.concat . P.map go
-- where go (h,o,c) = BL8.concat
-- [ BL8.fromStrict h
-- , BL8.pack "\n"
-- , BL8.fromStrict o
-- , BL8.pack "\n"
-- , BL8.fromStrict c
-- , BL8.pack "\n"
-- ]
--
-- goldenTests ∷ IO TestTree
-- goldenTests = do
-- fastaFiles ← Golden.findByExtension [".fa"] "./tests/"
-- return $ testGroup "readFastaFile golden tests"
-- [ Golden.goldenVsString
-- (takeBaseName fastaFile) -- test name
-- goldenFile -- golden file path
-- (lazyFastaOut <$> readFastaFile fastaFile) -- action whose result is tested
-- | fastaFile <- fastaFiles
-- , let goldenFile = replaceExtension fastaFile ".fa-golden"
-- ]
-- * unit tests
smallInlineFasta = P.unlines
[ ">Aaaa"
, "123"
, ">Bbbb"
, "4567"
, ">Cccc"
, "890"
]
| 1,295
|
smallInlineFasta = P.unlines
[ ">Aaaa"
, "123"
, ">Bbbb"
, "4567"
, ">Cccc"
, "890"
]
| 99
|
smallInlineFasta = P.unlines
[ ">Aaaa"
, "123"
, ">Bbbb"
, "4567"
, ">Cccc"
, "890"
]
| 99
| true
| false
| 1
| 5
| 357
| 67
| 52
| 15
| null | null |
LambdaHack/LambdaHack
|
engine-src/Game/LambdaHack/Client/UI/Frontend/ANSI.hs
|
bsd-3-clause
|
colorTranslate Color.Cyan = (ANSI.Dull, ANSI.Cyan)
| 55
|
colorTranslate Color.Cyan = (ANSI.Dull, ANSI.Cyan)
| 55
|
colorTranslate Color.Cyan = (ANSI.Dull, ANSI.Cyan)
| 55
| false
| false
| 0
| 6
| 9
| 21
| 11
| 10
| null | null |
cmears/mines-solver
|
TimeAccounting.hs
|
mit
|
-- The ClockTick type is not the "clock" unit that is used by
-- clock(3). It's the "clock tick" used by times(2). On my system
-- there seem to be 100 clock ticks per second.
clockTicksPerSec = 100
| 200
|
clockTicksPerSec = 100
| 22
|
clockTicksPerSec = 100
| 22
| true
| false
| 1
| 5
| 39
| 13
| 6
| 7
| null | null |
amirci/aoc2016-hs
|
src/Day4.hs
|
bsd-3-clause
|
isReal (_, words, check) = check == check'
where
check' = map fst
$ take 5
$ sortBy mostCommon
$ freq
$ concat words
mostCommon (a, l) (a', l')
| l > l' = LT
| l < l' = GT
| l == l' = compare a a'
| 275
|
isReal (_, words, check) = check == check'
where
check' = map fst
$ take 5
$ sortBy mostCommon
$ freq
$ concat words
mostCommon (a, l) (a', l')
| l > l' = LT
| l < l' = GT
| l == l' = compare a a'
| 275
|
isReal (_, words, check) = check == check'
where
check' = map fst
$ take 5
$ sortBy mostCommon
$ freq
$ concat words
mostCommon (a, l) (a', l')
| l > l' = LT
| l < l' = GT
| l == l' = compare a a'
| 275
| false
| false
| 2
| 9
| 127
| 121
| 59
| 62
| null | null |
sethfowler/bzbeaver
|
src/Application.hs
|
bsd-3-clause
|
-- The only difference between 'addUser' and 'updateUser' is that
-- 'addUser' doesn't update 'uiLastSeen'.
addUser :: UserLogin -> UserInfo -> Update AppState ()
addUser login info = modify $ over asUsers (M.insertWith merge login info)
where merge _ old = old
| 264
|
addUser :: UserLogin -> UserInfo -> Update AppState ()
addUser login info = modify $ over asUsers (M.insertWith merge login info)
where merge _ old = old
| 156
|
addUser login info = modify $ over asUsers (M.insertWith merge login info)
where merge _ old = old
| 101
| true
| true
| 0
| 9
| 44
| 71
| 34
| 37
| null | null |
Zoetermeer/latro
|
src/Latro/Interp.hs
|
mit
|
lookupVarId :: UniqId -> Eval Value
lookupVarId id = getVarEnv >>= lookupId id
| 78
|
lookupVarId :: UniqId -> Eval Value
lookupVarId id = getVarEnv >>= lookupId id
| 78
|
lookupVarId id = getVarEnv >>= lookupId id
| 42
| false
| true
| 0
| 6
| 12
| 28
| 13
| 15
| null | null |
alosich/language-java
|
Language/Java/Parser.hs
|
bsd-3-clause
|
classBodyStatements :: P [Decl]
classBodyStatements = catMaybes <$> list classBodyStatement
| 91
|
classBodyStatements :: P [Decl]
classBodyStatements = catMaybes <$> list classBodyStatement
| 91
|
classBodyStatements = catMaybes <$> list classBodyStatement
| 59
| false
| true
| 0
| 6
| 9
| 24
| 12
| 12
| null | null |
vigoos/Farrago-OS
|
aura-master/aura-master/src/aura.hs
|
gpl-2.0
|
displayOutputLanguages :: Aura ()
displayOutputLanguages = do
notify displayOutputLanguages_1
liftIO $ mapM_ print allLanguages
| 131
|
displayOutputLanguages :: Aura ()
displayOutputLanguages = do
notify displayOutputLanguages_1
liftIO $ mapM_ print allLanguages
| 131
|
displayOutputLanguages = do
notify displayOutputLanguages_1
liftIO $ mapM_ print allLanguages
| 97
| false
| true
| 0
| 8
| 17
| 34
| 15
| 19
| null | null |
poxu/pandoc
|
src/Text/Pandoc/Readers/HTML.hs
|
gpl-2.0
|
"li" `closes` "li" = True
| 25
|
"li" `closes` "li" = True
| 25
|
"li" `closes` "li" = True
| 25
| false
| false
| 0
| 5
| 4
| 14
| 7
| 7
| null | null |
modeswitch/barrelfish
|
tools/flounder/BackendCommon.hs
|
mit
|
msg_argstructdecl :: String -> [TypeDef] -> MessageArgument -> [C.Param]
msg_argstructdecl ifn typedefs (Arg tr (Name n)) =
[ C.Param (type_c_type_msgstruct ifn typedefs tr) n ]
| 182
|
msg_argstructdecl :: String -> [TypeDef] -> MessageArgument -> [C.Param]
msg_argstructdecl ifn typedefs (Arg tr (Name n)) =
[ C.Param (type_c_type_msgstruct ifn typedefs tr) n ]
| 182
|
msg_argstructdecl ifn typedefs (Arg tr (Name n)) =
[ C.Param (type_c_type_msgstruct ifn typedefs tr) n ]
| 109
| false
| true
| 0
| 9
| 29
| 72
| 37
| 35
| null | null |
karianna/jdk8_tl
|
jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
|
gpl-2.0
|
sizeof UINT16 = 2
| 17
|
sizeof UINT16 = 2
| 17
|
sizeof UINT16 = 2
| 17
| false
| false
| 0
| 4
| 3
| 10
| 4
| 6
| null | null |
eklavya/Idris-dev
|
src/Idris/Core/Evaluate.hs
|
bsd-3-clause
|
isUsableUniverse :: Term -> Bool
isUsableUniverse (UType NullType) = False
| 74
|
isUsableUniverse :: Term -> Bool
isUsableUniverse (UType NullType) = False
| 74
|
isUsableUniverse (UType NullType) = False
| 41
| false
| true
| 0
| 6
| 9
| 28
| 13
| 15
| null | null |
chlablak/platinum-parsing
|
cli/Cmd/Ebnf.hs
|
bsd-3-clause
|
dispatch :: Args -> Log.Logger
dispatch (Args _ (EbnfCmd args)) = do
Log.pushTag "ebnf"
input <- Log.io $ readFile $ ebnfFile args
case PP.parseAst input :: (PP.To Ebnf.Syntax) of
Left err -> do
Log.err $ "error in file '" ++ ebnfFile args ++ "':"
Log.err $ show err
Log.abort
Right ast -> do
-- Flag `--minify`
when (showMinified args) $ do
Log.info "minified:"
Log.out $ PP.stringify ast
r <- Log.io $ PP.rules' $ PP.lexify ast
case r of
Left err -> do
Log.err $ "cannot make rules: " ++ err
Log.abort
Right r -> do
let (prs, lrs) = PP.separate r
case PP.extend prs of
Left err -> do
Log.err "cannot extend the input grammar:"
Log.err err
Log.abort
Right g' -> do
let rs = PP.ruleSet g'
let fs = PP.firstSet rs
-- Flag `--lexical`
when (showLexical args) $ do
Log.info "lexical rules:"
mapM_ (Log.out . show) lrs
-- Flag `--regexfy`
when (showRegexfied args) $ do
Log.info "regexfied lexical rules:"
let lrs' = if removeToken args then PP.removeUnusedToken rs (PP.regexfy lrs) else PP.regexfy lrs
mapM_ (Log.out . show) $ PP.regexfy lrs'
-- Flag `--rules`
when (showRules args) $ do
Log.info "rules:"
mapM_ (Log.out . show) g'
-- Flag `--first`
when (showFirstSet args) $ do
Log.info "first set:"
mapM_ (Log.out . show) $ Map.toList fs
-- Flag `--check`
when (doCheck args) $ do
let (err, warn) = PP.check rs
Log.pushTag "check"
Log.info "errors:"
mapM_ Log.info err
Log.info "warnings:"
mapM_ Log.info warn
Log.popTag
when (err /= [])
Log.abort
-- End
Log.popTag
return ()
| 2,140
|
dispatch :: Args -> Log.Logger
dispatch (Args _ (EbnfCmd args)) = do
Log.pushTag "ebnf"
input <- Log.io $ readFile $ ebnfFile args
case PP.parseAst input :: (PP.To Ebnf.Syntax) of
Left err -> do
Log.err $ "error in file '" ++ ebnfFile args ++ "':"
Log.err $ show err
Log.abort
Right ast -> do
-- Flag `--minify`
when (showMinified args) $ do
Log.info "minified:"
Log.out $ PP.stringify ast
r <- Log.io $ PP.rules' $ PP.lexify ast
case r of
Left err -> do
Log.err $ "cannot make rules: " ++ err
Log.abort
Right r -> do
let (prs, lrs) = PP.separate r
case PP.extend prs of
Left err -> do
Log.err "cannot extend the input grammar:"
Log.err err
Log.abort
Right g' -> do
let rs = PP.ruleSet g'
let fs = PP.firstSet rs
-- Flag `--lexical`
when (showLexical args) $ do
Log.info "lexical rules:"
mapM_ (Log.out . show) lrs
-- Flag `--regexfy`
when (showRegexfied args) $ do
Log.info "regexfied lexical rules:"
let lrs' = if removeToken args then PP.removeUnusedToken rs (PP.regexfy lrs) else PP.regexfy lrs
mapM_ (Log.out . show) $ PP.regexfy lrs'
-- Flag `--rules`
when (showRules args) $ do
Log.info "rules:"
mapM_ (Log.out . show) g'
-- Flag `--first`
when (showFirstSet args) $ do
Log.info "first set:"
mapM_ (Log.out . show) $ Map.toList fs
-- Flag `--check`
when (doCheck args) $ do
let (err, warn) = PP.check rs
Log.pushTag "check"
Log.info "errors:"
mapM_ Log.info err
Log.info "warnings:"
mapM_ Log.info warn
Log.popTag
when (err /= [])
Log.abort
-- End
Log.popTag
return ()
| 2,140
|
dispatch (Args _ (EbnfCmd args)) = do
Log.pushTag "ebnf"
input <- Log.io $ readFile $ ebnfFile args
case PP.parseAst input :: (PP.To Ebnf.Syntax) of
Left err -> do
Log.err $ "error in file '" ++ ebnfFile args ++ "':"
Log.err $ show err
Log.abort
Right ast -> do
-- Flag `--minify`
when (showMinified args) $ do
Log.info "minified:"
Log.out $ PP.stringify ast
r <- Log.io $ PP.rules' $ PP.lexify ast
case r of
Left err -> do
Log.err $ "cannot make rules: " ++ err
Log.abort
Right r -> do
let (prs, lrs) = PP.separate r
case PP.extend prs of
Left err -> do
Log.err "cannot extend the input grammar:"
Log.err err
Log.abort
Right g' -> do
let rs = PP.ruleSet g'
let fs = PP.firstSet rs
-- Flag `--lexical`
when (showLexical args) $ do
Log.info "lexical rules:"
mapM_ (Log.out . show) lrs
-- Flag `--regexfy`
when (showRegexfied args) $ do
Log.info "regexfied lexical rules:"
let lrs' = if removeToken args then PP.removeUnusedToken rs (PP.regexfy lrs) else PP.regexfy lrs
mapM_ (Log.out . show) $ PP.regexfy lrs'
-- Flag `--rules`
when (showRules args) $ do
Log.info "rules:"
mapM_ (Log.out . show) g'
-- Flag `--first`
when (showFirstSet args) $ do
Log.info "first set:"
mapM_ (Log.out . show) $ Map.toList fs
-- Flag `--check`
when (doCheck args) $ do
let (err, warn) = PP.check rs
Log.pushTag "check"
Log.info "errors:"
mapM_ Log.info err
Log.info "warnings:"
mapM_ Log.info warn
Log.popTag
when (err /= [])
Log.abort
-- End
Log.popTag
return ()
| 2,109
| false
| true
| 0
| 34
| 915
| 698
| 309
| 389
| null | null |
fmapfmapfmap/amazonka
|
amazonka-iam/gen/Network/AWS/IAM/GetCredentialReport.hs
|
mpl-2.0
|
-- | Creates a value of 'GetCredentialReportResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'grsContent'
--
-- * 'grsGeneratedTime'
--
-- * 'grsReportFormat'
--
-- * 'grsResponseStatus'
getCredentialReportResponse
:: Int -- ^ 'grsResponseStatus'
-> GetCredentialReportResponse
getCredentialReportResponse pResponseStatus_ =
GetCredentialReportResponse'
{ _grsContent = Nothing
, _grsGeneratedTime = Nothing
, _grsReportFormat = Nothing
, _grsResponseStatus = pResponseStatus_
}
| 604
|
getCredentialReportResponse
:: Int -- ^ 'grsResponseStatus'
-> GetCredentialReportResponse
getCredentialReportResponse pResponseStatus_ =
GetCredentialReportResponse'
{ _grsContent = Nothing
, _grsGeneratedTime = Nothing
, _grsReportFormat = Nothing
, _grsResponseStatus = pResponseStatus_
}
| 323
|
getCredentialReportResponse pResponseStatus_ =
GetCredentialReportResponse'
{ _grsContent = Nothing
, _grsGeneratedTime = Nothing
, _grsReportFormat = Nothing
, _grsResponseStatus = pResponseStatus_
}
| 224
| true
| true
| 0
| 7
| 106
| 65
| 40
| 25
| null | null |
CindyLinz/Haskell.js
|
trans/src/Desugar/Tuple.hs
|
mit
|
deTupleOverlap (Overlap l) = Overlap (id l)
| 43
|
deTupleOverlap (Overlap l) = Overlap (id l)
| 43
|
deTupleOverlap (Overlap l) = Overlap (id l)
| 43
| false
| false
| 0
| 7
| 6
| 25
| 11
| 14
| null | null |
ulricha/dsh-example-queries
|
Queries/TPCH/NonStandard/Flat.hs
|
bsd-3-clause
|
sq6 :: Q [(Text, [Text])]
sq6 = [ tup2 (r_nameQ r)
(sortWith id [ n_nameQ n | n <- nations, n_regionkeyQ n == r_regionkeyQ r ])
| r <- regions
]
| 169
|
sq6 :: Q [(Text, [Text])]
sq6 = [ tup2 (r_nameQ r)
(sortWith id [ n_nameQ n | n <- nations, n_regionkeyQ n == r_regionkeyQ r ])
| r <- regions
]
| 169
|
sq6 = [ tup2 (r_nameQ r)
(sortWith id [ n_nameQ n | n <- nations, n_regionkeyQ n == r_regionkeyQ r ])
| r <- regions
]
| 143
| false
| true
| 2
| 13
| 55
| 91
| 43
| 48
| null | null |
black0range/Smutt
|
src/Smutt/HTTP/Version.hs
|
mit
|
parse :: (Str.StringData s) => s -> Maybe (s,s)
parse "" = Nothing
| 67
|
parse :: (Str.StringData s) => s -> Maybe (s,s)
parse "" = Nothing
| 67
|
parse "" = Nothing
| 19
| false
| true
| 0
| 9
| 13
| 43
| 21
| 22
| null | null |
carlohamalainen/imagetrove-uploader
|
src/Network/MyTardis/API.hs
|
bsd-2-clause
|
-- | Generic function for creating a resource.
getResource :: forall a. FromJSON a => URI -> ReaderT MyTardisConfig IO (Result a)
getResource uri = do
writeLog $ "getResource: " ++ uri
MyTardisConfig host _ _ _ opts _ _ _ _ _ _ <- ask
r <- liftIO $ getWithE opts (host ++ uri)
case r of
Left e -> return $ Error e
Right r' -> case (join $ decode <$> r' ^? responseBody :: Maybe Value) of
Just v -> return $ fromJSON v
Nothing -> do writeLog "getResource: could not decode resource."
return $ Error "Could not decode resource."
-- getParameterName :: URI -> ReaderT MyTardisConfig IO (Result RestParameterName)
-- getParameterName = getResource
| 765
|
getResource :: forall a. FromJSON a => URI -> ReaderT MyTardisConfig IO (Result a)
getResource uri = do
writeLog $ "getResource: " ++ uri
MyTardisConfig host _ _ _ opts _ _ _ _ _ _ <- ask
r <- liftIO $ getWithE opts (host ++ uri)
case r of
Left e -> return $ Error e
Right r' -> case (join $ decode <$> r' ^? responseBody :: Maybe Value) of
Just v -> return $ fromJSON v
Nothing -> do writeLog "getResource: could not decode resource."
return $ Error "Could not decode resource."
-- getParameterName :: URI -> ReaderT MyTardisConfig IO (Result RestParameterName)
-- getParameterName = getResource
| 718
|
getResource uri = do
writeLog $ "getResource: " ++ uri
MyTardisConfig host _ _ _ opts _ _ _ _ _ _ <- ask
r <- liftIO $ getWithE opts (host ++ uri)
case r of
Left e -> return $ Error e
Right r' -> case (join $ decode <$> r' ^? responseBody :: Maybe Value) of
Just v -> return $ fromJSON v
Nothing -> do writeLog "getResource: could not decode resource."
return $ Error "Could not decode resource."
-- getParameterName :: URI -> ReaderT MyTardisConfig IO (Result RestParameterName)
-- getParameterName = getResource
| 635
| true
| true
| 0
| 18
| 238
| 211
| 98
| 113
| null | null |
romanb/amazonka
|
amazonka-ec2/gen/Network/AWS/EC2/CreateSnapshot.hs
|
mpl-2.0
|
-- | The progress of the snapshot, as a percentage.
csr1Progress :: Lens' CreateSnapshotResponse Text
csr1Progress = lens _csr1Progress (\s a -> s { _csr1Progress = a })
| 169
|
csr1Progress :: Lens' CreateSnapshotResponse Text
csr1Progress = lens _csr1Progress (\s a -> s { _csr1Progress = a })
| 117
|
csr1Progress = lens _csr1Progress (\s a -> s { _csr1Progress = a })
| 67
| true
| true
| 0
| 9
| 27
| 40
| 22
| 18
| null | null |
wxwxwwxxx/ghc
|
testsuite/tests/typecheck/should_fail/T3102.hs
|
bsd-3-clause
|
result :: Int
result = f t
| 26
|
result :: Int
result = f t
| 26
|
result = f t
| 12
| false
| true
| 0
| 6
| 6
| 21
| 8
| 13
| null | null |
Javran/h2048
|
src/Game/H2048/Core.hs
|
mit
|
{-|
Safely convert a power of two into 'Cell'.
-}
intToCell :: Int -> Maybe Cell
intToCell v = [ unsafeIntToCell v | v > 0, popCount v == 1 ]
| 144
|
intToCell :: Int -> Maybe Cell
intToCell v = [ unsafeIntToCell v | v > 0, popCount v == 1 ]
| 91
|
intToCell v = [ unsafeIntToCell v | v > 0, popCount v == 1 ]
| 60
| true
| true
| 0
| 8
| 33
| 47
| 23
| 24
| null | null |
urbanslug/ghc
|
utils/hpc/HpcMarkup.hs
|
bsd-3-clause
|
--addMarkup tabStop cs loc os ((t1,t2,tik@(TopLevelDecl {})):ticks) | loc == t1 =
-- openTick tik ++ closeTick ++ addMarkup tabStop cs loc os ticks
addMarkup tabStop cs loc os ((t1,t2,tik0):ticks) | loc == t1 =
case os of
((_,tik'):_)
| not (allowNesting tik0 tik')
-> addMarkup tabStop cs loc os ticks -- already marked or bool within marked bool
_ -> openTick tik0 ++ addMarkup tabStop cs loc (addTo (t2,tik0) os) ticks
where
addTo (t,tik) [] = [(t,tik)]
addTo (t,tik) ((t',tik'):xs) | t <= t' = (t,tik):(t',tik'):xs
| otherwise = (t',tik):(t',tik'):xs
| 622
|
addMarkup tabStop cs loc os ((t1,t2,tik0):ticks) | loc == t1 =
case os of
((_,tik'):_)
| not (allowNesting tik0 tik')
-> addMarkup tabStop cs loc os ticks -- already marked or bool within marked bool
_ -> openTick tik0 ++ addMarkup tabStop cs loc (addTo (t2,tik0) os) ticks
where
addTo (t,tik) [] = [(t,tik)]
addTo (t,tik) ((t',tik'):xs) | t <= t' = (t,tik):(t',tik'):xs
| otherwise = (t',tik):(t',tik'):xs
| 471
|
addMarkup tabStop cs loc os ((t1,t2,tik0):ticks) | loc == t1 =
case os of
((_,tik'):_)
| not (allowNesting tik0 tik')
-> addMarkup tabStop cs loc os ticks -- already marked or bool within marked bool
_ -> openTick tik0 ++ addMarkup tabStop cs loc (addTo (t2,tik0) os) ticks
where
addTo (t,tik) [] = [(t,tik)]
addTo (t,tik) ((t',tik'):xs) | t <= t' = (t,tik):(t',tik'):xs
| otherwise = (t',tik):(t',tik'):xs
| 471
| true
| false
| 0
| 14
| 158
| 253
| 135
| 118
| null | null |
balangs/eTeak
|
aschem/Render.hs
|
bsd-3-clause
|
closePathStroke :: Render ()
closePathStroke = closePath >> stroke
| 70
|
closePathStroke :: Render ()
closePathStroke = closePath >> stroke
| 66
|
closePathStroke = closePath >> stroke
| 37
| false
| true
| 1
| 6
| 12
| 24
| 10
| 14
| null | null |
stothardj/hsudoku
|
Test.hs
|
gpl-3.0
|
-- Board 2. Inner boxes are 3x3
board2 = initBoard [
[8, 6, 0, 3, 5, 4, 2, 1, 0],
[0, 1, 0, 2, 8, 0, 5, 6, 3],
[0, 0, 2, 1, 6, 0, 4, 0, 9],
[0, 0, 7, 0, 0, 0, 1, 9, 0],
[9, 3, 0, 0, 0, 1, 0, 2, 4],
[0, 0, 0, 4, 0, 6, 0, 0, 5],
[5, 2, 3, 0, 1, 8, 9, 0, 6],
[0, 0, 8, 0, 3, 0, 0, 0, 1],
[0, 0, 6, 9, 4, 5, 0, 3, 0]
]
| 334
|
board2 = initBoard [
[8, 6, 0, 3, 5, 4, 2, 1, 0],
[0, 1, 0, 2, 8, 0, 5, 6, 3],
[0, 0, 2, 1, 6, 0, 4, 0, 9],
[0, 0, 7, 0, 0, 0, 1, 9, 0],
[9, 3, 0, 0, 0, 1, 0, 2, 4],
[0, 0, 0, 4, 0, 6, 0, 0, 5],
[5, 2, 3, 0, 1, 8, 9, 0, 6],
[0, 0, 8, 0, 3, 0, 0, 0, 1],
[0, 0, 6, 9, 4, 5, 0, 3, 0]
]
| 302
|
board2 = initBoard [
[8, 6, 0, 3, 5, 4, 2, 1, 0],
[0, 1, 0, 2, 8, 0, 5, 6, 3],
[0, 0, 2, 1, 6, 0, 4, 0, 9],
[0, 0, 7, 0, 0, 0, 1, 9, 0],
[9, 3, 0, 0, 0, 1, 0, 2, 4],
[0, 0, 0, 4, 0, 6, 0, 0, 5],
[5, 2, 3, 0, 1, 8, 9, 0, 6],
[0, 0, 8, 0, 3, 0, 0, 0, 1],
[0, 0, 6, 9, 4, 5, 0, 3, 0]
]
| 302
| true
| false
| 0
| 7
| 112
| 280
| 185
| 95
| null | null |
helino/wham
|
src/Wham/AnalyzeRunner.hs
|
bsd-3-clause
|
astep :: ConfigurationQueue -> ControlPointMap ->
Either String ([AbstractConfiguration], ConfigurationQueue)
astep queue cps = case istep queue of
Right (queue', set) -> Right (Set.toList set, increase queue' set)
Left err -> Left err
where
increase q set = foldl (\acc c -> update acc c cps) q $ Set.toList set
| 343
|
astep :: ConfigurationQueue -> ControlPointMap ->
Either String ([AbstractConfiguration], ConfigurationQueue)
astep queue cps = case istep queue of
Right (queue', set) -> Right (Set.toList set, increase queue' set)
Left err -> Left err
where
increase q set = foldl (\acc c -> update acc c cps) q $ Set.toList set
| 343
|
astep queue cps = case istep queue of
Right (queue', set) -> Right (Set.toList set, increase queue' set)
Left err -> Left err
where
increase q set = foldl (\acc c -> update acc c cps) q $ Set.toList set
| 224
| false
| true
| 0
| 11
| 80
| 134
| 66
| 68
| null | null |
gallais/potpourri
|
haskell/cyclic/CyclicListFlat.hs
|
gpl-3.0
|
minimise :: Eq a => CList a -> CList a
minimise = factor . rewind
| 65
|
minimise :: Eq a => CList a -> CList a
minimise = factor . rewind
| 65
|
minimise = factor . rewind
| 26
| false
| true
| 1
| 8
| 14
| 39
| 16
| 23
| null | null |
fmapfmapfmap/amazonka
|
amazonka-cloudsearch/gen/Network/AWS/CloudSearch/Types/Product.hs
|
mpl-2.0
|
-- | True if the search domain is created. It can take several minutes to
-- initialize a domain when CreateDomain is called. Newly created search
-- domains are returned from DescribeDomains with a false value for Created
-- until domain creation is complete.
dsCreated :: Lens' DomainStatus (Maybe Bool)
dsCreated = lens _dsCreated (\ s a -> s{_dsCreated = a})
| 362
|
dsCreated :: Lens' DomainStatus (Maybe Bool)
dsCreated = lens _dsCreated (\ s a -> s{_dsCreated = a})
| 101
|
dsCreated = lens _dsCreated (\ s a -> s{_dsCreated = a})
| 56
| true
| true
| 0
| 9
| 60
| 49
| 28
| 21
| null | null |
itsuart/fdc_archivist
|
src/SuccessfulRequestLogger.hs
|
mit
|
unspecifiedUAId :: Int
unspecifiedUAId = 1
| 42
|
unspecifiedUAId :: Int
unspecifiedUAId = 1
| 42
|
unspecifiedUAId = 1
| 19
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
winterland1989/mysql-haskell
|
test/BinaryRowNew.hs
|
bsd-3-clause
|
tests :: MySQLConn -> Assertion
tests c = do
selStmt <- prepareStmt c "SELECT * FROM test_new"
(f, is) <- queryStmt c selStmt []
assertEqual "decode Field types" (columnType <$> f)
[ mySQLTypeLong
, mySQLTypeDateTime
, mySQLTypeTimestamp
, mySQLTypeTime
]
Just v <- Stream.read is
assertEqual "decode NULL values" v
[ MySQLInt32 0
, MySQLNull
, MySQLNull
, MySQLNull
]
Stream.skipToEof is
execute_ c "UPDATE test_new SET \
\__datetime = '2016-08-08 17:25:59.12' ,\
\__timestamp = '2016-08-08 17:25:59.1234' ,\
\__time = '-199:59:59.123456' WHERE __id=0"
(_, is) <- queryStmt c selStmt []
Just v <- Stream.read is
assertEqual "decode binary protocol" v
[ MySQLInt32 0
, MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1234))
, MySQLTime 1 (TimeOfDay 199 59 59.123456)
]
Stream.skipToEof is
execute_ c "UPDATE test_new SET \
\__datetime = '2016-08-08 17:25:59.1' ,\
\__timestamp = '2016-08-08 17:25:59.12' ,\
\__time = '199:59:59.123' WHERE __id=0"
(_, is) <- queryStmt c selStmt []
Just v <- Stream.read is
assertEqual "decode binary protocol 2" v
[ MySQLInt32 0
, MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTime 0 (TimeOfDay 199 59 59.123)
]
Stream.skipToEof is
updStmt <- prepareStmt c
"UPDATE test_new SET \
\__datetime = ? ,\
\__timestamp = ? ,\
\__time = ? WHERE __id=0"
executeStmt c updStmt
[ MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1234))
, MySQLTime 1 (TimeOfDay 199 59 59.123456)
]
(_, is) <- queryStmt c selStmt []
Just v <- Stream.read is
assertEqual "roundtrip binary protocol" v
[ MySQLInt32 0
, MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1234))
, MySQLTime 1 (TimeOfDay 199 59 59.123456)
]
Stream.skipToEof is
executeStmt c updStmt
[ MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTime 0 (TimeOfDay 199 59 59.1234)
]
(_, is) <- queryStmt c selStmt []
Just v <- Stream.read is
assertEqual "roundtrip binary protocol 2" v
[ MySQLInt32 0
, MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTime 0 (TimeOfDay 199 59 59.1234)
]
Stream.skipToEof is
| 3,371
|
tests :: MySQLConn -> Assertion
tests c = do
selStmt <- prepareStmt c "SELECT * FROM test_new"
(f, is) <- queryStmt c selStmt []
assertEqual "decode Field types" (columnType <$> f)
[ mySQLTypeLong
, mySQLTypeDateTime
, mySQLTypeTimestamp
, mySQLTypeTime
]
Just v <- Stream.read is
assertEqual "decode NULL values" v
[ MySQLInt32 0
, MySQLNull
, MySQLNull
, MySQLNull
]
Stream.skipToEof is
execute_ c "UPDATE test_new SET \
\__datetime = '2016-08-08 17:25:59.12' ,\
\__timestamp = '2016-08-08 17:25:59.1234' ,\
\__time = '-199:59:59.123456' WHERE __id=0"
(_, is) <- queryStmt c selStmt []
Just v <- Stream.read is
assertEqual "decode binary protocol" v
[ MySQLInt32 0
, MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1234))
, MySQLTime 1 (TimeOfDay 199 59 59.123456)
]
Stream.skipToEof is
execute_ c "UPDATE test_new SET \
\__datetime = '2016-08-08 17:25:59.1' ,\
\__timestamp = '2016-08-08 17:25:59.12' ,\
\__time = '199:59:59.123' WHERE __id=0"
(_, is) <- queryStmt c selStmt []
Just v <- Stream.read is
assertEqual "decode binary protocol 2" v
[ MySQLInt32 0
, MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTime 0 (TimeOfDay 199 59 59.123)
]
Stream.skipToEof is
updStmt <- prepareStmt c
"UPDATE test_new SET \
\__datetime = ? ,\
\__timestamp = ? ,\
\__time = ? WHERE __id=0"
executeStmt c updStmt
[ MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1234))
, MySQLTime 1 (TimeOfDay 199 59 59.123456)
]
(_, is) <- queryStmt c selStmt []
Just v <- Stream.read is
assertEqual "roundtrip binary protocol" v
[ MySQLInt32 0
, MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1234))
, MySQLTime 1 (TimeOfDay 199 59 59.123456)
]
Stream.skipToEof is
executeStmt c updStmt
[ MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTime 0 (TimeOfDay 199 59 59.1234)
]
(_, is) <- queryStmt c selStmt []
Just v <- Stream.read is
assertEqual "roundtrip binary protocol 2" v
[ MySQLInt32 0
, MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTime 0 (TimeOfDay 199 59 59.1234)
]
Stream.skipToEof is
| 3,371
|
tests c = do
selStmt <- prepareStmt c "SELECT * FROM test_new"
(f, is) <- queryStmt c selStmt []
assertEqual "decode Field types" (columnType <$> f)
[ mySQLTypeLong
, mySQLTypeDateTime
, mySQLTypeTimestamp
, mySQLTypeTime
]
Just v <- Stream.read is
assertEqual "decode NULL values" v
[ MySQLInt32 0
, MySQLNull
, MySQLNull
, MySQLNull
]
Stream.skipToEof is
execute_ c "UPDATE test_new SET \
\__datetime = '2016-08-08 17:25:59.12' ,\
\__timestamp = '2016-08-08 17:25:59.1234' ,\
\__time = '-199:59:59.123456' WHERE __id=0"
(_, is) <- queryStmt c selStmt []
Just v <- Stream.read is
assertEqual "decode binary protocol" v
[ MySQLInt32 0
, MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1234))
, MySQLTime 1 (TimeOfDay 199 59 59.123456)
]
Stream.skipToEof is
execute_ c "UPDATE test_new SET \
\__datetime = '2016-08-08 17:25:59.1' ,\
\__timestamp = '2016-08-08 17:25:59.12' ,\
\__time = '199:59:59.123' WHERE __id=0"
(_, is) <- queryStmt c selStmt []
Just v <- Stream.read is
assertEqual "decode binary protocol 2" v
[ MySQLInt32 0
, MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTime 0 (TimeOfDay 199 59 59.123)
]
Stream.skipToEof is
updStmt <- prepareStmt c
"UPDATE test_new SET \
\__datetime = ? ,\
\__timestamp = ? ,\
\__time = ? WHERE __id=0"
executeStmt c updStmt
[ MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1234))
, MySQLTime 1 (TimeOfDay 199 59 59.123456)
]
(_, is) <- queryStmt c selStmt []
Just v <- Stream.read is
assertEqual "roundtrip binary protocol" v
[ MySQLInt32 0
, MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1234))
, MySQLTime 1 (TimeOfDay 199 59 59.123456)
]
Stream.skipToEof is
executeStmt c updStmt
[ MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTime 0 (TimeOfDay 199 59 59.1234)
]
(_, is) <- queryStmt c selStmt []
Just v <- Stream.read is
assertEqual "roundtrip binary protocol 2" v
[ MySQLInt32 0
, MySQLDateTime (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.1))
, MySQLTimeStamp (LocalTime (fromGregorian 2016 08 08) (TimeOfDay 17 25 59.12))
, MySQLTime 0 (TimeOfDay 199 59 59.1234)
]
Stream.skipToEof is
| 3,339
| false
| true
| 0
| 14
| 1,141
| 943
| 449
| 494
| null | null |
dysinger/amazonka
|
amazonka-rds/gen/Network/AWS/RDS/ModifyDBInstance.hs
|
mpl-2.0
|
-- | The weekly time range (in UTC) during which system maintenance can occur,
-- which may result in an outage. Changing this parameter does not result in an
-- outage, except in the following situation, and the change is asynchronously
-- applied as soon as possible. If there are pending actions that cause a
-- reboot, and the maintenance window is changed to include the current time,
-- then changing this parameter will cause a reboot of the DB instance. If
-- moving this window to the current time, there must be at least 30 minutes
-- between the current time and end of the window to ensure pending changes are
-- applied.
--
-- Default: Uses existing setting
--
-- Format: ddd:hh24:mi-ddd:hh24:mi
--
-- Valid Days: Mon | Tue | Wed | Thu | Fri | Sat | Sun
--
-- Constraints: Must be at least 30 minutes
mdbiPreferredMaintenanceWindow :: Lens' ModifyDBInstance (Maybe Text)
mdbiPreferredMaintenanceWindow =
lens _mdbiPreferredMaintenanceWindow
(\s a -> s { _mdbiPreferredMaintenanceWindow = a })
| 1,017
|
mdbiPreferredMaintenanceWindow :: Lens' ModifyDBInstance (Maybe Text)
mdbiPreferredMaintenanceWindow =
lens _mdbiPreferredMaintenanceWindow
(\s a -> s { _mdbiPreferredMaintenanceWindow = a })
| 203
|
mdbiPreferredMaintenanceWindow =
lens _mdbiPreferredMaintenanceWindow
(\s a -> s { _mdbiPreferredMaintenanceWindow = a })
| 133
| true
| true
| 0
| 8
| 180
| 63
| 41
| 22
| null | null |
nishiuramakoto/logiku
|
prolog/Prolog/Unifier.hs
|
gpl-3.0
|
unify' _ t (Var v) = return [(v,t)]
| 36
|
unify' _ t (Var v) = return [(v,t)]
| 36
|
unify' _ t (Var v) = return [(v,t)]
| 36
| false
| false
| 0
| 7
| 8
| 31
| 16
| 15
| null | null |
bogwonch/SecPAL
|
src/Logic/SecPAL/Z3Datalog.hs
|
gpl-3.0
|
vpToArgs SP.CanSay{ SP.what=f } = factToArgs f
| 46
|
vpToArgs SP.CanSay{ SP.what=f } = factToArgs f
| 46
|
vpToArgs SP.CanSay{ SP.what=f } = factToArgs f
| 46
| false
| false
| 0
| 8
| 6
| 25
| 12
| 13
| null | null |
phischu/fragnix
|
tests/packages/scotty/Data.Vector.Storable.hs
|
bsd-3-clause
|
imapMaybe = G.imapMaybe
| 23
|
imapMaybe = G.imapMaybe
| 23
|
imapMaybe = G.imapMaybe
| 23
| false
| false
| 0
| 5
| 2
| 8
| 4
| 4
| null | null |
onponomarev/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
socatPath :: String
socatPath = AutoConf.socatPath
| 50
|
socatPath :: String
socatPath = AutoConf.socatPath
| 50
|
socatPath = AutoConf.socatPath
| 30
| false
| true
| 0
| 6
| 5
| 20
| 8
| 12
| null | null |
gambogi/csh-eval
|
src/CSH/Eval/Frontend/Data.hs
|
mit
|
-- | The basic layout for every CSH Eval page
evalLayout :: Widget -> Handler Html
evalLayout widget = do
pc <- widgetToPageContent $ do
widget
addStylesheetRemote "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"
addScriptRemote "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"
addScriptRemote "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"
addStylesheet $ StaticR csh_bootstrap_min_css
addStylesheet $ StaticR syntax_css
addStylesheet $ StaticR csh_eval_css
toWidget $(luciusFile "frontend/templates/csh-eval.lucius")
addScript $ StaticR salvattore_min_js
withUrlRenderer $(hamletFile "frontend/templates/base.hamlet")
-- | The Yesod instance for the EvalFrontend
| 813
|
evalLayout :: Widget -> Handler Html
evalLayout widget = do
pc <- widgetToPageContent $ do
widget
addStylesheetRemote "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"
addScriptRemote "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"
addScriptRemote "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"
addStylesheet $ StaticR csh_bootstrap_min_css
addStylesheet $ StaticR syntax_css
addStylesheet $ StaticR csh_eval_css
toWidget $(luciusFile "frontend/templates/csh-eval.lucius")
addScript $ StaticR salvattore_min_js
withUrlRenderer $(hamletFile "frontend/templates/base.hamlet")
-- | The Yesod instance for the EvalFrontend
| 767
|
evalLayout widget = do
pc <- widgetToPageContent $ do
widget
addStylesheetRemote "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"
addScriptRemote "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"
addScriptRemote "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"
addStylesheet $ StaticR csh_bootstrap_min_css
addStylesheet $ StaticR syntax_css
addStylesheet $ StaticR csh_eval_css
toWidget $(luciusFile "frontend/templates/csh-eval.lucius")
addScript $ StaticR salvattore_min_js
withUrlRenderer $(hamletFile "frontend/templates/base.hamlet")
-- | The Yesod instance for the EvalFrontend
| 730
| true
| true
| 0
| 14
| 146
| 121
| 50
| 71
| null | null |
surajx/learn-haskell
|
crash.hs
|
mit
|
largest' l (Node x t1 t2) = max l (largest' (largest' x t1) t2)
| 63
|
largest' l (Node x t1 t2) = max l (largest' (largest' x t1) t2)
| 63
|
largest' l (Node x t1 t2) = max l (largest' (largest' x t1) t2)
| 63
| false
| false
| 0
| 9
| 13
| 44
| 20
| 24
| null | null |
yairchu/defend
|
src/NetEngine.hs
|
gpl-3.0
|
processPacket state _ (Moves moves)
| neWaitingForPeers state = netEngineNextIter updState
| otherwise = updState
where
updState =
state
{ neQueue =
mappend (neQueue state) . fromList
. filter ((>= neGameIteration state) . fst . fst)
. toList $ moves
}
| 310
|
processPacket state _ (Moves moves)
| neWaitingForPeers state = netEngineNextIter updState
| otherwise = updState
where
updState =
state
{ neQueue =
mappend (neQueue state) . fromList
. filter ((>= neGameIteration state) . fst . fst)
. toList $ moves
}
| 310
|
processPacket state _ (Moves moves)
| neWaitingForPeers state = netEngineNextIter updState
| otherwise = updState
where
updState =
state
{ neQueue =
mappend (neQueue state) . fromList
. filter ((>= neGameIteration state) . fst . fst)
. toList $ moves
}
| 310
| false
| false
| 1
| 15
| 98
| 103
| 50
| 53
| null | null |
e1528532/libelektra
|
src/plugins/regexdispatcher/Elektra/RegexDispatcher.hs
|
bsd-3-clause
|
hs_elektraHaskellError = elektraPluginErrorWith elektraRegexdispatcherError
| 75
|
hs_elektraHaskellError = elektraPluginErrorWith elektraRegexdispatcherError
| 75
|
hs_elektraHaskellError = elektraPluginErrorWith elektraRegexdispatcherError
| 75
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
nikita-volkov/ez-couch
|
src/EZCouch/ReadAction.hs
|
mit
|
readEntity :: (MonadAction m, Entity a, ToJSON k)
=> View a k -- ^ View
-> KeysSelection k -- ^ Keys selection mode
-> Int -- ^ Skip
-> Bool -- ^ Descending
-> m (Maybe (Persisted a))
readEntity view mode skip desc =
listToMaybe <$> readEntities view mode skip (Just 1) desc
| 287
|
readEntity :: (MonadAction m, Entity a, ToJSON k)
=> View a k -- ^ View
-> KeysSelection k -- ^ Keys selection mode
-> Int -- ^ Skip
-> Bool -- ^ Descending
-> m (Maybe (Persisted a))
readEntity view mode skip desc =
listToMaybe <$> readEntities view mode skip (Just 1) desc
| 287
|
readEntity view mode skip desc =
listToMaybe <$> readEntities view mode skip (Just 1) desc
| 93
| false
| true
| 0
| 15
| 65
| 106
| 53
| 53
| null | null |
gspindles/mj-score-eval
|
src/Game/Mahjong/Static/Examples.hs
|
mit
|
nineGatesEx :: Maybe Hand
nineGatesEx = mkSpecial1
[ b1, b1, b1
, b2, b3, b4
, b5
, b6, b7, b8
, b9, b9, b9
]
b5
[f3]
Nothing
| 143
|
nineGatesEx :: Maybe Hand
nineGatesEx = mkSpecial1
[ b1, b1, b1
, b2, b3, b4
, b5
, b6, b7, b8
, b9, b9, b9
]
b5
[f3]
Nothing
| 143
|
nineGatesEx = mkSpecial1
[ b1, b1, b1
, b2, b3, b4
, b5
, b6, b7, b8
, b9, b9, b9
]
b5
[f3]
Nothing
| 117
| false
| true
| 0
| 5
| 46
| 68
| 39
| 29
| null | null |
GaloisInc/halvm-ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
split_marker :: Char
split_marker = ':'
| 39
|
split_marker :: Char
split_marker = ':'
| 39
|
split_marker = ':'
| 18
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
jeannekamikaze/Spear
|
Spear/Math/Spatial3.hs
|
mit
|
-- | Move the spatial forwards.
moveFwd :: Spatial3 s => Float -> s -> s
moveFwd a s = let o = getObj3 s in setObj3 s $ o { p = p o + scale a (f o) }
| 151
|
moveFwd :: Spatial3 s => Float -> s -> s
moveFwd a s = let o = getObj3 s in setObj3 s $ o { p = p o + scale a (f o) }
| 117
|
moveFwd a s = let o = getObj3 s in setObj3 s $ o { p = p o + scale a (f o) }
| 76
| true
| true
| 0
| 14
| 42
| 84
| 39
| 45
| null | null |
ryanreich/bigint
|
test/Performance.hs
|
bsd-3-clause
|
twoNumbers :: Integer -> IO (Integer, Integer)
twoNumbers n = return (x,x)
where x = 2^(64 * 2^n) - 1
| 103
|
twoNumbers :: Integer -> IO (Integer, Integer)
twoNumbers n = return (x,x)
where x = 2^(64 * 2^n) - 1
| 103
|
twoNumbers n = return (x,x)
where x = 2^(64 * 2^n) - 1
| 56
| false
| true
| 3
| 8
| 21
| 73
| 34
| 39
| null | null |
kawamuray/ganeti
|
src/Ganeti/JQScheduler.hs
|
gpl-2.0
|
logFailedJobs jobs = do
let jids = S.fromList . map (qjId . jJob . fst) $ jobs
jidsString = commaJoin . map (show . fromJobId) . S.toList $ jids
logWarning $ "Starting jobs " ++ jidsString ++ " failed: "
++ show (map snd jobs)
return jids
-- | Requeue jobs that were previously selected for execution
-- but couldn't be started.
| 356
|
logFailedJobs jobs = do
let jids = S.fromList . map (qjId . jJob . fst) $ jobs
jidsString = commaJoin . map (show . fromJobId) . S.toList $ jids
logWarning $ "Starting jobs " ++ jidsString ++ " failed: "
++ show (map snd jobs)
return jids
-- | Requeue jobs that were previously selected for execution
-- but couldn't be started.
| 356
|
logFailedJobs jobs = do
let jids = S.fromList . map (qjId . jJob . fst) $ jobs
jidsString = commaJoin . map (show . fromJobId) . S.toList $ jids
logWarning $ "Starting jobs " ++ jidsString ++ " failed: "
++ show (map snd jobs)
return jids
-- | Requeue jobs that were previously selected for execution
-- but couldn't be started.
| 356
| false
| false
| 0
| 15
| 89
| 109
| 53
| 56
| null | null |
Bolt64/wyas
|
src/DataTypes.hs
|
mit
|
showType (LispString _) = "LispString"
| 38
|
showType (LispString _) = "LispString"
| 38
|
showType (LispString _) = "LispString"
| 38
| false
| false
| 0
| 6
| 4
| 16
| 7
| 9
| null | null |
seppeljordan/sdl2
|
src/SDL/Raw/Basic.hs
|
bsd-3-clause
|
logError :: CInt -> CString -> IO ()
logError category = logMessage category SDL_LOG_PRIORITY_ERROR
| 99
|
logError :: CInt -> CString -> IO ()
logError category = logMessage category SDL_LOG_PRIORITY_ERROR
| 99
|
logError category = logMessage category SDL_LOG_PRIORITY_ERROR
| 62
| false
| true
| 0
| 9
| 13
| 37
| 16
| 21
| null | null |
phonohawk/HsOpenSSL
|
OpenSSL/X509/Store.hs
|
cc0-1.0
|
getStoreCtxIssuer :: X509StoreCtx -> IO (Maybe X509)
getStoreCtxIssuer ctx = withX509StoreCtxPtr ctx $ \pCtx -> do
pCert <- _store_ctx_get0_current_issuer pCtx
if pCert == nullPtr
then return Nothing
else fmap Just $ mask_ $ _x509_ref pCert >> wrapX509 pCert
| 270
|
getStoreCtxIssuer :: X509StoreCtx -> IO (Maybe X509)
getStoreCtxIssuer ctx = withX509StoreCtxPtr ctx $ \pCtx -> do
pCert <- _store_ctx_get0_current_issuer pCtx
if pCert == nullPtr
then return Nothing
else fmap Just $ mask_ $ _x509_ref pCert >> wrapX509 pCert
| 270
|
getStoreCtxIssuer ctx = withX509StoreCtxPtr ctx $ \pCtx -> do
pCert <- _store_ctx_get0_current_issuer pCtx
if pCert == nullPtr
then return Nothing
else fmap Just $ mask_ $ _x509_ref pCert >> wrapX509 pCert
| 217
| false
| true
| 0
| 14
| 49
| 93
| 42
| 51
| null | null |
danr/agder
|
backend/Problems.hs
|
bsd-3-clause
|
problems :: FilePath
problems = "problems"
| 42
|
problems :: FilePath
problems = "problems"
| 42
|
problems = "problems"
| 21
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
brendanhay/numbersd
|
test/Properties/Conduit.hs
|
mpl-2.0
|
conduitProperties :: Test
conduitProperties = testGroup "sinks"
[ testGroup "graphite"
[ testGroup "aggregate event"
[ testProperty "encodes prefix" prop_graphite_aggr_event_encodes_prefix
, testProperty "encodes key" prop_graphite_aggr_event_encodes_key
, testProperty "encodes value" prop_graphite_aggr_event_encodes_value
]
, testProperty "ignores non aggregate events" prop_graphite_ignores_non_aggr_events
]
, testGroup "broadcast"
[ testProperty "doesn't modify received packets" prop_broadcast_doesnt_modify_received_packets
, testProperty "ignores non receive events" prop_broadcast_ignores_non_receive_events
]
, testGroup "downstream"
[ testGroup "flush event"
[ testProperty "encodes key" prop_downstream_flush_event_encodes_key
, testProperty "aggregates values" prop_downstream_flush_event_aggregates_values
, testProperty "encodes multiple values per line" prop_downstream_flush_event_encodes_mvalues_per_line
]
, testProperty "ignores non flush events" prop_downstream_ignores_non_flush_events
]
]
| 1,196
|
conduitProperties :: Test
conduitProperties = testGroup "sinks"
[ testGroup "graphite"
[ testGroup "aggregate event"
[ testProperty "encodes prefix" prop_graphite_aggr_event_encodes_prefix
, testProperty "encodes key" prop_graphite_aggr_event_encodes_key
, testProperty "encodes value" prop_graphite_aggr_event_encodes_value
]
, testProperty "ignores non aggregate events" prop_graphite_ignores_non_aggr_events
]
, testGroup "broadcast"
[ testProperty "doesn't modify received packets" prop_broadcast_doesnt_modify_received_packets
, testProperty "ignores non receive events" prop_broadcast_ignores_non_receive_events
]
, testGroup "downstream"
[ testGroup "flush event"
[ testProperty "encodes key" prop_downstream_flush_event_encodes_key
, testProperty "aggregates values" prop_downstream_flush_event_aggregates_values
, testProperty "encodes multiple values per line" prop_downstream_flush_event_encodes_mvalues_per_line
]
, testProperty "ignores non flush events" prop_downstream_ignores_non_flush_events
]
]
| 1,196
|
conduitProperties = testGroup "sinks"
[ testGroup "graphite"
[ testGroup "aggregate event"
[ testProperty "encodes prefix" prop_graphite_aggr_event_encodes_prefix
, testProperty "encodes key" prop_graphite_aggr_event_encodes_key
, testProperty "encodes value" prop_graphite_aggr_event_encodes_value
]
, testProperty "ignores non aggregate events" prop_graphite_ignores_non_aggr_events
]
, testGroup "broadcast"
[ testProperty "doesn't modify received packets" prop_broadcast_doesnt_modify_received_packets
, testProperty "ignores non receive events" prop_broadcast_ignores_non_receive_events
]
, testGroup "downstream"
[ testGroup "flush event"
[ testProperty "encodes key" prop_downstream_flush_event_encodes_key
, testProperty "aggregates values" prop_downstream_flush_event_aggregates_values
, testProperty "encodes multiple values per line" prop_downstream_flush_event_encodes_mvalues_per_line
]
, testProperty "ignores non flush events" prop_downstream_ignores_non_flush_events
]
]
| 1,170
| false
| true
| 0
| 11
| 274
| 136
| 68
| 68
| null | null |
awbraunstein/emonad
|
src/Editor.hs
|
mit
|
-- | Modify the minibuffer.
modifyMiniBuffer :: (String -> String) -> Editor
modifyMiniBuffer f = modify (\(ES bs d c (p, mb) v) -> ES bs d c (p, (f mb)) v)
| 156
|
modifyMiniBuffer :: (String -> String) -> Editor
modifyMiniBuffer f = modify (\(ES bs d c (p, mb) v) -> ES bs d c (p, (f mb)) v)
| 128
|
modifyMiniBuffer f = modify (\(ES bs d c (p, mb) v) -> ES bs d c (p, (f mb)) v)
| 79
| true
| true
| 0
| 11
| 31
| 86
| 44
| 42
| null | null |
ilexius/spf-ips
|
tests/tests.hs
|
gpl-3.0
|
tests = testGroup "Collected" [ TPS.tests ]
| 43
|
tests = testGroup "Collected" [ TPS.tests ]
| 43
|
tests = testGroup "Collected" [ TPS.tests ]
| 43
| false
| false
| 0
| 7
| 6
| 16
| 8
| 8
| null | null |
forste/haReFork
|
tools/base/syntax/SyntaxUtil.hs
|
bsd-3-clause
|
isVarE _ = False
| 37
|
isVarE _ = False
| 37
|
isVarE _ = False
| 37
| false
| false
| 0
| 4
| 24
| 10
| 4
| 6
| null | null |
raimohanska/Monads
|
challenges/State/IncrementBy10.hs
|
mit
|
incrementByTen = do
-- increment state 10 times
times 10 increment
-- return state
get
| 94
|
incrementByTen = do
-- increment state 10 times
times 10 increment
-- return state
get
| 94
|
incrementByTen = do
-- increment state 10 times
times 10 increment
-- return state
get
| 94
| false
| false
| 0
| 7
| 22
| 19
| 9
| 10
| null | null |
barrucadu/nagi
|
lib/Imageboard/Web/Template.hs
|
mit
|
threadSplices :: Maybe LoginId -> Bool -> Board -> Entity Thread -> BoardAction ctx BoardSplices
threadSplices loginid omit board (Entity threadid thread) = do
posts <- runSQL $ select $ from $ \p -> do
where_ (p ^. PostThread ==. val threadid)
when (isNothing loginid) $
where_ (p ^. PostHidden ==. val False)
orderBy [asc (p ^. PostCreatedAt)]
pure p
let Just (op, rest) = uncons posts
let (omitted, replies) = if omit
then splitAt (length rest - (boardPostsPerThread board-1)) rest
else ([], rest)
omittedImageReplies <- runSQL $ length <$> filterM isImageReply omitted
let omittedPosts = length omitted - omittedImageReplies
opSplices <- postSplices loginid op
link <- runSQL (formatThreadName threadid)
view <- getForm "threadControl" (threadControlForm thread)
pure $ do
opSplices
digestiveSplices view
"for-replies" ## forReplies replies
mapV textSplice $ do
"thread-id" ## show (fromThreadId threadid)
"thread-locked" ## tflag threadLocked "locked" "unlocked"
"thread-bumplocked" ## tflag threadBumplocked "bumplocked" "unbumplocked"
"thread-stickied" ## tflag threadStickied "stickied" "unstickied"
"thread-archived" ## tflag threadArchived "archived" "unarchived"
"thread-hidden" ## tflag threadHidden "hidden" "unhidden"
"omitted" ## case (omittedPosts, omittedImageReplies) of
(0, 0) -> ""
(0, y) -> show y <> " image " <> grammar y "reply" "replies" <> " omitted."
(x, 0) -> show x <> " " <> grammar x "post" "posts" <> " omitted."
(x, y) -> show x <> " " <> grammar x "post" "posts" <> " and " <>
show y <> " image " <> grammar y "reply" "replies" <> " omitted."
where
isImageReply (Entity postid _) = fmap (not . null) $ select $ from $ \a ->
where_ (a ^. AttachmentPost ==. val postid) >> pure a
forReplies = mapSplices renderPost where
renderPost p = runChildrenWith =<< lift (postSplices loginid p)
tflag f true false = if f thread then true else false
grammar 1 singular _ = singular
grammar _ _ plural = plural
-------------------------------------------------------------------------------
-- Post splices
-- | Splices to add when rendering a post.
--
-- TODO: word filters; file-type-info.
| 2,400
|
threadSplices :: Maybe LoginId -> Bool -> Board -> Entity Thread -> BoardAction ctx BoardSplices
threadSplices loginid omit board (Entity threadid thread) = do
posts <- runSQL $ select $ from $ \p -> do
where_ (p ^. PostThread ==. val threadid)
when (isNothing loginid) $
where_ (p ^. PostHidden ==. val False)
orderBy [asc (p ^. PostCreatedAt)]
pure p
let Just (op, rest) = uncons posts
let (omitted, replies) = if omit
then splitAt (length rest - (boardPostsPerThread board-1)) rest
else ([], rest)
omittedImageReplies <- runSQL $ length <$> filterM isImageReply omitted
let omittedPosts = length omitted - omittedImageReplies
opSplices <- postSplices loginid op
link <- runSQL (formatThreadName threadid)
view <- getForm "threadControl" (threadControlForm thread)
pure $ do
opSplices
digestiveSplices view
"for-replies" ## forReplies replies
mapV textSplice $ do
"thread-id" ## show (fromThreadId threadid)
"thread-locked" ## tflag threadLocked "locked" "unlocked"
"thread-bumplocked" ## tflag threadBumplocked "bumplocked" "unbumplocked"
"thread-stickied" ## tflag threadStickied "stickied" "unstickied"
"thread-archived" ## tflag threadArchived "archived" "unarchived"
"thread-hidden" ## tflag threadHidden "hidden" "unhidden"
"omitted" ## case (omittedPosts, omittedImageReplies) of
(0, 0) -> ""
(0, y) -> show y <> " image " <> grammar y "reply" "replies" <> " omitted."
(x, 0) -> show x <> " " <> grammar x "post" "posts" <> " omitted."
(x, y) -> show x <> " " <> grammar x "post" "posts" <> " and " <>
show y <> " image " <> grammar y "reply" "replies" <> " omitted."
where
isImageReply (Entity postid _) = fmap (not . null) $ select $ from $ \a ->
where_ (a ^. AttachmentPost ==. val postid) >> pure a
forReplies = mapSplices renderPost where
renderPost p = runChildrenWith =<< lift (postSplices loginid p)
tflag f true false = if f thread then true else false
grammar 1 singular _ = singular
grammar _ _ plural = plural
-------------------------------------------------------------------------------
-- Post splices
-- | Splices to add when rendering a post.
--
-- TODO: word filters; file-type-info.
| 2,400
|
threadSplices loginid omit board (Entity threadid thread) = do
posts <- runSQL $ select $ from $ \p -> do
where_ (p ^. PostThread ==. val threadid)
when (isNothing loginid) $
where_ (p ^. PostHidden ==. val False)
orderBy [asc (p ^. PostCreatedAt)]
pure p
let Just (op, rest) = uncons posts
let (omitted, replies) = if omit
then splitAt (length rest - (boardPostsPerThread board-1)) rest
else ([], rest)
omittedImageReplies <- runSQL $ length <$> filterM isImageReply omitted
let omittedPosts = length omitted - omittedImageReplies
opSplices <- postSplices loginid op
link <- runSQL (formatThreadName threadid)
view <- getForm "threadControl" (threadControlForm thread)
pure $ do
opSplices
digestiveSplices view
"for-replies" ## forReplies replies
mapV textSplice $ do
"thread-id" ## show (fromThreadId threadid)
"thread-locked" ## tflag threadLocked "locked" "unlocked"
"thread-bumplocked" ## tflag threadBumplocked "bumplocked" "unbumplocked"
"thread-stickied" ## tflag threadStickied "stickied" "unstickied"
"thread-archived" ## tflag threadArchived "archived" "unarchived"
"thread-hidden" ## tflag threadHidden "hidden" "unhidden"
"omitted" ## case (omittedPosts, omittedImageReplies) of
(0, 0) -> ""
(0, y) -> show y <> " image " <> grammar y "reply" "replies" <> " omitted."
(x, 0) -> show x <> " " <> grammar x "post" "posts" <> " omitted."
(x, y) -> show x <> " " <> grammar x "post" "posts" <> " and " <>
show y <> " image " <> grammar y "reply" "replies" <> " omitted."
where
isImageReply (Entity postid _) = fmap (not . null) $ select $ from $ \a ->
where_ (a ^. AttachmentPost ==. val postid) >> pure a
forReplies = mapSplices renderPost where
renderPost p = runChildrenWith =<< lift (postSplices loginid p)
tflag f true false = if f thread then true else false
grammar 1 singular _ = singular
grammar _ _ plural = plural
-------------------------------------------------------------------------------
-- Post splices
-- | Splices to add when rendering a post.
--
-- TODO: word filters; file-type-info.
| 2,303
| false
| true
| 0
| 25
| 612
| 753
| 358
| 395
| null | null |
ip1981/sproxy2
|
src/Sproxy/Application.hs
|
mit
|
forbidden :: AuthCookie -> W.Application
forbidden ac req resp = do
Log.info $ "403 Forbidden: " ++ show email ++ ": " ++ showReq req
resp $
W.responseLBS forbidden403 [(hContentType, "text/html; charset=utf-8")] page
where
email = getEmailUtf8 . acUser $ ac
page =
fromStrict
[qc|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Access Denied</title>
</head>
<body>
<h1>Access Denied</h1>
<p>You are currently logged in as <strong>{email}</strong></p>
<p><a href="/.sproxy/logout">Logout</a></p>
</body>
</html>
|]
| 595
|
forbidden :: AuthCookie -> W.Application
forbidden ac req resp = do
Log.info $ "403 Forbidden: " ++ show email ++ ": " ++ showReq req
resp $
W.responseLBS forbidden403 [(hContentType, "text/html; charset=utf-8")] page
where
email = getEmailUtf8 . acUser $ ac
page =
fromStrict
[qc|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Access Denied</title>
</head>
<body>
<h1>Access Denied</h1>
<p>You are currently logged in as <strong>{email}</strong></p>
<p><a href="/.sproxy/logout">Logout</a></p>
</body>
</html>
|]
| 595
|
forbidden ac req resp = do
Log.info $ "403 Forbidden: " ++ show email ++ ": " ++ showReq req
resp $
W.responseLBS forbidden403 [(hContentType, "text/html; charset=utf-8")] page
where
email = getEmailUtf8 . acUser $ ac
page =
fromStrict
[qc|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Access Denied</title>
</head>
<body>
<h1>Access Denied</h1>
<p>You are currently logged in as <strong>{email}</strong></p>
<p><a href="/.sproxy/logout">Logout</a></p>
</body>
</html>
|]
| 554
| false
| true
| 1
| 11
| 127
| 105
| 53
| 52
| null | null |
unisonweb/platform
|
parser-typechecker/src/Unison/Parser.hs
|
mit
|
uniqueBase32Namegen :: forall gen. Random.DRG gen => gen -> UniqueName
uniqueBase32Namegen rng =
UniqueName $ \pos lenInBase32Hex -> go pos lenInBase32Hex rng
where
-- if the identifier starts with a number, try again, since
-- we want the name to work as a valid wordyId
go :: L.Pos -> Int -> gen -> Maybe Text
go pos lenInBase32Hex rng0 = let
(bytes,rng) = Random.randomBytesGenerate 32 rng0
posBytes = runPutS $ do
serialize $ VarInt (L.line pos)
serialize $ VarInt (L.column pos)
h = Hashable.accumulate' $ bytes <> posBytes
b58 = Hash.base32Hex h
in if Char.isDigit (Text.head b58) then go pos lenInBase32Hex rng
else Just . Text.take lenInBase32Hex $ b58
| 711
|
uniqueBase32Namegen :: forall gen. Random.DRG gen => gen -> UniqueName
uniqueBase32Namegen rng =
UniqueName $ \pos lenInBase32Hex -> go pos lenInBase32Hex rng
where
-- if the identifier starts with a number, try again, since
-- we want the name to work as a valid wordyId
go :: L.Pos -> Int -> gen -> Maybe Text
go pos lenInBase32Hex rng0 = let
(bytes,rng) = Random.randomBytesGenerate 32 rng0
posBytes = runPutS $ do
serialize $ VarInt (L.line pos)
serialize $ VarInt (L.column pos)
h = Hashable.accumulate' $ bytes <> posBytes
b58 = Hash.base32Hex h
in if Char.isDigit (Text.head b58) then go pos lenInBase32Hex rng
else Just . Text.take lenInBase32Hex $ b58
| 711
|
uniqueBase32Namegen rng =
UniqueName $ \pos lenInBase32Hex -> go pos lenInBase32Hex rng
where
-- if the identifier starts with a number, try again, since
-- we want the name to work as a valid wordyId
go :: L.Pos -> Int -> gen -> Maybe Text
go pos lenInBase32Hex rng0 = let
(bytes,rng) = Random.randomBytesGenerate 32 rng0
posBytes = runPutS $ do
serialize $ VarInt (L.line pos)
serialize $ VarInt (L.column pos)
h = Hashable.accumulate' $ bytes <> posBytes
b58 = Hash.base32Hex h
in if Char.isDigit (Text.head b58) then go pos lenInBase32Hex rng
else Just . Text.take lenInBase32Hex $ b58
| 640
| false
| true
| 0
| 16
| 159
| 225
| 111
| 114
| null | null |
brendanhay/gogol
|
gogol-serviceuser/gen/Network/Google/Resource/ServiceUser/Projects/Services/Disable.hs
|
mpl-2.0
|
-- | Creates a value of 'ProjectsServicesDisable' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'psdXgafv'
--
-- * 'psdUploadProtocol'
--
-- * 'psdAccessToken'
--
-- * 'psdUploadType'
--
-- * 'psdPayload'
--
-- * 'psdName'
--
-- * 'psdCallback'
projectsServicesDisable
:: DisableServiceRequest -- ^ 'psdPayload'
-> Text -- ^ 'psdName'
-> ProjectsServicesDisable
projectsServicesDisable pPsdPayload_ pPsdName_ =
ProjectsServicesDisable'
{ _psdXgafv = Nothing
, _psdUploadProtocol = Nothing
, _psdAccessToken = Nothing
, _psdUploadType = Nothing
, _psdPayload = pPsdPayload_
, _psdName = pPsdName_
, _psdCallback = Nothing
}
| 755
|
projectsServicesDisable
:: DisableServiceRequest -- ^ 'psdPayload'
-> Text -- ^ 'psdName'
-> ProjectsServicesDisable
projectsServicesDisable pPsdPayload_ pPsdName_ =
ProjectsServicesDisable'
{ _psdXgafv = Nothing
, _psdUploadProtocol = Nothing
, _psdAccessToken = Nothing
, _psdUploadType = Nothing
, _psdPayload = pPsdPayload_
, _psdName = pPsdName_
, _psdCallback = Nothing
}
| 423
|
projectsServicesDisable pPsdPayload_ pPsdName_ =
ProjectsServicesDisable'
{ _psdXgafv = Nothing
, _psdUploadProtocol = Nothing
, _psdAccessToken = Nothing
, _psdUploadType = Nothing
, _psdPayload = pPsdPayload_
, _psdName = pPsdName_
, _psdCallback = Nothing
}
| 294
| true
| true
| 0
| 6
| 150
| 87
| 60
| 27
| null | null |
ssaavedra/liquidhaskell
|
tests/todo/gadtEval.hs
|
bsd-3-clause
|
equal (B x) (B y) = B (x == y)
| 31
|
equal (B x) (B y) = B (x == y)
| 31
|
equal (B x) (B y) = B (x == y)
| 31
| false
| false
| 0
| 7
| 10
| 35
| 16
| 19
| null | null |
isovector/dependent-types
|
src/Parser.hs
|
bsd-3-clause
|
readCharacter :: String -> Character
readCharacter "Ross" = Ross
| 68
|
readCharacter :: String -> Character
readCharacter "Ross" = Ross
| 68
|
readCharacter "Ross" = Ross
| 31
| false
| true
| 0
| 5
| 12
| 22
| 10
| 12
| null | null |
frantisekfarka/ghc-dsi
|
compiler/nativeGen/PPC/Ppr.hs
|
bsd-3-clause
|
pprInstr (FCMP reg1 reg2) = hcat [
char '\t',
ptext (sLit "fcmpu\tcr0, "),
-- Note: we're using fcmpu, not fcmpo
-- The difference is with fcmpo, compare with NaN is an invalid operation.
-- We don't handle invalid fp ops, so we don't care
pprReg reg1,
ptext (sLit ", "),
pprReg reg2
]
| 365
|
pprInstr (FCMP reg1 reg2) = hcat [
char '\t',
ptext (sLit "fcmpu\tcr0, "),
-- Note: we're using fcmpu, not fcmpo
-- The difference is with fcmpo, compare with NaN is an invalid operation.
-- We don't handle invalid fp ops, so we don't care
pprReg reg1,
ptext (sLit ", "),
pprReg reg2
]
| 365
|
pprInstr (FCMP reg1 reg2) = hcat [
char '\t',
ptext (sLit "fcmpu\tcr0, "),
-- Note: we're using fcmpu, not fcmpo
-- The difference is with fcmpo, compare with NaN is an invalid operation.
-- We don't handle invalid fp ops, so we don't care
pprReg reg1,
ptext (sLit ", "),
pprReg reg2
]
| 365
| false
| false
| 0
| 9
| 132
| 66
| 33
| 33
| null | null |
mikeizbicki/homoiconic
|
old/Algebra5.hs
|
bsd-3-clause
|
i :: IFree (I L) Int
i = IPure 3
| 32
|
i :: IFree (I L) Int
i = IPure 3
| 32
|
i = IPure 3
| 11
| false
| true
| 2
| 6
| 9
| 33
| 12
| 21
| null | null |
wyager/IHaskell
|
main/Main.hs
|
mit
|
replyTo _ message _ state = do
liftIO $ hPutStrLn stderr $ "Unimplemented message: " ++ show message
return (state, SendNothing)
-- | Handle comm messages
| 159
|
replyTo _ message _ state = do
liftIO $ hPutStrLn stderr $ "Unimplemented message: " ++ show message
return (state, SendNothing)
-- | Handle comm messages
| 159
|
replyTo _ message _ state = do
liftIO $ hPutStrLn stderr $ "Unimplemented message: " ++ show message
return (state, SendNothing)
-- | Handle comm messages
| 159
| false
| false
| 0
| 10
| 30
| 49
| 23
| 26
| null | null |
DavidAlphaFox/darcs
|
containers-0.5.2.1/Darcs/Data/Map/Base.hs
|
gpl-2.0
|
findMin :: Map k a -> (k,a)
findMin (Bin _ kx x Tip _) = (kx,x)
| 64
|
findMin :: Map k a -> (k,a)
findMin (Bin _ kx x Tip _) = (kx,x)
| 64
|
findMin (Bin _ kx x Tip _) = (kx,x)
| 36
| false
| true
| 0
| 7
| 16
| 49
| 26
| 23
| null | null |
darnuria/Yasc
|
Lisp.hs
|
mit
|
getVar :: Env -> String -> IOThrowsError LispVal
getVar envRef var = do
env <- liftIO $ readIORef envRef
maybe (throwError $ UnboundVar "Getting an unbound variable" var)
(liftIO . readIORef)
(lookup var env)
| 236
|
getVar :: Env -> String -> IOThrowsError LispVal
getVar envRef var = do
env <- liftIO $ readIORef envRef
maybe (throwError $ UnboundVar "Getting an unbound variable" var)
(liftIO . readIORef)
(lookup var env)
| 236
|
getVar envRef var = do
env <- liftIO $ readIORef envRef
maybe (throwError $ UnboundVar "Getting an unbound variable" var)
(liftIO . readIORef)
(lookup var env)
| 187
| false
| true
| 0
| 10
| 61
| 78
| 37
| 41
| null | null |
damianfral/clay
|
src/Clay/Flexbox.hs
|
bsd-3-clause
|
row, rowReverse, column, columnReverse :: FlexDirection
row = FlexDirection "row"
| 92
|
row, rowReverse, column, columnReverse :: FlexDirection
row = FlexDirection "row"
| 91
|
row = FlexDirection "row"
| 35
| false
| true
| 2
| 5
| 20
| 24
| 13
| 11
| null | null |
mbakke/ganeti
|
src/Ganeti/Hs2Py/OpDoc.hs
|
bsd-2-clause
|
opQuery :: String
opQuery =
"Query for resources/items.\n\
\\n\
\ @ivar what: Resources to query for, must be one of L{constants.QR_VIA_OP}\n\
\ @ivar fields: List of fields to retrieve\n\
\ @ivar qfilter: Query filter"
| 224
|
opQuery :: String
opQuery =
"Query for resources/items.\n\
\\n\
\ @ivar what: Resources to query for, must be one of L{constants.QR_VIA_OP}\n\
\ @ivar fields: List of fields to retrieve\n\
\ @ivar qfilter: Query filter"
| 224
|
opQuery =
"Query for resources/items.\n\
\\n\
\ @ivar what: Resources to query for, must be one of L{constants.QR_VIA_OP}\n\
\ @ivar fields: List of fields to retrieve\n\
\ @ivar qfilter: Query filter"
| 206
| false
| true
| 0
| 4
| 38
| 11
| 6
| 5
| null | null |
acowley/language-c
|
src/Language/C/Parser/Tokens.hs
|
bsd-3-clause
|
posLenOfTok (CTokSwitch pos ) = pos
| 38
|
posLenOfTok (CTokSwitch pos ) = pos
| 38
|
posLenOfTok (CTokSwitch pos ) = pos
| 38
| false
| false
| 0
| 6
| 8
| 16
| 7
| 9
| null | null |
brendanhay/gogol
|
gogol-gmail/gen/Network/Google/Gmail/Types/Product.hs
|
mpl-2.0
|
-- | List of messages changed in this history record. The fields for specific
-- change types, such as \`messagesAdded\` may duplicate messages in this
-- field. We recommend using the specific change-type fields instead of
-- this.
hMessages :: Lens' History [Message]
hMessages
= lens _hMessages (\ s a -> s{_hMessages = a}) .
_Default
. _Coerce
| 361
|
hMessages :: Lens' History [Message]
hMessages
= lens _hMessages (\ s a -> s{_hMessages = a}) .
_Default
. _Coerce
| 128
|
hMessages
= lens _hMessages (\ s a -> s{_hMessages = a}) .
_Default
. _Coerce
| 91
| true
| true
| 2
| 8
| 71
| 63
| 32
| 31
| null | null |
coghex/abridgefaraway
|
src/ABFA/World.hs
|
bsd-3-clause
|
seedConts state g (l:ls) (k:ks) (j:js) i = do
let x = seedGrid state 0 i (fst l) (snd l) g k j
seedConts state x ls ks js (i-1)
-- creates a single continent
| 162
|
seedConts state g (l:ls) (k:ks) (j:js) i = do
let x = seedGrid state 0 i (fst l) (snd l) g k j
seedConts state x ls ks js (i-1)
-- creates a single continent
| 162
|
seedConts state g (l:ls) (k:ks) (j:js) i = do
let x = seedGrid state 0 i (fst l) (snd l) g k j
seedConts state x ls ks js (i-1)
-- creates a single continent
| 162
| false
| false
| 0
| 12
| 39
| 102
| 51
| 51
| null | null |
apunktbau/co4
|
test/CO4/Thesis/WCB_MatrixStandalone.hs
|
gpl-3.0
|
matrixShift :: a -> List (List a) -> List (List a)
matrixShift zero m = matrixMap (\i j x -> case j of
Z -> zero
S j' -> matrixGet m (S i) j' zero id') m
| 157
|
matrixShift :: a -> List (List a) -> List (List a)
matrixShift zero m = matrixMap (\i j x -> case j of
Z -> zero
S j' -> matrixGet m (S i) j' zero id') m
| 157
|
matrixShift zero m = matrixMap (\i j x -> case j of
Z -> zero
S j' -> matrixGet m (S i) j' zero id') m
| 106
| false
| true
| 0
| 13
| 40
| 95
| 46
| 49
| null | null |
tejon/diagrams-contrib
|
src/Diagrams/TwoD/Path/Turtle.hs
|
bsd-3-clause
|
-- | Modify the current heading to the right by the specified angle in degrees.
right :: (OrderedField n, Monad m) => n -> TurtleT n m ()
right d = ST.modify $ T.right d
| 169
|
right :: (OrderedField n, Monad m) => n -> TurtleT n m ()
right d = ST.modify $ T.right d
| 89
|
right d = ST.modify $ T.right d
| 31
| true
| true
| 0
| 8
| 34
| 54
| 27
| 27
| null | null |
aztek/voogie
|
src/Voogie/Boogie/Syntax.hs
|
gpl-3.0
|
opTyped = ":"
| 13
|
opTyped = ":"
| 13
|
opTyped = ":"
| 13
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
jwiegley/hnix
|
src/Nix/Parser.hs
|
bsd-3-clause
|
-- postfix name op = (NUnaryDef name op,
-- Postfix (opWithLoc name op nUnary))
nixOperators
:: Parser (Ann SrcSpan (NAttrPath NExprLoc))
-> [[(NOperatorDef, Operator Parser NExprLoc)]]
nixOperators selector =
[ -- This is not parsed here, even though technically it's part of the
-- expression table. The problem is that in some cases, such as list
-- membership, it's also a term. And since terms are effectively the
-- highest precedence entities parsed by the expression parser, it ends up
-- working out that we parse them as a kind of "meta-term".
-- {- 1 -} [ (NSpecialDef "." NSelectOp NAssocLeft,
-- Postfix $ do
-- sel <- seldot *> selector
-- mor <- optional (reserved "or" *> term)
-- return $ \x -> nSelectLoc x sel mor) ]
{- 2 -}
[ ( NBinaryDef " " NApp NAssocLeft
,
-- Thanks to Brent Yorgey for showing me this trick!
InfixL $ nApp <$ symbol ""
)
]
, {- 3 -}
[prefix "-" NNeg]
, {- 4 -}
[ ( NSpecialDef "?" NHasAttrOp NAssocLeft
, Postfix $ symbol "?" *> (flip nHasAttr <$> selector)
)
]
, {- 5 -}
[binaryR "++" NConcat]
, {- 6 -}
[binaryL "*" NMult, binaryL "/" NDiv]
, {- 7 -}
[binaryL "+" NPlus, binaryL "-" NMinus]
, {- 8 -}
[prefix "!" NNot]
, {- 9 -}
[binaryR "//" NUpdate]
, {- 10 -}
[binaryL "<" NLt, binaryL ">" NGt, binaryL "<=" NLte, binaryL ">=" NGte]
, {- 11 -}
[binaryN "==" NEq, binaryN "!=" NNEq]
, {- 12 -}
[binaryL "&&" NAnd]
, {- 13 -}
[binaryL "||" NOr]
, {- 14 -}
[binaryN "->" NImpl]
]
| 1,703
|
nixOperators
:: Parser (Ann SrcSpan (NAttrPath NExprLoc))
-> [[(NOperatorDef, Operator Parser NExprLoc)]]
nixOperators selector =
[ -- This is not parsed here, even though technically it's part of the
-- expression table. The problem is that in some cases, such as list
-- membership, it's also a term. And since terms are effectively the
-- highest precedence entities parsed by the expression parser, it ends up
-- working out that we parse them as a kind of "meta-term".
-- {- 1 -} [ (NSpecialDef "." NSelectOp NAssocLeft,
-- Postfix $ do
-- sel <- seldot *> selector
-- mor <- optional (reserved "or" *> term)
-- return $ \x -> nSelectLoc x sel mor) ]
{- 2 -}
[ ( NBinaryDef " " NApp NAssocLeft
,
-- Thanks to Brent Yorgey for showing me this trick!
InfixL $ nApp <$ symbol ""
)
]
, {- 3 -}
[prefix "-" NNeg]
, {- 4 -}
[ ( NSpecialDef "?" NHasAttrOp NAssocLeft
, Postfix $ symbol "?" *> (flip nHasAttr <$> selector)
)
]
, {- 5 -}
[binaryR "++" NConcat]
, {- 6 -}
[binaryL "*" NMult, binaryL "/" NDiv]
, {- 7 -}
[binaryL "+" NPlus, binaryL "-" NMinus]
, {- 8 -}
[prefix "!" NNot]
, {- 9 -}
[binaryR "//" NUpdate]
, {- 10 -}
[binaryL "<" NLt, binaryL ">" NGt, binaryL "<=" NLte, binaryL ">=" NGte]
, {- 11 -}
[binaryN "==" NEq, binaryN "!=" NNEq]
, {- 12 -}
[binaryL "&&" NAnd]
, {- 13 -}
[binaryL "||" NOr]
, {- 14 -}
[binaryN "->" NImpl]
]
| 1,603
|
nixOperators selector =
[ -- This is not parsed here, even though technically it's part of the
-- expression table. The problem is that in some cases, such as list
-- membership, it's also a term. And since terms are effectively the
-- highest precedence entities parsed by the expression parser, it ends up
-- working out that we parse them as a kind of "meta-term".
-- {- 1 -} [ (NSpecialDef "." NSelectOp NAssocLeft,
-- Postfix $ do
-- sel <- seldot *> selector
-- mor <- optional (reserved "or" *> term)
-- return $ \x -> nSelectLoc x sel mor) ]
{- 2 -}
[ ( NBinaryDef " " NApp NAssocLeft
,
-- Thanks to Brent Yorgey for showing me this trick!
InfixL $ nApp <$ symbol ""
)
]
, {- 3 -}
[prefix "-" NNeg]
, {- 4 -}
[ ( NSpecialDef "?" NHasAttrOp NAssocLeft
, Postfix $ symbol "?" *> (flip nHasAttr <$> selector)
)
]
, {- 5 -}
[binaryR "++" NConcat]
, {- 6 -}
[binaryL "*" NMult, binaryL "/" NDiv]
, {- 7 -}
[binaryL "+" NPlus, binaryL "-" NMinus]
, {- 8 -}
[prefix "!" NNot]
, {- 9 -}
[binaryR "//" NUpdate]
, {- 10 -}
[binaryL "<" NLt, binaryL ">" NGt, binaryL "<=" NLte, binaryL ">=" NGte]
, {- 11 -}
[binaryN "==" NEq, binaryN "!=" NNEq]
, {- 12 -}
[binaryL "&&" NAnd]
, {- 13 -}
[binaryL "||" NOr]
, {- 14 -}
[binaryN "->" NImpl]
]
| 1,493
| true
| true
| 0
| 12
| 555
| 323
| 181
| 142
| null | null |
guillep19/uulib
|
src/UU/PPrint.hs
|
bsd-3-clause
|
double :: Double -> Doc
double d = text (show d)
| 55
|
double :: Double -> Doc
double d = text (show d)
| 55
|
double d = text (show d)
| 31
| false
| true
| 0
| 7
| 17
| 32
| 14
| 18
| null | null |
minhdoboi/deprecated-openshift-haskell-api
|
openshift/scripts/ClientUtils.hs
|
apache-2.0
|
defaultPort :: Int
defaultPort = 8443
| 37
|
defaultPort :: Int
defaultPort = 8443
| 37
|
defaultPort = 8443
| 18
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
phischu/game-dsl
|
tic-tac-toe/Main.hs
|
bsd-3-clause
|
renderO :: Rule
renderO = do
field <- entityTagged Field
x <- getAttribute XPosition field
y <- getAttribute YPosition field
ensure (getTag O field)
return (draw (translate (fieldCoordinate x) (fieldCoordinate y) (circleSolid 25)))
| 251
|
renderO :: Rule
renderO = do
field <- entityTagged Field
x <- getAttribute XPosition field
y <- getAttribute YPosition field
ensure (getTag O field)
return (draw (translate (fieldCoordinate x) (fieldCoordinate y) (circleSolid 25)))
| 251
|
renderO = do
field <- entityTagged Field
x <- getAttribute XPosition field
y <- getAttribute YPosition field
ensure (getTag O field)
return (draw (translate (fieldCoordinate x) (fieldCoordinate y) (circleSolid 25)))
| 235
| false
| true
| 0
| 14
| 52
| 106
| 46
| 60
| null | null |
sgillespie/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
uAddrHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uAddr#")
| 59
|
uAddrHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uAddr#")
| 59
|
uAddrHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uAddr#")
| 59
| false
| false
| 0
| 7
| 7
| 17
| 8
| 9
| null | null |
fffej/HS-Poker
|
LookupPatternMatch.hs
|
bsd-3-clause
|
getValueFromProduct 221559 = 5034
| 33
|
getValueFromProduct 221559 = 5034
| 33
|
getValueFromProduct 221559 = 5034
| 33
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
AccelerateHS/accelerate-c
|
Data/Array/Accelerate/C/Exp.hs
|
bsd-3-clause
|
primConstToC (PrimMaxBound ty) = maxBoundToC ty
| 47
|
primConstToC (PrimMaxBound ty) = maxBoundToC ty
| 47
|
primConstToC (PrimMaxBound ty) = maxBoundToC ty
| 47
| false
| false
| 0
| 7
| 5
| 18
| 8
| 10
| null | null |
oldmanmike/ghc
|
compiler/nativeGen/X86/CodeGen.hs
|
bsd-3-clause
|
genCCall64' :: DynFlags
-> ForeignTarget -- function to call
-> [CmmFormal] -- where to put the result
-> [CmmActual] -- arguments (of mixed type)
-> NatM InstrBlock
genCCall64' dflags target dest_regs args = do
-- load up the register arguments
let prom_args = map (maybePromoteCArg dflags W32) args
(stack_args, int_regs_used, fp_regs_used, load_args_code)
<-
if platformOS platform == OSMinGW32
then load_args_win prom_args [] [] (allArgRegs platform) nilOL
else do (stack_args, aregs, fregs, load_args_code)
<- load_args prom_args (allIntArgRegs platform) (allFPArgRegs platform) nilOL
let fp_regs_used = reverse (drop (length fregs) (reverse (allFPArgRegs platform)))
int_regs_used = reverse (drop (length aregs) (reverse (allIntArgRegs platform)))
return (stack_args, int_regs_used, fp_regs_used, load_args_code)
let
arg_regs_used = int_regs_used ++ fp_regs_used
arg_regs = [eax] ++ arg_regs_used
-- for annotating the call instruction with
sse_regs = length fp_regs_used
arg_stack_slots = if platformOS platform == OSMinGW32
then length stack_args + length (allArgRegs platform)
else length stack_args
tot_arg_size = arg_size * arg_stack_slots
-- Align stack to 16n for calls, assuming a starting stack
-- alignment of 16n - word_size on procedure entry. Which we
-- maintain. See Note [rts/StgCRun.c : Stack Alignment on X86]
(real_size, adjust_rsp) <-
if (tot_arg_size + wORD_SIZE dflags) `rem` 16 == 0
then return (tot_arg_size, nilOL)
else do -- we need to adjust...
delta <- getDeltaNat
setDeltaNat (delta - wORD_SIZE dflags)
return (tot_arg_size + wORD_SIZE dflags, toOL [
SUB II64 (OpImm (ImmInt (wORD_SIZE dflags))) (OpReg rsp),
DELTA (delta - wORD_SIZE dflags) ])
-- push the stack args, right to left
push_code <- push_args (reverse stack_args) nilOL
-- On Win64, we also have to leave stack space for the arguments
-- that we are passing in registers
lss_code <- if platformOS platform == OSMinGW32
then leaveStackSpace (length (allArgRegs platform))
else return nilOL
delta <- getDeltaNat
-- deal with static vs dynamic call targets
(callinsns,_cconv) <-
case target of
ForeignTarget (CmmLit (CmmLabel lbl)) conv
-> -- ToDo: stdcall arg sizes
return (unitOL (CALL (Left fn_imm) arg_regs), conv)
where fn_imm = ImmCLbl lbl
ForeignTarget expr conv
-> do (dyn_r, dyn_c) <- getSomeReg expr
return (dyn_c `snocOL` CALL (Right dyn_r) arg_regs, conv)
PrimTarget _
-> panic $ "genCCall: Can't handle PrimTarget call type here, error "
++ "probably because too many return values."
let
-- The x86_64 ABI requires us to set %al to the number of SSE2
-- registers that contain arguments, if the called routine
-- is a varargs function. We don't know whether it's a
-- varargs function or not, so we have to assume it is.
--
-- It's not safe to omit this assignment, even if the number
-- of SSE2 regs in use is zero. If %al is larger than 8
-- on entry to a varargs function, seg faults ensue.
assign_eax n = unitOL (MOV II32 (OpImm (ImmInt n)) (OpReg eax))
let call = callinsns `appOL`
toOL (
-- Deallocate parameters after call for ccall;
-- stdcall has callee do it, but is not supported on
-- x86_64 target (see #3336)
(if real_size==0 then [] else
[ADD (intFormat (wordWidth dflags)) (OpImm (ImmInt real_size)) (OpReg esp)])
++
[DELTA (delta + real_size)]
)
setDeltaNat (delta + real_size)
let
-- assign the results, if necessary
assign_code [] = nilOL
assign_code [dest] =
case typeWidth rep of
W32 | isFloatType rep -> unitOL (MOV (floatFormat W32)
(OpReg xmm0)
(OpReg r_dest))
W64 | isFloatType rep -> unitOL (MOV (floatFormat W64)
(OpReg xmm0)
(OpReg r_dest))
_ -> unitOL (MOV (cmmTypeFormat rep) (OpReg rax) (OpReg r_dest))
where
rep = localRegType dest
r_dest = getRegisterReg platform True (CmmLocal dest)
assign_code _many = panic "genCCall.assign_code many"
return (load_args_code `appOL`
adjust_rsp `appOL`
push_code `appOL`
lss_code `appOL`
assign_eax sse_regs `appOL`
call `appOL`
assign_code dest_regs)
where platform = targetPlatform dflags
arg_size = 8 -- always, at the mo
load_args :: [CmmExpr]
-> [Reg] -- int regs avail for args
-> [Reg] -- FP regs avail for args
-> InstrBlock
-> NatM ([CmmExpr],[Reg],[Reg],InstrBlock)
load_args args [] [] code = return (args, [], [], code)
-- no more regs to use
load_args [] aregs fregs code = return ([], aregs, fregs, code)
-- no more args to push
load_args (arg : rest) aregs fregs code
| isFloatType arg_rep =
case fregs of
[] -> push_this_arg
(r:rs) -> do
arg_code <- getAnyReg arg
load_args rest aregs rs (code `appOL` arg_code r)
| otherwise =
case aregs of
[] -> push_this_arg
(r:rs) -> do
arg_code <- getAnyReg arg
load_args rest rs fregs (code `appOL` arg_code r)
where
arg_rep = cmmExprType dflags arg
push_this_arg = do
(args',ars,frs,code') <- load_args rest aregs fregs code
return (arg:args', ars, frs, code')
load_args_win :: [CmmExpr]
-> [Reg] -- used int regs
-> [Reg] -- used FP regs
-> [(Reg, Reg)] -- (int, FP) regs avail for args
-> InstrBlock
-> NatM ([CmmExpr],[Reg],[Reg],InstrBlock)
load_args_win args usedInt usedFP [] code
= return (args, usedInt, usedFP, code)
-- no more regs to use
load_args_win [] usedInt usedFP _ code
= return ([], usedInt, usedFP, code)
-- no more args to push
load_args_win (arg : rest) usedInt usedFP
((ireg, freg) : regs) code
| isFloatType arg_rep = do
arg_code <- getAnyReg arg
load_args_win rest (ireg : usedInt) (freg : usedFP) regs
(code `appOL`
arg_code freg `snocOL`
-- If we are calling a varargs function
-- then we need to define ireg as well
-- as freg
MOV II64 (OpReg freg) (OpReg ireg))
| otherwise = do
arg_code <- getAnyReg arg
load_args_win rest (ireg : usedInt) usedFP regs
(code `appOL` arg_code ireg)
where
arg_rep = cmmExprType dflags arg
push_args [] code = return code
push_args (arg:rest) code
| isFloatType arg_rep = do
(arg_reg, arg_code) <- getSomeReg arg
delta <- getDeltaNat
setDeltaNat (delta-arg_size)
let code' = code `appOL` arg_code `appOL` toOL [
SUB (intFormat (wordWidth dflags)) (OpImm (ImmInt arg_size)) (OpReg rsp),
DELTA (delta-arg_size),
MOV (floatFormat width) (OpReg arg_reg) (OpAddr (spRel dflags 0))]
push_args rest code'
| otherwise = do
ASSERT(width == W64) return ()
(arg_op, arg_code) <- getOperand arg
delta <- getDeltaNat
setDeltaNat (delta-arg_size)
let code' = code `appOL` arg_code `appOL` toOL [
PUSH II64 arg_op,
DELTA (delta-arg_size)]
push_args rest code'
where
arg_rep = cmmExprType dflags arg
width = typeWidth arg_rep
leaveStackSpace n = do
delta <- getDeltaNat
setDeltaNat (delta - n * arg_size)
return $ toOL [
SUB II64 (OpImm (ImmInt (n * wORD_SIZE dflags))) (OpReg rsp),
DELTA (delta - n * arg_size)]
| 9,453
|
genCCall64' :: DynFlags
-> ForeignTarget -- function to call
-> [CmmFormal] -- where to put the result
-> [CmmActual] -- arguments (of mixed type)
-> NatM InstrBlock
genCCall64' dflags target dest_regs args = do
-- load up the register arguments
let prom_args = map (maybePromoteCArg dflags W32) args
(stack_args, int_regs_used, fp_regs_used, load_args_code)
<-
if platformOS platform == OSMinGW32
then load_args_win prom_args [] [] (allArgRegs platform) nilOL
else do (stack_args, aregs, fregs, load_args_code)
<- load_args prom_args (allIntArgRegs platform) (allFPArgRegs platform) nilOL
let fp_regs_used = reverse (drop (length fregs) (reverse (allFPArgRegs platform)))
int_regs_used = reverse (drop (length aregs) (reverse (allIntArgRegs platform)))
return (stack_args, int_regs_used, fp_regs_used, load_args_code)
let
arg_regs_used = int_regs_used ++ fp_regs_used
arg_regs = [eax] ++ arg_regs_used
-- for annotating the call instruction with
sse_regs = length fp_regs_used
arg_stack_slots = if platformOS platform == OSMinGW32
then length stack_args + length (allArgRegs platform)
else length stack_args
tot_arg_size = arg_size * arg_stack_slots
-- Align stack to 16n for calls, assuming a starting stack
-- alignment of 16n - word_size on procedure entry. Which we
-- maintain. See Note [rts/StgCRun.c : Stack Alignment on X86]
(real_size, adjust_rsp) <-
if (tot_arg_size + wORD_SIZE dflags) `rem` 16 == 0
then return (tot_arg_size, nilOL)
else do -- we need to adjust...
delta <- getDeltaNat
setDeltaNat (delta - wORD_SIZE dflags)
return (tot_arg_size + wORD_SIZE dflags, toOL [
SUB II64 (OpImm (ImmInt (wORD_SIZE dflags))) (OpReg rsp),
DELTA (delta - wORD_SIZE dflags) ])
-- push the stack args, right to left
push_code <- push_args (reverse stack_args) nilOL
-- On Win64, we also have to leave stack space for the arguments
-- that we are passing in registers
lss_code <- if platformOS platform == OSMinGW32
then leaveStackSpace (length (allArgRegs platform))
else return nilOL
delta <- getDeltaNat
-- deal with static vs dynamic call targets
(callinsns,_cconv) <-
case target of
ForeignTarget (CmmLit (CmmLabel lbl)) conv
-> -- ToDo: stdcall arg sizes
return (unitOL (CALL (Left fn_imm) arg_regs), conv)
where fn_imm = ImmCLbl lbl
ForeignTarget expr conv
-> do (dyn_r, dyn_c) <- getSomeReg expr
return (dyn_c `snocOL` CALL (Right dyn_r) arg_regs, conv)
PrimTarget _
-> panic $ "genCCall: Can't handle PrimTarget call type here, error "
++ "probably because too many return values."
let
-- The x86_64 ABI requires us to set %al to the number of SSE2
-- registers that contain arguments, if the called routine
-- is a varargs function. We don't know whether it's a
-- varargs function or not, so we have to assume it is.
--
-- It's not safe to omit this assignment, even if the number
-- of SSE2 regs in use is zero. If %al is larger than 8
-- on entry to a varargs function, seg faults ensue.
assign_eax n = unitOL (MOV II32 (OpImm (ImmInt n)) (OpReg eax))
let call = callinsns `appOL`
toOL (
-- Deallocate parameters after call for ccall;
-- stdcall has callee do it, but is not supported on
-- x86_64 target (see #3336)
(if real_size==0 then [] else
[ADD (intFormat (wordWidth dflags)) (OpImm (ImmInt real_size)) (OpReg esp)])
++
[DELTA (delta + real_size)]
)
setDeltaNat (delta + real_size)
let
-- assign the results, if necessary
assign_code [] = nilOL
assign_code [dest] =
case typeWidth rep of
W32 | isFloatType rep -> unitOL (MOV (floatFormat W32)
(OpReg xmm0)
(OpReg r_dest))
W64 | isFloatType rep -> unitOL (MOV (floatFormat W64)
(OpReg xmm0)
(OpReg r_dest))
_ -> unitOL (MOV (cmmTypeFormat rep) (OpReg rax) (OpReg r_dest))
where
rep = localRegType dest
r_dest = getRegisterReg platform True (CmmLocal dest)
assign_code _many = panic "genCCall.assign_code many"
return (load_args_code `appOL`
adjust_rsp `appOL`
push_code `appOL`
lss_code `appOL`
assign_eax sse_regs `appOL`
call `appOL`
assign_code dest_regs)
where platform = targetPlatform dflags
arg_size = 8 -- always, at the mo
load_args :: [CmmExpr]
-> [Reg] -- int regs avail for args
-> [Reg] -- FP regs avail for args
-> InstrBlock
-> NatM ([CmmExpr],[Reg],[Reg],InstrBlock)
load_args args [] [] code = return (args, [], [], code)
-- no more regs to use
load_args [] aregs fregs code = return ([], aregs, fregs, code)
-- no more args to push
load_args (arg : rest) aregs fregs code
| isFloatType arg_rep =
case fregs of
[] -> push_this_arg
(r:rs) -> do
arg_code <- getAnyReg arg
load_args rest aregs rs (code `appOL` arg_code r)
| otherwise =
case aregs of
[] -> push_this_arg
(r:rs) -> do
arg_code <- getAnyReg arg
load_args rest rs fregs (code `appOL` arg_code r)
where
arg_rep = cmmExprType dflags arg
push_this_arg = do
(args',ars,frs,code') <- load_args rest aregs fregs code
return (arg:args', ars, frs, code')
load_args_win :: [CmmExpr]
-> [Reg] -- used int regs
-> [Reg] -- used FP regs
-> [(Reg, Reg)] -- (int, FP) regs avail for args
-> InstrBlock
-> NatM ([CmmExpr],[Reg],[Reg],InstrBlock)
load_args_win args usedInt usedFP [] code
= return (args, usedInt, usedFP, code)
-- no more regs to use
load_args_win [] usedInt usedFP _ code
= return ([], usedInt, usedFP, code)
-- no more args to push
load_args_win (arg : rest) usedInt usedFP
((ireg, freg) : regs) code
| isFloatType arg_rep = do
arg_code <- getAnyReg arg
load_args_win rest (ireg : usedInt) (freg : usedFP) regs
(code `appOL`
arg_code freg `snocOL`
-- If we are calling a varargs function
-- then we need to define ireg as well
-- as freg
MOV II64 (OpReg freg) (OpReg ireg))
| otherwise = do
arg_code <- getAnyReg arg
load_args_win rest (ireg : usedInt) usedFP regs
(code `appOL` arg_code ireg)
where
arg_rep = cmmExprType dflags arg
push_args [] code = return code
push_args (arg:rest) code
| isFloatType arg_rep = do
(arg_reg, arg_code) <- getSomeReg arg
delta <- getDeltaNat
setDeltaNat (delta-arg_size)
let code' = code `appOL` arg_code `appOL` toOL [
SUB (intFormat (wordWidth dflags)) (OpImm (ImmInt arg_size)) (OpReg rsp),
DELTA (delta-arg_size),
MOV (floatFormat width) (OpReg arg_reg) (OpAddr (spRel dflags 0))]
push_args rest code'
| otherwise = do
ASSERT(width == W64) return ()
(arg_op, arg_code) <- getOperand arg
delta <- getDeltaNat
setDeltaNat (delta-arg_size)
let code' = code `appOL` arg_code `appOL` toOL [
PUSH II64 arg_op,
DELTA (delta-arg_size)]
push_args rest code'
where
arg_rep = cmmExprType dflags arg
width = typeWidth arg_rep
leaveStackSpace n = do
delta <- getDeltaNat
setDeltaNat (delta - n * arg_size)
return $ toOL [
SUB II64 (OpImm (ImmInt (n * wORD_SIZE dflags))) (OpReg rsp),
DELTA (delta - n * arg_size)]
| 9,453
|
genCCall64' dflags target dest_regs args = do
-- load up the register arguments
let prom_args = map (maybePromoteCArg dflags W32) args
(stack_args, int_regs_used, fp_regs_used, load_args_code)
<-
if platformOS platform == OSMinGW32
then load_args_win prom_args [] [] (allArgRegs platform) nilOL
else do (stack_args, aregs, fregs, load_args_code)
<- load_args prom_args (allIntArgRegs platform) (allFPArgRegs platform) nilOL
let fp_regs_used = reverse (drop (length fregs) (reverse (allFPArgRegs platform)))
int_regs_used = reverse (drop (length aregs) (reverse (allIntArgRegs platform)))
return (stack_args, int_regs_used, fp_regs_used, load_args_code)
let
arg_regs_used = int_regs_used ++ fp_regs_used
arg_regs = [eax] ++ arg_regs_used
-- for annotating the call instruction with
sse_regs = length fp_regs_used
arg_stack_slots = if platformOS platform == OSMinGW32
then length stack_args + length (allArgRegs platform)
else length stack_args
tot_arg_size = arg_size * arg_stack_slots
-- Align stack to 16n for calls, assuming a starting stack
-- alignment of 16n - word_size on procedure entry. Which we
-- maintain. See Note [rts/StgCRun.c : Stack Alignment on X86]
(real_size, adjust_rsp) <-
if (tot_arg_size + wORD_SIZE dflags) `rem` 16 == 0
then return (tot_arg_size, nilOL)
else do -- we need to adjust...
delta <- getDeltaNat
setDeltaNat (delta - wORD_SIZE dflags)
return (tot_arg_size + wORD_SIZE dflags, toOL [
SUB II64 (OpImm (ImmInt (wORD_SIZE dflags))) (OpReg rsp),
DELTA (delta - wORD_SIZE dflags) ])
-- push the stack args, right to left
push_code <- push_args (reverse stack_args) nilOL
-- On Win64, we also have to leave stack space for the arguments
-- that we are passing in registers
lss_code <- if platformOS platform == OSMinGW32
then leaveStackSpace (length (allArgRegs platform))
else return nilOL
delta <- getDeltaNat
-- deal with static vs dynamic call targets
(callinsns,_cconv) <-
case target of
ForeignTarget (CmmLit (CmmLabel lbl)) conv
-> -- ToDo: stdcall arg sizes
return (unitOL (CALL (Left fn_imm) arg_regs), conv)
where fn_imm = ImmCLbl lbl
ForeignTarget expr conv
-> do (dyn_r, dyn_c) <- getSomeReg expr
return (dyn_c `snocOL` CALL (Right dyn_r) arg_regs, conv)
PrimTarget _
-> panic $ "genCCall: Can't handle PrimTarget call type here, error "
++ "probably because too many return values."
let
-- The x86_64 ABI requires us to set %al to the number of SSE2
-- registers that contain arguments, if the called routine
-- is a varargs function. We don't know whether it's a
-- varargs function or not, so we have to assume it is.
--
-- It's not safe to omit this assignment, even if the number
-- of SSE2 regs in use is zero. If %al is larger than 8
-- on entry to a varargs function, seg faults ensue.
assign_eax n = unitOL (MOV II32 (OpImm (ImmInt n)) (OpReg eax))
let call = callinsns `appOL`
toOL (
-- Deallocate parameters after call for ccall;
-- stdcall has callee do it, but is not supported on
-- x86_64 target (see #3336)
(if real_size==0 then [] else
[ADD (intFormat (wordWidth dflags)) (OpImm (ImmInt real_size)) (OpReg esp)])
++
[DELTA (delta + real_size)]
)
setDeltaNat (delta + real_size)
let
-- assign the results, if necessary
assign_code [] = nilOL
assign_code [dest] =
case typeWidth rep of
W32 | isFloatType rep -> unitOL (MOV (floatFormat W32)
(OpReg xmm0)
(OpReg r_dest))
W64 | isFloatType rep -> unitOL (MOV (floatFormat W64)
(OpReg xmm0)
(OpReg r_dest))
_ -> unitOL (MOV (cmmTypeFormat rep) (OpReg rax) (OpReg r_dest))
where
rep = localRegType dest
r_dest = getRegisterReg platform True (CmmLocal dest)
assign_code _many = panic "genCCall.assign_code many"
return (load_args_code `appOL`
adjust_rsp `appOL`
push_code `appOL`
lss_code `appOL`
assign_eax sse_regs `appOL`
call `appOL`
assign_code dest_regs)
where platform = targetPlatform dflags
arg_size = 8 -- always, at the mo
load_args :: [CmmExpr]
-> [Reg] -- int regs avail for args
-> [Reg] -- FP regs avail for args
-> InstrBlock
-> NatM ([CmmExpr],[Reg],[Reg],InstrBlock)
load_args args [] [] code = return (args, [], [], code)
-- no more regs to use
load_args [] aregs fregs code = return ([], aregs, fregs, code)
-- no more args to push
load_args (arg : rest) aregs fregs code
| isFloatType arg_rep =
case fregs of
[] -> push_this_arg
(r:rs) -> do
arg_code <- getAnyReg arg
load_args rest aregs rs (code `appOL` arg_code r)
| otherwise =
case aregs of
[] -> push_this_arg
(r:rs) -> do
arg_code <- getAnyReg arg
load_args rest rs fregs (code `appOL` arg_code r)
where
arg_rep = cmmExprType dflags arg
push_this_arg = do
(args',ars,frs,code') <- load_args rest aregs fregs code
return (arg:args', ars, frs, code')
load_args_win :: [CmmExpr]
-> [Reg] -- used int regs
-> [Reg] -- used FP regs
-> [(Reg, Reg)] -- (int, FP) regs avail for args
-> InstrBlock
-> NatM ([CmmExpr],[Reg],[Reg],InstrBlock)
load_args_win args usedInt usedFP [] code
= return (args, usedInt, usedFP, code)
-- no more regs to use
load_args_win [] usedInt usedFP _ code
= return ([], usedInt, usedFP, code)
-- no more args to push
load_args_win (arg : rest) usedInt usedFP
((ireg, freg) : regs) code
| isFloatType arg_rep = do
arg_code <- getAnyReg arg
load_args_win rest (ireg : usedInt) (freg : usedFP) regs
(code `appOL`
arg_code freg `snocOL`
-- If we are calling a varargs function
-- then we need to define ireg as well
-- as freg
MOV II64 (OpReg freg) (OpReg ireg))
| otherwise = do
arg_code <- getAnyReg arg
load_args_win rest (ireg : usedInt) usedFP regs
(code `appOL` arg_code ireg)
where
arg_rep = cmmExprType dflags arg
push_args [] code = return code
push_args (arg:rest) code
| isFloatType arg_rep = do
(arg_reg, arg_code) <- getSomeReg arg
delta <- getDeltaNat
setDeltaNat (delta-arg_size)
let code' = code `appOL` arg_code `appOL` toOL [
SUB (intFormat (wordWidth dflags)) (OpImm (ImmInt arg_size)) (OpReg rsp),
DELTA (delta-arg_size),
MOV (floatFormat width) (OpReg arg_reg) (OpAddr (spRel dflags 0))]
push_args rest code'
| otherwise = do
ASSERT(width == W64) return ()
(arg_op, arg_code) <- getOperand arg
delta <- getDeltaNat
setDeltaNat (delta-arg_size)
let code' = code `appOL` arg_code `appOL` toOL [
PUSH II64 arg_op,
DELTA (delta-arg_size)]
push_args rest code'
where
arg_rep = cmmExprType dflags arg
width = typeWidth arg_rep
leaveStackSpace n = do
delta <- getDeltaNat
setDeltaNat (delta - n * arg_size)
return $ toOL [
SUB II64 (OpImm (ImmInt (n * wORD_SIZE dflags))) (OpReg rsp),
DELTA (delta - n * arg_size)]
| 9,214
| false
| true
| 6
| 21
| 3,892
| 2,294
| 1,162
| 1,132
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.