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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nevrenato/Hets_Fork | HasCASL/AsUtils.hs | gpl-2.0 | -- | create the (raw if True) kind from type arguments
typeArgsListToRawKind :: [TypeArg] -> RawKind -> RawKind
typeArgsListToRawKind tArgs = mkFunKind (getRange tArgs) $
map (\ (TypeArg _ v _ rk _ _ _) -> (v, rk)) tArgs | 224 | typeArgsListToRawKind :: [TypeArg] -> RawKind -> RawKind
typeArgsListToRawKind tArgs = mkFunKind (getRange tArgs) $
map (\ (TypeArg _ v _ rk _ _ _) -> (v, rk)) tArgs | 169 | typeArgsListToRawKind tArgs = mkFunKind (getRange tArgs) $
map (\ (TypeArg _ v _ rk _ _ _) -> (v, rk)) tArgs | 112 | true | true | 0 | 10 | 42 | 76 | 40 | 36 | null | null |
juhp/network-uri | Network/URI.hs | bsd-3-clause | opt_n_h4c_h4 :: Int -> URIParser String
opt_n_h4c_h4 n = option "" $
do { a1 <- countMinMax 0 n h4c
; a2 <- h4
; return $ concat a1 ++ a2
} | 168 | opt_n_h4c_h4 :: Int -> URIParser String
opt_n_h4c_h4 n = option "" $
do { a1 <- countMinMax 0 n h4c
; a2 <- h4
; return $ concat a1 ++ a2
} | 168 | opt_n_h4c_h4 n = option "" $
do { a1 <- countMinMax 0 n h4c
; a2 <- h4
; return $ concat a1 ++ a2
} | 128 | false | true | 0 | 10 | 60 | 67 | 32 | 35 | null | null |
coubeatczech/product-profunctors | Data/Profunctor/Product.hs | bsd-3-clause | pT12 :: ProductProfunctor p => T12 (p a1 b1) (p a2 b2) (p a3 b3) (p a4 b4)
(p a5 b5) (p a6 b6) (p a7 b7) (p a8 b8)
(p a9 b9) (p a10 b10) (p a11 b11)
(p a12 b12)
-> p (T12 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12)
(T12 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12)
pT12 = chain pT11 | 397 | pT12 :: ProductProfunctor p => T12 (p a1 b1) (p a2 b2) (p a3 b3) (p a4 b4)
(p a5 b5) (p a6 b6) (p a7 b7) (p a8 b8)
(p a9 b9) (p a10 b10) (p a11 b11)
(p a12 b12)
-> p (T12 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12)
(T12 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12)
pT12 = chain pT11 | 397 | pT12 = chain pT11 | 17 | false | true | 0 | 10 | 197 | 213 | 103 | 110 | null | null |
shapr/adventofcode2016 | src/Lib.hs | bsd-3-clause | showHash :: B.ByteString -> String
showHash = fmap (toEnum.fromEnum) . hexalise . B.unpack | 90 | showHash :: B.ByteString -> String
showHash = fmap (toEnum.fromEnum) . hexalise . B.unpack | 90 | showHash = fmap (toEnum.fromEnum) . hexalise . B.unpack | 55 | false | true | 0 | 9 | 12 | 35 | 18 | 17 | null | null |
mbakke/ganeti | src/Ganeti/Ssconf.hs | bsd-2-clause | hvparamsSSKey Types.XenPvm = SSHvparamsXenPvm | 45 | hvparamsSSKey Types.XenPvm = SSHvparamsXenPvm | 45 | hvparamsSSKey Types.XenPvm = SSHvparamsXenPvm | 45 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
fjarri/haskell-random123 | test/test_perf.hs | bsd-3-clause | test_rng_custom 32 Threefry4x64 key = testfunc (mkCustomCBRNG32 threefry4 $ key4x64 key) | 88 | test_rng_custom 32 Threefry4x64 key = testfunc (mkCustomCBRNG32 threefry4 $ key4x64 key) | 88 | test_rng_custom 32 Threefry4x64 key = testfunc (mkCustomCBRNG32 threefry4 $ key4x64 key) | 88 | false | false | 0 | 8 | 10 | 29 | 13 | 16 | null | null |
NICTA/lets-lens | src/Lets/StoreLens.hs | bsd-3-clause | -- |
--
-- >>> get (mapL 3) (Map.fromList (map (\c -> (ord c - 96, c)) ['a'..'d']))
-- Just 'c'
--
-- >>> get (mapL 33) (Map.fromList (map (\c -> (ord c - 96, c)) ['a'..'d']))
-- Nothing
--
-- >>> set (mapL 3) (Map.fromList (map (\c -> (ord c - 96, c)) ['a'..'d'])) (Just 'X')
-- fromList [(1,'a'),(2,'b'),(3,'X'),(4,'d')]
--
-- >>> set (mapL 33) (Map.fromList (map (\c -> (ord c - 96, c)) ['a'..'d'])) (Just 'X')
-- fromList [(1,'a'),(2,'b'),(3,'c'),(4,'d'),(33,'X')]
--
-- >>> set (mapL 3) (Map.fromList (map (\c -> (ord c - 96, c)) ['a'..'d'])) Nothing
-- fromList [(1,'a'),(2,'b'),(4,'d')]
--
-- >>> set (mapL 33) (Map.fromList (map (\c -> (ord c - 96, c)) ['a'..'d'])) Nothing
-- fromList [(1,'a'),(2,'b'),(3,'c'),(4,'d')]
mapL ::
Ord k =>
k
-> Lens (Map k v) (Maybe v)
mapL =
error "todo: mapL" | 808 | mapL ::
Ord k =>
k
-> Lens (Map k v) (Maybe v)
mapL =
error "todo: mapL" | 80 | mapL =
error "todo: mapL" | 27 | true | true | 0 | 10 | 146 | 65 | 40 | 25 | null | null |
Cahu/krpc-hs | src/KRPCHS/SpaceCenter.hs | gpl-3.0 | referenceFrameCreateHybrid :: KRPCHS.SpaceCenter.ReferenceFrame -> KRPCHS.SpaceCenter.ReferenceFrame -> KRPCHS.SpaceCenter.ReferenceFrame -> KRPCHS.SpaceCenter.ReferenceFrame -> RPCContext (KRPCHS.SpaceCenter.ReferenceFrame)
referenceFrameCreateHybrid positionArg rotationArg velocityArg angularVelocityArg = do
let r = makeRequest "SpaceCenter" "ReferenceFrame_CreateHybrid" [makeArgument 0 positionArg, makeArgument 1 rotationArg, makeArgument 2 velocityArg, makeArgument 3 angularVelocityArg]
res <- sendRequest r
processResponse res | 548 | referenceFrameCreateHybrid :: KRPCHS.SpaceCenter.ReferenceFrame -> KRPCHS.SpaceCenter.ReferenceFrame -> KRPCHS.SpaceCenter.ReferenceFrame -> KRPCHS.SpaceCenter.ReferenceFrame -> RPCContext (KRPCHS.SpaceCenter.ReferenceFrame)
referenceFrameCreateHybrid positionArg rotationArg velocityArg angularVelocityArg = do
let r = makeRequest "SpaceCenter" "ReferenceFrame_CreateHybrid" [makeArgument 0 positionArg, makeArgument 1 rotationArg, makeArgument 2 velocityArg, makeArgument 3 angularVelocityArg]
res <- sendRequest r
processResponse res | 548 | referenceFrameCreateHybrid positionArg rotationArg velocityArg angularVelocityArg = do
let r = makeRequest "SpaceCenter" "ReferenceFrame_CreateHybrid" [makeArgument 0 positionArg, makeArgument 1 rotationArg, makeArgument 2 velocityArg, makeArgument 3 angularVelocityArg]
res <- sendRequest r
processResponse res | 323 | false | true | 0 | 13 | 54 | 126 | 61 | 65 | null | null |
qpliu/esolang | 01_/hs/interp/ParseBodies.hs | gpl-3.0 | parseLiteral arities bindings (One:tokens) literal =
parseLiteral arities bindings tokens (True:literal) | 108 | parseLiteral arities bindings (One:tokens) literal =
parseLiteral arities bindings tokens (True:literal) | 108 | parseLiteral arities bindings (One:tokens) literal =
parseLiteral arities bindings tokens (True:literal) | 108 | false | false | 0 | 7 | 14 | 38 | 19 | 19 | null | null |
brendanhay/gogol | gogol-remotebuildexecution/gen/Network/Google/RemoteBuildExecution/Types/Product.hs | mpl-2.0 | bbrevpcPriorities :: Lens' BuildBazelRemoteExecutionV2PriorityCapabilities [BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange]
bbrevpcPriorities
= lens _bbrevpcPriorities
(\ s a -> s{_bbrevpcPriorities = a})
. _Default
. _Coerce | 259 | bbrevpcPriorities :: Lens' BuildBazelRemoteExecutionV2PriorityCapabilities [BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange]
bbrevpcPriorities
= lens _bbrevpcPriorities
(\ s a -> s{_bbrevpcPriorities = a})
. _Default
. _Coerce | 259 | bbrevpcPriorities
= lens _bbrevpcPriorities
(\ s a -> s{_bbrevpcPriorities = a})
. _Default
. _Coerce | 121 | false | true | 0 | 11 | 39 | 52 | 27 | 25 | null | null |
hvr/hoopl | src/Compiler/Hoopl/Block.hs | bsd-3-clause | -- Modifying
replaceFirstNode :: Block n C x -> n C O -> Block n C x
replaceFirstNode (BlockCO _ b) f = BlockCO f b | 118 | replaceFirstNode :: Block n C x -> n C O -> Block n C x
replaceFirstNode (BlockCO _ b) f = BlockCO f b | 104 | replaceFirstNode (BlockCO _ b) f = BlockCO f b | 48 | true | true | 0 | 7 | 28 | 57 | 27 | 30 | null | null |
JPMoresmau/ghcid | src/Language/Haskell/Ghcid/Terminal.hs | bsd-3-clause | wM_SETICON = 0x0080 :: WindowMessage | 36 | wM_SETICON = 0x0080 :: WindowMessage | 36 | wM_SETICON = 0x0080 :: WindowMessage | 36 | false | false | 0 | 4 | 4 | 9 | 5 | 4 | null | null |
adbrowne/dynamodb-eventstore | dynamodb-eventstore/src/DynamoDbEventStore/Storage/GlobalStreamItem.hs | mit | globalFeedItemsProducerInternal next waitForNewPages Nothing = globalFeedItemsProducerInternal next waitForNewPages (Just firstPageKey) | 135 | globalFeedItemsProducerInternal next waitForNewPages Nothing = globalFeedItemsProducerInternal next waitForNewPages (Just firstPageKey) | 135 | globalFeedItemsProducerInternal next waitForNewPages Nothing = globalFeedItemsProducerInternal next waitForNewPages (Just firstPageKey) | 135 | false | false | 0 | 7 | 9 | 26 | 12 | 14 | null | null |
zsedem/my-linux-config | scripts/update_configs.hs | mit | -- utils
toString :: Text -> String
toString = unpack | 53 | toString :: Text -> String
toString = unpack | 44 | toString = unpack | 17 | true | true | 0 | 5 | 9 | 16 | 9 | 7 | null | null |
jespino/sth | STHLib.hs | bsd-3-clause | variance::[Float] -> Float
variance list = (1 / count list) * (Prelude.sum $ map (\x -> (x - (meanList))^2) list)
where meanList = mean list | 156 | variance::[Float] -> Float
variance list = (1 / count list) * (Prelude.sum $ map (\x -> (x - (meanList))^2) list)
where meanList = mean list | 156 | variance list = (1 / count list) * (Prelude.sum $ map (\x -> (x - (meanList))^2) list)
where meanList = mean list | 129 | false | true | 2 | 13 | 40 | 92 | 44 | 48 | null | null |
bitemyapp/haskell-jwt | tests/src/Web/JWTTests.hs | mit | case_decodeJWT = do
-- Generated with ruby-jwt
let input = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzb21lIjoicGF5bG9hZCJ9.Joh1R2dYzkRvDkqv3sygm5YyK8Gi4ShZqbhK2gxcs2U"
mJwt = decode input
True @=? isJust mJwt
True @=? isJust (fmap signature mJwt)
let (Just unverified) = mJwt
Just HS256 @=? alg (header unverified)
Just "payload" @=? Map.lookup "some" (unregisteredClaims $ claims unverified) | 427 | case_decodeJWT = do
-- Generated with ruby-jwt
let input = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzb21lIjoicGF5bG9hZCJ9.Joh1R2dYzkRvDkqv3sygm5YyK8Gi4ShZqbhK2gxcs2U"
mJwt = decode input
True @=? isJust mJwt
True @=? isJust (fmap signature mJwt)
let (Just unverified) = mJwt
Just HS256 @=? alg (header unverified)
Just "payload" @=? Map.lookup "some" (unregisteredClaims $ claims unverified) | 427 | case_decodeJWT = do
-- Generated with ruby-jwt
let input = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzb21lIjoicGF5bG9hZCJ9.Joh1R2dYzkRvDkqv3sygm5YyK8Gi4ShZqbhK2gxcs2U"
mJwt = decode input
True @=? isJust mJwt
True @=? isJust (fmap signature mJwt)
let (Just unverified) = mJwt
Just HS256 @=? alg (header unverified)
Just "payload" @=? Map.lookup "some" (unregisteredClaims $ claims unverified) | 427 | false | false | 1 | 12 | 80 | 118 | 51 | 67 | null | null |
fmapfmapfmap/amazonka | amazonka-ds/gen/Network/AWS/DirectoryService/GetSnapshotLimits.hs | mpl-2.0 | -- | The response status code.
gslrsResponseStatus :: Lens' GetSnapshotLimitsResponse Int
gslrsResponseStatus = lens _gslrsResponseStatus (\ s a -> s{_gslrsResponseStatus = a}) | 176 | gslrsResponseStatus :: Lens' GetSnapshotLimitsResponse Int
gslrsResponseStatus = lens _gslrsResponseStatus (\ s a -> s{_gslrsResponseStatus = a}) | 145 | gslrsResponseStatus = lens _gslrsResponseStatus (\ s a -> s{_gslrsResponseStatus = a}) | 86 | true | true | 1 | 9 | 21 | 45 | 22 | 23 | null | null |
Blaisorblade/stack | src/Stack/Config.hs | bsd-3-clause | -- | Determine the extra config file locations which exist.
--
-- Returns most local first
getExtraConfigs :: (MonadIO m, MonadLogger m)
=> Path Abs File -- ^ use config path
-> m [Path Abs File]
getExtraConfigs userConfigPath = do
defaultStackGlobalConfigPath <- getDefaultGlobalConfigPath
liftIO $ do
env <- getEnvironment
mstackConfig <-
maybe (return Nothing) (fmap Just . parseAbsFile)
$ lookup "STACK_CONFIG" env
mstackGlobalConfig <-
maybe (return Nothing) (fmap Just . parseAbsFile)
$ lookup "STACK_GLOBAL_CONFIG" env
filterM doesFileExist
$ fromMaybe userConfigPath mstackConfig
: maybe [] return (mstackGlobalConfig <|> defaultStackGlobalConfigPath)
-- | Load and parse YAML from the given conig file. Throws
-- 'ParseConfigFileException' when there's a decoding error. | 876 | getExtraConfigs :: (MonadIO m, MonadLogger m)
=> Path Abs File -- ^ use config path
-> m [Path Abs File]
getExtraConfigs userConfigPath = do
defaultStackGlobalConfigPath <- getDefaultGlobalConfigPath
liftIO $ do
env <- getEnvironment
mstackConfig <-
maybe (return Nothing) (fmap Just . parseAbsFile)
$ lookup "STACK_CONFIG" env
mstackGlobalConfig <-
maybe (return Nothing) (fmap Just . parseAbsFile)
$ lookup "STACK_GLOBAL_CONFIG" env
filterM doesFileExist
$ fromMaybe userConfigPath mstackConfig
: maybe [] return (mstackGlobalConfig <|> defaultStackGlobalConfigPath)
-- | Load and parse YAML from the given conig file. Throws
-- 'ParseConfigFileException' when there's a decoding error. | 785 | getExtraConfigs userConfigPath = do
defaultStackGlobalConfigPath <- getDefaultGlobalConfigPath
liftIO $ do
env <- getEnvironment
mstackConfig <-
maybe (return Nothing) (fmap Just . parseAbsFile)
$ lookup "STACK_CONFIG" env
mstackGlobalConfig <-
maybe (return Nothing) (fmap Just . parseAbsFile)
$ lookup "STACK_GLOBAL_CONFIG" env
filterM doesFileExist
$ fromMaybe userConfigPath mstackConfig
: maybe [] return (mstackGlobalConfig <|> defaultStackGlobalConfigPath)
-- | Load and parse YAML from the given conig file. Throws
-- 'ParseConfigFileException' when there's a decoding error. | 648 | true | true | 0 | 15 | 203 | 185 | 89 | 96 | null | null |
lancelotsix/hs-tls | core/Network/TLS/Struct.hs | bsd-3-clause | typeOfHandshake (Certificates {}) = HandshakeType_Certificate | 72 | typeOfHandshake (Certificates {}) = HandshakeType_Certificate | 72 | typeOfHandshake (Certificates {}) = HandshakeType_Certificate | 72 | false | false | 0 | 6 | 15 | 17 | 8 | 9 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/pred_7.hs | mit | toEnumOrdering vx = toEnum1 vx | 30 | toEnumOrdering vx = toEnum1 vx | 30 | toEnumOrdering vx = toEnum1 vx | 30 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Vector.Primitive.hs | bsd-3-clause | replicateM = G.replicateM | 25 | replicateM = G.replicateM | 25 | replicateM = G.replicateM | 25 | false | false | 1 | 6 | 2 | 12 | 4 | 8 | null | null |
kyagrd/mininax | src/Infer.hs | bsd-2-clause | extendSubst (x,Var y) | x < y = extendSubst (y,Var x)
| x== y = return () | 95 | extendSubst (x,Var y) | x < y = extendSubst (y,Var x)
| x== y = return () | 95 | extendSubst (x,Var y) | x < y = extendSubst (y,Var x)
| x== y = return () | 95 | false | false | 0 | 8 | 38 | 58 | 27 | 31 | null | null |
craffit/flexdb | src/DB/Flex/Query/Typed.hs | bsd-3-clause | postOp :: String -> Expr i' l t -> Expr i' l t'
postOp op = Exp . fmap (B.postOp op) . bExp | 91 | postOp :: String -> Expr i' l t -> Expr i' l t'
postOp op = Exp . fmap (B.postOp op) . bExp | 91 | postOp op = Exp . fmap (B.postOp op) . bExp | 43 | false | true | 0 | 10 | 22 | 60 | 27 | 33 | null | null |
kryoxide/delta | src/main/delta/System/Delta/Poll.hs | lgpl-3.0 | recursiveDescent path =
M.filterWithKey (\_ -> not . fileInfoIsDir) <$> -- files only
recursiveDescent' M.empty path | 122 | recursiveDescent path =
M.filterWithKey (\_ -> not . fileInfoIsDir) <$> -- files only
recursiveDescent' M.empty path | 122 | recursiveDescent path =
M.filterWithKey (\_ -> not . fileInfoIsDir) <$> -- files only
recursiveDescent' M.empty path | 122 | false | false | 0 | 9 | 21 | 38 | 19 | 19 | null | null |
glutamate/space | GeneralizedSignals.hs | bsd-3-clause | at :: Signal a b -> a -> b
at (Signal delta lims _ arr) x = arr `SV.index` (discreteIndex lims delta x) | 104 | at :: Signal a b -> a -> b
at (Signal delta lims _ arr) x = arr `SV.index` (discreteIndex lims delta x) | 104 | at (Signal delta lims _ arr) x = arr `SV.index` (discreteIndex lims delta x) | 77 | false | true | 0 | 10 | 23 | 68 | 32 | 36 | null | null |
uduki/hsQt | Qtc/Core/QMimeData.hs | bsd-2-clause | setColorData :: QMimeData a -> ((QVariant t1)) -> IO ()
setColorData x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withObjectPtr x1 $ \cobj_x1 ->
qtc_QMimeData_setColorData cobj_x0 cobj_x1 | 193 | setColorData :: QMimeData a -> ((QVariant t1)) -> IO ()
setColorData x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withObjectPtr x1 $ \cobj_x1 ->
qtc_QMimeData_setColorData cobj_x0 cobj_x1 | 193 | setColorData x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withObjectPtr x1 $ \cobj_x1 ->
qtc_QMimeData_setColorData cobj_x0 cobj_x1 | 137 | false | true | 0 | 9 | 36 | 73 | 36 | 37 | null | null |
toonn/wyah | src/CalcEval.hs | bsd-2-clause | isNum _ = False | 22 | isNum _ = False | 22 | isNum _ = False | 22 | false | false | 0 | 4 | 10 | 10 | 4 | 6 | null | null |
mankyKitty/leesp | src/Main.hs | mit | eqv [DottedList xs x, DottedList ys y] = eqv [List $ xs ++ [x], List $ ys ++ [y]] | 81 | eqv [DottedList xs x, DottedList ys y] = eqv [List $ xs ++ [x], List $ ys ++ [y]] | 81 | eqv [DottedList xs x, DottedList ys y] = eqv [List $ xs ++ [x], List $ ys ++ [y]] | 81 | false | false | 0 | 8 | 18 | 57 | 29 | 28 | null | null |
andrewMacmurray/haskell-book-solutions | src/ch12/anamorphs.hs | mit | betterIterate :: (a -> a) -> a -> [a]
betterIterate f x = myUnfoldr (\b -> Just (b, f b)) x | 91 | betterIterate :: (a -> a) -> a -> [a]
betterIterate f x = myUnfoldr (\b -> Just (b, f b)) x | 91 | betterIterate f x = myUnfoldr (\b -> Just (b, f b)) x | 53 | false | true | 0 | 10 | 20 | 59 | 31 | 28 | null | null |
gridaphobe/ghc | compiler/basicTypes/MkId.hs | bsd-3-clause | -- Same as `wrapFamInstBody`, but for type family instances, which are
-- represented by a `CoAxiom`, and not a `TyCon`
wrapTypeFamInstBody :: CoAxiom br -> Int -> [Type] -> [Coercion]
-> CoreExpr -> CoreExpr
wrapTypeFamInstBody axiom ind args cos body
= mkCast body (mkSymCo (mkAxInstCo Representational axiom ind args cos)) | 347 | wrapTypeFamInstBody :: CoAxiom br -> Int -> [Type] -> [Coercion]
-> CoreExpr -> CoreExpr
wrapTypeFamInstBody axiom ind args cos body
= mkCast body (mkSymCo (mkAxInstCo Representational axiom ind args cos)) | 227 | wrapTypeFamInstBody axiom ind args cos body
= mkCast body (mkSymCo (mkAxInstCo Representational axiom ind args cos)) | 118 | true | true | 0 | 9 | 71 | 78 | 40 | 38 | null | null |
pepeiborra/yices-0.0.0.12 | Math/SMT/Yices/Parser.hs | bsd-3-clause | expY :: GenParser Char st ExpY
expY = try litb <|> try litr <|> liti <|> vare <|> paren expYinParen | 99 | expY :: GenParser Char st ExpY
expY = try litb <|> try litr <|> liti <|> vare <|> paren expYinParen | 99 | expY = try litb <|> try litr <|> liti <|> vare <|> paren expYinParen | 68 | false | true | 4 | 7 | 19 | 50 | 22 | 28 | null | null |
rad1al/hutton_exercises | notes_ch07.hs | gpl-2.0 | product'' :: Num a => [a] -> a
product'' = foldr (*) 1 | 54 | product'' :: Num a => [a] -> a
product'' = foldr (*) 1 | 54 | product'' = foldr (*) 1 | 23 | false | true | 0 | 8 | 12 | 39 | 18 | 21 | null | null |
droundy/franchise | Distribution/Franchise/VersionControl.hs | bsd-3-clause | patchLevel :: ReleaseType -> C Int
patchLevel t = withRootdir $ inVC $
VC (writeit darcsPatchLevel) (writeit gitPatchLevel) readL (-1)
where writeit rel = do x <- rel t
distclean [releaseFile t++"PatchLevel"]
writeF (releaseFile t++"PatchLevel") (show x)
return x
readL = do [(i,"")] <- reads `fmap`
cat (releaseFile t++"PatchLevel")
return i | 513 | patchLevel :: ReleaseType -> C Int
patchLevel t = withRootdir $ inVC $
VC (writeit darcsPatchLevel) (writeit gitPatchLevel) readL (-1)
where writeit rel = do x <- rel t
distclean [releaseFile t++"PatchLevel"]
writeF (releaseFile t++"PatchLevel") (show x)
return x
readL = do [(i,"")] <- reads `fmap`
cat (releaseFile t++"PatchLevel")
return i | 513 | patchLevel t = withRootdir $ inVC $
VC (writeit darcsPatchLevel) (writeit gitPatchLevel) readL (-1)
where writeit rel = do x <- rel t
distclean [releaseFile t++"PatchLevel"]
writeF (releaseFile t++"PatchLevel") (show x)
return x
readL = do [(i,"")] <- reads `fmap`
cat (releaseFile t++"PatchLevel")
return i | 478 | false | true | 1 | 13 | 221 | 177 | 81 | 96 | null | null |
abbradar/smtp | src/Network/SMTP/Address.hs | bsd-3-clause | -- | Matches atom according to RFC 5321.
atom :: Parser Text
atom = takeWhile1 isAtomText | 89 | atom :: Parser Text
atom = takeWhile1 isAtomText | 48 | atom = takeWhile1 isAtomText | 28 | true | true | 0 | 5 | 15 | 18 | 9 | 9 | null | null |
bennofs/reflex | src/Reflex/Spider/Internal.hs | bsd-3-clause | pull :: BehaviorM a -> Behavior a
pull a = BehaviorPull $ Pull
{ pullCompute = a
, pullValue = unsafeNewIORef a Nothing
} | 127 | pull :: BehaviorM a -> Behavior a
pull a = BehaviorPull $ Pull
{ pullCompute = a
, pullValue = unsafeNewIORef a Nothing
} | 127 | pull a = BehaviorPull $ Pull
{ pullCompute = a
, pullValue = unsafeNewIORef a Nothing
} | 93 | false | true | 2 | 8 | 29 | 56 | 26 | 30 | null | null |
siddhanathan/yi | yi-core/src/Yi/Buffer/Normal.hs | gpl-2.0 | putRegionStyle :: RegionStyle -> BufferM ()
putRegionStyle = putBufferDyn | 73 | putRegionStyle :: RegionStyle -> BufferM ()
putRegionStyle = putBufferDyn | 73 | putRegionStyle = putBufferDyn | 29 | false | true | 0 | 7 | 8 | 20 | 10 | 10 | null | null |
sebastiaanvisser/haha | src/Graphics/Ascii/Haha/Geometry.hs | bsd-3-clause | outlinePoint :: Point u -> Poly u
outlinePoint p = Poly [p, p] | 62 | outlinePoint :: Point u -> Poly u
outlinePoint p = Poly [p, p] | 62 | outlinePoint p = Poly [p, p] | 28 | false | true | 0 | 6 | 12 | 33 | 16 | 17 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTRING :: Int
wxSTRING = 1 | 28 | wxSTRING :: Int
wxSTRING = 1 | 28 | wxSTRING = 1 | 12 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
ganeti-github-testing/ganeti-test-1 | src/Ganeti/HTools/Node.hs | bsd-2-clause | computePDsk :: Int -> Double -> Double
computePDsk _ 0 = 1 | 65 | computePDsk :: Int -> Double -> Double
computePDsk _ 0 = 1 | 65 | computePDsk _ 0 = 1 | 26 | false | true | 0 | 6 | 18 | 24 | 12 | 12 | null | null |
begriffs/postgrest | src/PostgREST/QueryBuilder.hs | mit | unquoted (JSON.Number n) =
toS $ formatScientific Fixed (if isInteger n then Just 0 else Nothing) n | 101 | unquoted (JSON.Number n) =
toS $ formatScientific Fixed (if isInteger n then Just 0 else Nothing) n | 101 | unquoted (JSON.Number n) =
toS $ formatScientific Fixed (if isInteger n then Just 0 else Nothing) n | 101 | false | false | 0 | 9 | 18 | 45 | 22 | 23 | null | null |
beni55/hermit | src/HERMIT/PrettyPrinter/Clean.hs | bsd-2-clause | normalExpr (RetForAll vs ty) = specialSymbol ForallSymbol <+> hsep vs <+> symbol '.' <+> ty | 91 | normalExpr (RetForAll vs ty) = specialSymbol ForallSymbol <+> hsep vs <+> symbol '.' <+> ty | 91 | normalExpr (RetForAll vs ty) = specialSymbol ForallSymbol <+> hsep vs <+> symbol '.' <+> ty | 91 | false | false | 0 | 8 | 14 | 39 | 17 | 22 | null | null |
keithodulaigh/Hets | OWL2/AS.hs | gpl-2.0 | floatToInt :: FloatLit -> IntLit
floatToInt = truncDec . floatBase | 66 | floatToInt :: FloatLit -> IntLit
floatToInt = truncDec . floatBase | 66 | floatToInt = truncDec . floatBase | 33 | false | true | 1 | 7 | 9 | 27 | 11 | 16 | null | null |
brendanhay/gogol | gogol-dlp/gen/Network/Google/DLP/Types/Product.hs | mpl-2.0 | -- | Lower bound on the size of the equivalence classes in this bucket.
gpdvkahbEquivalenceClassSizeLowerBound :: Lens' GooglePrivacyDlpV2KAnonymityHistogramBucket (Maybe Int64)
gpdvkahbEquivalenceClassSizeLowerBound
= lens _gpdvkahbEquivalenceClassSizeLowerBound
(\ s a ->
s{_gpdvkahbEquivalenceClassSizeLowerBound = a})
. mapping _Coerce | 362 | gpdvkahbEquivalenceClassSizeLowerBound :: Lens' GooglePrivacyDlpV2KAnonymityHistogramBucket (Maybe Int64)
gpdvkahbEquivalenceClassSizeLowerBound
= lens _gpdvkahbEquivalenceClassSizeLowerBound
(\ s a ->
s{_gpdvkahbEquivalenceClassSizeLowerBound = a})
. mapping _Coerce | 290 | gpdvkahbEquivalenceClassSizeLowerBound
= lens _gpdvkahbEquivalenceClassSizeLowerBound
(\ s a ->
s{_gpdvkahbEquivalenceClassSizeLowerBound = a})
. mapping _Coerce | 184 | true | true | 0 | 10 | 56 | 55 | 28 | 27 | null | null |
k-bx/riak-haskell-client | src/Network/Riak/Cluster.hs | apache-2.0 | rotateL :: Int -> [a] -> [a]
rotateL i xs = right ++ left
where
(left, right) = splitAt i xs | 98 | rotateL :: Int -> [a] -> [a]
rotateL i xs = right ++ left
where
(left, right) = splitAt i xs | 98 | rotateL i xs = right ++ left
where
(left, right) = splitAt i xs | 69 | false | true | 0 | 7 | 26 | 53 | 28 | 25 | null | null |
roelvandijk/aeson | Data/Aeson/TH.hs | bsd-3-clause | array :: ExpQ -> ExpQ
array exp = [|Encoding|] `appE` ([|E.char7 '['|] <^> exp <^> [|E.char7 ']'|]) | 99 | array :: ExpQ -> ExpQ
array exp = [|Encoding|] `appE` ([|E.char7 '['|] <^> exp <^> [|E.char7 ']'|]) | 99 | array exp = [|Encoding|] `appE` ([|E.char7 '['|] <^> exp <^> [|E.char7 ']'|]) | 77 | false | true | 0 | 9 | 16 | 48 | 29 | 19 | null | null |
ownclo/jpeg-on-steroids | src/Graphics/JPG/Decoder.hs | bsd-3-clause | compMCU :: CompMCUSpec -> State BS DataUnit
compMCU (CompMCUSpec numDUs duSpec) =
concatDUs <$> matrixM numDUs (dataUnit duSpec) | 132 | compMCU :: CompMCUSpec -> State BS DataUnit
compMCU (CompMCUSpec numDUs duSpec) =
concatDUs <$> matrixM numDUs (dataUnit duSpec) | 132 | compMCU (CompMCUSpec numDUs duSpec) =
concatDUs <$> matrixM numDUs (dataUnit duSpec) | 88 | false | true | 0 | 8 | 21 | 46 | 22 | 24 | null | null |
winterland1989/mysql-haskell | Database/MySQL/Protocol/Packet.hs | bsd-3-clause | getInt24be :: Get Int24
getInt24be = do
a <- fromIntegral <$> getWord16be
b <- fromIntegral <$> getWord8
return $! fromIntegral $ (b .|. (a `shiftL` 8) :: Word24)
| 175 | getInt24be :: Get Int24
getInt24be = do
a <- fromIntegral <$> getWord16be
b <- fromIntegral <$> getWord8
return $! fromIntegral $ (b .|. (a `shiftL` 8) :: Word24)
| 175 | getInt24be = do
a <- fromIntegral <$> getWord16be
b <- fromIntegral <$> getWord8
return $! fromIntegral $ (b .|. (a `shiftL` 8) :: Word24)
| 151 | false | true | 0 | 11 | 40 | 66 | 34 | 32 | null | null |
fredokun/piexplorer | src/Causality.hs | gpl-3.0 | causalFreshOut :: CausalOrder -> Name -> CausalOrder
causalFreshOut (CausalOrder cs) o@(FreshOut _) = CausalOrder $ Map.insert o Set.empty cs | 141 | causalFreshOut :: CausalOrder -> Name -> CausalOrder
causalFreshOut (CausalOrder cs) o@(FreshOut _) = CausalOrder $ Map.insert o Set.empty cs | 141 | causalFreshOut (CausalOrder cs) o@(FreshOut _) = CausalOrder $ Map.insert o Set.empty cs | 88 | false | true | 0 | 8 | 18 | 54 | 27 | 27 | null | null |
keera-studios/hsQt | Qtc/Core/QTimer.hs | bsd-2-clause | qTimer_deleteLater :: QTimer a -> IO ()
qTimer_deleteLater x0
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QTimer_deleteLater cobj_x0 | 131 | qTimer_deleteLater :: QTimer a -> IO ()
qTimer_deleteLater x0
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QTimer_deleteLater cobj_x0 | 131 | qTimer_deleteLater x0
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QTimer_deleteLater cobj_x0 | 91 | false | true | 2 | 8 | 22 | 47 | 20 | 27 | null | null |
termite2/code-widget | CodeWidget/CodeWidgetAPI.hs | bsd-3-clause | codeRegionGetText :: RCodeView -> Region -> IO String
codeRegionGetText ref r = do
cv <- readIORef ref
case getContexts cv r of
Nothing -> error ("regionGetText: region not found: " ++ (show r))
Just (pg,rc) -> cvSubRgnText pg rc | 267 | codeRegionGetText :: RCodeView -> Region -> IO String
codeRegionGetText ref r = do
cv <- readIORef ref
case getContexts cv r of
Nothing -> error ("regionGetText: region not found: " ++ (show r))
Just (pg,rc) -> cvSubRgnText pg rc | 267 | codeRegionGetText ref r = do
cv <- readIORef ref
case getContexts cv r of
Nothing -> error ("regionGetText: region not found: " ++ (show r))
Just (pg,rc) -> cvSubRgnText pg rc | 213 | false | true | 0 | 14 | 76 | 91 | 43 | 48 | null | null |
jystic/hsimport | tests/inputFiles/ModuleTest28.hs | bsd-3-clause | f :: Int -> Int
f = (+ 3) | 25 | f :: Int -> Int
f = (+ 3) | 25 | f = (+ 3) | 9 | false | true | 0 | 7 | 8 | 26 | 12 | 14 | null | null |
keera-studios/hsQt | Qtc/Enums/Gui/QCompleter.hs | bsd-2-clause | ePopupCompletion :: CompletionMode
ePopupCompletion
= ieCompletionMode $ 0 | 76 | ePopupCompletion :: CompletionMode
ePopupCompletion
= ieCompletionMode $ 0 | 76 | ePopupCompletion
= ieCompletionMode $ 0 | 41 | false | true | 0 | 6 | 9 | 18 | 8 | 10 | null | null |
mfpi/OpenGL | Graphics/Rendering/OpenGL/GL/BufferObjects.hs | bsd-3-clause | noBufferObject :: BufferObject
noBufferObject = BufferObject 0 | 62 | noBufferObject :: BufferObject
noBufferObject = BufferObject 0 | 62 | noBufferObject = BufferObject 0 | 31 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
spinda/liquidhaskell | src/Language/Haskell/Liquid/Spec/Resolve.hs | bsd-3-clause | getLocation :: ResolveM SrcSpan
getLocation = gets rs_location | 62 | getLocation :: ResolveM SrcSpan
getLocation = gets rs_location | 62 | getLocation = gets rs_location | 30 | false | true | 0 | 6 | 7 | 23 | 9 | 14 | null | null |
unisonweb/platform | parser-typechecker/src/Unison/Runtime/IOSource.hs | mit | doc2ItalicId = constructorNamed doc2Ref "Doc2.Italic" | 53 | doc2ItalicId = constructorNamed doc2Ref "Doc2.Italic" | 53 | doc2ItalicId = constructorNamed doc2Ref "Doc2.Italic" | 53 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
ony/Yampa-core | tests/AFRPTestsComp.hs | bsd-3-clause | comp_t4r :: [Double]
comp_t4r =
[0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,
9.0,9.5,10.0,10.5,11.0,11.5,12.0] | 148 | comp_t4r :: [Double]
comp_t4r =
[0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,
9.0,9.5,10.0,10.5,11.0,11.5,12.0] | 148 | comp_t4r =
[0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,
9.0,9.5,10.0,10.5,11.0,11.5,12.0] | 127 | false | true | 0 | 7 | 15 | 96 | 59 | 37 | null | null |
rueshyna/gogol | gogol-sheets/gen/Network/Google/Resource/Sheets/Spreadsheets/Values/BatchGet.hs | mpl-2.0 | -- | The major dimension that results should use. For example, if the
-- spreadsheet data is: \`A1=1,B1=2,A2=3,B2=4\`, then requesting
-- \`range=A1:B2,majorDimension=ROWS\` will return \`[[1,2],[3,4]]\`,
-- whereas requesting \`range=A1:B2,majorDimension=COLUMNS\` will return
-- \`[[1,3],[2,4]]\`.
svbgMajorDimension :: Lens' SpreadsheetsValuesBatchGet (Maybe Text)
svbgMajorDimension
= lens _svbgMajorDimension
(\ s a -> s{_svbgMajorDimension = a}) | 459 | svbgMajorDimension :: Lens' SpreadsheetsValuesBatchGet (Maybe Text)
svbgMajorDimension
= lens _svbgMajorDimension
(\ s a -> s{_svbgMajorDimension = a}) | 159 | svbgMajorDimension
= lens _svbgMajorDimension
(\ s a -> s{_svbgMajorDimension = a}) | 91 | true | true | 0 | 9 | 57 | 52 | 29 | 23 | null | null |
markborkum/json2rdf-hs | src/JSON2RDF/Types.hs | unlicense | setBlankRDFLabelsCount :: Int -> Context -> Context
setBlankRDFLabelsCount x ctx =
ctx { getBlankRDFLabelsCount = x } | 119 | setBlankRDFLabelsCount :: Int -> Context -> Context
setBlankRDFLabelsCount x ctx =
ctx { getBlankRDFLabelsCount = x } | 119 | setBlankRDFLabelsCount x ctx =
ctx { getBlankRDFLabelsCount = x } | 67 | false | true | 0 | 7 | 18 | 36 | 18 | 18 | null | null |
Gurmeet-Singh/Zeno | src/Zeno/Utils.hs | mit | xor False False = False | 23 | xor False False = False | 23 | xor False False = False | 23 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
massysett/penny | penny/lib/Penny/Copper/Decopperize.hs | bsd-3-clause | dDateTimeZone :: DateTimeZone t a -> Time.ZonedTime
dDateTimeZone (DateTimeZone dt tmzOpt) = Time.ZonedTime lt tz
where
(tod, tz) = dTimeAndMayZone'Opt tmzOpt
lt = Time.LocalTime day tod
where
day = dDate dt
-- # Comments | 246 | dDateTimeZone :: DateTimeZone t a -> Time.ZonedTime
dDateTimeZone (DateTimeZone dt tmzOpt) = Time.ZonedTime lt tz
where
(tod, tz) = dTimeAndMayZone'Opt tmzOpt
lt = Time.LocalTime day tod
where
day = dDate dt
-- # Comments | 246 | dDateTimeZone (DateTimeZone dt tmzOpt) = Time.ZonedTime lt tz
where
(tod, tz) = dTimeAndMayZone'Opt tmzOpt
lt = Time.LocalTime day tod
where
day = dDate dt
-- # Comments | 194 | false | true | 1 | 7 | 58 | 80 | 40 | 40 | null | null |
anton-k/language-css | src/Language/Css/Build/Idents.hs | bsd-3-clause | -- | x-large
xLarge :: Idents a => a
xLarge = ident "x-large" | 61 | xLarge :: Idents a => a
xLarge = ident "x-large" | 48 | xLarge = ident "x-large" | 24 | true | true | 0 | 7 | 12 | 28 | 12 | 16 | null | null |
atsukotakahashi/wi | src/library/Yi/Syntax/Haskell.hs | gpl-2.0 | pCBrace p c = Paren <$> pCAtom [Special '{'] c
<*> p <*> (recoverAtom <|> pCAtom [Special '}'] c) | 108 | pCBrace p c = Paren <$> pCAtom [Special '{'] c
<*> p <*> (recoverAtom <|> pCAtom [Special '}'] c) | 108 | pCBrace p c = Paren <$> pCAtom [Special '{'] c
<*> p <*> (recoverAtom <|> pCAtom [Special '}'] c) | 108 | false | false | 0 | 10 | 29 | 52 | 25 | 27 | null | null |
HIPERFIT/futhark | src/Language/Futhark/TypeChecker/Terms/Monad.hs | isc | checkIfConsumable :: SrcLoc -> Aliasing -> TermTypeM ()
checkIfConsumable loc als = do
vtable <- asks $ scopeVtable . termScope
let consumable v = case M.lookup v vtable of
Just (BoundV Local _ t)
| arrayRank t > 0 -> unique t
| Scalar TypeVar {} <- t -> unique t
| Scalar Arrow {} <- t -> False
| otherwise -> True
Just (BoundV Global _ _) -> False
_ -> True
-- The sort ensures that AliasBound vars are shown before AliasFree.
case map aliasVar $ sort $ filter (not . consumable . aliasVar) $ S.toList als of
v : _ -> notConsumable loc =<< describeVar loc v
[] -> pure ()
-- | Proclaim that we have written to the given variable. | 712 | checkIfConsumable :: SrcLoc -> Aliasing -> TermTypeM ()
checkIfConsumable loc als = do
vtable <- asks $ scopeVtable . termScope
let consumable v = case M.lookup v vtable of
Just (BoundV Local _ t)
| arrayRank t > 0 -> unique t
| Scalar TypeVar {} <- t -> unique t
| Scalar Arrow {} <- t -> False
| otherwise -> True
Just (BoundV Global _ _) -> False
_ -> True
-- The sort ensures that AliasBound vars are shown before AliasFree.
case map aliasVar $ sort $ filter (not . consumable . aliasVar) $ S.toList als of
v : _ -> notConsumable loc =<< describeVar loc v
[] -> pure ()
-- | Proclaim that we have written to the given variable. | 712 | checkIfConsumable loc als = do
vtable <- asks $ scopeVtable . termScope
let consumable v = case M.lookup v vtable of
Just (BoundV Local _ t)
| arrayRank t > 0 -> unique t
| Scalar TypeVar {} <- t -> unique t
| Scalar Arrow {} <- t -> False
| otherwise -> True
Just (BoundV Global _ _) -> False
_ -> True
-- The sort ensures that AliasBound vars are shown before AliasFree.
case map aliasVar $ sort $ filter (not . consumable . aliasVar) $ S.toList als of
v : _ -> notConsumable loc =<< describeVar loc v
[] -> pure ()
-- | Proclaim that we have written to the given variable. | 656 | false | true | 0 | 18 | 205 | 257 | 118 | 139 | null | null |
Hodapp87/ivory | ivory/src/Ivory/Language/Syntax/Concrete/QQ/CondQQ.hs | bsd-3-clause | --------------------------------------------------------------------------------
-- Assertions, e.g.,
--
-- requires (checkStored (pid ~> pid_err) (\err -> err <? 1)) ensures (\res ->
-- checkStored (pid ~> pid_err) (\err -> err <? res))
--------------------------------------------------------------------------------
mkPrePostConds :: [PrePost] -> T.Exp -> Q T.Exp
mkPrePostConds conds procBody = do
condFns <- mapM mkCond conds
-- Apply conditions to the proc body in the Q monad.
return (foldr AppE procBody condFns)
where
mkCond :: PrePost -> Q T.Exp
mkCond cond = case cond of
PreCond exp -> appE (varE 'I.requires) (runExp exp)
PostCond exp -> appE (varE 'I.ensures) (lamE [varP $ mkName "return"]
(runExp exp))
runExp :: Exp -> Q T.Exp
runExp exp = do
(e, derefs) <- runToQ (fromExpCond exp)
return (foldr go e derefs)
where
go :: (T.Exp, T.Name) -> T.Exp -> T.Exp
go (deref, nm) acc =
AppE (AppE (VarE 'I.checkStored) deref) (LamE [VarP nm] acc)
-------------------------------------------------------------------------------- | 1,141 | mkPrePostConds :: [PrePost] -> T.Exp -> Q T.Exp
mkPrePostConds conds procBody = do
condFns <- mapM mkCond conds
-- Apply conditions to the proc body in the Q monad.
return (foldr AppE procBody condFns)
where
mkCond :: PrePost -> Q T.Exp
mkCond cond = case cond of
PreCond exp -> appE (varE 'I.requires) (runExp exp)
PostCond exp -> appE (varE 'I.ensures) (lamE [varP $ mkName "return"]
(runExp exp))
runExp :: Exp -> Q T.Exp
runExp exp = do
(e, derefs) <- runToQ (fromExpCond exp)
return (foldr go e derefs)
where
go :: (T.Exp, T.Name) -> T.Exp -> T.Exp
go (deref, nm) acc =
AppE (AppE (VarE 'I.checkStored) deref) (LamE [VarP nm] acc)
-------------------------------------------------------------------------------- | 821 | mkPrePostConds conds procBody = do
condFns <- mapM mkCond conds
-- Apply conditions to the proc body in the Q monad.
return (foldr AppE procBody condFns)
where
mkCond :: PrePost -> Q T.Exp
mkCond cond = case cond of
PreCond exp -> appE (varE 'I.requires) (runExp exp)
PostCond exp -> appE (varE 'I.ensures) (lamE [varP $ mkName "return"]
(runExp exp))
runExp :: Exp -> Q T.Exp
runExp exp = do
(e, derefs) <- runToQ (fromExpCond exp)
return (foldr go e derefs)
where
go :: (T.Exp, T.Name) -> T.Exp -> T.Exp
go (deref, nm) acc =
AppE (AppE (VarE 'I.checkStored) deref) (LamE [VarP nm] acc)
-------------------------------------------------------------------------------- | 773 | true | true | 0 | 13 | 248 | 335 | 164 | 171 | null | null |
tchagnon/cs636-raytracer | a1/MathHmatrix.hs | apache-2.0 | id4f :: Mat4f
id4f = ident 4 | 28 | id4f :: Mat4f
id4f = ident 4 | 28 | id4f = ident 4 | 14 | false | true | 0 | 6 | 6 | 20 | 8 | 12 | null | null |
Vlix/facebookmessenger | test/Spec.hs | mit | aesonTests :: TestTree
aesonTests = Tasty.testGroup
"Aeson"
[ staticTests
, requestTests
, responseTests
, callbackTests
] | 166 | aesonTests :: TestTree
aesonTests = Tasty.testGroup
"Aeson"
[ staticTests
, requestTests
, responseTests
, callbackTests
] | 166 | aesonTests = Tasty.testGroup
"Aeson"
[ staticTests
, requestTests
, responseTests
, callbackTests
] | 143 | false | true | 0 | 6 | 59 | 30 | 17 | 13 | null | null |
harendra-kumar/asyncly | src/Streamly/Internal/Benchmark/Prelude.hs | bsd-3-clause | eqBy :: Int -> IO Bool
eqBy n = eqBy' (source n) | 48 | eqBy :: Int -> IO Bool
eqBy n = eqBy' (source n) | 48 | eqBy n = eqBy' (source n) | 25 | false | true | 0 | 7 | 11 | 35 | 15 | 20 | null | null |
sdiehl/ghc | compiler/GHC/Types/RepType.hs | bsd-3-clause | countConRepArgs :: DataCon -> RepArity
countConRepArgs dc = go (dataConRepArity dc) (dataConRepType dc)
where
go :: Arity -> Type -> RepArity
go 0 _
= 0
go n ty
| FunTy _ arg res <- unwrapType ty
= length (typePrimRep arg) + go (n - 1) res
| otherwise
= pprPanic "countConRepArgs: arity greater than type can handle" (ppr (n, ty, typePrimRep ty))
-- | True if the type has zero width. | 429 | countConRepArgs :: DataCon -> RepArity
countConRepArgs dc = go (dataConRepArity dc) (dataConRepType dc)
where
go :: Arity -> Type -> RepArity
go 0 _
= 0
go n ty
| FunTy _ arg res <- unwrapType ty
= length (typePrimRep arg) + go (n - 1) res
| otherwise
= pprPanic "countConRepArgs: arity greater than type can handle" (ppr (n, ty, typePrimRep ty))
-- | True if the type has zero width. | 429 | countConRepArgs dc = go (dataConRepArity dc) (dataConRepType dc)
where
go :: Arity -> Type -> RepArity
go 0 _
= 0
go n ty
| FunTy _ arg res <- unwrapType ty
= length (typePrimRep arg) + go (n - 1) res
| otherwise
= pprPanic "countConRepArgs: arity greater than type can handle" (ppr (n, ty, typePrimRep ty))
-- | True if the type has zero width. | 390 | false | true | 0 | 10 | 116 | 163 | 76 | 87 | null | null |
nevrenato/Hets_Fork | Maude/PreComorphism.hs | gpl-2.0 | maudeSym2CASLOp :: IdMap -> MSym.Symbol -> Maybe (Id, CSign.OpType, CSign.OpType)
maudeSym2CASLOp im (MSym.Operator op ar co) = Just (token2id op, ot, ot')
where f = token2id . getName
g = \ x -> maudeSymbol2caslSort x im
ot = CSign.OpType CAS.Total (map g ar) (g co)
ot' = CSign.OpType CAS.Total (map f ar) (f co) | 356 | maudeSym2CASLOp :: IdMap -> MSym.Symbol -> Maybe (Id, CSign.OpType, CSign.OpType)
maudeSym2CASLOp im (MSym.Operator op ar co) = Just (token2id op, ot, ot')
where f = token2id . getName
g = \ x -> maudeSymbol2caslSort x im
ot = CSign.OpType CAS.Total (map g ar) (g co)
ot' = CSign.OpType CAS.Total (map f ar) (f co) | 356 | maudeSym2CASLOp im (MSym.Operator op ar co) = Just (token2id op, ot, ot')
where f = token2id . getName
g = \ x -> maudeSymbol2caslSort x im
ot = CSign.OpType CAS.Total (map g ar) (g co)
ot' = CSign.OpType CAS.Total (map f ar) (f co) | 274 | false | true | 4 | 9 | 95 | 173 | 81 | 92 | null | null |
Peaker/resolve-trivial-conflicts | src/Main.hs | gpl-2.0 | d </> p = d FilePath.</> p | 26 | d </> p = d FilePath.</> p | 26 | d </> p = d FilePath.</> p | 26 | false | false | 3 | 6 | 6 | 21 | 8 | 13 | null | null |
kevinbackhouse/Control-Monad-ST2 | src/Control/Monad/ST2.hs | bsd-3-clause | modifyST2Ref :: ST2Ref r w a -> (a -> a) -> ST2 r w ()
modifyST2Ref (ST2Ref r) f =
ST2 $ modifyIORef r f | 106 | modifyST2Ref :: ST2Ref r w a -> (a -> a) -> ST2 r w ()
modifyST2Ref (ST2Ref r) f =
ST2 $ modifyIORef r f | 106 | modifyST2Ref (ST2Ref r) f =
ST2 $ modifyIORef r f | 51 | false | true | 0 | 8 | 26 | 62 | 30 | 32 | null | null |
ahmadsalim/p3-tool | p3-tool/FPromela/Parser.hs | gpl-3.0 | pAssign :: Parser ParserState Assign
pAssign = (try (pVarRef <* symbol "+" <* symbol "+") >>= return . AssignIncr)
<|> (try (pVarRef <* symbol "-" <* symbol "-") >>= return . AssignDecr)
<|> do var <- try (pVarRef <* reservedOp "=") -- to avoid equality test
val <- pAnyExpr
return $ AssignExpr var val | 350 | pAssign :: Parser ParserState Assign
pAssign = (try (pVarRef <* symbol "+" <* symbol "+") >>= return . AssignIncr)
<|> (try (pVarRef <* symbol "-" <* symbol "-") >>= return . AssignDecr)
<|> do var <- try (pVarRef <* reservedOp "=") -- to avoid equality test
val <- pAnyExpr
return $ AssignExpr var val | 350 | pAssign = (try (pVarRef <* symbol "+" <* symbol "+") >>= return . AssignIncr)
<|> (try (pVarRef <* symbol "-" <* symbol "-") >>= return . AssignDecr)
<|> do var <- try (pVarRef <* reservedOp "=") -- to avoid equality test
val <- pAnyExpr
return $ AssignExpr var val | 313 | false | true | 0 | 14 | 101 | 126 | 60 | 66 | null | null |
keithodulaigh/Hets | Common/ATerm/ConvInstances.hs | gpl-2.0 | ordToInt :: Ordering -> Int
ordToInt LT = 0 | 43 | ordToInt :: Ordering -> Int
ordToInt LT = 0 | 43 | ordToInt LT = 0 | 15 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
brendanhay/gogol | gogol-binaryauthorization/gen/Network/Google/Resource/BinaryAuthorization/Projects/UpdatePolicy.hs | mpl-2.0 | -- | Output only. The resource name, in the format \`projects\/*\/policy\`.
-- There is at most one policy per project.
pupName :: Lens' ProjectsUpdatePolicy Text
pupName = lens _pupName (\ s a -> s{_pupName = a}) | 213 | pupName :: Lens' ProjectsUpdatePolicy Text
pupName = lens _pupName (\ s a -> s{_pupName = a}) | 93 | pupName = lens _pupName (\ s a -> s{_pupName = a}) | 50 | true | true | 0 | 9 | 35 | 41 | 23 | 18 | null | null |
Cahu/krpc-hs | src/KRPCHS/SpaceCenter.hs | gpl-3.0 | getPartThermalSkinMassStream :: KRPCHS.SpaceCenter.Part -> RPCContext (KRPCStream (Float))
getPartThermalSkinMassStream thisArg = requestStream $ getPartThermalSkinMassStreamReq thisArg | 185 | getPartThermalSkinMassStream :: KRPCHS.SpaceCenter.Part -> RPCContext (KRPCStream (Float))
getPartThermalSkinMassStream thisArg = requestStream $ getPartThermalSkinMassStreamReq thisArg | 185 | getPartThermalSkinMassStream thisArg = requestStream $ getPartThermalSkinMassStreamReq thisArg | 94 | false | true | 0 | 9 | 13 | 43 | 21 | 22 | null | null |
ajnsit/custom-prelude | test-is-a-prelude.hs | gpl-3.0 | span = P.span | 13 | span = P.span | 13 | span = P.span | 13 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
kim/amazonka | amazonka-iam/gen/Network/AWS/IAM/Types.hs | mpl-2.0 | -- | The Amazon Resource Name (ARN) specifying the role. For more information
-- about ARNs and how to use them in policies, see <http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM Identifiers> in the /UsingIAM/ guide.
rArn :: Lens' Role Text
rArn = lens _rArn (\s a -> s { _rArn = a }) | 310 | rArn :: Lens' Role Text
rArn = lens _rArn (\s a -> s { _rArn = a }) | 67 | rArn = lens _rArn (\s a -> s { _rArn = a }) | 43 | true | true | 0 | 9 | 48 | 41 | 23 | 18 | null | null |
Blaisorblade/stack | src/Stack/Build/Cache.hs | bsd-3-clause | readPrecompiledCache :: (MonadThrow m, MonadReader env m, HasEnvConfig env, MonadIO m, MonadLogger m, MonadBaseControl IO m)
=> PackageIdentifier -- ^ target package
-> ConfigureOpts
-> Set GhcPkgId -- ^ dependencies
-> m (Maybe PrecompiledCache)
readPrecompiledCache pkgident copts depIDs = do
ec <- asks getEnvConfig
let toAbsPath path = do
if FilePath.isAbsolute path
then path -- Only older version store absolute path
else toFilePath (getStackRoot ec) FilePath.</> path
let toAbsPC pc =
PrecompiledCache
{ pcLibrary = fmap toAbsPath (pcLibrary pc)
, pcExes = map toAbsPath (pcExes pc)
}
(file, getOldFile) <- precompiledCacheFile pkgident copts depIDs
mres <- $(versionedDecodeFile precompiledCacheVC) file
case mres of
Just res -> return (Just $ toAbsPC res)
Nothing -> do
-- Fallback on trying the old binary format.
oldFile <- getOldFile
mpc <- fmap (fmap toAbsPC) $ binaryDecodeFileOrFailDeep oldFile
-- Write out file in new format. Keep old file around for
-- the benefit of older stack versions.
forM_ mpc ($(versionedEncodeFile precompiledCacheVC) file)
return mpc
-- | Ensure that there are no lurking exceptions deep inside the parsed
-- value... because that happens unfortunately. See
-- https://github.com/commercialhaskell/stack/issues/554 | 1,572 | readPrecompiledCache :: (MonadThrow m, MonadReader env m, HasEnvConfig env, MonadIO m, MonadLogger m, MonadBaseControl IO m)
=> PackageIdentifier -- ^ target package
-> ConfigureOpts
-> Set GhcPkgId -- ^ dependencies
-> m (Maybe PrecompiledCache)
readPrecompiledCache pkgident copts depIDs = do
ec <- asks getEnvConfig
let toAbsPath path = do
if FilePath.isAbsolute path
then path -- Only older version store absolute path
else toFilePath (getStackRoot ec) FilePath.</> path
let toAbsPC pc =
PrecompiledCache
{ pcLibrary = fmap toAbsPath (pcLibrary pc)
, pcExes = map toAbsPath (pcExes pc)
}
(file, getOldFile) <- precompiledCacheFile pkgident copts depIDs
mres <- $(versionedDecodeFile precompiledCacheVC) file
case mres of
Just res -> return (Just $ toAbsPC res)
Nothing -> do
-- Fallback on trying the old binary format.
oldFile <- getOldFile
mpc <- fmap (fmap toAbsPC) $ binaryDecodeFileOrFailDeep oldFile
-- Write out file in new format. Keep old file around for
-- the benefit of older stack versions.
forM_ mpc ($(versionedEncodeFile precompiledCacheVC) file)
return mpc
-- | Ensure that there are no lurking exceptions deep inside the parsed
-- value... because that happens unfortunately. See
-- https://github.com/commercialhaskell/stack/issues/554 | 1,572 | readPrecompiledCache pkgident copts depIDs = do
ec <- asks getEnvConfig
let toAbsPath path = do
if FilePath.isAbsolute path
then path -- Only older version store absolute path
else toFilePath (getStackRoot ec) FilePath.</> path
let toAbsPC pc =
PrecompiledCache
{ pcLibrary = fmap toAbsPath (pcLibrary pc)
, pcExes = map toAbsPath (pcExes pc)
}
(file, getOldFile) <- precompiledCacheFile pkgident copts depIDs
mres <- $(versionedDecodeFile precompiledCacheVC) file
case mres of
Just res -> return (Just $ toAbsPC res)
Nothing -> do
-- Fallback on trying the old binary format.
oldFile <- getOldFile
mpc <- fmap (fmap toAbsPC) $ binaryDecodeFileOrFailDeep oldFile
-- Write out file in new format. Keep old file around for
-- the benefit of older stack versions.
forM_ mpc ($(versionedEncodeFile precompiledCacheVC) file)
return mpc
-- | Ensure that there are no lurking exceptions deep inside the parsed
-- value... because that happens unfortunately. See
-- https://github.com/commercialhaskell/stack/issues/554 | 1,241 | false | true | 0 | 17 | 493 | 324 | 156 | 168 | null | null |
c000/twitter-client255 | Client255/Client255.hs | bsd-3-clause | getCred :: IO Credential
getCred = do
tmp <- withManager $ getTemporaryCredential oauth
hPutStrLn stderr $ "URL: " ++ authorizeUrl oauth tmp
hPutStr stderr $ "Enter PIN: "
hFlush stderr
pin <- BS.getLine
let tmp' = injectVerifier pin tmp
cred <- withManager $ getTokenCredential oauth tmp'
return cred | 333 | getCred :: IO Credential
getCred = do
tmp <- withManager $ getTemporaryCredential oauth
hPutStrLn stderr $ "URL: " ++ authorizeUrl oauth tmp
hPutStr stderr $ "Enter PIN: "
hFlush stderr
pin <- BS.getLine
let tmp' = injectVerifier pin tmp
cred <- withManager $ getTokenCredential oauth tmp'
return cred | 333 | getCred = do
tmp <- withManager $ getTemporaryCredential oauth
hPutStrLn stderr $ "URL: " ++ authorizeUrl oauth tmp
hPutStr stderr $ "Enter PIN: "
hFlush stderr
pin <- BS.getLine
let tmp' = injectVerifier pin tmp
cred <- withManager $ getTokenCredential oauth tmp'
return cred | 308 | false | true | 0 | 11 | 79 | 114 | 47 | 67 | null | null |
vTurbine/ghc | compiler/codeGen/StgCmmClosure.hs | bsd-3-clause | closureSingleEntry :: ClosureInfo -> Bool
closureSingleEntry (ClosureInfo { closureLFInfo = LFThunk _ _ upd _ _}) = not upd | 123 | closureSingleEntry :: ClosureInfo -> Bool
closureSingleEntry (ClosureInfo { closureLFInfo = LFThunk _ _ upd _ _}) = not upd | 123 | closureSingleEntry (ClosureInfo { closureLFInfo = LFThunk _ _ upd _ _}) = not upd | 81 | false | true | 0 | 10 | 18 | 44 | 22 | 22 | null | null |
denisenkom/hsmssql | Database/Mssql/Tds.hs | mit | putTimeSecs :: Int -> Int -> Rational -> Put
putTimeSecs scale size secs = do
let ival = round $ secs * (10 ^ scale)
putInt 0 0 = return ()
putInt 0 val = fail $ "secs is not fully consumed: " ++ show val
putInt i val = do
let (q, r) = quotRem val 0x100
putWord8 $ fromIntegral r
putInt (i - 1) q
putInt size ival | 381 | putTimeSecs :: Int -> Int -> Rational -> Put
putTimeSecs scale size secs = do
let ival = round $ secs * (10 ^ scale)
putInt 0 0 = return ()
putInt 0 val = fail $ "secs is not fully consumed: " ++ show val
putInt i val = do
let (q, r) = quotRem val 0x100
putWord8 $ fromIntegral r
putInt (i - 1) q
putInt size ival | 381 | putTimeSecs scale size secs = do
let ival = round $ secs * (10 ^ scale)
putInt 0 0 = return ()
putInt 0 val = fail $ "secs is not fully consumed: " ++ show val
putInt i val = do
let (q, r) = quotRem val 0x100
putWord8 $ fromIntegral r
putInt (i - 1) q
putInt size ival | 336 | false | true | 0 | 15 | 137 | 154 | 73 | 81 | null | null |
jcf42b/tutorials-1 | theSantaClausProblem.hs | cc0-1.0 | joinGroup :: Group -> IO (Gate, Gate)
joinGroup (MkGroup n tv) = atomically (do { (n_left, g1, g2) <- readTVar tv;
check (n_left > 0);
writeTVar tv (n_left - 1, g1, g2);
return (g1, g2) }) | 248 | joinGroup :: Group -> IO (Gate, Gate)
joinGroup (MkGroup n tv) = atomically (do { (n_left, g1, g2) <- readTVar tv;
check (n_left > 0);
writeTVar tv (n_left - 1, g1, g2);
return (g1, g2) }) | 248 | joinGroup (MkGroup n tv) = atomically (do { (n_left, g1, g2) <- readTVar tv;
check (n_left > 0);
writeTVar tv (n_left - 1, g1, g2);
return (g1, g2) }) | 210 | false | true | 0 | 11 | 95 | 115 | 60 | 55 | null | null |
adscib/monad-bayes | benchmark/Speed.hs | mit | prepareBenchmarkable :: GenIO -> ProbProgSys -> Model -> Alg -> Benchmarkable
prepareBenchmarkable g MonadBayes model alg = nfIO $ sampleIOwith (runAlg model alg) g | 164 | prepareBenchmarkable :: GenIO -> ProbProgSys -> Model -> Alg -> Benchmarkable
prepareBenchmarkable g MonadBayes model alg = nfIO $ sampleIOwith (runAlg model alg) g | 164 | prepareBenchmarkable g MonadBayes model alg = nfIO $ sampleIOwith (runAlg model alg) g | 86 | false | true | 0 | 8 | 23 | 53 | 26 | 27 | null | null |
qpliu/esolang | blo/hs/Check.hs | gpl-3.0 | checkStmt types funcSigs scope forLabels retType (StmtExpr expr) = do
checkedExpr <- checkExpr funcSigs scope Nothing expr
return (AstStmtExpr (exprSourcePos expr) checkedExpr) | 184 | checkStmt types funcSigs scope forLabels retType (StmtExpr expr) = do
checkedExpr <- checkExpr funcSigs scope Nothing expr
return (AstStmtExpr (exprSourcePos expr) checkedExpr) | 184 | checkStmt types funcSigs scope forLabels retType (StmtExpr expr) = do
checkedExpr <- checkExpr funcSigs scope Nothing expr
return (AstStmtExpr (exprSourcePos expr) checkedExpr) | 184 | false | false | 0 | 11 | 29 | 66 | 28 | 38 | null | null |
droundy/franchise | Distribution/Franchise/StringSet.hs | bsd-3-clause | singleS (c:cs) = SS False $ singleC c $ singleS cs | 50 | singleS (c:cs) = SS False $ singleC c $ singleS cs | 50 | singleS (c:cs) = SS False $ singleC c $ singleS cs | 50 | false | false | 0 | 7 | 10 | 33 | 15 | 18 | null | null |
aleksj/lamdu | Lamdu/Sugar/Convert.hs | gpl-3.0 | getStoredNameS :: MonadA m => Guid -> ConvertM m (Maybe String)
getStoredNameS = ConvertM.liftTransaction . ConvertExpr.getStoredName | 133 | getStoredNameS :: MonadA m => Guid -> ConvertM m (Maybe String)
getStoredNameS = ConvertM.liftTransaction . ConvertExpr.getStoredName | 133 | getStoredNameS = ConvertM.liftTransaction . ConvertExpr.getStoredName | 69 | false | true | 0 | 10 | 15 | 47 | 21 | 26 | null | null |
bvdelft/paragon | test/Language/Java/Paragon/NameResolutionSpec.hs | bsd-3-clause | spec :: Spec
spec = do
describe "resolveNames" $ do
-- Success, resolving does not alter AST
it "resolves empty class declaration" $
noAltering "ClassDeclEmpty"
it "resolves empty class declaration with modifiers" $
noAltering "ClassDeclMod"
it "resolves class declaration with single field declaration" $
noAltering "ClassDeclSingleField"
it "resolves class declaration with single field declaration with modifiers" $
noAltering "ClassDeclSingleFieldMod"
it "resolves class declaration with multiple field declarations with modifiers" $
noAltering "ClassDeclMultFields"
it "resolves class declaration with void method with semicolon body" $
noAltering "ClassDeclVoidMethodSemiColon"
it "resolves class declaration with int method with semicolon body" $
noAltering "ClassDeclIntMethodSemiColon"
it "resolves class declaration with void method with empty body" $
noAltering "ClassDeclVoidMethodEmptyBody"
it "resolves class declaration with int method with empty body with modifiers" $
noAltering "ClassDeclIntMethodModEmptyBody"
it "resolves class declaration with void method with empty statement" $
noAltering "ClassDeclVoidMethodSemiColonStmt"
it "resolves class declaration with void method with single local variable declaration with modifier" $
noAltering "ClassDeclVoidMethodSingleLocalVarDeclMod"
it "resolves class declaration with void method with multiple local variable declarations" $
noAltering "ClassDeclVoidMethodMultLocalVarDecls"
it "resolves class declaration with single field declaration of primitive type with literal initializer" $
noAltering "ClassDeclSinglePrimFieldInit"
it "resolves class declaration with multiple field declarations of primitive types with literal initializers" $
noAltering "ClassDeclMultPrimFieldsInit"
it "parses class declaration with single high policy field" $
noAltering "ClassDeclSingleHighPolicyField"
it "parses class declaration with single field with reads policy modifier" $
noAltering "ClassDeclSingleFieldReadsMod"
it "parses class declaration with single field with writes policy modifier" $
noAltering "ClassDeclSingleFieldWritesMod"
-- Success, resolving does alter AST
it "resolves class declaration with single field declaration with reference type" $ do
ast <- parseSuccessFile "ClassDeclSingleFieldRefType"
let newPrefix = mkName const PkgName [Id defaultAnn "java", Id defaultAnn "lang"]
let transform = modifyBodyDecl 0 $ modifyFieldDeclType $
modifyRefTypePrefix (const $ Just newPrefix)
successCase ast (transform ast)
it "resolves class declaration with single field declaration of reference type with null initializer" $ do
ast <- parseSuccessFile "ClassDeclSingleRefFieldInit"
let newPrefix = mkName const PkgName [Id defaultAnn "java", Id defaultAnn "lang"]
let transform = modifyBodyDecl 0 $ modifyFieldDeclType $
modifyRefTypePrefix (const $ Just newPrefix)
successCase ast (transform ast)
it "resolves class declaration with void method with single local variable declaration of reference type with null initializer" $ do
ast <- parseSuccessFile "ClassDeclVoidMethodSingleRefLocalVarInit"
let newPrefix = mkName const PkgName [Id defaultAnn "java", Id defaultAnn "lang"]
let transform = modifyBodyDecl 0 $ modifyMethodBlockStmt 0 $
modifyLocalVarsType $ modifyRefTypePrefix (const $ Just newPrefix)
successCase ast (transform ast)
it "resolves class declaration with single low policy field" $ do
ast <- parseSuccessFile "ClassDeclSingleLowPolicyField"
let newPrefix = mkName const PkgName [Id defaultAnn "java", Id defaultAnn "lang"]
let transform = modifyBodyDecl 0 $ modifyFieldDeclInitExp 0 $
modifyPolicyClause 0 $ modifyDeclHeadRef $
modifyRefTypePrefix (const $ Just newPrefix)
successCase ast (transform ast)
it "parses class declaration with shadowing reference type - reference type" $ do
ast <- parseSuccessFile "ClassDeclShadowingRefRef"
let t1 = modifyBodyDecl 0 $ modifyFieldDeclType $
modifyRefTypePrefix $ prefixNameType PkgName
let t2 = modifyBodyDecl 1 $ modifyFieldDeclInitExp 0 $ modifyPolicyClause 0 $
modifyDeclHeadRef $ modifyRefTypePrefix $ prefixNameType PkgName
let t3 = modifyBodyDecl 2 $ modifyMethodBlockStmt 0 $ modifyLocalVarsType $
modifyRefTypePrefix $ prefixNameType PkgName
let transform = t3 . t2 . t1
successCase ast (transform ast)
it "parses class declaration with shadowing primitive type - reference type" $ do
ast <- parseSuccessFile "ClassDeclShadowingPrimRef"
let t2 = modifyBodyDecl 1 $ modifyFieldDeclInitExp 0 $ modifyPolicyClause 0 $
modifyDeclHeadRef $ modifyRefTypePrefix $ prefixNameType PkgName
let t3 = modifyBodyDecl 2 $ modifyMethodBlockStmt 0 $ modifyLocalVarsType $
modifyRefTypePrefix $ prefixNameType PkgName
let transform = t3 . t2
successCase ast (transform ast)
-- Failure, error should be as expected.
it "cannot resolve an empty program" $ do
let err = unsupportedError "compilation unit without type definition"
errorAnnotation [nrCtxt]
failureCase "Empty" [err]
it "refuses assignments to undefined variables" $ do
let baseName = "ClassDeclVoidMethodSingleAssignLit"
fileName = mkFileName baseName
vSrcSpan = makeSrcSpanAnn fileName 3 5 3 5
vId = Id vSrcSpan "x"
vName = Name vSrcSpan vId ExpName Nothing
ctxt = [nrCtxt,defClassBodyContext "C",defMethodContext "f"]
err = unresolvedName vName vName ctxt
failureCase baseName [err]
it "cannot resolve an undefined variable on right-hand side" $ do
let baseName = "ClassDeclVoidMethodSingleAssignVar"
fileName = mkFileName baseName
vSrcSpan = makeSrcSpanAnn fileName 4 9 4 9
vId = Id vSrcSpan "y"
vName = Name vSrcSpan vId ExpOrLockName Nothing
ctxt = [nrCtxt,defClassBodyContext "C",defMethodContext "f"]
err = unresolvedName vName vName ctxt
failureCase baseName [err] | 6,465 | spec :: Spec
spec = do
describe "resolveNames" $ do
-- Success, resolving does not alter AST
it "resolves empty class declaration" $
noAltering "ClassDeclEmpty"
it "resolves empty class declaration with modifiers" $
noAltering "ClassDeclMod"
it "resolves class declaration with single field declaration" $
noAltering "ClassDeclSingleField"
it "resolves class declaration with single field declaration with modifiers" $
noAltering "ClassDeclSingleFieldMod"
it "resolves class declaration with multiple field declarations with modifiers" $
noAltering "ClassDeclMultFields"
it "resolves class declaration with void method with semicolon body" $
noAltering "ClassDeclVoidMethodSemiColon"
it "resolves class declaration with int method with semicolon body" $
noAltering "ClassDeclIntMethodSemiColon"
it "resolves class declaration with void method with empty body" $
noAltering "ClassDeclVoidMethodEmptyBody"
it "resolves class declaration with int method with empty body with modifiers" $
noAltering "ClassDeclIntMethodModEmptyBody"
it "resolves class declaration with void method with empty statement" $
noAltering "ClassDeclVoidMethodSemiColonStmt"
it "resolves class declaration with void method with single local variable declaration with modifier" $
noAltering "ClassDeclVoidMethodSingleLocalVarDeclMod"
it "resolves class declaration with void method with multiple local variable declarations" $
noAltering "ClassDeclVoidMethodMultLocalVarDecls"
it "resolves class declaration with single field declaration of primitive type with literal initializer" $
noAltering "ClassDeclSinglePrimFieldInit"
it "resolves class declaration with multiple field declarations of primitive types with literal initializers" $
noAltering "ClassDeclMultPrimFieldsInit"
it "parses class declaration with single high policy field" $
noAltering "ClassDeclSingleHighPolicyField"
it "parses class declaration with single field with reads policy modifier" $
noAltering "ClassDeclSingleFieldReadsMod"
it "parses class declaration with single field with writes policy modifier" $
noAltering "ClassDeclSingleFieldWritesMod"
-- Success, resolving does alter AST
it "resolves class declaration with single field declaration with reference type" $ do
ast <- parseSuccessFile "ClassDeclSingleFieldRefType"
let newPrefix = mkName const PkgName [Id defaultAnn "java", Id defaultAnn "lang"]
let transform = modifyBodyDecl 0 $ modifyFieldDeclType $
modifyRefTypePrefix (const $ Just newPrefix)
successCase ast (transform ast)
it "resolves class declaration with single field declaration of reference type with null initializer" $ do
ast <- parseSuccessFile "ClassDeclSingleRefFieldInit"
let newPrefix = mkName const PkgName [Id defaultAnn "java", Id defaultAnn "lang"]
let transform = modifyBodyDecl 0 $ modifyFieldDeclType $
modifyRefTypePrefix (const $ Just newPrefix)
successCase ast (transform ast)
it "resolves class declaration with void method with single local variable declaration of reference type with null initializer" $ do
ast <- parseSuccessFile "ClassDeclVoidMethodSingleRefLocalVarInit"
let newPrefix = mkName const PkgName [Id defaultAnn "java", Id defaultAnn "lang"]
let transform = modifyBodyDecl 0 $ modifyMethodBlockStmt 0 $
modifyLocalVarsType $ modifyRefTypePrefix (const $ Just newPrefix)
successCase ast (transform ast)
it "resolves class declaration with single low policy field" $ do
ast <- parseSuccessFile "ClassDeclSingleLowPolicyField"
let newPrefix = mkName const PkgName [Id defaultAnn "java", Id defaultAnn "lang"]
let transform = modifyBodyDecl 0 $ modifyFieldDeclInitExp 0 $
modifyPolicyClause 0 $ modifyDeclHeadRef $
modifyRefTypePrefix (const $ Just newPrefix)
successCase ast (transform ast)
it "parses class declaration with shadowing reference type - reference type" $ do
ast <- parseSuccessFile "ClassDeclShadowingRefRef"
let t1 = modifyBodyDecl 0 $ modifyFieldDeclType $
modifyRefTypePrefix $ prefixNameType PkgName
let t2 = modifyBodyDecl 1 $ modifyFieldDeclInitExp 0 $ modifyPolicyClause 0 $
modifyDeclHeadRef $ modifyRefTypePrefix $ prefixNameType PkgName
let t3 = modifyBodyDecl 2 $ modifyMethodBlockStmt 0 $ modifyLocalVarsType $
modifyRefTypePrefix $ prefixNameType PkgName
let transform = t3 . t2 . t1
successCase ast (transform ast)
it "parses class declaration with shadowing primitive type - reference type" $ do
ast <- parseSuccessFile "ClassDeclShadowingPrimRef"
let t2 = modifyBodyDecl 1 $ modifyFieldDeclInitExp 0 $ modifyPolicyClause 0 $
modifyDeclHeadRef $ modifyRefTypePrefix $ prefixNameType PkgName
let t3 = modifyBodyDecl 2 $ modifyMethodBlockStmt 0 $ modifyLocalVarsType $
modifyRefTypePrefix $ prefixNameType PkgName
let transform = t3 . t2
successCase ast (transform ast)
-- Failure, error should be as expected.
it "cannot resolve an empty program" $ do
let err = unsupportedError "compilation unit without type definition"
errorAnnotation [nrCtxt]
failureCase "Empty" [err]
it "refuses assignments to undefined variables" $ do
let baseName = "ClassDeclVoidMethodSingleAssignLit"
fileName = mkFileName baseName
vSrcSpan = makeSrcSpanAnn fileName 3 5 3 5
vId = Id vSrcSpan "x"
vName = Name vSrcSpan vId ExpName Nothing
ctxt = [nrCtxt,defClassBodyContext "C",defMethodContext "f"]
err = unresolvedName vName vName ctxt
failureCase baseName [err]
it "cannot resolve an undefined variable on right-hand side" $ do
let baseName = "ClassDeclVoidMethodSingleAssignVar"
fileName = mkFileName baseName
vSrcSpan = makeSrcSpanAnn fileName 4 9 4 9
vId = Id vSrcSpan "y"
vName = Name vSrcSpan vId ExpOrLockName Nothing
ctxt = [nrCtxt,defClassBodyContext "C",defMethodContext "f"]
err = unresolvedName vName vName ctxt
failureCase baseName [err] | 6,465 | spec = do
describe "resolveNames" $ do
-- Success, resolving does not alter AST
it "resolves empty class declaration" $
noAltering "ClassDeclEmpty"
it "resolves empty class declaration with modifiers" $
noAltering "ClassDeclMod"
it "resolves class declaration with single field declaration" $
noAltering "ClassDeclSingleField"
it "resolves class declaration with single field declaration with modifiers" $
noAltering "ClassDeclSingleFieldMod"
it "resolves class declaration with multiple field declarations with modifiers" $
noAltering "ClassDeclMultFields"
it "resolves class declaration with void method with semicolon body" $
noAltering "ClassDeclVoidMethodSemiColon"
it "resolves class declaration with int method with semicolon body" $
noAltering "ClassDeclIntMethodSemiColon"
it "resolves class declaration with void method with empty body" $
noAltering "ClassDeclVoidMethodEmptyBody"
it "resolves class declaration with int method with empty body with modifiers" $
noAltering "ClassDeclIntMethodModEmptyBody"
it "resolves class declaration with void method with empty statement" $
noAltering "ClassDeclVoidMethodSemiColonStmt"
it "resolves class declaration with void method with single local variable declaration with modifier" $
noAltering "ClassDeclVoidMethodSingleLocalVarDeclMod"
it "resolves class declaration with void method with multiple local variable declarations" $
noAltering "ClassDeclVoidMethodMultLocalVarDecls"
it "resolves class declaration with single field declaration of primitive type with literal initializer" $
noAltering "ClassDeclSinglePrimFieldInit"
it "resolves class declaration with multiple field declarations of primitive types with literal initializers" $
noAltering "ClassDeclMultPrimFieldsInit"
it "parses class declaration with single high policy field" $
noAltering "ClassDeclSingleHighPolicyField"
it "parses class declaration with single field with reads policy modifier" $
noAltering "ClassDeclSingleFieldReadsMod"
it "parses class declaration with single field with writes policy modifier" $
noAltering "ClassDeclSingleFieldWritesMod"
-- Success, resolving does alter AST
it "resolves class declaration with single field declaration with reference type" $ do
ast <- parseSuccessFile "ClassDeclSingleFieldRefType"
let newPrefix = mkName const PkgName [Id defaultAnn "java", Id defaultAnn "lang"]
let transform = modifyBodyDecl 0 $ modifyFieldDeclType $
modifyRefTypePrefix (const $ Just newPrefix)
successCase ast (transform ast)
it "resolves class declaration with single field declaration of reference type with null initializer" $ do
ast <- parseSuccessFile "ClassDeclSingleRefFieldInit"
let newPrefix = mkName const PkgName [Id defaultAnn "java", Id defaultAnn "lang"]
let transform = modifyBodyDecl 0 $ modifyFieldDeclType $
modifyRefTypePrefix (const $ Just newPrefix)
successCase ast (transform ast)
it "resolves class declaration with void method with single local variable declaration of reference type with null initializer" $ do
ast <- parseSuccessFile "ClassDeclVoidMethodSingleRefLocalVarInit"
let newPrefix = mkName const PkgName [Id defaultAnn "java", Id defaultAnn "lang"]
let transform = modifyBodyDecl 0 $ modifyMethodBlockStmt 0 $
modifyLocalVarsType $ modifyRefTypePrefix (const $ Just newPrefix)
successCase ast (transform ast)
it "resolves class declaration with single low policy field" $ do
ast <- parseSuccessFile "ClassDeclSingleLowPolicyField"
let newPrefix = mkName const PkgName [Id defaultAnn "java", Id defaultAnn "lang"]
let transform = modifyBodyDecl 0 $ modifyFieldDeclInitExp 0 $
modifyPolicyClause 0 $ modifyDeclHeadRef $
modifyRefTypePrefix (const $ Just newPrefix)
successCase ast (transform ast)
it "parses class declaration with shadowing reference type - reference type" $ do
ast <- parseSuccessFile "ClassDeclShadowingRefRef"
let t1 = modifyBodyDecl 0 $ modifyFieldDeclType $
modifyRefTypePrefix $ prefixNameType PkgName
let t2 = modifyBodyDecl 1 $ modifyFieldDeclInitExp 0 $ modifyPolicyClause 0 $
modifyDeclHeadRef $ modifyRefTypePrefix $ prefixNameType PkgName
let t3 = modifyBodyDecl 2 $ modifyMethodBlockStmt 0 $ modifyLocalVarsType $
modifyRefTypePrefix $ prefixNameType PkgName
let transform = t3 . t2 . t1
successCase ast (transform ast)
it "parses class declaration with shadowing primitive type - reference type" $ do
ast <- parseSuccessFile "ClassDeclShadowingPrimRef"
let t2 = modifyBodyDecl 1 $ modifyFieldDeclInitExp 0 $ modifyPolicyClause 0 $
modifyDeclHeadRef $ modifyRefTypePrefix $ prefixNameType PkgName
let t3 = modifyBodyDecl 2 $ modifyMethodBlockStmt 0 $ modifyLocalVarsType $
modifyRefTypePrefix $ prefixNameType PkgName
let transform = t3 . t2
successCase ast (transform ast)
-- Failure, error should be as expected.
it "cannot resolve an empty program" $ do
let err = unsupportedError "compilation unit without type definition"
errorAnnotation [nrCtxt]
failureCase "Empty" [err]
it "refuses assignments to undefined variables" $ do
let baseName = "ClassDeclVoidMethodSingleAssignLit"
fileName = mkFileName baseName
vSrcSpan = makeSrcSpanAnn fileName 3 5 3 5
vId = Id vSrcSpan "x"
vName = Name vSrcSpan vId ExpName Nothing
ctxt = [nrCtxt,defClassBodyContext "C",defMethodContext "f"]
err = unresolvedName vName vName ctxt
failureCase baseName [err]
it "cannot resolve an undefined variable on right-hand side" $ do
let baseName = "ClassDeclVoidMethodSingleAssignVar"
fileName = mkFileName baseName
vSrcSpan = makeSrcSpanAnn fileName 4 9 4 9
vId = Id vSrcSpan "y"
vName = Name vSrcSpan vId ExpOrLockName Nothing
ctxt = [nrCtxt,defClassBodyContext "C",defMethodContext "f"]
err = unresolvedName vName vName ctxt
failureCase baseName [err] | 6,452 | false | true | 0 | 21 | 1,520 | 1,204 | 530 | 674 | null | null |
fatlazycat/eventjournal | src/JournalFile.hs | bsd-3-clause | syncPoints :: Int -> Int -> Int -> (Int, Int)
syncPoints start size pageSize = (pagedStart, pagedSize)
where pagedStart = quot start pageSize * pageSize
pagedSize = (quot (start + size) pageSize + 1) * pageSize - pagedStart | 295 | syncPoints :: Int -> Int -> Int -> (Int, Int)
syncPoints start size pageSize = (pagedStart, pagedSize)
where pagedStart = quot start pageSize * pageSize
pagedSize = (quot (start + size) pageSize + 1) * pageSize - pagedStart | 295 | syncPoints start size pageSize = (pagedStart, pagedSize)
where pagedStart = quot start pageSize * pageSize
pagedSize = (quot (start + size) pageSize + 1) * pageSize - pagedStart | 249 | false | true | 0 | 13 | 109 | 90 | 48 | 42 | null | null |
tek/proteome | packages/proteome/lib/Proteome/Grep/Syntax.hs | mit | grepSyntax :: Syntax
grepSyntax =
Syntax items [] links
where
items =
[path, ln, line, col, colon, text_, sync]
links =
[hlPath, hlLn, hlLine, hlCol, hlText] | 181 | grepSyntax :: Syntax
grepSyntax =
Syntax items [] links
where
items =
[path, ln, line, col, colon, text_, sync]
links =
[hlPath, hlLn, hlLine, hlCol, hlText] | 181 | grepSyntax =
Syntax items [] links
where
items =
[path, ln, line, col, colon, text_, sync]
links =
[hlPath, hlLn, hlLine, hlCol, hlText] | 160 | false | true | 2 | 6 | 49 | 83 | 42 | 41 | null | null |
dysinger/amazonka | amazonka-storagegateway/gen/Network/AWS/StorageGateway/DescribeSnapshotSchedule.hs | mpl-2.0 | dssrStartAt :: Lens' DescribeSnapshotScheduleResponse (Maybe Natural)
dssrStartAt = lens _dssrStartAt (\s a -> s { _dssrStartAt = a }) . mapping _Nat | 149 | dssrStartAt :: Lens' DescribeSnapshotScheduleResponse (Maybe Natural)
dssrStartAt = lens _dssrStartAt (\s a -> s { _dssrStartAt = a }) . mapping _Nat | 149 | dssrStartAt = lens _dssrStartAt (\s a -> s { _dssrStartAt = a }) . mapping _Nat | 79 | false | true | 0 | 10 | 21 | 52 | 27 | 25 | null | null |
maoe/kc | Kc.hs | bsd-3-clause | verify :: Mode KcMode
verify = mode $ Verify
{ files = def &= args
} &= text "Verify configuration files." & defMode | 120 | verify :: Mode KcMode
verify = mode $ Verify
{ files = def &= args
} &= text "Verify configuration files." & defMode | 120 | verify = mode $ Verify
{ files = def &= args
} &= text "Verify configuration files." & defMode | 98 | false | true | 4 | 7 | 26 | 52 | 24 | 28 | null | null |
brendanhay/gogol | gogol-bigquerydatatransfer/gen/Network/Google/Resource/BigQueryDataTransfer/Projects/Locations/TransferConfigs/List.hs | mpl-2.0 | -- | Required. The BigQuery project id for which data sources should be
-- returned: \`projects\/{project_id}\` or
-- \`projects\/{project_id}\/locations\/{location_id}\`
pltclParent :: Lens' ProjectsLocationsTransferConfigsList Text
pltclParent
= lens _pltclParent (\ s a -> s{_pltclParent = a}) | 298 | pltclParent :: Lens' ProjectsLocationsTransferConfigsList Text
pltclParent
= lens _pltclParent (\ s a -> s{_pltclParent = a}) | 127 | pltclParent
= lens _pltclParent (\ s a -> s{_pltclParent = a}) | 64 | true | true | 0 | 9 | 36 | 44 | 24 | 20 | null | null |
DaMSL/K3 | src/Language/K3/Analysis/Properties.hs | apache-2.0 | pldel :: PList -> Identifier -> PList
pldel pl x = removeAssoc pl x | 67 | pldel :: PList -> Identifier -> PList
pldel pl x = removeAssoc pl x | 67 | pldel pl x = removeAssoc pl x | 29 | false | true | 0 | 6 | 13 | 29 | 14 | 15 | null | null |
kosmoskatten/hats | src/Network/Nats/Types.hs | mit | -- | Read the complete topic on which a message was received.
topic :: Msg -> Topic
topic (Msg t _ _ _) = t | 107 | topic :: Msg -> Topic
topic (Msg t _ _ _) = t | 45 | topic (Msg t _ _ _) = t | 23 | true | true | 0 | 9 | 24 | 37 | 17 | 20 | null | null |
XinhuaZhang/PetaVisionHaskell | PetaVision/Data/Weight.hs | gpl-3.0 | weightedSum
:: PVPWeight -> Array U DIM1 Double -> Array U DIM3 Double
weightedSum weightPatches a = foldS (+) 0 arr
where arr =
traverse2 weightPatches
a
(\sh _ -> sh)
(\fwp fa sh@(Z :. _j :. _i :. _k :. n) ->
(fwp sh) * (fa (Z :. n))) | 333 | weightedSum
:: PVPWeight -> Array U DIM1 Double -> Array U DIM3 Double
weightedSum weightPatches a = foldS (+) 0 arr
where arr =
traverse2 weightPatches
a
(\sh _ -> sh)
(\fwp fa sh@(Z :. _j :. _i :. _k :. n) ->
(fwp sh) * (fa (Z :. n))) | 333 | weightedSum weightPatches a = foldS (+) 0 arr
where arr =
traverse2 weightPatches
a
(\sh _ -> sh)
(\fwp fa sh@(Z :. _j :. _i :. _k :. n) ->
(fwp sh) * (fa (Z :. n))) | 260 | false | true | 0 | 13 | 146 | 134 | 69 | 65 | null | null |
kylcarte/wangtiles | src/Texture/Util.hs | bsd-3-clause | mixColors :: Rational -> PixelRGBA8 -> PixelRGBA8 -> PixelRGBA8
mixColors rat c1 c2 = PixelRGBA8
(enums $ rat * r1 + inv * r2)
(enums $ rat * g1 + inv * g2)
(enums $ rat * b1 + inv * b2)
(enums $ rat * a1 + inv * a2)
where
(r1,g1,b1,a1) = on4 toRational $ rgba8 c1
(r2,g2,b2,a2) = on4 toRational $ rgba8 c2
inv = 1 - rat
-- }}} | 354 | mixColors :: Rational -> PixelRGBA8 -> PixelRGBA8 -> PixelRGBA8
mixColors rat c1 c2 = PixelRGBA8
(enums $ rat * r1 + inv * r2)
(enums $ rat * g1 + inv * g2)
(enums $ rat * b1 + inv * b2)
(enums $ rat * a1 + inv * a2)
where
(r1,g1,b1,a1) = on4 toRational $ rgba8 c1
(r2,g2,b2,a2) = on4 toRational $ rgba8 c2
inv = 1 - rat
-- }}} | 354 | mixColors rat c1 c2 = PixelRGBA8
(enums $ rat * r1 + inv * r2)
(enums $ rat * g1 + inv * g2)
(enums $ rat * b1 + inv * b2)
(enums $ rat * a1 + inv * a2)
where
(r1,g1,b1,a1) = on4 toRational $ rgba8 c1
(r2,g2,b2,a2) = on4 toRational $ rgba8 c2
inv = 1 - rat
-- }}} | 290 | false | true | 1 | 9 | 99 | 196 | 97 | 99 | null | null |
lambdataro/Dive | Eval.hs | mit | -- 値の表示
evalPrint :: Value -> IO ()
evalPrint (CONST (Int n)) = putStr (show n) | 79 | evalPrint :: Value -> IO ()
evalPrint (CONST (Int n)) = putStr (show n) | 71 | evalPrint (CONST (Int n)) = putStr (show n) | 43 | true | true | 0 | 8 | 15 | 49 | 23 | 26 | null | null |
silky/csound-expression | src/Csound/Air/Misc.hs | bsd-3-clause | resons :: [(Sig, Sig)] -> Sig -> Sig
resons = resonsBy bp | 57 | resons :: [(Sig, Sig)] -> Sig -> Sig
resons = resonsBy bp | 57 | resons = resonsBy bp | 20 | false | true | 0 | 7 | 11 | 31 | 17 | 14 | null | null |
ezyang/ghc | compiler/types/Type.hs | bsd-3-clause | tyConAppTyCon_maybe _ = Nothing | 45 | tyConAppTyCon_maybe _ = Nothing | 45 | tyConAppTyCon_maybe _ = Nothing | 45 | false | false | 0 | 4 | 17 | 10 | 4 | 6 | null | null |
coursestitch/coursestitch-api | lib/CourseStitch/Handlers/Topic.hs | apache-2.0 | withTopicId :: (Int64 -> ActionM ()) -> ActionM ()
withTopicId action = do
id <- param "topic"
case readMaybe id of
Nothing -> badRequest400 "Topics should be of the form /topic/<integer>"
Just id -> action id | 233 | withTopicId :: (Int64 -> ActionM ()) -> ActionM ()
withTopicId action = do
id <- param "topic"
case readMaybe id of
Nothing -> badRequest400 "Topics should be of the form /topic/<integer>"
Just id -> action id | 233 | withTopicId action = do
id <- param "topic"
case readMaybe id of
Nothing -> badRequest400 "Topics should be of the form /topic/<integer>"
Just id -> action id | 182 | false | true | 0 | 11 | 59 | 80 | 35 | 45 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.