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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
justinethier/husk-scheme | hs-src/Language/Scheme/Core.hs | mit | eval env cont val@(Vector _) = continueEval env cont val Nothing | 64 | eval env cont val@(Vector _) = continueEval env cont val Nothing | 64 | eval env cont val@(Vector _) = continueEval env cont val Nothing | 64 | false | false | 0 | 8 | 10 | 31 | 15 | 16 | null | null |
jwiegley/ghc-release | utils/haddock/src/Haddock/Backends/Xhtml/Decl.hs | gpl-3.0 | ppFunLhType unicode qual ty = ppr_mono_ty pREC_FUN ty unicode qual | 67 | ppFunLhType unicode qual ty = ppr_mono_ty pREC_FUN ty unicode qual | 67 | ppFunLhType unicode qual ty = ppr_mono_ty pREC_FUN ty unicode qual | 67 | false | false | 0 | 5 | 10 | 22 | 10 | 12 | null | null |
Axure/elm-compiler | src/Validate.hs | bsd-3-clause | extractValues :: D.ValidDecl -> ([A.Located String], [A.Located String])
extractValues (A.A (region, _) decl) =
case decl of
D.Definition (Valid.Definition pattern _ _) ->
( Pattern.boundVars pattern
, []
)
D.Datatype name _ ctors ->
( map (A.A region . fst) ctors
, [A.A region name]
)
D.TypeAlias name _ (A.A _ (Type.RRecord _ _)) ->
( [A.A region name]
, [A.A region name]
)
D.TypeAlias name _ _ ->
( []
, [A.A region name]
)
D.Port port ->
( [A.A region (D.validPortName port)]
, []
)
D.Fixity _ _ _ ->
( []
, []
)
-- UNBOUND TYPE VARIABLES | 721 | extractValues :: D.ValidDecl -> ([A.Located String], [A.Located String])
extractValues (A.A (region, _) decl) =
case decl of
D.Definition (Valid.Definition pattern _ _) ->
( Pattern.boundVars pattern
, []
)
D.Datatype name _ ctors ->
( map (A.A region . fst) ctors
, [A.A region name]
)
D.TypeAlias name _ (A.A _ (Type.RRecord _ _)) ->
( [A.A region name]
, [A.A region name]
)
D.TypeAlias name _ _ ->
( []
, [A.A region name]
)
D.Port port ->
( [A.A region (D.validPortName port)]
, []
)
D.Fixity _ _ _ ->
( []
, []
)
-- UNBOUND TYPE VARIABLES | 721 | extractValues (A.A (region, _) decl) =
case decl of
D.Definition (Valid.Definition pattern _ _) ->
( Pattern.boundVars pattern
, []
)
D.Datatype name _ ctors ->
( map (A.A region . fst) ctors
, [A.A region name]
)
D.TypeAlias name _ (A.A _ (Type.RRecord _ _)) ->
( [A.A region name]
, [A.A region name]
)
D.TypeAlias name _ _ ->
( []
, [A.A region name]
)
D.Port port ->
( [A.A region (D.validPortName port)]
, []
)
D.Fixity _ _ _ ->
( []
, []
)
-- UNBOUND TYPE VARIABLES | 648 | false | true | 0 | 13 | 277 | 303 | 156 | 147 | null | null |
eddywestbrook/hobbits | src/Data/Binding/Hobbits/QQ.hs | bsd-3-clause | -- | Helper function to apply an expression to multiple arguments
appEMulti :: Exp -> [Exp] -> Exp
appEMulti = foldl AppE | 121 | appEMulti :: Exp -> [Exp] -> Exp
appEMulti = foldl AppE | 55 | appEMulti = foldl AppE | 22 | true | true | 0 | 7 | 21 | 26 | 14 | 12 | null | null |
rzil/honours | LeavittPathAlgebras/Example15.hs | mit | f2 = edge2 "f" | 14 | f2 = edge2 "f" | 14 | f2 = edge2 "f" | 14 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
cdepillabout/ssh | src/SSH/Session.hs | bsd-3-clause | newChannelID :: Session Word32
newChannelID = gets ssChannels >>= return . findNext . M.keys
where
findNext :: [Word32] -> Word32
findNext ks = head . filter (not . (`elem` ks)) $ [0..] | 195 | newChannelID :: Session Word32
newChannelID = gets ssChannels >>= return . findNext . M.keys
where
findNext :: [Word32] -> Word32
findNext ks = head . filter (not . (`elem` ks)) $ [0..] | 195 | newChannelID = gets ssChannels >>= return . findNext . M.keys
where
findNext :: [Word32] -> Word32
findNext ks = head . filter (not . (`elem` ks)) $ [0..] | 164 | false | true | 1 | 10 | 41 | 90 | 44 | 46 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/WebGLRenderingContextBase.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContextBase.getProgramParameter Mozilla WebGLRenderingContextBase.getProgramParameter documentation>
getProgramParameter_ ::
(MonadDOM m, IsWebGLRenderingContextBase self) =>
self -> Maybe WebGLProgram -> GLenum -> m ()
getProgramParameter_ self program pname
= liftDOM
(void
((toWebGLRenderingContextBase self) ^. jsf "getProgramParameter"
[toJSVal program, toJSVal pname])) | 518 | getProgramParameter_ ::
(MonadDOM m, IsWebGLRenderingContextBase self) =>
self -> Maybe WebGLProgram -> GLenum -> m ()
getProgramParameter_ self program pname
= liftDOM
(void
((toWebGLRenderingContextBase self) ^. jsf "getProgramParameter"
[toJSVal program, toJSVal pname])) | 347 | getProgramParameter_ self program pname
= liftDOM
(void
((toWebGLRenderingContextBase self) ^. jsf "getProgramParameter"
[toJSVal program, toJSVal pname])) | 184 | true | true | 0 | 12 | 111 | 98 | 47 | 51 | null | null |
thasenpusch/scheme | syntax.hs | isc | numberIsExactInt :: Number -> Bool
numberIsExactInt (LComplex x) = imagPart x == 0 && case realPart x of
LInexact _ -> False
LExact y -> isInt y | 152 | numberIsExactInt :: Number -> Bool
numberIsExactInt (LComplex x) = imagPart x == 0 && case realPart x of
LInexact _ -> False
LExact y -> isInt y | 152 | numberIsExactInt (LComplex x) = imagPart x == 0 && case realPart x of
LInexact _ -> False
LExact y -> isInt y | 117 | false | true | 0 | 9 | 34 | 63 | 29 | 34 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2017/M01/D09/Exercise.hs | mit | pers2JSON :: Person -> ByteString
pers2JSON pers = undefined | 60 | pers2JSON :: Person -> ByteString
pers2JSON pers = undefined | 60 | pers2JSON pers = undefined | 26 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
yupferris/write-you-a-haskell | chapter9/happy/Eval.hs | mit | binop Eql (VInt a) (VInt b) = return $ VBool (a==b) | 51 | binop Eql (VInt a) (VInt b) = return $ VBool (a==b) | 51 | binop Eql (VInt a) (VInt b) = return $ VBool (a==b) | 51 | false | false | 0 | 8 | 10 | 41 | 19 | 22 | null | null |
erantapaa/test-spelling | src/Dictionary.hs | bsd-3-clause | backup db p
| p <= 0 = 0
| BS.index db (p-1) == '\n' = p
| otherwise = backup db (p-1) | 127 | backup db p
| p <= 0 = 0
| BS.index db (p-1) == '\n' = p
| otherwise = backup db (p-1) | 127 | backup db p
| p <= 0 = 0
| BS.index db (p-1) == '\n' = p
| otherwise = backup db (p-1) | 127 | false | false | 1 | 11 | 63 | 73 | 34 | 39 | null | null |
koengit/zeldspar | tests/Examples.hs | bsd-3-clause | main = return () | 16 | main = return () | 16 | main = return () | 16 | false | false | 1 | 6 | 3 | 14 | 5 | 9 | null | null |
gridaphobe/ghc | compiler/types/Coercion.hs | bsd-3-clause | -- Note, mkAppCo is careful to maintain invariants regarding
-- where Refl constructors appear; see the comments in the definition
-- of Coercion and the Note [Refl invariant] in TyCoRep.
-- | Applies multiple 'Coercion's to another 'Coercion', from left to right.
-- See also 'mkAppCo'.
mkAppCos :: Coercion
-> [Coercion]
-> Coercion
mkAppCos co1 cos = foldl mkAppCo co1 cos | 394 | mkAppCos :: Coercion
-> [Coercion]
-> Coercion
mkAppCos co1 cos = foldl mkAppCo co1 cos | 105 | mkAppCos co1 cos = foldl mkAppCo co1 cos | 40 | true | true | 0 | 7 | 79 | 39 | 22 | 17 | null | null |
keera-studios/hssdl | Graphics/UI/SDL/Utilities.hs | bsd-3-clause | fromBitmask :: (Bounded a,Enum a b,Bits b,Num b) => b -> [a]
fromBitmask mask = foldr worker [] lst
where lst = enumFromTo minBound maxBound
worker v
= if (mask .&. fromEnum v) /= 0
then (:) v
else id
{-
toBitmaskW :: (UnsignedEnum a) => [a] -> Word32
toBitmaskW = foldr (.|.) 0 . map fromEnumW
fromBitmaskW :: (Bounded a,UnsignedEnum a) => Word32 -> [a]
fromBitmaskW mask = foldr worker [] lst
where lst = enumFromToW minBound maxBound
worker v
= if (mask .&. fromEnumW v) /= 0
then (:) v
else id
-} | 634 | fromBitmask :: (Bounded a,Enum a b,Bits b,Num b) => b -> [a]
fromBitmask mask = foldr worker [] lst
where lst = enumFromTo minBound maxBound
worker v
= if (mask .&. fromEnum v) /= 0
then (:) v
else id
{-
toBitmaskW :: (UnsignedEnum a) => [a] -> Word32
toBitmaskW = foldr (.|.) 0 . map fromEnumW
fromBitmaskW :: (Bounded a,UnsignedEnum a) => Word32 -> [a]
fromBitmaskW mask = foldr worker [] lst
where lst = enumFromToW minBound maxBound
worker v
= if (mask .&. fromEnumW v) /= 0
then (:) v
else id
-} | 634 | fromBitmask mask = foldr worker [] lst
where lst = enumFromTo minBound maxBound
worker v
= if (mask .&. fromEnum v) /= 0
then (:) v
else id
{-
toBitmaskW :: (UnsignedEnum a) => [a] -> Word32
toBitmaskW = foldr (.|.) 0 . map fromEnumW
fromBitmaskW :: (Bounded a,UnsignedEnum a) => Word32 -> [a]
fromBitmaskW mask = foldr worker [] lst
where lst = enumFromToW minBound maxBound
worker v
= if (mask .&. fromEnumW v) /= 0
then (:) v
else id
-} | 573 | false | true | 2 | 9 | 228 | 123 | 57 | 66 | null | null |
olorin/amazonka | amazonka-redshift/gen/Network/AWS/Redshift/Types/Product.hs | mpl-2.0 | -- | The anticipated utilization of the reserved node, as defined in the
-- reserved node offering.
rnOfferingType :: Lens' ReservedNode (Maybe Text)
rnOfferingType = lens _rnOfferingType (\ s a -> s{_rnOfferingType = a}) | 221 | rnOfferingType :: Lens' ReservedNode (Maybe Text)
rnOfferingType = lens _rnOfferingType (\ s a -> s{_rnOfferingType = a}) | 121 | rnOfferingType = lens _rnOfferingType (\ s a -> s{_rnOfferingType = a}) | 71 | true | true | 0 | 9 | 33 | 47 | 26 | 21 | null | null |
zachsully/hakaru | haskell/Language/Hakaru/Parser/Parser.hs | bsd-3-clause | let_expr :: Parser (AST' Text)
let_expr = localIndentation Ge
(absoluteIndentation (try (Let <$> identifier <* reservedOp "=")
<*> localIndentation Gt expr)
<*> absoluteIndentation expr) | 194 | let_expr :: Parser (AST' Text)
let_expr = localIndentation Ge
(absoluteIndentation (try (Let <$> identifier <* reservedOp "=")
<*> localIndentation Gt expr)
<*> absoluteIndentation expr) | 194 | let_expr = localIndentation Ge
(absoluteIndentation (try (Let <$> identifier <* reservedOp "=")
<*> localIndentation Gt expr)
<*> absoluteIndentation expr) | 163 | false | true | 2 | 14 | 31 | 75 | 32 | 43 | null | null |
snoyberg/ghc | compiler/utils/Util.hs | bsd-3-clause | mapAccumL2 :: (s1 -> s2 -> a -> (s1, s2, b)) -> s1 -> s2 -> [a] -> (s1, s2, [b])
mapAccumL2 f s1 s2 xs = (s1', s2', ys)
where ((s1', s2'), ys) = mapAccumL (\(s1, s2) x -> case f s1 s2 x of
(s1', s2', y) -> ((s1', s2'), y))
(s1, s2) xs | 328 | mapAccumL2 :: (s1 -> s2 -> a -> (s1, s2, b)) -> s1 -> s2 -> [a] -> (s1, s2, [b])
mapAccumL2 f s1 s2 xs = (s1', s2', ys)
where ((s1', s2'), ys) = mapAccumL (\(s1, s2) x -> case f s1 s2 x of
(s1', s2', y) -> ((s1', s2'), y))
(s1, s2) xs | 328 | mapAccumL2 f s1 s2 xs = (s1', s2', ys)
where ((s1', s2'), ys) = mapAccumL (\(s1, s2) x -> case f s1 s2 x of
(s1', s2', y) -> ((s1', s2'), y))
(s1, s2) xs | 247 | false | true | 0 | 12 | 149 | 171 | 99 | 72 | null | null |
markflorisson/hpack | testrepo/bytestring-0.10.4.1/Data/ByteString/Internal.hs | bsd-3-clause | -- for Hugs, NHC etc
unsafeDupablePerformIO :: IO a -> a
unsafeDupablePerformIO = unsafePerformIO | 97 | unsafeDupablePerformIO :: IO a -> a
unsafeDupablePerformIO = unsafePerformIO | 76 | unsafeDupablePerformIO = unsafePerformIO | 40 | true | true | 0 | 6 | 13 | 19 | 10 | 9 | null | null |
svenssonjoel/EmbArBB | Intel/ArBB/Backend/ArBB/CodeGen.hs | bsd-3-clause | isOpDynamic Scatter = True | 26 | isOpDynamic Scatter = True | 26 | isOpDynamic Scatter = True | 26 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
grnet/snf-ganeti | src/Ganeti/OpParams.hs | bsd-2-clause | pClusterOsParamsPrivate :: Field
pClusterOsParamsPrivate =
withDoc "Cluster-wide private OS parameter defaults" .
renameField "ClusterOsParamsPrivate" .
optionalField $
-- This field needs an unique name to aid Python deserialization
simpleField "osparams_private_cluster"
[t| GenericContainer String (JSObject (Private JSValue)) |] | 346 | pClusterOsParamsPrivate :: Field
pClusterOsParamsPrivate =
withDoc "Cluster-wide private OS parameter defaults" .
renameField "ClusterOsParamsPrivate" .
optionalField $
-- This field needs an unique name to aid Python deserialization
simpleField "osparams_private_cluster"
[t| GenericContainer String (JSObject (Private JSValue)) |] | 346 | pClusterOsParamsPrivate =
withDoc "Cluster-wide private OS parameter defaults" .
renameField "ClusterOsParamsPrivate" .
optionalField $
-- This field needs an unique name to aid Python deserialization
simpleField "osparams_private_cluster"
[t| GenericContainer String (JSObject (Private JSValue)) |] | 313 | false | true | 0 | 8 | 50 | 40 | 21 | 19 | null | null |
vikraman/ghc | compiler/basicTypes/Literal.hs | bsd-3-clause | litTag (MachStr _) = 2 | 30 | litTag (MachStr _) = 2 | 30 | litTag (MachStr _) = 2 | 30 | false | false | 0 | 6 | 12 | 16 | 7 | 9 | null | null |
bergey/plots | src/Plots/Types/Others.hs | bsd-3-clause | linerangevPlot :: (Typeable b, Renderable (Path V2 Double) b,
MonadState (Axis b c Double) m, BaseSpace c ~ V2) =>
(Double, Double) -> Double -> m ()
linerangevPlot a s = linePlot (createlinerangev a s) | 240 | linerangevPlot :: (Typeable b, Renderable (Path V2 Double) b,
MonadState (Axis b c Double) m, BaseSpace c ~ V2) =>
(Double, Double) -> Double -> m ()
linerangevPlot a s = linePlot (createlinerangev a s) | 240 | linerangevPlot a s = linePlot (createlinerangev a s) | 53 | false | true | 0 | 9 | 72 | 100 | 50 | 50 | null | null |
rubenpieters/gre-project | shared/src/GameState.hs | bsd-3-clause | newTimersAndEffs :: [Timer] -> ([(CardEffect, Origin)], [Timer])
newTimersAndEffs ts = partitionEithers $ tick <$> ts | 117 | newTimersAndEffs :: [Timer] -> ([(CardEffect, Origin)], [Timer])
newTimersAndEffs ts = partitionEithers $ tick <$> ts | 117 | newTimersAndEffs ts = partitionEithers $ tick <$> ts | 52 | false | true | 0 | 10 | 14 | 53 | 28 | 25 | null | null |
brendanhay/gogol | gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs | mpl-2.0 | -- | Client billing code of this project.
pClientBillingCode :: Lens' Project (Maybe Text)
pClientBillingCode
= lens _pClientBillingCode
(\ s a -> s{_pClientBillingCode = a}) | 182 | pClientBillingCode :: Lens' Project (Maybe Text)
pClientBillingCode
= lens _pClientBillingCode
(\ s a -> s{_pClientBillingCode = a}) | 140 | pClientBillingCode
= lens _pClientBillingCode
(\ s a -> s{_pClientBillingCode = a}) | 91 | true | true | 1 | 9 | 32 | 51 | 25 | 26 | null | null |
davdar/darailude | ghci-load/GHCILoad.hs | bsd-3-clause | extensionFlags ∷ BuildInfo → String
extensionFlags = intercalate " " . map (\ s → "-X" ++ extensionCommand s) . defaultExtensions | 129 | extensionFlags ∷ BuildInfo → String
extensionFlags = intercalate " " . map (\ s → "-X" ++ extensionCommand s) . defaultExtensions | 129 | extensionFlags = intercalate " " . map (\ s → "-X" ++ extensionCommand s) . defaultExtensions | 93 | false | true | 0 | 11 | 20 | 44 | 22 | 22 | null | null |
anchor/snaplet-httpauth | test/SnapletTestsResponse.hs | bsd-3-clause | suite :: Spec
suite = do
describe "no auth" $
it "fetches a page without auth" $
req "/pub" "get" Nothing Nothing >>=
expectHttpCode HT.ok200
describe "ifheader auth" $ do
it "prompts for auth when none is provided" $
req "/ifheader" "get" Nothing Nothing >>=
expectHttpCodeHeaders HT.unauthorized401 [("WWW-Authenticate", "Basic realm=ifheader")]
it "flunks out when bad auth is provided" $
req "/ifheader" "get" Nothing (Just $ packBasic "wrong" "credentials") >>=
expectHttpCode HT.ok200
it "fetches a page when auth is provided" $
req "/ifheader" "get" Nothing (Just $ packBasic "foo" "bar") >>=
expectHttpCode HT.ok200
describe "userpass auth" $ do
it "prompts for auth when none is provided" $
req "/userpass" "get" Nothing Nothing >>=
expectHttpCodeHeaders HT.unauthorized401 [("WWW-Authenticate", "Basic realm=userpass")]
it "flunks out when bad auth is provided" $
req "/userpass" "get" Nothing (Just $ packBasic "wrong" "credentials") >>=
expectHttpCode HT.forbidden403
it "fetches a page when good auth is provided" $
req "/userpass" "get" Nothing (Just $ packBasic "foo" "bar") >>=
expectHttpCode HT.ok200 | 1,355 | suite :: Spec
suite = do
describe "no auth" $
it "fetches a page without auth" $
req "/pub" "get" Nothing Nothing >>=
expectHttpCode HT.ok200
describe "ifheader auth" $ do
it "prompts for auth when none is provided" $
req "/ifheader" "get" Nothing Nothing >>=
expectHttpCodeHeaders HT.unauthorized401 [("WWW-Authenticate", "Basic realm=ifheader")]
it "flunks out when bad auth is provided" $
req "/ifheader" "get" Nothing (Just $ packBasic "wrong" "credentials") >>=
expectHttpCode HT.ok200
it "fetches a page when auth is provided" $
req "/ifheader" "get" Nothing (Just $ packBasic "foo" "bar") >>=
expectHttpCode HT.ok200
describe "userpass auth" $ do
it "prompts for auth when none is provided" $
req "/userpass" "get" Nothing Nothing >>=
expectHttpCodeHeaders HT.unauthorized401 [("WWW-Authenticate", "Basic realm=userpass")]
it "flunks out when bad auth is provided" $
req "/userpass" "get" Nothing (Just $ packBasic "wrong" "credentials") >>=
expectHttpCode HT.forbidden403
it "fetches a page when good auth is provided" $
req "/userpass" "get" Nothing (Just $ packBasic "foo" "bar") >>=
expectHttpCode HT.ok200 | 1,355 | suite = do
describe "no auth" $
it "fetches a page without auth" $
req "/pub" "get" Nothing Nothing >>=
expectHttpCode HT.ok200
describe "ifheader auth" $ do
it "prompts for auth when none is provided" $
req "/ifheader" "get" Nothing Nothing >>=
expectHttpCodeHeaders HT.unauthorized401 [("WWW-Authenticate", "Basic realm=ifheader")]
it "flunks out when bad auth is provided" $
req "/ifheader" "get" Nothing (Just $ packBasic "wrong" "credentials") >>=
expectHttpCode HT.ok200
it "fetches a page when auth is provided" $
req "/ifheader" "get" Nothing (Just $ packBasic "foo" "bar") >>=
expectHttpCode HT.ok200
describe "userpass auth" $ do
it "prompts for auth when none is provided" $
req "/userpass" "get" Nothing Nothing >>=
expectHttpCodeHeaders HT.unauthorized401 [("WWW-Authenticate", "Basic realm=userpass")]
it "flunks out when bad auth is provided" $
req "/userpass" "get" Nothing (Just $ packBasic "wrong" "credentials") >>=
expectHttpCode HT.forbidden403
it "fetches a page when good auth is provided" $
req "/userpass" "get" Nothing (Just $ packBasic "foo" "bar") >>=
expectHttpCode HT.ok200 | 1,341 | false | true | 0 | 16 | 397 | 311 | 140 | 171 | null | null |
quyse/flaw | flaw-visual/Flaw/Visual.hs | mit | xyY2xyz :: (OfScalarType a, Vectorized a, Fractional a) => Node (Vec3 a) -> Program (Node (Vec3 a))
xyY2xyz xyY = temp $ cvec111
(z_ xyY * x_ xyY / y_ xyY)
(z_ xyY)
(z_ xyY * (1 - x_ xyY - y_ xyY) / y_ xyY) | 212 | xyY2xyz :: (OfScalarType a, Vectorized a, Fractional a) => Node (Vec3 a) -> Program (Node (Vec3 a))
xyY2xyz xyY = temp $ cvec111
(z_ xyY * x_ xyY / y_ xyY)
(z_ xyY)
(z_ xyY * (1 - x_ xyY - y_ xyY) / y_ xyY) | 212 | xyY2xyz xyY = temp $ cvec111
(z_ xyY * x_ xyY / y_ xyY)
(z_ xyY)
(z_ xyY * (1 - x_ xyY - y_ xyY) / y_ xyY) | 112 | false | true | 0 | 12 | 51 | 141 | 65 | 76 | null | null |
randen/cabal | Cabal/Distribution/Simple/Compiler.hs | bsd-3-clause | extensionToFlag :: Compiler -> Extension -> Maybe Flag
extensionToFlag comp ext = lookup ext (compilerExtensions comp) | 118 | extensionToFlag :: Compiler -> Extension -> Maybe Flag
extensionToFlag comp ext = lookup ext (compilerExtensions comp) | 118 | extensionToFlag comp ext = lookup ext (compilerExtensions comp) | 63 | false | true | 0 | 7 | 15 | 38 | 18 | 20 | null | null |
farrellm/advent-2016 | src/Day24.hs | mit | moves :: MazeMap -> Grid -> MazeState -> [MazeState]
moves m g MazeState {..} = do
n <- opens g _position
let (r, c) = n
q = m ! r ! c
[MazeState n (S.delete q _remaining)] | 184 | moves :: MazeMap -> Grid -> MazeState -> [MazeState]
moves m g MazeState {..} = do
n <- opens g _position
let (r, c) = n
q = m ! r ! c
[MazeState n (S.delete q _remaining)] | 184 | moves m g MazeState {..} = do
n <- opens g _position
let (r, c) = n
q = m ! r ! c
[MazeState n (S.delete q _remaining)] | 131 | false | true | 0 | 12 | 49 | 106 | 51 | 55 | null | null |
snoyberg/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | tcSplitPredFunTy_maybe (FunTy arg res)
| isPredTy arg = Just (arg, res) | 73 | tcSplitPredFunTy_maybe (FunTy arg res)
| isPredTy arg = Just (arg, res) | 73 | tcSplitPredFunTy_maybe (FunTy arg res)
| isPredTy arg = Just (arg, res) | 73 | false | false | 0 | 8 | 12 | 35 | 16 | 19 | null | null |
martinra/hlinear | src/HLinear/Hook/EchelonForm/Row.hs | gpl-3.0 | sumRow :: EchelonFormRow a -> Vector a -> EchelonFormRow a
sumRow (EchelonFormRow o v) v' = EchelonFormRow o $ v <> v' | 118 | sumRow :: EchelonFormRow a -> Vector a -> EchelonFormRow a
sumRow (EchelonFormRow o v) v' = EchelonFormRow o $ v <> v' | 118 | sumRow (EchelonFormRow o v) v' = EchelonFormRow o $ v <> v' | 59 | false | true | 0 | 7 | 21 | 52 | 24 | 28 | null | null |
olsner/ghc | compiler/typecheck/TcDerivUtils.hs | bsd-3-clause | isDerivSpecAnyClass (DerivSpecAnyClass{}) = True | 48 | isDerivSpecAnyClass (DerivSpecAnyClass{}) = True | 48 | isDerivSpecAnyClass (DerivSpecAnyClass{}) = True | 48 | false | false | 0 | 7 | 3 | 16 | 8 | 8 | null | null |
Qu4tro/CP | CP.hs | mit | istl = (swap -|- swap) . distr . swap
| 38 | distl = (swap -|- swap) . distr . swap | 38 | distl = (swap -|- swap) . distr . swap | 38 | false | false | 2 | 6 | 9 | 25 | 11 | 14 | null | null |
rahulmutt/ghcvm | compiler/Eta/TypeCheck/TcEvidence.hs | bsd-3-clause | mkTcSymCo (TcSymCo co) = co | 30 | mkTcSymCo (TcSymCo co) = co | 30 | mkTcSymCo (TcSymCo co) = co | 30 | false | false | 0 | 7 | 7 | 15 | 7 | 8 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/FontFace.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/FontFace.unicodeRange Mozilla FontFace.unicodeRange documentation>
getUnicodeRange ::
(MonadDOM m, FromJSString result) => FontFace -> m result
getUnicodeRange self
= liftDOM ((self ^. js "unicodeRange") >>= fromJSValUnchecked) | 301 | getUnicodeRange ::
(MonadDOM m, FromJSString result) => FontFace -> m result
getUnicodeRange self
= liftDOM ((self ^. js "unicodeRange") >>= fromJSValUnchecked) | 178 | getUnicodeRange self
= liftDOM ((self ^. js "unicodeRange") >>= fromJSValUnchecked) | 85 | true | true | 0 | 10 | 45 | 57 | 29 | 28 | null | null |
ihc/futhark | src/Language/Futhark/Attributes.hs | isc | maskAliases (Record ets) (RecordDiet ds) =
Record $ M.intersectionWith maskAliases ets ds | 91 | maskAliases (Record ets) (RecordDiet ds) =
Record $ M.intersectionWith maskAliases ets ds | 91 | maskAliases (Record ets) (RecordDiet ds) =
Record $ M.intersectionWith maskAliases ets ds | 91 | false | false | 0 | 7 | 13 | 36 | 17 | 19 | null | null |
urbanslug/ghc | compiler/prelude/THNames.hs | bsd-3-clause | rationalLIdKey = mkPreludeMiscIdUnique 227 | 45 | rationalLIdKey = mkPreludeMiscIdUnique 227 | 45 | rationalLIdKey = mkPreludeMiscIdUnique 227 | 45 | false | false | 1 | 5 | 6 | 12 | 4 | 8 | null | null |
hamishmack/haskell-gi | lib/Data/GI/GIR/Arg.hs | lgpl-2.1 | parseScope "async" = return ScopeTypeAsync | 42 | parseScope "async" = return ScopeTypeAsync | 42 | parseScope "async" = return ScopeTypeAsync | 42 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
izimbra/PLT2014 | mini/haskell/AnnotatingTypeChecker.hs | gpl-2.0 | lookupVar :: Env -> Ident -> Err Type
lookupVar [] x = fail $ "Unknown variable " ++ printTree x ++ "." | 103 | lookupVar :: Env -> Ident -> Err Type
lookupVar [] x = fail $ "Unknown variable " ++ printTree x ++ "." | 103 | lookupVar [] x = fail $ "Unknown variable " ++ printTree x ++ "." | 65 | false | true | 2 | 9 | 21 | 50 | 22 | 28 | null | null |
ezyang/ghc | compiler/nativeGen/SPARC/Ppr.hs | bsd-3-clause | pprInstr (FxTOy format1 format2 reg1 reg2)
= hcat [
text "\tf",
ptext
(case format1 of
II32 -> sLit "ito"
FF32 -> sLit "sto"
FF64 -> sLit "dto"
_ -> panic "SPARC.Ppr.pprInstr.FxToY: no match"),
ptext
(case format2 of
II32 -> sLit "i\t"
II64 -> sLit "x\t"
FF32 -> sLit "s\t"
FF64 -> sLit "d\t"
_ -> panic "SPARC.Ppr.pprInstr.FxToY: no match"),
pprReg reg1, comma, pprReg reg2
] | 553 | pprInstr (FxTOy format1 format2 reg1 reg2)
= hcat [
text "\tf",
ptext
(case format1 of
II32 -> sLit "ito"
FF32 -> sLit "sto"
FF64 -> sLit "dto"
_ -> panic "SPARC.Ppr.pprInstr.FxToY: no match"),
ptext
(case format2 of
II32 -> sLit "i\t"
II64 -> sLit "x\t"
FF32 -> sLit "s\t"
FF64 -> sLit "d\t"
_ -> panic "SPARC.Ppr.pprInstr.FxToY: no match"),
pprReg reg1, comma, pprReg reg2
] | 553 | pprInstr (FxTOy format1 format2 reg1 reg2)
= hcat [
text "\tf",
ptext
(case format1 of
II32 -> sLit "ito"
FF32 -> sLit "sto"
FF64 -> sLit "dto"
_ -> panic "SPARC.Ppr.pprInstr.FxToY: no match"),
ptext
(case format2 of
II32 -> sLit "i\t"
II64 -> sLit "x\t"
FF32 -> sLit "s\t"
FF64 -> sLit "d\t"
_ -> panic "SPARC.Ppr.pprInstr.FxToY: no match"),
pprReg reg1, comma, pprReg reg2
] | 553 | false | false | 0 | 12 | 241 | 152 | 72 | 80 | null | null |
leventdinckal/haskell-nvd3 | src/Graphics/NVD3/Writer.hs | bsd-3-clause | b :: Text -> B.Builder
b = B.fromLazyText | 41 | b :: Text -> B.Builder
b = B.fromLazyText | 41 | b = B.fromLazyText | 18 | false | true | 0 | 8 | 7 | 26 | 11 | 15 | null | null |
mgsloan/lenq | src/Language/Lenq.hs | bsd-3-clause | -- | Convenience function to build a bijection quasi-quoter configuration from
-- stuff that's convertible to expressions. See "Language.Haskell.TH.Build".
mkLenqConf :: (Convertible a ExpQ, Convertible b ExpQ, Convertible c ExpQ)
=> a -> b -> c -> LenqConf
mkLenqConf c g s = LenqConf (convert c) (convert g) (convert s) | 335 | mkLenqConf :: (Convertible a ExpQ, Convertible b ExpQ, Convertible c ExpQ)
=> a -> b -> c -> LenqConf
mkLenqConf c g s = LenqConf (convert c) (convert g) (convert s) | 176 | mkLenqConf c g s = LenqConf (convert c) (convert g) (convert s) | 63 | true | true | 0 | 8 | 63 | 84 | 43 | 41 | null | null |
ulricha/dsh | src/Database/DSH/VSL/Opt/Rewrite/Redundant.hs | bsd-3-clause | --------------------------------------------------------------------------------
-- Rewrites that deal with nested structures and propagation vectors.
--------------------------------------------------------------------------------
-- Eliminating operators whose output is not required
-- notReqNumber ::VSLRule TExpr TExpr Properties
-- notReqNumber q =
-- $(dagPatMatch 'q "Number (q1)"
-- [| do
-- w <- vectorWidth . vectorTypeProp . bu <$> properties $(v "q1")
-- VProp (Just reqCols) <- reqColumnsProp . td <$> properties $(v "q")
-- -- The number output in column w + 1 must not be required
-- predicate $ all (<= w) reqCols
-- return $ do
-- logRewrite "Redundant.Req.Number" q
-- -- Add a dummy column instead of the number output to keep
-- -- column references intact.
-- let proj = map Column [1..w] ++ [Constant $ IntV 0xdeadbeef]
-- void $ replaceWithNew q $ UnOp (Project proj) $(v "q1") |])
--------------------------------------------------------------------------------
-- Classical relational algebra rewrites
-- | Merge a selection that refers to both sides of a cartesian
-- product operators' inputs into a join.
selectCartProd ::VSLRule TExpr TExpr ()
selectCartProd q =
$(dagPatMatch 'q "R1 (Select p (R1 ((q1) CartProduct (q2))))"
[| do
TBinApp (SBRelOp op) e1 e2 <- return $(v "p")
-- The left operand column has to be from the left input, the
-- right operand from the right input.
predicate $ idxOnly (== First) e1
predicate $ idxOnly (== (Next First)) e2
return $ do
logRewrite "Redundant.Relational.Join" q
let e1' = mergeExpr (TMkTuple [TInput, TInput]) e1
let e2' = mergeExpr (TMkTuple [TInput, TInput]) e2
let joinPred = singlePred $ JoinConjunct e1' op e2'
joinNode <- insert $ BinOp (ThetaJoin (Direct, Direct, joinPred)) $(v "q1") $(v "q2")
void $ replaceWithNew q $ UnOp R1 joinNode |]) | 2,052 | selectCartProd ::VSLRule TExpr TExpr ()
selectCartProd q =
$(dagPatMatch 'q "R1 (Select p (R1 ((q1) CartProduct (q2))))"
[| do
TBinApp (SBRelOp op) e1 e2 <- return $(v "p")
-- The left operand column has to be from the left input, the
-- right operand from the right input.
predicate $ idxOnly (== First) e1
predicate $ idxOnly (== (Next First)) e2
return $ do
logRewrite "Redundant.Relational.Join" q
let e1' = mergeExpr (TMkTuple [TInput, TInput]) e1
let e2' = mergeExpr (TMkTuple [TInput, TInput]) e2
let joinPred = singlePred $ JoinConjunct e1' op e2'
joinNode <- insert $ BinOp (ThetaJoin (Direct, Direct, joinPred)) $(v "q1") $(v "q2")
void $ replaceWithNew q $ UnOp R1 joinNode |]) | 816 | selectCartProd q =
$(dagPatMatch 'q "R1 (Select p (R1 ((q1) CartProduct (q2))))"
[| do
TBinApp (SBRelOp op) e1 e2 <- return $(v "p")
-- The left operand column has to be from the left input, the
-- right operand from the right input.
predicate $ idxOnly (== First) e1
predicate $ idxOnly (== (Next First)) e2
return $ do
logRewrite "Redundant.Relational.Join" q
let e1' = mergeExpr (TMkTuple [TInput, TInput]) e1
let e2' = mergeExpr (TMkTuple [TInput, TInput]) e2
let joinPred = singlePred $ JoinConjunct e1' op e2'
joinNode <- insert $ BinOp (ThetaJoin (Direct, Direct, joinPred)) $(v "q1") $(v "q2")
void $ replaceWithNew q $ UnOp R1 joinNode |]) | 776 | true | true | 0 | 7 | 502 | 60 | 42 | 18 | null | null |
ganeti/ganeti | src/Ganeti/Locking/Locks.hs | bsd-2-clause | -- | Obtain the ClientID from its JSON representation.
clientIdFromJSON :: J.JSValue -> J.Result ClientId
clientIdFromJSON (J.JSArray [clienttp, J.JSString lf, pid]) =
ClientId <$> J.readJSON clienttp <*> pure (J.fromJSString lf)
<*> liftM fromIntegral (J.readJSON pid :: J.Result Integer) | 302 | clientIdFromJSON :: J.JSValue -> J.Result ClientId
clientIdFromJSON (J.JSArray [clienttp, J.JSString lf, pid]) =
ClientId <$> J.readJSON clienttp <*> pure (J.fromJSString lf)
<*> liftM fromIntegral (J.readJSON pid :: J.Result Integer) | 247 | clientIdFromJSON (J.JSArray [clienttp, J.JSString lf, pid]) =
ClientId <$> J.readJSON clienttp <*> pure (J.fromJSString lf)
<*> liftM fromIntegral (J.readJSON pid :: J.Result Integer) | 196 | true | true | 5 | 12 | 50 | 106 | 51 | 55 | null | null |
pepeiborra/yices-0.0.0.12 | Math/SMT/Yices/Syntax.hs | bsd-3-clause | showCmdY (DEFTYP tname Nothing) = paren $ showString "define-type " . showString tname | 86 | showCmdY (DEFTYP tname Nothing) = paren $ showString "define-type " . showString tname | 86 | showCmdY (DEFTYP tname Nothing) = paren $ showString "define-type " . showString tname | 86 | false | false | 0 | 7 | 12 | 32 | 14 | 18 | null | null |
bartavelle/pcre-utils | Text/Regex/PCRE/ByteString/Utils.hs | bsd-3-clause | regexpUnmatched :: [RegexpSplit a] -> [a]
regexpUnmatched = regexpAll . filter (not . isMatched) | 96 | regexpUnmatched :: [RegexpSplit a] -> [a]
regexpUnmatched = regexpAll . filter (not . isMatched) | 96 | regexpUnmatched = regexpAll . filter (not . isMatched) | 54 | false | true | 0 | 8 | 13 | 38 | 20 | 18 | null | null |
DarrenMowat/blackbox | tests/results/SplitTests.hs | unlicense | test0 (Just x) = 0 | 18 | test0 (Just x) = 0 | 18 | test0 (Just x) = 0 | 18 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
dmp1ce/Haskell-Programming-Exercises | Chapter 14/addition/Addition.hs | unlicense | genBool :: Gen Bool
genBool = choose (False, True) | 50 | genBool :: Gen Bool
genBool = choose (False, True) | 50 | genBool = choose (False, True) | 30 | false | true | 0 | 6 | 8 | 23 | 12 | 11 | null | null |
AlexeyRaga/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpInfo UnsafeThawArrayOp = mkGenPrimOp (fsLit "unsafeThawArray#") [alphaTyVar, deltaTyVar] [mkArrayPrimTy alphaTy, mkStatePrimTy deltaTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy deltaTy, mkMutableArrayPrimTy deltaTy alphaTy])) | 231 | primOpInfo UnsafeThawArrayOp = mkGenPrimOp (fsLit "unsafeThawArray#") [alphaTyVar, deltaTyVar] [mkArrayPrimTy alphaTy, mkStatePrimTy deltaTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy deltaTy, mkMutableArrayPrimTy deltaTy alphaTy])) | 231 | primOpInfo UnsafeThawArrayOp = mkGenPrimOp (fsLit "unsafeThawArray#") [alphaTyVar, deltaTyVar] [mkArrayPrimTy alphaTy, mkStatePrimTy deltaTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy deltaTy, mkMutableArrayPrimTy deltaTy alphaTy])) | 231 | false | false | 0 | 10 | 19 | 68 | 34 | 34 | null | null |
damoxc/ganeti | src/Ganeti/HTools/Program/Hcheck.hs | gpl-2.0 | -- | Data showed per group.
groupData :: [(String, String)]
groupData = commonData ++ [("SCORE", "Group score")] | 112 | groupData :: [(String, String)]
groupData = commonData ++ [("SCORE", "Group score")] | 84 | groupData = commonData ++ [("SCORE", "Group score")] | 52 | true | true | 0 | 7 | 16 | 34 | 21 | 13 | null | null |
mumuki/mulang | src/Language/Mulang/Ast/Visitor.hs | gpl-3.0 | extractTerminal Self = True | 42 | extractTerminal Self = True | 42 | extractTerminal Self = True | 42 | false | false | 0 | 5 | 18 | 9 | 4 | 5 | null | null |
elben/typing-haskell-in-haskell | StaticPrelude.hs | bsd-3-clause | tEither = TCon (Tycon "Either" (Kfun Star (Kfun Star Star))) | 62 | tEither = TCon (Tycon "Either" (Kfun Star (Kfun Star Star))) | 62 | tEither = TCon (Tycon "Either" (Kfun Star (Kfun Star Star))) | 62 | false | false | 0 | 11 | 11 | 33 | 16 | 17 | null | null |
ohua-dev/ohua-core | test-tools/src/Ohua/Test/DFGraph.hs | epl-1.0 | isIsomorphic :: (Eq a, Ord b) => Gr a b -> Gr a b -> Bool
isIsomorphic gr1 gr2 = isJust $ isomorphicMapping gr1 gr2 | 115 | isIsomorphic :: (Eq a, Ord b) => Gr a b -> Gr a b -> Bool
isIsomorphic gr1 gr2 = isJust $ isomorphicMapping gr1 gr2 | 115 | isIsomorphic gr1 gr2 = isJust $ isomorphicMapping gr1 gr2 | 57 | false | true | 0 | 8 | 24 | 58 | 28 | 30 | null | null |
perryleo/sicp | ch1/sicpc1e41.hs | mit | -- Increase one number by 1
inc x = x + 1 | 41 | inc x = x + 1 | 13 | inc x = x + 1 | 13 | true | false | 3 | 5 | 11 | 19 | 7 | 12 | null | null |
sgillespie/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | prefix_RDR = dataQual_RDR gENERICS (fsLit "Prefix") | 55 | prefix_RDR = dataQual_RDR gENERICS (fsLit "Prefix") | 55 | prefix_RDR = dataQual_RDR gENERICS (fsLit "Prefix") | 55 | false | false | 0 | 7 | 9 | 17 | 8 | 9 | null | null |
OS2World/DEV-UTIL-HUGS | oldlib/LeftistHeap.hs | bsd-3-clause | size :: Ord a => Heap a -> Int
size h = sz h 0
where sz E i = i
sz (L _ _ a b) i = sz a (sz b (i + 1)) | 112 | size :: Ord a => Heap a -> Int
size h = sz h 0
where sz E i = i
sz (L _ _ a b) i = sz a (sz b (i + 1)) | 112 | size h = sz h 0
where sz E i = i
sz (L _ _ a b) i = sz a (sz b (i + 1)) | 81 | false | true | 1 | 9 | 45 | 87 | 42 | 45 | null | null |
phischu/fragnix | tests/packages/scotty/Data.ByteString.Unsafe.hs | bsd-3-clause | -- | /O(1)/ 'unsafePackAddressLen' provides constant-time construction of
-- 'ByteString's, which is ideal for string literals. It packs a sequence
-- of bytes into a @ByteString@, given a raw 'Addr#' to the string, and
-- the length of the string.
--
-- This function is /unsafe/ in two ways:
--
-- * the length argument is assumed to be correct. If the length
-- argument is incorrect, it is possible to overstep the end of the
-- byte array.
--
-- * if the underying Addr# is later modified, this change will be
-- reflected in resulting @ByteString@, breaking referential
-- transparency.
--
-- If in doubt, don't use this function.
--
unsafePackAddressLen :: Int -> Addr# -> IO ByteString
unsafePackAddressLen len addr# = do
p <- newForeignPtr_ (Ptr addr#)
return $ PS p 0 len
| 790 | unsafePackAddressLen :: Int -> Addr# -> IO ByteString
unsafePackAddressLen len addr# = do
p <- newForeignPtr_ (Ptr addr#)
return $ PS p 0 len
| 150 | unsafePackAddressLen len addr# = do
p <- newForeignPtr_ (Ptr addr#)
return $ PS p 0 len
| 96 | true | true | 0 | 10 | 144 | 74 | 43 | 31 | null | null |
olsner/ghc | testsuite/tests/programs/life_space_leak/Main.hs | bsd-3-clause | map1 f (C1 x xs) = C1 (f x) (map1 f xs) | 39 | map1 f (C1 x xs) = C1 (f x) (map1 f xs) | 39 | map1 f (C1 x xs) = C1 (f x) (map1 f xs) | 39 | false | false | 0 | 7 | 11 | 40 | 18 | 22 | null | null |
kawamuray/ganeti | src/Ganeti/HTools/Cluster.hs | gpl-2.0 | -- | Given a list of commands, prefix them with @gnt-instance@ and
-- also beautify the display a little.
formatJob :: Int -> Int -> (Int, MoveJob) -> [String]
formatJob jsn jsl (sn, (_, _, _, cmds)) =
let out =
printf " echo job %d/%d" jsn sn:
printf " check":
map (" gnt-instance " ++) cmds
in if sn == 1
then ["", printf "echo jobset %d, %d jobs" jsn jsl] ++ out
else out | 419 | formatJob :: Int -> Int -> (Int, MoveJob) -> [String]
formatJob jsn jsl (sn, (_, _, _, cmds)) =
let out =
printf " echo job %d/%d" jsn sn:
printf " check":
map (" gnt-instance " ++) cmds
in if sn == 1
then ["", printf "echo jobset %d, %d jobs" jsn jsl] ++ out
else out | 313 | formatJob jsn jsl (sn, (_, _, _, cmds)) =
let out =
printf " echo job %d/%d" jsn sn:
printf " check":
map (" gnt-instance " ++) cmds
in if sn == 1
then ["", printf "echo jobset %d, %d jobs" jsn jsl] ++ out
else out | 259 | true | true | 0 | 11 | 120 | 126 | 69 | 57 | null | null |
brendanhay/gogol | gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs | mpl-2.0 | -- | The criteria for showing\/hiding values per column. The map\'s key is
-- the column index, and the value is the criteria for that column. This
-- field is deprecated in favor of filter_specs.
bfCriteria :: Lens' BasicFilter (Maybe BasicFilterCriteria)
bfCriteria
= lens _bfCriteria (\ s a -> s{_bfCriteria = a}) | 318 | bfCriteria :: Lens' BasicFilter (Maybe BasicFilterCriteria)
bfCriteria
= lens _bfCriteria (\ s a -> s{_bfCriteria = a}) | 121 | bfCriteria
= lens _bfCriteria (\ s a -> s{_bfCriteria = a}) | 61 | true | true | 1 | 9 | 53 | 54 | 27 | 27 | null | null |
strburst/haskell-stuff | surjectionLatex.hs | mit | -- This experiment generates LaTex code representing the Stirling number of the
-- second kind, which is the number of surjections from m things to k things
main = do
input <- getLine
let m = read (words input !! 0)
k = read (words input !! 1)
putStrLn $ surjectionLatex m k | 294 | main = do
input <- getLine
let m = read (words input !! 0)
k = read (words input !! 1)
putStrLn $ surjectionLatex m k | 137 | main = do
input <- getLine
let m = read (words input !! 0)
k = read (words input !! 1)
putStrLn $ surjectionLatex m k | 137 | true | false | 0 | 13 | 72 | 67 | 32 | 35 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/HTMLDivElement.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLDivElement.align Mozilla HTMLDivElement.align documentation>
getAlign ::
(MonadDOM m, FromJSString result) => HTMLDivElement -> m result
getAlign self
= liftDOM ((self ^. js "align") >>= fromJSValUnchecked) | 277 | getAlign ::
(MonadDOM m, FromJSString result) => HTMLDivElement -> m result
getAlign self
= liftDOM ((self ^. js "align") >>= fromJSValUnchecked) | 156 | getAlign self
= liftDOM ((self ^. js "align") >>= fromJSValUnchecked) | 71 | true | true | 0 | 10 | 38 | 57 | 29 | 28 | null | null |
unisonweb/platform | parser-typechecker/src/Unison/Runtime/Pattern.hs | mit | builtinCase :: Set Reference
builtinCase
= Set.fromList
[ Rf.intRef
, Rf.natRef
, Rf.floatRef
, Rf.textRef
, Rf.charRef
] | 135 | builtinCase :: Set Reference
builtinCase
= Set.fromList
[ Rf.intRef
, Rf.natRef
, Rf.floatRef
, Rf.textRef
, Rf.charRef
] | 135 | builtinCase
= Set.fromList
[ Rf.intRef
, Rf.natRef
, Rf.floatRef
, Rf.textRef
, Rf.charRef
] | 106 | false | true | 0 | 6 | 31 | 46 | 24 | 22 | null | null |
rueshyna/gogol | gogol-compute/gen/Network/Google/Compute/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'VPNTunnelsScopedList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'vtslVPNTunnels'
--
-- * 'vtslWarning'
vpnTunnelsScopedList
:: VPNTunnelsScopedList
vpnTunnelsScopedList =
VPNTunnelsScopedList'
{ _vtslVPNTunnels = Nothing
, _vtslWarning = Nothing
} | 383 | vpnTunnelsScopedList
:: VPNTunnelsScopedList
vpnTunnelsScopedList =
VPNTunnelsScopedList'
{ _vtslVPNTunnels = Nothing
, _vtslWarning = Nothing
} | 164 | vpnTunnelsScopedList =
VPNTunnelsScopedList'
{ _vtslVPNTunnels = Nothing
, _vtslWarning = Nothing
} | 115 | true | true | 0 | 7 | 72 | 42 | 24 | 18 | null | null |
8l/barrelfish | hake/ARMv7.hs | mit | cxxlinker = ArchDefaults.cxxlinker arch cxxcompiler | 51 | cxxlinker = ArchDefaults.cxxlinker arch cxxcompiler | 51 | cxxlinker = ArchDefaults.cxxlinker arch cxxcompiler | 51 | false | false | 1 | 6 | 4 | 16 | 6 | 10 | null | null |
black0range/BufferedSocket | Network/BufferedSocket/Reader.hs | mit | readTextLazy:: BS.BufferedSocket -> BS.ReadSize -> IO TL.Text
readTextLazy bSocket readSize = do
byteData <- BS.readLazy bSocket readSize
return $ ENCL.decodeUtf8With (ENCERROR.replace '\xfffd') byteData | 211 | readTextLazy:: BS.BufferedSocket -> BS.ReadSize -> IO TL.Text
readTextLazy bSocket readSize = do
byteData <- BS.readLazy bSocket readSize
return $ ENCL.decodeUtf8With (ENCERROR.replace '\xfffd') byteData | 211 | readTextLazy bSocket readSize = do
byteData <- BS.readLazy bSocket readSize
return $ ENCL.decodeUtf8With (ENCERROR.replace '\xfffd') byteData | 149 | false | true | 0 | 11 | 30 | 69 | 32 | 37 | null | null |
mightymoose/liquidhaskell | src/Language/Haskell/Liquid/PrettyPrint.hs | bsd-3-clause | ppr_rty_fun bb prefix t
= prefix <+> ppr_rty_fun' bb t | 56 | ppr_rty_fun bb prefix t
= prefix <+> ppr_rty_fun' bb t | 56 | ppr_rty_fun bb prefix t
= prefix <+> ppr_rty_fun' bb t | 56 | false | false | 0 | 6 | 11 | 22 | 10 | 12 | null | null |
ekr/tamarin-prover | lib/utils/src/Utils/Misc.hs | gpl-3.0 | -- | @noDuplicates xs@ returns @True@ if the list @xs@ contains no duplicates
noDuplicates :: (Ord a) => [a] -> Bool
noDuplicates xs = all ((==1).length) . group . sort $ xs | 173 | noDuplicates :: (Ord a) => [a] -> Bool
noDuplicates xs = all ((==1).length) . group . sort $ xs | 95 | noDuplicates xs = all ((==1).length) . group . sort $ xs | 56 | true | true | 0 | 11 | 31 | 55 | 30 | 25 | null | null |
romac/mental | src/Mental/Tree/Untyped.hs | bsd-3-clause | getPos :: UntypedTree -> SourcePos
getPos (pos :< _) = pos | 58 | getPos :: UntypedTree -> SourcePos
getPos (pos :< _) = pos | 58 | getPos (pos :< _) = pos | 23 | false | true | 0 | 9 | 10 | 31 | 14 | 17 | null | null |
zeyuanxy/hacker-rank | practice/fp/persistent-ds/minimum-multiple/minimum-multiple.hs | mit | query :: SegmentTree (M.Map Int Int) -> Int -> Int -> M.Map Int Int
query Empty _ _ = getValue Empty | 100 | query :: SegmentTree (M.Map Int Int) -> Int -> Int -> M.Map Int Int
query Empty _ _ = getValue Empty | 100 | query Empty _ _ = getValue Empty | 32 | false | true | 0 | 9 | 20 | 58 | 26 | 32 | null | null |
ttylec/QLogic | src/QLogic/GeneralBoxes.hs | gpl-3.0 | two :: a -> a -> Two a
two a b = Two (a, b) | 43 | two :: a -> a -> Two a
two a b = Two (a, b) | 43 | two a b = Two (a, b) | 20 | false | true | 0 | 8 | 14 | 40 | 19 | 21 | null | null |
mplamann/magic-spieler | src/CardSelector.hs | mit | selectYouControl cID (CardTarget tID) =
(==) <$> playerControllingCard cID <*> playerControllingCard tID | 106 | selectYouControl cID (CardTarget tID) =
(==) <$> playerControllingCard cID <*> playerControllingCard tID | 106 | selectYouControl cID (CardTarget tID) =
(==) <$> playerControllingCard cID <*> playerControllingCard tID | 106 | false | false | 0 | 7 | 13 | 33 | 16 | 17 | null | null |
brunjlar/pell | Math/NumberTheory/Pell/PQa.hs | mit | reduced :: Integer -> Integer -> Integer -> Bool
reduced x y dd
| y > 0 = (dd >= y - x) && (dd < x + y) && (dd >= x)
| otherwise = (dd < y - x) && (dd >= x + y) && (dd < x) | 187 | reduced :: Integer -> Integer -> Integer -> Bool
reduced x y dd
| y > 0 = (dd >= y - x) && (dd < x + y) && (dd >= x)
| otherwise = (dd < y - x) && (dd >= x + y) && (dd < x) | 187 | reduced x y dd
| y > 0 = (dd >= y - x) && (dd < x + y) && (dd >= x)
| otherwise = (dd < y - x) && (dd >= x + y) && (dd < x) | 138 | false | true | 0 | 10 | 65 | 131 | 65 | 66 | null | null |
purebred-mua/purebred | src/Purebred/Storage/Notmuch.hs | agpl-3.0 | applyTagOp :: (ManageTags a) => TagOp -> a -> a
applyTagOp (AddTag t) = addTags [t] | 83 | applyTagOp :: (ManageTags a) => TagOp -> a -> a
applyTagOp (AddTag t) = addTags [t] | 83 | applyTagOp (AddTag t) = addTags [t] | 35 | false | true | 0 | 7 | 15 | 43 | 22 | 21 | null | null |
DougBurke/swish | tests/RDFProofTest.hs | lgpl-2.1 | simple6b :: RDFGraph
simple6b = mkGr2
[ "_:Si3 rel:son pers:Ol4 ; \n"
, " rel:son pers:Lo4 . \n"
] | 146 | simple6b :: RDFGraph
simple6b = mkGr2
[ "_:Si3 rel:son pers:Ol4 ; \n"
, " rel:son pers:Lo4 . \n"
] | 146 | simple6b = mkGr2
[ "_:Si3 rel:son pers:Ol4 ; \n"
, " rel:son pers:Lo4 . \n"
] | 125 | false | true | 0 | 6 | 66 | 20 | 11 | 9 | null | null |
rhaps0dy/nlp-labs | src/Classify.hs | mit | classifyWords :: M.Map T.Text T.Text -> [T.Text] -> [(T.Text, T.Text)]
classifyWords m = map (\w -> (w, fromMaybe unknown $ M.lookup w m)) | 138 | classifyWords :: M.Map T.Text T.Text -> [T.Text] -> [(T.Text, T.Text)]
classifyWords m = map (\w -> (w, fromMaybe unknown $ M.lookup w m)) | 138 | classifyWords m = map (\w -> (w, fromMaybe unknown $ M.lookup w m)) | 67 | false | true | 0 | 11 | 22 | 82 | 43 | 39 | null | null |
glguy/irc-core | src/Client/View/Mentions.hs | isc | -- | Generate the list of message lines marked important ordered by
-- time. Each run of lines from the same channel will be grouped
-- together. Messages are headed by their window, network, and channel.
mentionsViewLines :: Int -> ClientState -> [Image']
mentionsViewLines w st = addMarkers w st entries
where
detail = view clientDetailView st
padAmt = view (clientConfig . configNickPadding) st
palette = clientPalette st
filt
| clientIsFiltered st = clientFilter st (view wlText)
| otherwise = filter (\x -> WLImportant == view wlImportance x)
entries = merge
[windowEntries filt palette w padAmt detail focus v
| (focus, v) <- Map.toList (view clientWindows st) ] | 744 | mentionsViewLines :: Int -> ClientState -> [Image']
mentionsViewLines w st = addMarkers w st entries
where
detail = view clientDetailView st
padAmt = view (clientConfig . configNickPadding) st
palette = clientPalette st
filt
| clientIsFiltered st = clientFilter st (view wlText)
| otherwise = filter (\x -> WLImportant == view wlImportance x)
entries = merge
[windowEntries filt palette w padAmt detail focus v
| (focus, v) <- Map.toList (view clientWindows st) ] | 539 | mentionsViewLines w st = addMarkers w st entries
where
detail = view clientDetailView st
padAmt = view (clientConfig . configNickPadding) st
palette = clientPalette st
filt
| clientIsFiltered st = clientFilter st (view wlText)
| otherwise = filter (\x -> WLImportant == view wlImportance x)
entries = merge
[windowEntries filt palette w padAmt detail focus v
| (focus, v) <- Map.toList (view clientWindows st) ] | 487 | true | true | 2 | 11 | 183 | 179 | 91 | 88 | null | null |
AndressaUmetsu/PapaEhPop | huffman/Huffman.hs | mit | removeDups (x:xs)
| x `elem` xs = removeDups xs
| otherwise = x : removeDups xs | 94 | removeDups (x:xs)
| x `elem` xs = removeDups xs
| otherwise = x : removeDups xs | 94 | removeDups (x:xs)
| x `elem` xs = removeDups xs
| otherwise = x : removeDups xs | 94 | false | false | 1 | 8 | 30 | 45 | 22 | 23 | null | null |
sqd/haskell-C89-interpreter | Parse.hs | mit | spanParseStruct :: [String] -> (StructDefinition, [String])
spanParseStruct ("struct":name:x) = (StructDef name vars, rest) where
(body, rest') = fst' extract $ spanBracket "{" "}" x
vars = foldl (\l (Declaration (VarDecl type_ n _)) -> (type_, n):l ) [] $ parseCtlFlow body
rest = case rest' of
";":xs -> xs
t:";":xs -> [name, t, ";"] ++ xs | 369 | spanParseStruct :: [String] -> (StructDefinition, [String])
spanParseStruct ("struct":name:x) = (StructDef name vars, rest) where
(body, rest') = fst' extract $ spanBracket "{" "}" x
vars = foldl (\l (Declaration (VarDecl type_ n _)) -> (type_, n):l ) [] $ parseCtlFlow body
rest = case rest' of
";":xs -> xs
t:";":xs -> [name, t, ";"] ++ xs | 369 | spanParseStruct ("struct":name:x) = (StructDef name vars, rest) where
(body, rest') = fst' extract $ spanBracket "{" "}" x
vars = foldl (\l (Declaration (VarDecl type_ n _)) -> (type_, n):l ) [] $ parseCtlFlow body
rest = case rest' of
";":xs -> xs
t:";":xs -> [name, t, ";"] ++ xs | 309 | false | true | 0 | 14 | 83 | 181 | 97 | 84 | null | null |
mcschroeder/smc | Formula.hs | mit | ors :: [Formula] -> Formula
ors [] = Lit (Pos 0) | 52 | ors :: [Formula] -> Formula
ors [] = Lit (Pos 0) | 52 | ors [] = Lit (Pos 0) | 24 | false | true | 0 | 8 | 14 | 37 | 17 | 20 | null | null |
snapframework/snap-core | test/Snap/Util/FileUploads/Tests.hs | bsd-3-clause | testSuccessUtf8Filename :: Test
testSuccessUtf8Filename = testCase "fileUploads/utf8-filename" $
harness tmpdir hndl utf8FilenameBody
where
tmpdir = "tempdir3"
hndl = do
xs <- handleFileUploads tmpdir
defaultUploadPolicy
(const $ allowWithMaximumSize 300000)
hndl'
liftIO $ assertEqual "filename" [filenameUtf8] xs
hndl' pinfo _ = return $ fromJust $ partFileName pinfo
------------------------------------------------------------------------------ | 606 | testSuccessUtf8Filename :: Test
testSuccessUtf8Filename = testCase "fileUploads/utf8-filename" $
harness tmpdir hndl utf8FilenameBody
where
tmpdir = "tempdir3"
hndl = do
xs <- handleFileUploads tmpdir
defaultUploadPolicy
(const $ allowWithMaximumSize 300000)
hndl'
liftIO $ assertEqual "filename" [filenameUtf8] xs
hndl' pinfo _ = return $ fromJust $ partFileName pinfo
------------------------------------------------------------------------------ | 606 | testSuccessUtf8Filename = testCase "fileUploads/utf8-filename" $
harness tmpdir hndl utf8FilenameBody
where
tmpdir = "tempdir3"
hndl = do
xs <- handleFileUploads tmpdir
defaultUploadPolicy
(const $ allowWithMaximumSize 300000)
hndl'
liftIO $ assertEqual "filename" [filenameUtf8] xs
hndl' pinfo _ = return $ fromJust $ partFileName pinfo
------------------------------------------------------------------------------ | 574 | false | true | 2 | 14 | 203 | 105 | 50 | 55 | null | null |
Motions/motions | src/Bio/Motions/PDB/Backend.hs | apache-2.0 | getMove' :: MonadIO m => PDBReader -> Dump -> m (Maybe Move)
getMove' reader dump = eitherFail "PDB read error: " . runExceptT $
getFrame reader >>= mapM (either diffError return . diffDumps dump)
where
diffError e = throwError $ "adjacent frames don't match: " ++ e
| 277 | getMove' :: MonadIO m => PDBReader -> Dump -> m (Maybe Move)
getMove' reader dump = eitherFail "PDB read error: " . runExceptT $
getFrame reader >>= mapM (either diffError return . diffDumps dump)
where
diffError e = throwError $ "adjacent frames don't match: " ++ e
| 277 | getMove' reader dump = eitherFail "PDB read error: " . runExceptT $
getFrame reader >>= mapM (either diffError return . diffDumps dump)
where
diffError e = throwError $ "adjacent frames don't match: " ++ e
| 216 | false | true | 0 | 10 | 57 | 95 | 44 | 51 | null | null |
spechub/Hets | Comorphisms/KnownProvers.hs | gpl-2.0 | -- | a map of known prover names implemanting a GUI interface
knownProversGUI :: Result KnownProversMap
knownProversGUI = knownProversWithKind ProveGUI | 151 | knownProversGUI :: Result KnownProversMap
knownProversGUI = knownProversWithKind ProveGUI | 89 | knownProversGUI = knownProversWithKind ProveGUI | 47 | true | true | 0 | 5 | 19 | 18 | 9 | 9 | null | null |
notae/haskell-exercise | cp/TypedCP.hs | bsd-3-clause | f3 :: FDValue a => a -> String
f3 a = show a ++ ":" ++ show (a == a) | 68 | f3 :: FDValue a => a -> String
f3 a = show a ++ ":" ++ show (a == a) | 68 | f3 a = show a ++ ":" ++ show (a == a) | 37 | false | true | 4 | 8 | 19 | 53 | 23 | 30 | null | null |
smlsharp/smlsharp | benchmark/benchmarks_parallel/nqueen/nqueen_ghc_par.hs | mit | rep size cutOff n =
do t1 <- getCurrentTime
r <- evaluate $ doit cutOff size
t2 <- getCurrentTime
putStrLn $ " - {result: " ++ show 0 ++ ", time: "
++ show (t2 `diffUTCTime` t1) ++ "}"
rep size cutOff (n - 1) | 246 | rep size cutOff n =
do t1 <- getCurrentTime
r <- evaluate $ doit cutOff size
t2 <- getCurrentTime
putStrLn $ " - {result: " ++ show 0 ++ ", time: "
++ show (t2 `diffUTCTime` t1) ++ "}"
rep size cutOff (n - 1) | 246 | rep size cutOff n =
do t1 <- getCurrentTime
r <- evaluate $ doit cutOff size
t2 <- getCurrentTime
putStrLn $ " - {result: " ++ show 0 ++ ", time: "
++ show (t2 `diffUTCTime` t1) ++ "}"
rep size cutOff (n - 1) | 246 | false | false | 0 | 11 | 82 | 98 | 46 | 52 | null | null |
pranjaltale16/codeworld | codeworld-compiler/src/CodeWorld/Compile/Stages.hs | apache-2.0 | isGoodExpAppRhs _ = False | 25 | isGoodExpAppRhs _ = False | 25 | isGoodExpAppRhs _ = False | 25 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
shlevy/ghc | compiler/nativeGen/PPC/CodeGen.hs | bsd-3-clause | genCCall'
:: DynFlags
-> GenCCallPlatform
-> ForeignTarget -- function to call
-> [CmmFormal] -- where to put the result
-> [CmmActual] -- arguments (of mixed type)
-> NatM InstrBlock
{-
The PowerPC calling convention for Darwin/Mac OS X
is described in Apple's document
"Inside Mac OS X - Mach-O Runtime Architecture".
PowerPC Linux uses the System V Release 4 Calling Convention
for PowerPC. It is described in the
"System V Application Binary Interface PowerPC Processor Supplement".
Both conventions are similar:
Parameters may be passed in general-purpose registers starting at r3, in
floating point registers starting at f1, or on the stack.
But there are substantial differences:
* The number of registers used for parameter passing and the exact set of
nonvolatile registers differs (see MachRegs.hs).
* On Darwin, stack space is always reserved for parameters, even if they are
passed in registers. The called routine may choose to save parameters from
registers to the corresponding space on the stack.
* On Darwin, a corresponding amount of GPRs is skipped when a floating point
parameter is passed in an FPR.
* SysV insists on either passing I64 arguments on the stack, or in two GPRs,
starting with an odd-numbered GPR. It may skip a GPR to achieve this.
Darwin just treats an I64 like two separate II32s (high word first).
* I64 and FF64 arguments are 8-byte aligned on the stack for SysV, but only
4-byte aligned like everything else on Darwin.
* The SysV spec claims that FF32 is represented as FF64 on the stack. GCC on
PowerPC Linux does not agree, so neither do we.
PowerPC 64 Linux uses the System V Release 4 Calling Convention for
64-bit PowerPC. It is specified in
"64-bit PowerPC ELF Application Binary Interface Supplement 1.9"
(PPC64 ELF v1.9).
PowerPC 64 Linux in little endian mode uses the "Power Architecture 64-Bit
ELF V2 ABI Specification -- OpenPOWER ABI for Linux Supplement"
(PPC64 ELF v2).
AIX follows the "PowerOpen ABI: Application Binary Interface Big-Endian
32-Bit Hardware Implementation"
According to all conventions, the parameter area should be part of the
caller's stack frame, allocated in the caller's prologue code (large enough
to hold the parameter lists for all called routines). The NCG already
uses the stack for register spilling, leaving 64 bytes free at the top.
If we need a larger parameter area than that, we just allocate a new stack
frame just before ccalling.
-}
genCCall' dflags gcp target dest_regs args
= ASSERT(not $ any (`elem` [II16]) $ map cmmTypeFormat argReps)
-- we rely on argument promotion in the codeGen
do
(finalStack,passArgumentsCode,usedRegs) <- passArguments
(zip args argReps)
allArgRegs
(allFPArgRegs platform)
initialStackOffset
(toOL []) []
(labelOrExpr, reduceToFF32) <- case target of
ForeignTarget (CmmLit (CmmLabel lbl)) _ -> do
uses_pic_base_implicitly
return (Left lbl, False)
ForeignTarget expr _ -> do
uses_pic_base_implicitly
return (Right expr, False)
PrimTarget mop -> outOfLineMachOp mop
let codeBefore = move_sp_down finalStack `appOL` passArgumentsCode
codeAfter = move_sp_up finalStack `appOL` moveResult reduceToFF32
case labelOrExpr of
Left lbl -> do -- the linker does all the work for us
return ( codeBefore
`snocOL` BL lbl usedRegs
`appOL` maybeNOP -- some ABI require a NOP after BL
`appOL` codeAfter)
Right dyn -> do -- implement call through function pointer
(dynReg, dynCode) <- getSomeReg dyn
case gcp of
GCPLinux64ELF 1 -> return ( dynCode
`appOL` codeBefore
`snocOL` ST spFormat toc (AddrRegImm sp (ImmInt 40))
`snocOL` LD II64 r11 (AddrRegImm dynReg (ImmInt 0))
`snocOL` LD II64 toc (AddrRegImm dynReg (ImmInt 8))
`snocOL` MTCTR r11
`snocOL` LD II64 r11 (AddrRegImm dynReg (ImmInt 16))
`snocOL` BCTRL usedRegs
`snocOL` LD spFormat toc (AddrRegImm sp (ImmInt 40))
`appOL` codeAfter)
GCPLinux64ELF 2 -> return ( dynCode
`appOL` codeBefore
`snocOL` ST spFormat toc (AddrRegImm sp (ImmInt 24))
`snocOL` MR r12 dynReg
`snocOL` MTCTR r12
`snocOL` BCTRL usedRegs
`snocOL` LD spFormat toc (AddrRegImm sp (ImmInt 24))
`appOL` codeAfter)
GCPAIX -> return ( dynCode
-- AIX/XCOFF follows the PowerOPEN ABI
-- which is quite similiar to LinuxPPC64/ELFv1
`appOL` codeBefore
`snocOL` ST spFormat toc (AddrRegImm sp (ImmInt 20))
`snocOL` LD II32 r11 (AddrRegImm dynReg (ImmInt 0))
`snocOL` LD II32 toc (AddrRegImm dynReg (ImmInt 4))
`snocOL` MTCTR r11
`snocOL` LD II32 r11 (AddrRegImm dynReg (ImmInt 8))
`snocOL` BCTRL usedRegs
`snocOL` LD spFormat toc (AddrRegImm sp (ImmInt 20))
`appOL` codeAfter)
_ -> return ( dynCode
`snocOL` MTCTR dynReg
`appOL` codeBefore
`snocOL` BCTRL usedRegs
`appOL` codeAfter)
where
platform = targetPlatform dflags
uses_pic_base_implicitly = do
-- See Note [implicit register in PPC PIC code]
-- on why we claim to use PIC register here
when (positionIndependent dflags && target32Bit platform) $ do
_ <- getPicBaseNat $ archWordFormat True
return ()
initialStackOffset = case gcp of
GCPAIX -> 24
GCPDarwin -> 24
GCPLinux -> 8
GCPLinux64ELF 1 -> 48
GCPLinux64ELF 2 -> 32
_ -> panic "genCall': unknown calling convention"
-- size of linkage area + size of arguments, in bytes
stackDelta finalStack = case gcp of
GCPAIX ->
roundTo 16 $ (24 +) $ max 32 $ sum $
map (widthInBytes . typeWidth) argReps
GCPDarwin ->
roundTo 16 $ (24 +) $ max 32 $ sum $
map (widthInBytes . typeWidth) argReps
GCPLinux -> roundTo 16 finalStack
GCPLinux64ELF 1 ->
roundTo 16 $ (48 +) $ max 64 $ sum $
map (roundTo 8 . widthInBytes . typeWidth)
argReps
GCPLinux64ELF 2 ->
roundTo 16 $ (32 +) $ max 64 $ sum $
map (roundTo 8 . widthInBytes . typeWidth)
argReps
_ -> panic "genCall': unknown calling conv."
argReps = map (cmmExprType dflags) args
roundTo a x | x `mod` a == 0 = x
| otherwise = x + a - (x `mod` a)
spFormat = if target32Bit platform then II32 else II64
-- TODO: Do not create a new stack frame if delta is too large.
move_sp_down finalStack
| delta > stackFrameHeaderSize dflags =
toOL [STU spFormat sp (AddrRegImm sp (ImmInt (-delta))),
DELTA (-delta)]
| otherwise = nilOL
where delta = stackDelta finalStack
move_sp_up finalStack
| delta > stackFrameHeaderSize dflags =
toOL [ADD sp sp (RIImm (ImmInt delta)),
DELTA 0]
| otherwise = nilOL
where delta = stackDelta finalStack
-- A NOP instruction is required after a call (bl instruction)
-- on AIX and 64-Bit Linux.
-- If the call is to a function with a different TOC (r2) the
-- link editor replaces the NOP instruction with a load of the TOC
-- from the stack to restore the TOC.
maybeNOP = case gcp of
-- See Section 3.9.4 of OpenPower ABI
GCPAIX -> unitOL NOP
-- See Section 3.5.11 of PPC64 ELF v1.9
GCPLinux64ELF 1 -> unitOL NOP
-- See Section 2.3.6 of PPC64 ELF v2
GCPLinux64ELF 2 -> unitOL NOP
_ -> nilOL
passArguments [] _ _ stackOffset accumCode accumUsed = return (stackOffset, accumCode, accumUsed)
passArguments ((arg,arg_ty):args) gprs fprs stackOffset
accumCode accumUsed | isWord64 arg_ty
&& target32Bit (targetPlatform dflags) =
do
ChildCode64 code vr_lo <- iselExpr64 arg
let vr_hi = getHiVRegFromLo vr_lo
case gcp of
GCPAIX -> -- same as for Darwin
do let storeWord vr (gpr:_) _ = MR gpr vr
storeWord vr [] offset
= ST II32 vr (AddrRegImm sp (ImmInt offset))
passArguments args
(drop 2 gprs)
fprs
(stackOffset+8)
(accumCode `appOL` code
`snocOL` storeWord vr_hi gprs stackOffset
`snocOL` storeWord vr_lo (drop 1 gprs) (stackOffset+4))
((take 2 gprs) ++ accumUsed)
GCPDarwin ->
do let storeWord vr (gpr:_) _ = MR gpr vr
storeWord vr [] offset
= ST II32 vr (AddrRegImm sp (ImmInt offset))
passArguments args
(drop 2 gprs)
fprs
(stackOffset+8)
(accumCode `appOL` code
`snocOL` storeWord vr_hi gprs stackOffset
`snocOL` storeWord vr_lo (drop 1 gprs) (stackOffset+4))
((take 2 gprs) ++ accumUsed)
GCPLinux ->
do let stackOffset' = roundTo 8 stackOffset
stackCode = accumCode `appOL` code
`snocOL` ST II32 vr_hi (AddrRegImm sp (ImmInt stackOffset'))
`snocOL` ST II32 vr_lo (AddrRegImm sp (ImmInt (stackOffset'+4)))
regCode hireg loreg =
accumCode `appOL` code
`snocOL` MR hireg vr_hi
`snocOL` MR loreg vr_lo
case gprs of
hireg : loreg : regs | even (length gprs) ->
passArguments args regs fprs stackOffset
(regCode hireg loreg) (hireg : loreg : accumUsed)
_skipped : hireg : loreg : regs ->
passArguments args regs fprs stackOffset
(regCode hireg loreg) (hireg : loreg : accumUsed)
_ -> -- only one or no regs left
passArguments args [] fprs (stackOffset'+8)
stackCode accumUsed
GCPLinux64ELF _ -> panic "passArguments: 32 bit code"
passArguments ((arg,rep):args) gprs fprs stackOffset accumCode accumUsed
| reg : _ <- regs = do
register <- getRegister arg
let code = case register of
Fixed _ freg fcode -> fcode `snocOL` MR reg freg
Any _ acode -> acode reg
stackOffsetRes = case gcp of
-- The Darwin ABI requires that we reserve
-- stack slots for register parameters
GCPDarwin -> stackOffset + stackBytes
-- ... so does the PowerOpen ABI.
GCPAIX -> stackOffset + stackBytes
-- ... the SysV ABI 32-bit doesn't.
GCPLinux -> stackOffset
-- ... but SysV ABI 64-bit does.
GCPLinux64ELF _ -> stackOffset + stackBytes
passArguments args
(drop nGprs gprs)
(drop nFprs fprs)
stackOffsetRes
(accumCode `appOL` code)
(reg : accumUsed)
| otherwise = do
(vr, code) <- getSomeReg arg
passArguments args
(drop nGprs gprs)
(drop nFprs fprs)
(stackOffset' + stackBytes)
(accumCode `appOL` code `snocOL` ST (cmmTypeFormat rep) vr stackSlot)
accumUsed
where
stackOffset' = case gcp of
GCPDarwin ->
-- stackOffset is at least 4-byte aligned
-- The Darwin ABI is happy with that.
stackOffset
GCPAIX ->
-- The 32bit PowerOPEN ABI is happy with
-- 32bit-alignment as well...
stackOffset
GCPLinux
-- ... the SysV ABI requires 8-byte
-- alignment for doubles.
| isFloatType rep && typeWidth rep == W64 ->
roundTo 8 stackOffset
| otherwise ->
stackOffset
GCPLinux64ELF _ ->
-- Everything on the stack is mapped to
-- 8-byte aligned doublewords
stackOffset
stackOffset''
| isFloatType rep && typeWidth rep == W32 =
case gcp of
-- The ELF v1 ABI Section 3.2.3 requires:
-- "Single precision floating point values
-- are mapped to the second word in a single
-- doubleword"
GCPLinux64ELF 1 -> stackOffset' + 4
_ -> stackOffset'
| otherwise = stackOffset'
stackSlot = AddrRegImm sp (ImmInt stackOffset'')
(nGprs, nFprs, stackBytes, regs)
= case gcp of
GCPAIX ->
case cmmTypeFormat rep of
II8 -> (1, 0, 4, gprs)
II16 -> (1, 0, 4, gprs)
II32 -> (1, 0, 4, gprs)
-- The PowerOpen ABI requires that we skip a
-- corresponding number of GPRs when we use
-- the FPRs.
--
-- E.g. for a `double` two GPRs are skipped,
-- whereas for a `float` one GPR is skipped
-- when parameters are assigned to
-- registers.
--
-- The PowerOpen ABI specification can be found at
-- ftp://www.sourceware.org/pub/binutils/ppc-docs/ppc-poweropen/
FF32 -> (1, 1, 4, fprs)
FF64 -> (2, 1, 8, fprs)
II64 -> panic "genCCall' passArguments II64"
FF80 -> panic "genCCall' passArguments FF80"
GCPDarwin ->
case cmmTypeFormat rep of
II8 -> (1, 0, 4, gprs)
II16 -> (1, 0, 4, gprs)
II32 -> (1, 0, 4, gprs)
-- The Darwin ABI requires that we skip a
-- corresponding number of GPRs when we use
-- the FPRs.
FF32 -> (1, 1, 4, fprs)
FF64 -> (2, 1, 8, fprs)
II64 -> panic "genCCall' passArguments II64"
FF80 -> panic "genCCall' passArguments FF80"
GCPLinux ->
case cmmTypeFormat rep of
II8 -> (1, 0, 4, gprs)
II16 -> (1, 0, 4, gprs)
II32 -> (1, 0, 4, gprs)
-- ... the SysV ABI doesn't.
FF32 -> (0, 1, 4, fprs)
FF64 -> (0, 1, 8, fprs)
II64 -> panic "genCCall' passArguments II64"
FF80 -> panic "genCCall' passArguments FF80"
GCPLinux64ELF _ ->
case cmmTypeFormat rep of
II8 -> (1, 0, 8, gprs)
II16 -> (1, 0, 8, gprs)
II32 -> (1, 0, 8, gprs)
II64 -> (1, 0, 8, gprs)
-- The ELFv1 ABI requires that we skip a
-- corresponding number of GPRs when we use
-- the FPRs.
FF32 -> (1, 1, 8, fprs)
FF64 -> (1, 1, 8, fprs)
FF80 -> panic "genCCall' passArguments FF80"
moveResult reduceToFF32 =
case dest_regs of
[] -> nilOL
[dest]
| reduceToFF32 && isFloat32 rep -> unitOL (FRSP r_dest f1)
| isFloat32 rep || isFloat64 rep -> unitOL (MR r_dest f1)
| isWord64 rep && target32Bit (targetPlatform dflags)
-> toOL [MR (getHiVRegFromLo r_dest) r3,
MR r_dest r4]
| otherwise -> unitOL (MR r_dest r3)
where rep = cmmRegType dflags (CmmLocal dest)
r_dest = getRegisterReg platform (CmmLocal dest)
_ -> panic "genCCall' moveResult: Bad dest_regs"
outOfLineMachOp mop =
do
dflags <- getDynFlags
mopExpr <- cmmMakeDynamicReference dflags CallReference $
mkForeignLabel functionName Nothing ForeignLabelInThisPackage IsFunction
let mopLabelOrExpr = case mopExpr of
CmmLit (CmmLabel lbl) -> Left lbl
_ -> Right mopExpr
return (mopLabelOrExpr, reduce)
where
(functionName, reduce) = case mop of
MO_F32_Exp -> (fsLit "exp", True)
MO_F32_Log -> (fsLit "log", True)
MO_F32_Sqrt -> (fsLit "sqrt", True)
MO_F32_Fabs -> unsupported
MO_F32_Sin -> (fsLit "sin", True)
MO_F32_Cos -> (fsLit "cos", True)
MO_F32_Tan -> (fsLit "tan", True)
MO_F32_Asin -> (fsLit "asin", True)
MO_F32_Acos -> (fsLit "acos", True)
MO_F32_Atan -> (fsLit "atan", True)
MO_F32_Sinh -> (fsLit "sinh", True)
MO_F32_Cosh -> (fsLit "cosh", True)
MO_F32_Tanh -> (fsLit "tanh", True)
MO_F32_Pwr -> (fsLit "pow", True)
MO_F64_Exp -> (fsLit "exp", False)
MO_F64_Log -> (fsLit "log", False)
MO_F64_Sqrt -> (fsLit "sqrt", False)
MO_F64_Fabs -> unsupported
MO_F64_Sin -> (fsLit "sin", False)
MO_F64_Cos -> (fsLit "cos", False)
MO_F64_Tan -> (fsLit "tan", False)
MO_F64_Asin -> (fsLit "asin", False)
MO_F64_Acos -> (fsLit "acos", False)
MO_F64_Atan -> (fsLit "atan", False)
MO_F64_Sinh -> (fsLit "sinh", False)
MO_F64_Cosh -> (fsLit "cosh", False)
MO_F64_Tanh -> (fsLit "tanh", False)
MO_F64_Pwr -> (fsLit "pow", False)
MO_UF_Conv w -> (fsLit $ word2FloatLabel w, False)
MO_Memcpy _ -> (fsLit "memcpy", False)
MO_Memset _ -> (fsLit "memset", False)
MO_Memmove _ -> (fsLit "memmove", False)
MO_Memcmp _ -> (fsLit "memcmp", False)
MO_BSwap w -> (fsLit $ bSwapLabel w, False)
MO_PopCnt w -> (fsLit $ popCntLabel w, False)
MO_Pdep w -> (fsLit $ pdepLabel w, False)
MO_Pext w -> (fsLit $ pextLabel w, False)
MO_Clz _ -> unsupported
MO_Ctz _ -> unsupported
MO_AtomicRMW {} -> unsupported
MO_Cmpxchg w -> (fsLit $ cmpxchgLabel w, False)
MO_AtomicRead _ -> unsupported
MO_AtomicWrite _ -> unsupported
MO_S_QuotRem {} -> unsupported
MO_U_QuotRem {} -> unsupported
MO_U_QuotRem2 {} -> unsupported
MO_Add2 {} -> unsupported
MO_SubWordC {} -> unsupported
MO_AddIntC {} -> unsupported
MO_SubIntC {} -> unsupported
MO_U_Mul2 {} -> unsupported
MO_WriteBarrier -> unsupported
MO_Touch -> unsupported
MO_Prefetch_Data _ -> unsupported
unsupported = panic ("outOfLineCmmOp: " ++ show mop
++ " not supported")
-- -----------------------------------------------------------------------------
-- Generating a table-branch | 24,130 | genCCall'
:: DynFlags
-> GenCCallPlatform
-> ForeignTarget -- function to call
-> [CmmFormal] -- where to put the result
-> [CmmActual] -- arguments (of mixed type)
-> NatM InstrBlock
genCCall' dflags gcp target dest_regs args
= ASSERT(not $ any (`elem` [II16]) $ map cmmTypeFormat argReps)
-- we rely on argument promotion in the codeGen
do
(finalStack,passArgumentsCode,usedRegs) <- passArguments
(zip args argReps)
allArgRegs
(allFPArgRegs platform)
initialStackOffset
(toOL []) []
(labelOrExpr, reduceToFF32) <- case target of
ForeignTarget (CmmLit (CmmLabel lbl)) _ -> do
uses_pic_base_implicitly
return (Left lbl, False)
ForeignTarget expr _ -> do
uses_pic_base_implicitly
return (Right expr, False)
PrimTarget mop -> outOfLineMachOp mop
let codeBefore = move_sp_down finalStack `appOL` passArgumentsCode
codeAfter = move_sp_up finalStack `appOL` moveResult reduceToFF32
case labelOrExpr of
Left lbl -> do -- the linker does all the work for us
return ( codeBefore
`snocOL` BL lbl usedRegs
`appOL` maybeNOP -- some ABI require a NOP after BL
`appOL` codeAfter)
Right dyn -> do -- implement call through function pointer
(dynReg, dynCode) <- getSomeReg dyn
case gcp of
GCPLinux64ELF 1 -> return ( dynCode
`appOL` codeBefore
`snocOL` ST spFormat toc (AddrRegImm sp (ImmInt 40))
`snocOL` LD II64 r11 (AddrRegImm dynReg (ImmInt 0))
`snocOL` LD II64 toc (AddrRegImm dynReg (ImmInt 8))
`snocOL` MTCTR r11
`snocOL` LD II64 r11 (AddrRegImm dynReg (ImmInt 16))
`snocOL` BCTRL usedRegs
`snocOL` LD spFormat toc (AddrRegImm sp (ImmInt 40))
`appOL` codeAfter)
GCPLinux64ELF 2 -> return ( dynCode
`appOL` codeBefore
`snocOL` ST spFormat toc (AddrRegImm sp (ImmInt 24))
`snocOL` MR r12 dynReg
`snocOL` MTCTR r12
`snocOL` BCTRL usedRegs
`snocOL` LD spFormat toc (AddrRegImm sp (ImmInt 24))
`appOL` codeAfter)
GCPAIX -> return ( dynCode
-- AIX/XCOFF follows the PowerOPEN ABI
-- which is quite similiar to LinuxPPC64/ELFv1
`appOL` codeBefore
`snocOL` ST spFormat toc (AddrRegImm sp (ImmInt 20))
`snocOL` LD II32 r11 (AddrRegImm dynReg (ImmInt 0))
`snocOL` LD II32 toc (AddrRegImm dynReg (ImmInt 4))
`snocOL` MTCTR r11
`snocOL` LD II32 r11 (AddrRegImm dynReg (ImmInt 8))
`snocOL` BCTRL usedRegs
`snocOL` LD spFormat toc (AddrRegImm sp (ImmInt 20))
`appOL` codeAfter)
_ -> return ( dynCode
`snocOL` MTCTR dynReg
`appOL` codeBefore
`snocOL` BCTRL usedRegs
`appOL` codeAfter)
where
platform = targetPlatform dflags
uses_pic_base_implicitly = do
-- See Note [implicit register in PPC PIC code]
-- on why we claim to use PIC register here
when (positionIndependent dflags && target32Bit platform) $ do
_ <- getPicBaseNat $ archWordFormat True
return ()
initialStackOffset = case gcp of
GCPAIX -> 24
GCPDarwin -> 24
GCPLinux -> 8
GCPLinux64ELF 1 -> 48
GCPLinux64ELF 2 -> 32
_ -> panic "genCall': unknown calling convention"
-- size of linkage area + size of arguments, in bytes
stackDelta finalStack = case gcp of
GCPAIX ->
roundTo 16 $ (24 +) $ max 32 $ sum $
map (widthInBytes . typeWidth) argReps
GCPDarwin ->
roundTo 16 $ (24 +) $ max 32 $ sum $
map (widthInBytes . typeWidth) argReps
GCPLinux -> roundTo 16 finalStack
GCPLinux64ELF 1 ->
roundTo 16 $ (48 +) $ max 64 $ sum $
map (roundTo 8 . widthInBytes . typeWidth)
argReps
GCPLinux64ELF 2 ->
roundTo 16 $ (32 +) $ max 64 $ sum $
map (roundTo 8 . widthInBytes . typeWidth)
argReps
_ -> panic "genCall': unknown calling conv."
argReps = map (cmmExprType dflags) args
roundTo a x | x `mod` a == 0 = x
| otherwise = x + a - (x `mod` a)
spFormat = if target32Bit platform then II32 else II64
-- TODO: Do not create a new stack frame if delta is too large.
move_sp_down finalStack
| delta > stackFrameHeaderSize dflags =
toOL [STU spFormat sp (AddrRegImm sp (ImmInt (-delta))),
DELTA (-delta)]
| otherwise = nilOL
where delta = stackDelta finalStack
move_sp_up finalStack
| delta > stackFrameHeaderSize dflags =
toOL [ADD sp sp (RIImm (ImmInt delta)),
DELTA 0]
| otherwise = nilOL
where delta = stackDelta finalStack
-- A NOP instruction is required after a call (bl instruction)
-- on AIX and 64-Bit Linux.
-- If the call is to a function with a different TOC (r2) the
-- link editor replaces the NOP instruction with a load of the TOC
-- from the stack to restore the TOC.
maybeNOP = case gcp of
-- See Section 3.9.4 of OpenPower ABI
GCPAIX -> unitOL NOP
-- See Section 3.5.11 of PPC64 ELF v1.9
GCPLinux64ELF 1 -> unitOL NOP
-- See Section 2.3.6 of PPC64 ELF v2
GCPLinux64ELF 2 -> unitOL NOP
_ -> nilOL
passArguments [] _ _ stackOffset accumCode accumUsed = return (stackOffset, accumCode, accumUsed)
passArguments ((arg,arg_ty):args) gprs fprs stackOffset
accumCode accumUsed | isWord64 arg_ty
&& target32Bit (targetPlatform dflags) =
do
ChildCode64 code vr_lo <- iselExpr64 arg
let vr_hi = getHiVRegFromLo vr_lo
case gcp of
GCPAIX -> -- same as for Darwin
do let storeWord vr (gpr:_) _ = MR gpr vr
storeWord vr [] offset
= ST II32 vr (AddrRegImm sp (ImmInt offset))
passArguments args
(drop 2 gprs)
fprs
(stackOffset+8)
(accumCode `appOL` code
`snocOL` storeWord vr_hi gprs stackOffset
`snocOL` storeWord vr_lo (drop 1 gprs) (stackOffset+4))
((take 2 gprs) ++ accumUsed)
GCPDarwin ->
do let storeWord vr (gpr:_) _ = MR gpr vr
storeWord vr [] offset
= ST II32 vr (AddrRegImm sp (ImmInt offset))
passArguments args
(drop 2 gprs)
fprs
(stackOffset+8)
(accumCode `appOL` code
`snocOL` storeWord vr_hi gprs stackOffset
`snocOL` storeWord vr_lo (drop 1 gprs) (stackOffset+4))
((take 2 gprs) ++ accumUsed)
GCPLinux ->
do let stackOffset' = roundTo 8 stackOffset
stackCode = accumCode `appOL` code
`snocOL` ST II32 vr_hi (AddrRegImm sp (ImmInt stackOffset'))
`snocOL` ST II32 vr_lo (AddrRegImm sp (ImmInt (stackOffset'+4)))
regCode hireg loreg =
accumCode `appOL` code
`snocOL` MR hireg vr_hi
`snocOL` MR loreg vr_lo
case gprs of
hireg : loreg : regs | even (length gprs) ->
passArguments args regs fprs stackOffset
(regCode hireg loreg) (hireg : loreg : accumUsed)
_skipped : hireg : loreg : regs ->
passArguments args regs fprs stackOffset
(regCode hireg loreg) (hireg : loreg : accumUsed)
_ -> -- only one or no regs left
passArguments args [] fprs (stackOffset'+8)
stackCode accumUsed
GCPLinux64ELF _ -> panic "passArguments: 32 bit code"
passArguments ((arg,rep):args) gprs fprs stackOffset accumCode accumUsed
| reg : _ <- regs = do
register <- getRegister arg
let code = case register of
Fixed _ freg fcode -> fcode `snocOL` MR reg freg
Any _ acode -> acode reg
stackOffsetRes = case gcp of
-- The Darwin ABI requires that we reserve
-- stack slots for register parameters
GCPDarwin -> stackOffset + stackBytes
-- ... so does the PowerOpen ABI.
GCPAIX -> stackOffset + stackBytes
-- ... the SysV ABI 32-bit doesn't.
GCPLinux -> stackOffset
-- ... but SysV ABI 64-bit does.
GCPLinux64ELF _ -> stackOffset + stackBytes
passArguments args
(drop nGprs gprs)
(drop nFprs fprs)
stackOffsetRes
(accumCode `appOL` code)
(reg : accumUsed)
| otherwise = do
(vr, code) <- getSomeReg arg
passArguments args
(drop nGprs gprs)
(drop nFprs fprs)
(stackOffset' + stackBytes)
(accumCode `appOL` code `snocOL` ST (cmmTypeFormat rep) vr stackSlot)
accumUsed
where
stackOffset' = case gcp of
GCPDarwin ->
-- stackOffset is at least 4-byte aligned
-- The Darwin ABI is happy with that.
stackOffset
GCPAIX ->
-- The 32bit PowerOPEN ABI is happy with
-- 32bit-alignment as well...
stackOffset
GCPLinux
-- ... the SysV ABI requires 8-byte
-- alignment for doubles.
| isFloatType rep && typeWidth rep == W64 ->
roundTo 8 stackOffset
| otherwise ->
stackOffset
GCPLinux64ELF _ ->
-- Everything on the stack is mapped to
-- 8-byte aligned doublewords
stackOffset
stackOffset''
| isFloatType rep && typeWidth rep == W32 =
case gcp of
-- The ELF v1 ABI Section 3.2.3 requires:
-- "Single precision floating point values
-- are mapped to the second word in a single
-- doubleword"
GCPLinux64ELF 1 -> stackOffset' + 4
_ -> stackOffset'
| otherwise = stackOffset'
stackSlot = AddrRegImm sp (ImmInt stackOffset'')
(nGprs, nFprs, stackBytes, regs)
= case gcp of
GCPAIX ->
case cmmTypeFormat rep of
II8 -> (1, 0, 4, gprs)
II16 -> (1, 0, 4, gprs)
II32 -> (1, 0, 4, gprs)
-- The PowerOpen ABI requires that we skip a
-- corresponding number of GPRs when we use
-- the FPRs.
--
-- E.g. for a `double` two GPRs are skipped,
-- whereas for a `float` one GPR is skipped
-- when parameters are assigned to
-- registers.
--
-- The PowerOpen ABI specification can be found at
-- ftp://www.sourceware.org/pub/binutils/ppc-docs/ppc-poweropen/
FF32 -> (1, 1, 4, fprs)
FF64 -> (2, 1, 8, fprs)
II64 -> panic "genCCall' passArguments II64"
FF80 -> panic "genCCall' passArguments FF80"
GCPDarwin ->
case cmmTypeFormat rep of
II8 -> (1, 0, 4, gprs)
II16 -> (1, 0, 4, gprs)
II32 -> (1, 0, 4, gprs)
-- The Darwin ABI requires that we skip a
-- corresponding number of GPRs when we use
-- the FPRs.
FF32 -> (1, 1, 4, fprs)
FF64 -> (2, 1, 8, fprs)
II64 -> panic "genCCall' passArguments II64"
FF80 -> panic "genCCall' passArguments FF80"
GCPLinux ->
case cmmTypeFormat rep of
II8 -> (1, 0, 4, gprs)
II16 -> (1, 0, 4, gprs)
II32 -> (1, 0, 4, gprs)
-- ... the SysV ABI doesn't.
FF32 -> (0, 1, 4, fprs)
FF64 -> (0, 1, 8, fprs)
II64 -> panic "genCCall' passArguments II64"
FF80 -> panic "genCCall' passArguments FF80"
GCPLinux64ELF _ ->
case cmmTypeFormat rep of
II8 -> (1, 0, 8, gprs)
II16 -> (1, 0, 8, gprs)
II32 -> (1, 0, 8, gprs)
II64 -> (1, 0, 8, gprs)
-- The ELFv1 ABI requires that we skip a
-- corresponding number of GPRs when we use
-- the FPRs.
FF32 -> (1, 1, 8, fprs)
FF64 -> (1, 1, 8, fprs)
FF80 -> panic "genCCall' passArguments FF80"
moveResult reduceToFF32 =
case dest_regs of
[] -> nilOL
[dest]
| reduceToFF32 && isFloat32 rep -> unitOL (FRSP r_dest f1)
| isFloat32 rep || isFloat64 rep -> unitOL (MR r_dest f1)
| isWord64 rep && target32Bit (targetPlatform dflags)
-> toOL [MR (getHiVRegFromLo r_dest) r3,
MR r_dest r4]
| otherwise -> unitOL (MR r_dest r3)
where rep = cmmRegType dflags (CmmLocal dest)
r_dest = getRegisterReg platform (CmmLocal dest)
_ -> panic "genCCall' moveResult: Bad dest_regs"
outOfLineMachOp mop =
do
dflags <- getDynFlags
mopExpr <- cmmMakeDynamicReference dflags CallReference $
mkForeignLabel functionName Nothing ForeignLabelInThisPackage IsFunction
let mopLabelOrExpr = case mopExpr of
CmmLit (CmmLabel lbl) -> Left lbl
_ -> Right mopExpr
return (mopLabelOrExpr, reduce)
where
(functionName, reduce) = case mop of
MO_F32_Exp -> (fsLit "exp", True)
MO_F32_Log -> (fsLit "log", True)
MO_F32_Sqrt -> (fsLit "sqrt", True)
MO_F32_Fabs -> unsupported
MO_F32_Sin -> (fsLit "sin", True)
MO_F32_Cos -> (fsLit "cos", True)
MO_F32_Tan -> (fsLit "tan", True)
MO_F32_Asin -> (fsLit "asin", True)
MO_F32_Acos -> (fsLit "acos", True)
MO_F32_Atan -> (fsLit "atan", True)
MO_F32_Sinh -> (fsLit "sinh", True)
MO_F32_Cosh -> (fsLit "cosh", True)
MO_F32_Tanh -> (fsLit "tanh", True)
MO_F32_Pwr -> (fsLit "pow", True)
MO_F64_Exp -> (fsLit "exp", False)
MO_F64_Log -> (fsLit "log", False)
MO_F64_Sqrt -> (fsLit "sqrt", False)
MO_F64_Fabs -> unsupported
MO_F64_Sin -> (fsLit "sin", False)
MO_F64_Cos -> (fsLit "cos", False)
MO_F64_Tan -> (fsLit "tan", False)
MO_F64_Asin -> (fsLit "asin", False)
MO_F64_Acos -> (fsLit "acos", False)
MO_F64_Atan -> (fsLit "atan", False)
MO_F64_Sinh -> (fsLit "sinh", False)
MO_F64_Cosh -> (fsLit "cosh", False)
MO_F64_Tanh -> (fsLit "tanh", False)
MO_F64_Pwr -> (fsLit "pow", False)
MO_UF_Conv w -> (fsLit $ word2FloatLabel w, False)
MO_Memcpy _ -> (fsLit "memcpy", False)
MO_Memset _ -> (fsLit "memset", False)
MO_Memmove _ -> (fsLit "memmove", False)
MO_Memcmp _ -> (fsLit "memcmp", False)
MO_BSwap w -> (fsLit $ bSwapLabel w, False)
MO_PopCnt w -> (fsLit $ popCntLabel w, False)
MO_Pdep w -> (fsLit $ pdepLabel w, False)
MO_Pext w -> (fsLit $ pextLabel w, False)
MO_Clz _ -> unsupported
MO_Ctz _ -> unsupported
MO_AtomicRMW {} -> unsupported
MO_Cmpxchg w -> (fsLit $ cmpxchgLabel w, False)
MO_AtomicRead _ -> unsupported
MO_AtomicWrite _ -> unsupported
MO_S_QuotRem {} -> unsupported
MO_U_QuotRem {} -> unsupported
MO_U_QuotRem2 {} -> unsupported
MO_Add2 {} -> unsupported
MO_SubWordC {} -> unsupported
MO_AddIntC {} -> unsupported
MO_SubIntC {} -> unsupported
MO_U_Mul2 {} -> unsupported
MO_WriteBarrier -> unsupported
MO_Touch -> unsupported
MO_Prefetch_Data _ -> unsupported
unsupported = panic ("outOfLineCmmOp: " ++ show mop
++ " not supported")
-- -----------------------------------------------------------------------------
-- Generating a table-branch | 21,709 | genCCall' dflags gcp target dest_regs args
= ASSERT(not $ any (`elem` [II16]) $ map cmmTypeFormat argReps)
-- we rely on argument promotion in the codeGen
do
(finalStack,passArgumentsCode,usedRegs) <- passArguments
(zip args argReps)
allArgRegs
(allFPArgRegs platform)
initialStackOffset
(toOL []) []
(labelOrExpr, reduceToFF32) <- case target of
ForeignTarget (CmmLit (CmmLabel lbl)) _ -> do
uses_pic_base_implicitly
return (Left lbl, False)
ForeignTarget expr _ -> do
uses_pic_base_implicitly
return (Right expr, False)
PrimTarget mop -> outOfLineMachOp mop
let codeBefore = move_sp_down finalStack `appOL` passArgumentsCode
codeAfter = move_sp_up finalStack `appOL` moveResult reduceToFF32
case labelOrExpr of
Left lbl -> do -- the linker does all the work for us
return ( codeBefore
`snocOL` BL lbl usedRegs
`appOL` maybeNOP -- some ABI require a NOP after BL
`appOL` codeAfter)
Right dyn -> do -- implement call through function pointer
(dynReg, dynCode) <- getSomeReg dyn
case gcp of
GCPLinux64ELF 1 -> return ( dynCode
`appOL` codeBefore
`snocOL` ST spFormat toc (AddrRegImm sp (ImmInt 40))
`snocOL` LD II64 r11 (AddrRegImm dynReg (ImmInt 0))
`snocOL` LD II64 toc (AddrRegImm dynReg (ImmInt 8))
`snocOL` MTCTR r11
`snocOL` LD II64 r11 (AddrRegImm dynReg (ImmInt 16))
`snocOL` BCTRL usedRegs
`snocOL` LD spFormat toc (AddrRegImm sp (ImmInt 40))
`appOL` codeAfter)
GCPLinux64ELF 2 -> return ( dynCode
`appOL` codeBefore
`snocOL` ST spFormat toc (AddrRegImm sp (ImmInt 24))
`snocOL` MR r12 dynReg
`snocOL` MTCTR r12
`snocOL` BCTRL usedRegs
`snocOL` LD spFormat toc (AddrRegImm sp (ImmInt 24))
`appOL` codeAfter)
GCPAIX -> return ( dynCode
-- AIX/XCOFF follows the PowerOPEN ABI
-- which is quite similiar to LinuxPPC64/ELFv1
`appOL` codeBefore
`snocOL` ST spFormat toc (AddrRegImm sp (ImmInt 20))
`snocOL` LD II32 r11 (AddrRegImm dynReg (ImmInt 0))
`snocOL` LD II32 toc (AddrRegImm dynReg (ImmInt 4))
`snocOL` MTCTR r11
`snocOL` LD II32 r11 (AddrRegImm dynReg (ImmInt 8))
`snocOL` BCTRL usedRegs
`snocOL` LD spFormat toc (AddrRegImm sp (ImmInt 20))
`appOL` codeAfter)
_ -> return ( dynCode
`snocOL` MTCTR dynReg
`appOL` codeBefore
`snocOL` BCTRL usedRegs
`appOL` codeAfter)
where
platform = targetPlatform dflags
uses_pic_base_implicitly = do
-- See Note [implicit register in PPC PIC code]
-- on why we claim to use PIC register here
when (positionIndependent dflags && target32Bit platform) $ do
_ <- getPicBaseNat $ archWordFormat True
return ()
initialStackOffset = case gcp of
GCPAIX -> 24
GCPDarwin -> 24
GCPLinux -> 8
GCPLinux64ELF 1 -> 48
GCPLinux64ELF 2 -> 32
_ -> panic "genCall': unknown calling convention"
-- size of linkage area + size of arguments, in bytes
stackDelta finalStack = case gcp of
GCPAIX ->
roundTo 16 $ (24 +) $ max 32 $ sum $
map (widthInBytes . typeWidth) argReps
GCPDarwin ->
roundTo 16 $ (24 +) $ max 32 $ sum $
map (widthInBytes . typeWidth) argReps
GCPLinux -> roundTo 16 finalStack
GCPLinux64ELF 1 ->
roundTo 16 $ (48 +) $ max 64 $ sum $
map (roundTo 8 . widthInBytes . typeWidth)
argReps
GCPLinux64ELF 2 ->
roundTo 16 $ (32 +) $ max 64 $ sum $
map (roundTo 8 . widthInBytes . typeWidth)
argReps
_ -> panic "genCall': unknown calling conv."
argReps = map (cmmExprType dflags) args
roundTo a x | x `mod` a == 0 = x
| otherwise = x + a - (x `mod` a)
spFormat = if target32Bit platform then II32 else II64
-- TODO: Do not create a new stack frame if delta is too large.
move_sp_down finalStack
| delta > stackFrameHeaderSize dflags =
toOL [STU spFormat sp (AddrRegImm sp (ImmInt (-delta))),
DELTA (-delta)]
| otherwise = nilOL
where delta = stackDelta finalStack
move_sp_up finalStack
| delta > stackFrameHeaderSize dflags =
toOL [ADD sp sp (RIImm (ImmInt delta)),
DELTA 0]
| otherwise = nilOL
where delta = stackDelta finalStack
-- A NOP instruction is required after a call (bl instruction)
-- on AIX and 64-Bit Linux.
-- If the call is to a function with a different TOC (r2) the
-- link editor replaces the NOP instruction with a load of the TOC
-- from the stack to restore the TOC.
maybeNOP = case gcp of
-- See Section 3.9.4 of OpenPower ABI
GCPAIX -> unitOL NOP
-- See Section 3.5.11 of PPC64 ELF v1.9
GCPLinux64ELF 1 -> unitOL NOP
-- See Section 2.3.6 of PPC64 ELF v2
GCPLinux64ELF 2 -> unitOL NOP
_ -> nilOL
passArguments [] _ _ stackOffset accumCode accumUsed = return (stackOffset, accumCode, accumUsed)
passArguments ((arg,arg_ty):args) gprs fprs stackOffset
accumCode accumUsed | isWord64 arg_ty
&& target32Bit (targetPlatform dflags) =
do
ChildCode64 code vr_lo <- iselExpr64 arg
let vr_hi = getHiVRegFromLo vr_lo
case gcp of
GCPAIX -> -- same as for Darwin
do let storeWord vr (gpr:_) _ = MR gpr vr
storeWord vr [] offset
= ST II32 vr (AddrRegImm sp (ImmInt offset))
passArguments args
(drop 2 gprs)
fprs
(stackOffset+8)
(accumCode `appOL` code
`snocOL` storeWord vr_hi gprs stackOffset
`snocOL` storeWord vr_lo (drop 1 gprs) (stackOffset+4))
((take 2 gprs) ++ accumUsed)
GCPDarwin ->
do let storeWord vr (gpr:_) _ = MR gpr vr
storeWord vr [] offset
= ST II32 vr (AddrRegImm sp (ImmInt offset))
passArguments args
(drop 2 gprs)
fprs
(stackOffset+8)
(accumCode `appOL` code
`snocOL` storeWord vr_hi gprs stackOffset
`snocOL` storeWord vr_lo (drop 1 gprs) (stackOffset+4))
((take 2 gprs) ++ accumUsed)
GCPLinux ->
do let stackOffset' = roundTo 8 stackOffset
stackCode = accumCode `appOL` code
`snocOL` ST II32 vr_hi (AddrRegImm sp (ImmInt stackOffset'))
`snocOL` ST II32 vr_lo (AddrRegImm sp (ImmInt (stackOffset'+4)))
regCode hireg loreg =
accumCode `appOL` code
`snocOL` MR hireg vr_hi
`snocOL` MR loreg vr_lo
case gprs of
hireg : loreg : regs | even (length gprs) ->
passArguments args regs fprs stackOffset
(regCode hireg loreg) (hireg : loreg : accumUsed)
_skipped : hireg : loreg : regs ->
passArguments args regs fprs stackOffset
(regCode hireg loreg) (hireg : loreg : accumUsed)
_ -> -- only one or no regs left
passArguments args [] fprs (stackOffset'+8)
stackCode accumUsed
GCPLinux64ELF _ -> panic "passArguments: 32 bit code"
passArguments ((arg,rep):args) gprs fprs stackOffset accumCode accumUsed
| reg : _ <- regs = do
register <- getRegister arg
let code = case register of
Fixed _ freg fcode -> fcode `snocOL` MR reg freg
Any _ acode -> acode reg
stackOffsetRes = case gcp of
-- The Darwin ABI requires that we reserve
-- stack slots for register parameters
GCPDarwin -> stackOffset + stackBytes
-- ... so does the PowerOpen ABI.
GCPAIX -> stackOffset + stackBytes
-- ... the SysV ABI 32-bit doesn't.
GCPLinux -> stackOffset
-- ... but SysV ABI 64-bit does.
GCPLinux64ELF _ -> stackOffset + stackBytes
passArguments args
(drop nGprs gprs)
(drop nFprs fprs)
stackOffsetRes
(accumCode `appOL` code)
(reg : accumUsed)
| otherwise = do
(vr, code) <- getSomeReg arg
passArguments args
(drop nGprs gprs)
(drop nFprs fprs)
(stackOffset' + stackBytes)
(accumCode `appOL` code `snocOL` ST (cmmTypeFormat rep) vr stackSlot)
accumUsed
where
stackOffset' = case gcp of
GCPDarwin ->
-- stackOffset is at least 4-byte aligned
-- The Darwin ABI is happy with that.
stackOffset
GCPAIX ->
-- The 32bit PowerOPEN ABI is happy with
-- 32bit-alignment as well...
stackOffset
GCPLinux
-- ... the SysV ABI requires 8-byte
-- alignment for doubles.
| isFloatType rep && typeWidth rep == W64 ->
roundTo 8 stackOffset
| otherwise ->
stackOffset
GCPLinux64ELF _ ->
-- Everything on the stack is mapped to
-- 8-byte aligned doublewords
stackOffset
stackOffset''
| isFloatType rep && typeWidth rep == W32 =
case gcp of
-- The ELF v1 ABI Section 3.2.3 requires:
-- "Single precision floating point values
-- are mapped to the second word in a single
-- doubleword"
GCPLinux64ELF 1 -> stackOffset' + 4
_ -> stackOffset'
| otherwise = stackOffset'
stackSlot = AddrRegImm sp (ImmInt stackOffset'')
(nGprs, nFprs, stackBytes, regs)
= case gcp of
GCPAIX ->
case cmmTypeFormat rep of
II8 -> (1, 0, 4, gprs)
II16 -> (1, 0, 4, gprs)
II32 -> (1, 0, 4, gprs)
-- The PowerOpen ABI requires that we skip a
-- corresponding number of GPRs when we use
-- the FPRs.
--
-- E.g. for a `double` two GPRs are skipped,
-- whereas for a `float` one GPR is skipped
-- when parameters are assigned to
-- registers.
--
-- The PowerOpen ABI specification can be found at
-- ftp://www.sourceware.org/pub/binutils/ppc-docs/ppc-poweropen/
FF32 -> (1, 1, 4, fprs)
FF64 -> (2, 1, 8, fprs)
II64 -> panic "genCCall' passArguments II64"
FF80 -> panic "genCCall' passArguments FF80"
GCPDarwin ->
case cmmTypeFormat rep of
II8 -> (1, 0, 4, gprs)
II16 -> (1, 0, 4, gprs)
II32 -> (1, 0, 4, gprs)
-- The Darwin ABI requires that we skip a
-- corresponding number of GPRs when we use
-- the FPRs.
FF32 -> (1, 1, 4, fprs)
FF64 -> (2, 1, 8, fprs)
II64 -> panic "genCCall' passArguments II64"
FF80 -> panic "genCCall' passArguments FF80"
GCPLinux ->
case cmmTypeFormat rep of
II8 -> (1, 0, 4, gprs)
II16 -> (1, 0, 4, gprs)
II32 -> (1, 0, 4, gprs)
-- ... the SysV ABI doesn't.
FF32 -> (0, 1, 4, fprs)
FF64 -> (0, 1, 8, fprs)
II64 -> panic "genCCall' passArguments II64"
FF80 -> panic "genCCall' passArguments FF80"
GCPLinux64ELF _ ->
case cmmTypeFormat rep of
II8 -> (1, 0, 8, gprs)
II16 -> (1, 0, 8, gprs)
II32 -> (1, 0, 8, gprs)
II64 -> (1, 0, 8, gprs)
-- The ELFv1 ABI requires that we skip a
-- corresponding number of GPRs when we use
-- the FPRs.
FF32 -> (1, 1, 8, fprs)
FF64 -> (1, 1, 8, fprs)
FF80 -> panic "genCCall' passArguments FF80"
moveResult reduceToFF32 =
case dest_regs of
[] -> nilOL
[dest]
| reduceToFF32 && isFloat32 rep -> unitOL (FRSP r_dest f1)
| isFloat32 rep || isFloat64 rep -> unitOL (MR r_dest f1)
| isWord64 rep && target32Bit (targetPlatform dflags)
-> toOL [MR (getHiVRegFromLo r_dest) r3,
MR r_dest r4]
| otherwise -> unitOL (MR r_dest r3)
where rep = cmmRegType dflags (CmmLocal dest)
r_dest = getRegisterReg platform (CmmLocal dest)
_ -> panic "genCCall' moveResult: Bad dest_regs"
outOfLineMachOp mop =
do
dflags <- getDynFlags
mopExpr <- cmmMakeDynamicReference dflags CallReference $
mkForeignLabel functionName Nothing ForeignLabelInThisPackage IsFunction
let mopLabelOrExpr = case mopExpr of
CmmLit (CmmLabel lbl) -> Left lbl
_ -> Right mopExpr
return (mopLabelOrExpr, reduce)
where
(functionName, reduce) = case mop of
MO_F32_Exp -> (fsLit "exp", True)
MO_F32_Log -> (fsLit "log", True)
MO_F32_Sqrt -> (fsLit "sqrt", True)
MO_F32_Fabs -> unsupported
MO_F32_Sin -> (fsLit "sin", True)
MO_F32_Cos -> (fsLit "cos", True)
MO_F32_Tan -> (fsLit "tan", True)
MO_F32_Asin -> (fsLit "asin", True)
MO_F32_Acos -> (fsLit "acos", True)
MO_F32_Atan -> (fsLit "atan", True)
MO_F32_Sinh -> (fsLit "sinh", True)
MO_F32_Cosh -> (fsLit "cosh", True)
MO_F32_Tanh -> (fsLit "tanh", True)
MO_F32_Pwr -> (fsLit "pow", True)
MO_F64_Exp -> (fsLit "exp", False)
MO_F64_Log -> (fsLit "log", False)
MO_F64_Sqrt -> (fsLit "sqrt", False)
MO_F64_Fabs -> unsupported
MO_F64_Sin -> (fsLit "sin", False)
MO_F64_Cos -> (fsLit "cos", False)
MO_F64_Tan -> (fsLit "tan", False)
MO_F64_Asin -> (fsLit "asin", False)
MO_F64_Acos -> (fsLit "acos", False)
MO_F64_Atan -> (fsLit "atan", False)
MO_F64_Sinh -> (fsLit "sinh", False)
MO_F64_Cosh -> (fsLit "cosh", False)
MO_F64_Tanh -> (fsLit "tanh", False)
MO_F64_Pwr -> (fsLit "pow", False)
MO_UF_Conv w -> (fsLit $ word2FloatLabel w, False)
MO_Memcpy _ -> (fsLit "memcpy", False)
MO_Memset _ -> (fsLit "memset", False)
MO_Memmove _ -> (fsLit "memmove", False)
MO_Memcmp _ -> (fsLit "memcmp", False)
MO_BSwap w -> (fsLit $ bSwapLabel w, False)
MO_PopCnt w -> (fsLit $ popCntLabel w, False)
MO_Pdep w -> (fsLit $ pdepLabel w, False)
MO_Pext w -> (fsLit $ pextLabel w, False)
MO_Clz _ -> unsupported
MO_Ctz _ -> unsupported
MO_AtomicRMW {} -> unsupported
MO_Cmpxchg w -> (fsLit $ cmpxchgLabel w, False)
MO_AtomicRead _ -> unsupported
MO_AtomicWrite _ -> unsupported
MO_S_QuotRem {} -> unsupported
MO_U_QuotRem {} -> unsupported
MO_U_QuotRem2 {} -> unsupported
MO_Add2 {} -> unsupported
MO_SubWordC {} -> unsupported
MO_AddIntC {} -> unsupported
MO_SubIntC {} -> unsupported
MO_U_Mul2 {} -> unsupported
MO_WriteBarrier -> unsupported
MO_Touch -> unsupported
MO_Prefetch_Data _ -> unsupported
unsupported = panic ("outOfLineCmmOp: " ++ show mop
++ " not supported")
-- -----------------------------------------------------------------------------
-- Generating a table-branch | 21,476 | true | true | 208 | 29 | 11,848 | 4,350 | 2,213 | 2,137 | null | null |
Athas/Sindre | Sindre/Compiler.hs | mit | runtimeError :: Compiler m (String -> Execution m a)
runtimeError = do pos <- position <$> asks currentPos
return $ \s -> fail $ pos ++ s | 155 | runtimeError :: Compiler m (String -> Execution m a)
runtimeError = do pos <- position <$> asks currentPos
return $ \s -> fail $ pos ++ s | 155 | runtimeError = do pos <- position <$> asks currentPos
return $ \s -> fail $ pos ++ s | 102 | false | true | 1 | 10 | 44 | 66 | 30 | 36 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F30.hs | bsd-3-clause | ptr_glVertexAttrib4dvARB :: FunPtr (GLuint -> Ptr GLdouble -> IO ())
ptr_glVertexAttrib4dvARB = unsafePerformIO $ getCommand "glVertexAttrib4dvARB" | 147 | ptr_glVertexAttrib4dvARB :: FunPtr (GLuint -> Ptr GLdouble -> IO ())
ptr_glVertexAttrib4dvARB = unsafePerformIO $ getCommand "glVertexAttrib4dvARB" | 147 | ptr_glVertexAttrib4dvARB = unsafePerformIO $ getCommand "glVertexAttrib4dvARB" | 78 | false | true | 0 | 10 | 15 | 40 | 19 | 21 | null | null |
cornell-pl/HsAdapton | weak-hashtables/benchmark/src/Criterion/Collection/Main.hs | bsd-3-clause | -- Fixme: fold chart output into config and generalize to other post-processing
-- functions (like alternative chart types and CSV output)
runBenchmark :: (NFData op)
=> MeasurementMode
-> WorkloadMode
-> Benchmark op
-> CriterionCollectionConfig
-> Maybe FilePath
-> IO ()
runBenchmark mMode wMode benchmark (Cfg cfg logPlot) fp = withConfig cfg $ do
rng <- liftIO $ R.withSystemRandom (\r -> return r :: IO GenIO)
env <- measureEnvironment
plotData <- takeSamples mMode wMode benchmark env rng
liftIO $ mkChart logPlot (benchmarkName benchmark) fp plotData
liftIO $ mkCSV (benchmarkName benchmark) fp plotData
------------------------------------------------------------------------------ | 801 | runBenchmark :: (NFData op)
=> MeasurementMode
-> WorkloadMode
-> Benchmark op
-> CriterionCollectionConfig
-> Maybe FilePath
-> IO ()
runBenchmark mMode wMode benchmark (Cfg cfg logPlot) fp = withConfig cfg $ do
rng <- liftIO $ R.withSystemRandom (\r -> return r :: IO GenIO)
env <- measureEnvironment
plotData <- takeSamples mMode wMode benchmark env rng
liftIO $ mkChart logPlot (benchmarkName benchmark) fp plotData
liftIO $ mkCSV (benchmarkName benchmark) fp plotData
------------------------------------------------------------------------------ | 662 | runBenchmark mMode wMode benchmark (Cfg cfg logPlot) fp = withConfig cfg $ do
rng <- liftIO $ R.withSystemRandom (\r -> return r :: IO GenIO)
env <- measureEnvironment
plotData <- takeSamples mMode wMode benchmark env rng
liftIO $ mkChart logPlot (benchmarkName benchmark) fp plotData
liftIO $ mkCSV (benchmarkName benchmark) fp plotData
------------------------------------------------------------------------------ | 449 | true | true | 0 | 13 | 202 | 180 | 86 | 94 | null | null |
lambdageek/insomnia | src/Insomnia/Typecheck/Expr.hs | bsd-3-clause | unifyAnn _ _ = return () | 24 | unifyAnn _ _ = return () | 24 | unifyAnn _ _ = return () | 24 | false | false | 0 | 6 | 5 | 16 | 7 | 9 | null | null |
ezyang/ghc | compiler/cmm/Hoopl/Label.hs | bsd-3-clause | lookupFact :: Label -> FactBase f -> Maybe f
lookupFact = mapLookup | 67 | lookupFact :: Label -> FactBase f -> Maybe f
lookupFact = mapLookup | 67 | lookupFact = mapLookup | 22 | false | true | 0 | 8 | 11 | 31 | 13 | 18 | null | null |
raphaelmor/99HaskellProblems | 1-10.hs | mit | myLength (x:xs) = 1 + (myLength xs) | 35 | myLength (x:xs) = 1 + (myLength xs) | 35 | myLength (x:xs) = 1 + (myLength xs) | 35 | false | false | 0 | 7 | 6 | 26 | 13 | 13 | null | null |
Baranowski/SourceGraph | Analyse.hs | gpl-3.0 | mods = (dg', R.Bold txt)
where
dg' = DG "legend_mods" (Text "Module Import") dg
dg = mkLegendGraph ns es
nAs = [shape Tab, fillColor defaultNodeColor]
ns = [ (1, toLabel m1 : nAs)
, (2, toLabel m2 : nAs)
]
m1 = "Foo"
m2 = "Bar"
es = [(1,2,[])]
txt = Grouping [ Text "Two modules with module"
, Emphasis $ Text m1
, Text "importing"
, Emphasis $ Text m2
, Text "."
] | 544 | mods = (dg', R.Bold txt)
where
dg' = DG "legend_mods" (Text "Module Import") dg
dg = mkLegendGraph ns es
nAs = [shape Tab, fillColor defaultNodeColor]
ns = [ (1, toLabel m1 : nAs)
, (2, toLabel m2 : nAs)
]
m1 = "Foo"
m2 = "Bar"
es = [(1,2,[])]
txt = Grouping [ Text "Two modules with module"
, Emphasis $ Text m1
, Text "importing"
, Emphasis $ Text m2
, Text "."
] | 544 | mods = (dg', R.Bold txt)
where
dg' = DG "legend_mods" (Text "Module Import") dg
dg = mkLegendGraph ns es
nAs = [shape Tab, fillColor defaultNodeColor]
ns = [ (1, toLabel m1 : nAs)
, (2, toLabel m2 : nAs)
]
m1 = "Foo"
m2 = "Bar"
es = [(1,2,[])]
txt = Grouping [ Text "Two modules with module"
, Emphasis $ Text m1
, Text "importing"
, Emphasis $ Text m2
, Text "."
] | 544 | false | false | 7 | 9 | 253 | 182 | 95 | 87 | null | null |
pbrisbin/renters-reality | Handler/Feed.hs | bsd-2-clause | feedFromRecords records@(r:_) =
rssFeed Feed
{ feedAuthor = "Patrick Brisbin"
, feedTitle = "Renters' reality"
, feedDescription = "Recent reviews on rentersreality.com"
, feedLanguage = "en-us"
, feedLinkSelf = FeedR
, feedLinkHome = RootR
, feedUpdated = reviewCreatedDate . entityVal $ fst r
, feedEntries = map recordToRssEntry records
} | 445 | feedFromRecords records@(r:_) =
rssFeed Feed
{ feedAuthor = "Patrick Brisbin"
, feedTitle = "Renters' reality"
, feedDescription = "Recent reviews on rentersreality.com"
, feedLanguage = "en-us"
, feedLinkSelf = FeedR
, feedLinkHome = RootR
, feedUpdated = reviewCreatedDate . entityVal $ fst r
, feedEntries = map recordToRssEntry records
} | 445 | feedFromRecords records@(r:_) =
rssFeed Feed
{ feedAuthor = "Patrick Brisbin"
, feedTitle = "Renters' reality"
, feedDescription = "Recent reviews on rentersreality.com"
, feedLanguage = "en-us"
, feedLinkSelf = FeedR
, feedLinkHome = RootR
, feedUpdated = reviewCreatedDate . entityVal $ fst r
, feedEntries = map recordToRssEntry records
} | 445 | false | false | 0 | 9 | 153 | 88 | 51 | 37 | null | null |
haskell-infra/cloudflare | src/CloudFlare.hs | bsd-3-clause | purgeFile :: Account -> Zone -> Text -> IO (Either Text ())
purgeFile a z url = postCf k a "zone_file_purge" [ "z" := z, "url" := url ]
where k _ = return ()
--------------------------------------------------------------------------------
-- Internals
-- | Utility to post to Cloudflare API endpoints and pass responses to
-- continuations. Returns 'Left' if an error occurs. | 379 | purgeFile :: Account -> Zone -> Text -> IO (Either Text ())
purgeFile a z url = postCf k a "zone_file_purge" [ "z" := z, "url" := url ]
where k _ = return ()
--------------------------------------------------------------------------------
-- Internals
-- | Utility to post to Cloudflare API endpoints and pass responses to
-- continuations. Returns 'Left' if an error occurs. | 379 | purgeFile a z url = postCf k a "zone_file_purge" [ "z" := z, "url" := url ]
where k _ = return ()
--------------------------------------------------------------------------------
-- Internals
-- | Utility to post to Cloudflare API endpoints and pass responses to
-- continuations. Returns 'Left' if an error occurs. | 319 | false | true | 0 | 11 | 62 | 85 | 44 | 41 | null | null |
input-output-hk/pos-haskell-prototype | wallet/src/Cardano/Wallet/Kernel/DB/HdWallet.hs | mit | {-------------------------------------------------------------------------------
Zoom to existing parts of a HD wallet
-------------------------------------------------------------------------------}
zoomHdRootId :: forall f e a. CanZoom f
=> (UnknownHdRoot -> e)
-> HdRootId
-> f e HdRoot a -> f e HdWallets a
zoomHdRootId embedErr rootId =
zoomDef err (hdWalletsRoots . at rootId)
where
err :: f e HdWallets a
err = missing $ embedErr (UnknownHdRoot rootId) | 515 | zoomHdRootId :: forall f e a. CanZoom f
=> (UnknownHdRoot -> e)
-> HdRootId
-> f e HdRoot a -> f e HdWallets a
zoomHdRootId embedErr rootId =
zoomDef err (hdWalletsRoots . at rootId)
where
err :: f e HdWallets a
err = missing $ embedErr (UnknownHdRoot rootId) | 312 | zoomHdRootId embedErr rootId =
zoomDef err (hdWalletsRoots . at rootId)
where
err :: f e HdWallets a
err = missing $ embedErr (UnknownHdRoot rootId) | 162 | true | true | 0 | 10 | 113 | 112 | 56 | 56 | null | null |
spechub/Hets | HasCASL/AsUtils.hs | gpl-2.0 | expected :: Pretty a => a -> a -> String
expected a b =
"\n expected: " ++ showDoc a
"\n found: " ++ showDoc b "\n" | 128 | expected :: Pretty a => a -> a -> String
expected a b =
"\n expected: " ++ showDoc a
"\n found: " ++ showDoc b "\n" | 128 | expected a b =
"\n expected: " ++ showDoc a
"\n found: " ++ showDoc b "\n" | 87 | false | true | 4 | 9 | 39 | 57 | 24 | 33 | null | null |
sheyll/isobmff-builder | src/Data/ByteString/Mp4/AudioStreaming.hs | bsd-3-clause | sampleCountDuration :: DashAacInit -> Word32 -> Word64
sampleCountDuration (DashAacInit _ _ _ _ _c) r =
fromIntegral r | 120 | sampleCountDuration :: DashAacInit -> Word32 -> Word64
sampleCountDuration (DashAacInit _ _ _ _ _c) r =
fromIntegral r | 120 | sampleCountDuration (DashAacInit _ _ _ _ _c) r =
fromIntegral r | 65 | false | true | 0 | 10 | 19 | 47 | 21 | 26 | null | null |
florianpilz/autotool | src/Graph/TSP/Search.hs | gpl-2.0 | inbound :: ( Num w, Ord w, ToDoc w )
=> State w -> Tropic w
inbound s = sum $ do
(x,False) <- assocs $ has_input s
return $ minimum $ Infinite : do
(y,False) <- assocs $ has_output s
return $ dist s ! (x,y) | 256 | inbound :: ( Num w, Ord w, ToDoc w )
=> State w -> Tropic w
inbound s = sum $ do
(x,False) <- assocs $ has_input s
return $ minimum $ Infinite : do
(y,False) <- assocs $ has_output s
return $ dist s ! (x,y) | 256 | inbound s = sum $ do
(x,False) <- assocs $ has_input s
return $ minimum $ Infinite : do
(y,False) <- assocs $ has_output s
return $ dist s ! (x,y) | 187 | false | true | 0 | 13 | 96 | 124 | 61 | 63 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.