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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
holdenlee/philosophocle | site.hs | mit | postCtxWithTags :: Tags -> Context String
postCtxWithTags tags = tagsField "tags" tags <>
postCtx | 120 | postCtxWithTags :: Tags -> Context String
postCtxWithTags tags = tagsField "tags" tags <>
postCtx | 120 | postCtxWithTags tags = tagsField "tags" tags <>
postCtx | 78 | false | true | 0 | 6 | 36 | 30 | 14 | 16 | null | null |
phischu/fragnix | tests/packages/scotty/Blaze.ByteString.Builder.Word.hs | bsd-3-clause | -- | Serialize a list of 'Word16's in big endian format.
fromWord16sbe :: [Word16] -> Builder
fromWord16sbe = P.primMapListFixed P.word16BE | 139 | fromWord16sbe :: [Word16] -> Builder
fromWord16sbe = P.primMapListFixed P.word16BE | 82 | fromWord16sbe = P.primMapListFixed P.word16BE | 45 | true | true | 0 | 7 | 19 | 32 | 15 | 17 | null | null |
romanb/amazonka | amazonka-storagegateway/gen/Network/AWS/StorageGateway/CancelRetrieval.hs | mpl-2.0 | -- | 'CancelRetrieval' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'crGatewayARN' @::@ 'Text'
--
-- * 'crTapeARN' @::@ 'Text'
--
cancelRetrieval :: Text -- ^ 'crGatewayARN'
-> Text -- ^ 'crTapeARN'
-> CancelRetrieval
cancelRetrieval p1 p2 = CancelRetrieval
{ _crGatewayARN = p1
, _crTapeARN = p2
} | 383 | cancelRetrieval :: Text -- ^ 'crGatewayARN'
-> Text -- ^ 'crTapeARN'
-> CancelRetrieval
cancelRetrieval p1 p2 = CancelRetrieval
{ _crGatewayARN = p1
, _crTapeARN = p2
} | 215 | cancelRetrieval p1 p2 = CancelRetrieval
{ _crGatewayARN = p1
, _crTapeARN = p2
} | 95 | true | true | 0 | 6 | 99 | 48 | 31 | 17 | null | null |
spirom/haskell-monads | ValueOrDetails.hs | mit | axInRange :: Integer -> Integer -> [Integer] -> ValueOrDetails Integer
maxInRange l u values = maxInRangeRec l u (return l) values
| 142 | maxInRange :: Integer -> Integer -> [Integer] -> ValueOrDetails Integer
maxInRange l u values = maxInRangeRec l u (return l) values | 142 | maxInRange l u values = maxInRangeRec l u (return l) values | 63 | false | true | 0 | 9 | 32 | 55 | 26 | 29 | null | null |
flipstone/kioku | src/Database/Kioku/Core.hs | mit | openKiokuDB :: FilePath -> IO KiokuDB
openKiokuDB path = do
bufs <- newBufferMap
let db = KiokuDB { rootDir = path, bufferMap = bufs }
traverse_ (createDirectoryIfMissing True)
[ dataDir db
, tmpDir db
, dataSetObjDir db
, indexObjDir db
, schemaObjDir db
]
pure db | 348 | openKiokuDB :: FilePath -> IO KiokuDB
openKiokuDB path = do
bufs <- newBufferMap
let db = KiokuDB { rootDir = path, bufferMap = bufs }
traverse_ (createDirectoryIfMissing True)
[ dataDir db
, tmpDir db
, dataSetObjDir db
, indexObjDir db
, schemaObjDir db
]
pure db | 348 | openKiokuDB path = do
bufs <- newBufferMap
let db = KiokuDB { rootDir = path, bufferMap = bufs }
traverse_ (createDirectoryIfMissing True)
[ dataDir db
, tmpDir db
, dataSetObjDir db
, indexObjDir db
, schemaObjDir db
]
pure db | 310 | false | true | 0 | 11 | 128 | 101 | 49 | 52 | null | null |
qmuli/qmuli | library/Qi/Config/AWS/ApiGw/ApiResource/Accessors.hs | mit | getChildren
:: Either ApiId ApiResourceId
-> Config
-> [ApiResourceId]
getChildren rid config = SHM.lookupDefault [] rid $ config^.apiGwConfig.acApiResourceDeps | 166 | getChildren
:: Either ApiId ApiResourceId
-> Config
-> [ApiResourceId]
getChildren rid config = SHM.lookupDefault [] rid $ config^.apiGwConfig.acApiResourceDeps | 166 | getChildren rid config = SHM.lookupDefault [] rid $ config^.apiGwConfig.acApiResourceDeps | 89 | false | true | 0 | 9 | 23 | 57 | 26 | 31 | null | null |
Zankoku-Okuno/conlang-powertools | src/Conlang/Powertools/Segmenter.hs | bsd-3-clause | segmentize :: Segmenter -> String -> [String]
segmentize s "" = [] | 66 | segmentize :: Segmenter -> String -> [String]
segmentize s "" = [] | 66 | segmentize s "" = [] | 20 | false | true | 0 | 7 | 11 | 29 | 15 | 14 | null | null |
DiegoNolan/Asciify | Asciify.hs | mit | charToNovem ',' = Novemant Bnk Bnk Bnk Bnk Bnk Bnk Bnk Drk Bnk | 64 | charToNovem ',' = Novemant Bnk Bnk Bnk Bnk Bnk Bnk Bnk Drk Bnk | 64 | charToNovem ',' = Novemant Bnk Bnk Bnk Bnk Bnk Bnk Bnk Drk Bnk | 64 | false | false | 0 | 5 | 14 | 29 | 13 | 16 | null | null |
seL4/capDL-tool | CapDL/PrintUtils.hs | bsd-2-clause | successiveWords :: [Maybe Word] -> [Word]
successiveWords [] = [] | 65 | successiveWords :: [Maybe Word] -> [Word]
successiveWords [] = [] | 65 | successiveWords [] = [] | 23 | false | true | 0 | 7 | 9 | 31 | 16 | 15 | null | null |
alexkyllo/xtwelve | src/X12/Definitions/ElementDefs.hs | bsd-3-clause | i09 = ElementDef { elementId = "I09"
, elementName = "Interchange Time"
, elementType = "TM"
, elementMinLength = 4
, elementMaxLength = 4
, elementPrecision = Nothing
, elementCodeList = Nothing
} | 316 | i09 = ElementDef { elementId = "I09"
, elementName = "Interchange Time"
, elementType = "TM"
, elementMinLength = 4
, elementMaxLength = 4
, elementPrecision = Nothing
, elementCodeList = Nothing
} | 316 | i09 = ElementDef { elementId = "I09"
, elementName = "Interchange Time"
, elementType = "TM"
, elementMinLength = 4
, elementMaxLength = 4
, elementPrecision = Nothing
, elementCodeList = Nothing
} | 316 | false | false | 1 | 7 | 151 | 57 | 33 | 24 | null | null |
keera-studios/hsQt | Qtc/ClassTypes/Gui.hs | bsd-2-clause | qCastList_QStyleOptionHeader x = qcl_QStyleOptionHeader [] x | 60 | qCastList_QStyleOptionHeader x = qcl_QStyleOptionHeader [] x | 60 | qCastList_QStyleOptionHeader x = qcl_QStyleOptionHeader [] x | 60 | false | false | 0 | 6 | 5 | 16 | 7 | 9 | null | null |
yusent/cfdis | src/CFDI/Types/Currency.hs | mit | decimalPlaces CUR_CZK = 2 | 25 | decimalPlaces CUR_CZK = 2 | 25 | decimalPlaces CUR_CZK = 2 | 25 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
hlian/zwischenzug | Grab.hs | bsd-3-clause | wikipediaChar Knight = "n" | 26 | wikipediaChar Knight = "n" | 26 | wikipediaChar Knight = "n" | 26 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
dagit/hs6502 | src/Emulator/Instructions.hs | bsd-3-clause | fetchOperand AbsoluteX = do
w <- fetchWordAtPC
x <- getReg rX
fetchByteMem (w + (toWord x)) | 97 | fetchOperand AbsoluteX = do
w <- fetchWordAtPC
x <- getReg rX
fetchByteMem (w + (toWord x)) | 97 | fetchOperand AbsoluteX = do
w <- fetchWordAtPC
x <- getReg rX
fetchByteMem (w + (toWord x)) | 97 | false | false | 1 | 12 | 21 | 49 | 20 | 29 | null | null |
tibbe/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | -- Check to make sure that we can generate code for the specified vector type
-- given the current set of dynamic flags.
checkVecCompatibility :: DynFlags -> PrimOpVecCat -> Length -> Width -> FCode ()
checkVecCompatibility dflags vcat l w = do
when (hscTarget dflags /= HscLlvm) $ do
sorry $ unlines ["SIMD vector instructions require the LLVM back-end."
,"Please use -fllvm."]
check vecWidth vcat l w
where
check :: Width -> PrimOpVecCat -> Length -> Width -> FCode ()
check W128 FloatVec 4 W32 | not (isSseEnabled dflags) =
sorry $ "128-bit wide single-precision floating point " ++
"SIMD vector instructions require at least -msse."
check W128 _ _ _ | not (isSse2Enabled dflags) =
sorry $ "128-bit wide integer and double precision " ++
"SIMD vector instructions require at least -msse2."
check W256 FloatVec _ _ | not (isAvxEnabled dflags) =
sorry $ "256-bit wide floating point " ++
"SIMD vector instructions require at least -mavx."
check W256 _ _ _ | not (isAvx2Enabled dflags) =
sorry $ "256-bit wide integer " ++
"SIMD vector instructions require at least -mavx2."
check W512 _ _ _ | not (isAvx512fEnabled dflags) =
sorry $ "512-bit wide " ++
"SIMD vector instructions require -mavx512f."
check _ _ _ _ = return ()
vecWidth = typeWidth (vecVmmType vcat l w)
------------------------------------------------------------------------------
-- Helpers for translating vector packing and unpacking. | 1,600 | checkVecCompatibility :: DynFlags -> PrimOpVecCat -> Length -> Width -> FCode ()
checkVecCompatibility dflags vcat l w = do
when (hscTarget dflags /= HscLlvm) $ do
sorry $ unlines ["SIMD vector instructions require the LLVM back-end."
,"Please use -fllvm."]
check vecWidth vcat l w
where
check :: Width -> PrimOpVecCat -> Length -> Width -> FCode ()
check W128 FloatVec 4 W32 | not (isSseEnabled dflags) =
sorry $ "128-bit wide single-precision floating point " ++
"SIMD vector instructions require at least -msse."
check W128 _ _ _ | not (isSse2Enabled dflags) =
sorry $ "128-bit wide integer and double precision " ++
"SIMD vector instructions require at least -msse2."
check W256 FloatVec _ _ | not (isAvxEnabled dflags) =
sorry $ "256-bit wide floating point " ++
"SIMD vector instructions require at least -mavx."
check W256 _ _ _ | not (isAvx2Enabled dflags) =
sorry $ "256-bit wide integer " ++
"SIMD vector instructions require at least -mavx2."
check W512 _ _ _ | not (isAvx512fEnabled dflags) =
sorry $ "512-bit wide " ++
"SIMD vector instructions require -mavx512f."
check _ _ _ _ = return ()
vecWidth = typeWidth (vecVmmType vcat l w)
------------------------------------------------------------------------------
-- Helpers for translating vector packing and unpacking. | 1,479 | checkVecCompatibility dflags vcat l w = do
when (hscTarget dflags /= HscLlvm) $ do
sorry $ unlines ["SIMD vector instructions require the LLVM back-end."
,"Please use -fllvm."]
check vecWidth vcat l w
where
check :: Width -> PrimOpVecCat -> Length -> Width -> FCode ()
check W128 FloatVec 4 W32 | not (isSseEnabled dflags) =
sorry $ "128-bit wide single-precision floating point " ++
"SIMD vector instructions require at least -msse."
check W128 _ _ _ | not (isSse2Enabled dflags) =
sorry $ "128-bit wide integer and double precision " ++
"SIMD vector instructions require at least -msse2."
check W256 FloatVec _ _ | not (isAvxEnabled dflags) =
sorry $ "256-bit wide floating point " ++
"SIMD vector instructions require at least -mavx."
check W256 _ _ _ | not (isAvx2Enabled dflags) =
sorry $ "256-bit wide integer " ++
"SIMD vector instructions require at least -mavx2."
check W512 _ _ _ | not (isAvx512fEnabled dflags) =
sorry $ "512-bit wide " ++
"SIMD vector instructions require -mavx512f."
check _ _ _ _ = return ()
vecWidth = typeWidth (vecVmmType vcat l w)
------------------------------------------------------------------------------
-- Helpers for translating vector packing and unpacking. | 1,398 | true | true | 0 | 12 | 423 | 344 | 163 | 181 | null | null |
fatuhoku/haskell-noughts-and-crosses | src/NAA/AI.hs | bsd-3-clause | -- The unbeatable AI
-------------------------
-- Based on a simple mini-max algorithm.
-- Scoring is based on the number of ways that a given a particular
unbeatableAI :: GameState -> IO Move
unbeatableAI gs@(GameState {computer=me,boardState=bs}) =
return $ argmax (score me . apply bs) $ validMoves bs | 307 | unbeatableAI :: GameState -> IO Move
unbeatableAI gs@(GameState {computer=me,boardState=bs}) =
return $ argmax (score me . apply bs) $ validMoves bs | 150 | unbeatableAI gs@(GameState {computer=me,boardState=bs}) =
return $ argmax (score me . apply bs) $ validMoves bs | 113 | true | true | 8 | 10 | 49 | 78 | 40 | 38 | null | null |
paulbarbu/haskell-ground | modifiable_lists.hs | apache-2.0 | replaceValueIndex :: Expr -> [Int] -> Expr -> [Expr]
replaceValueIndex (List list) [i] val = replace i val list | 111 | replaceValueIndex :: Expr -> [Int] -> Expr -> [Expr]
replaceValueIndex (List list) [i] val = replace i val list | 111 | replaceValueIndex (List list) [i] val = replace i val list | 58 | false | true | 0 | 8 | 18 | 52 | 27 | 25 | null | null |
kinghajj/Life | src/Life/Model.hs | bsd-3-clause | isFemale _ = False | 46 | isFemale _ = False | 46 | isFemale _ = False | 46 | false | false | 0 | 4 | 31 | 10 | 4 | 6 | null | null |
koulakis/FiletreeAnalyser | test/Spec.hs | bsd-3-clause | file52 = combine dir5 "I_am_spec.hs" | 36 | file52 = combine dir5 "I_am_spec.hs" | 36 | file52 = combine dir5 "I_am_spec.hs" | 36 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
DavidAlphaFox/ghc | libraries/Cabal/cabal-install/Distribution/Client/Exec.hs | bsd-3-clause | requireProgram' :: Verbosity
-> UseSandbox
-> ProgramDb
-> String
-> IO ConfiguredProgram
requireProgram' verbosity useSandbox programDb exe = do
(program, _) <- requireProgram
verbosity
(simpleProgram exe)
updateSearchPath
return program
where
updateSearchPath =
flip modifyProgramSearchPath programDb $ \searchPath ->
case useSandbox of
NoSandbox -> searchPath
UseSandbox sandboxDir ->
ProgramSearchPathDir (sandboxDir </> "bin") : searchPath | 666 | requireProgram' :: Verbosity
-> UseSandbox
-> ProgramDb
-> String
-> IO ConfiguredProgram
requireProgram' verbosity useSandbox programDb exe = do
(program, _) <- requireProgram
verbosity
(simpleProgram exe)
updateSearchPath
return program
where
updateSearchPath =
flip modifyProgramSearchPath programDb $ \searchPath ->
case useSandbox of
NoSandbox -> searchPath
UseSandbox sandboxDir ->
ProgramSearchPathDir (sandboxDir </> "bin") : searchPath | 666 | requireProgram' verbosity useSandbox programDb exe = do
(program, _) <- requireProgram
verbosity
(simpleProgram exe)
updateSearchPath
return program
where
updateSearchPath =
flip modifyProgramSearchPath programDb $ \searchPath ->
case useSandbox of
NoSandbox -> searchPath
UseSandbox sandboxDir ->
ProgramSearchPathDir (sandboxDir </> "bin") : searchPath | 512 | false | true | 0 | 13 | 274 | 126 | 61 | 65 | null | null |
bflyblue/parse-quote | IP4.hs | unlicense | fromProtocol UDP = 17 | 32 | fromProtocol UDP = 17 | 32 | fromProtocol UDP = 17 | 32 | false | false | 0 | 4 | 14 | 10 | 4 | 6 | null | null |
sighingnow/Functional-99-Problems | Haskell/37.hs | mit | encode (x:xs) = (x, (+1) $ length $ takeWhile (== x) xs) : encode (dropWhile (== x) xs) | 87 | encode (x:xs) = (x, (+1) $ length $ takeWhile (== x) xs) : encode (dropWhile (== x) xs) | 87 | encode (x:xs) = (x, (+1) $ length $ takeWhile (== x) xs) : encode (dropWhile (== x) xs) | 87 | false | false | 0 | 9 | 17 | 62 | 34 | 28 | null | null |
GaloisInc/estimator | src/Numeric/Estimator/Model/SensorFusion.hs | bsd-3-clause | processModel :: Fractional a
=> a
-- ^ time since last process model update
-> AugmentState StateVector DisturbanceVector a
-- ^ prior (augmented) state
-> AugmentState StateVector DisturbanceVector a
-- ^ posterior (augmented) state
processModel dt (AugmentState state dist) = AugmentState state' $ pure 0
where
state' = state
-- Discretization of @qdot = 0.5 * <0, deltaAngle> * q@.
--
-- * /Strapdown Inertial Navigation Technology, 2nd Ed/, section 11.2.5 (on
-- pages 319-320) gives qdot and its analytic discretization, without proof.
-- * http://en.wikipedia.org/wiki/Discretization derives the general form of
-- discretization.
-- * http://www.euclideanspace.com/physics/kinematics/angularvelocity/QuaternionDifferentiation2.pdf
-- derives qdot from angular momentum.
{ stateOrient = stateOrient state `quatMul` deltaQuat
, stateVel = stateVel state + deltaVel
, statePos = statePos state + fmap (* dt) (stateVel state + fmap (/ 2) deltaVel)
-- remaining state vector elements are unchanged by the process model
}
-- Even fairly low-order approximations introduce error small enough
-- that it's swamped by other filter errors.
deltaQuat = approxAxisAngle 3 $ xyzToVec3 $ fmap (* dt) $ disturbanceGyro dist - stateGyroBias state
deltaVel = fmap (* dt) $ body2nav state (disturbanceAccel dist) + g
g = ned 0 0 9.80665 -- NED gravity vector - m/sec^2
-- | Compute the local air pressure from the state vector. Useful as a
-- measurement model for a pressure sensor. | 1,695 | processModel :: Fractional a
=> a
-- ^ time since last process model update
-> AugmentState StateVector DisturbanceVector a
-- ^ prior (augmented) state
-> AugmentState StateVector DisturbanceVector a
processModel dt (AugmentState state dist) = AugmentState state' $ pure 0
where
state' = state
-- Discretization of @qdot = 0.5 * <0, deltaAngle> * q@.
--
-- * /Strapdown Inertial Navigation Technology, 2nd Ed/, section 11.2.5 (on
-- pages 319-320) gives qdot and its analytic discretization, without proof.
-- * http://en.wikipedia.org/wiki/Discretization derives the general form of
-- discretization.
-- * http://www.euclideanspace.com/physics/kinematics/angularvelocity/QuaternionDifferentiation2.pdf
-- derives qdot from angular momentum.
{ stateOrient = stateOrient state `quatMul` deltaQuat
, stateVel = stateVel state + deltaVel
, statePos = statePos state + fmap (* dt) (stateVel state + fmap (/ 2) deltaVel)
-- remaining state vector elements are unchanged by the process model
}
-- Even fairly low-order approximations introduce error small enough
-- that it's swamped by other filter errors.
deltaQuat = approxAxisAngle 3 $ xyzToVec3 $ fmap (* dt) $ disturbanceGyro dist - stateGyroBias state
deltaVel = fmap (* dt) $ body2nav state (disturbanceAccel dist) + g
g = ned 0 0 9.80665 -- NED gravity vector - m/sec^2
-- | Compute the local air pressure from the state vector. Useful as a
-- measurement model for a pressure sensor. | 1,649 | processModel dt (AugmentState state dist) = AugmentState state' $ pure 0
where
state' = state
-- Discretization of @qdot = 0.5 * <0, deltaAngle> * q@.
--
-- * /Strapdown Inertial Navigation Technology, 2nd Ed/, section 11.2.5 (on
-- pages 319-320) gives qdot and its analytic discretization, without proof.
-- * http://en.wikipedia.org/wiki/Discretization derives the general form of
-- discretization.
-- * http://www.euclideanspace.com/physics/kinematics/angularvelocity/QuaternionDifferentiation2.pdf
-- derives qdot from angular momentum.
{ stateOrient = stateOrient state `quatMul` deltaQuat
, stateVel = stateVel state + deltaVel
, statePos = statePos state + fmap (* dt) (stateVel state + fmap (/ 2) deltaVel)
-- remaining state vector elements are unchanged by the process model
}
-- Even fairly low-order approximations introduce error small enough
-- that it's swamped by other filter errors.
deltaQuat = approxAxisAngle 3 $ xyzToVec3 $ fmap (* dt) $ disturbanceGyro dist - stateGyroBias state
deltaVel = fmap (* dt) $ body2nav state (disturbanceAccel dist) + g
g = ned 0 0 9.80665 -- NED gravity vector - m/sec^2
-- | Compute the local air pressure from the state vector. Useful as a
-- measurement model for a pressure sensor. | 1,383 | true | true | 0 | 12 | 444 | 239 | 129 | 110 | null | null |
kawamuray/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | oobStatusUnknown :: String
oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown | 83 | oobStatusUnknown :: String
oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown | 83 | oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown | 56 | false | true | 0 | 6 | 6 | 16 | 8 | 8 | null | null |
kawamuray/ganeti | test/hs/Test/Ganeti/Locking/Waiting.hs | gpl-2.0 | -- | Verify the result list of the opportunistic union: if a lock is not in
-- the result that, than its state has not changed, and if it is, it is as
-- requested. The latter property is tested in that liberal way, so that we
-- really can take arbitrary requests, including those that require both, shared
-- and exlusive state for the same lock.
prop_OpportunisticAnswer :: Property
prop_OpportunisticAnswer =
forAll (arbitrary :: Gen (LockWaiting TestLock TestOwner Integer)) $ \state ->
forAll (arbitrary :: Gen TestOwner) $ \a ->
forAll ((choose (1,3) >>= vector) :: Gen [(TestLock, L.OwnerState)]) $ \req ->
let (state', (result, _)) = opportunisticLockUnion a req state
oldOwned = listLocks a $ getAllocation state
newOwned = listLocks a $ getAllocation state'
involvedLocks = M.keys oldOwned ++ map fst req
in conjoin [ printTestCase ("Locks not in the answer set " ++ show result
++ " may not be changed, but found "
++ show state')
. flip all involvedLocks $ \lock ->
(lock `elem` result)
|| (M.lookup lock oldOwned == M.lookup lock newOwned)
, printTestCase ("Locks not in the answer set " ++ show result
++ " must be as requested, but found "
++ show state')
. flip all involvedLocks $ \lock ->
notElem lock result
|| maybe False (flip elem req . (,) lock)
(M.lookup lock newOwned)
] | 1,596 | prop_OpportunisticAnswer :: Property
prop_OpportunisticAnswer =
forAll (arbitrary :: Gen (LockWaiting TestLock TestOwner Integer)) $ \state ->
forAll (arbitrary :: Gen TestOwner) $ \a ->
forAll ((choose (1,3) >>= vector) :: Gen [(TestLock, L.OwnerState)]) $ \req ->
let (state', (result, _)) = opportunisticLockUnion a req state
oldOwned = listLocks a $ getAllocation state
newOwned = listLocks a $ getAllocation state'
involvedLocks = M.keys oldOwned ++ map fst req
in conjoin [ printTestCase ("Locks not in the answer set " ++ show result
++ " may not be changed, but found "
++ show state')
. flip all involvedLocks $ \lock ->
(lock `elem` result)
|| (M.lookup lock oldOwned == M.lookup lock newOwned)
, printTestCase ("Locks not in the answer set " ++ show result
++ " must be as requested, but found "
++ show state')
. flip all involvedLocks $ \lock ->
notElem lock result
|| maybe False (flip elem req . (,) lock)
(M.lookup lock newOwned)
] | 1,247 | prop_OpportunisticAnswer =
forAll (arbitrary :: Gen (LockWaiting TestLock TestOwner Integer)) $ \state ->
forAll (arbitrary :: Gen TestOwner) $ \a ->
forAll ((choose (1,3) >>= vector) :: Gen [(TestLock, L.OwnerState)]) $ \req ->
let (state', (result, _)) = opportunisticLockUnion a req state
oldOwned = listLocks a $ getAllocation state
newOwned = listLocks a $ getAllocation state'
involvedLocks = M.keys oldOwned ++ map fst req
in conjoin [ printTestCase ("Locks not in the answer set " ++ show result
++ " may not be changed, but found "
++ show state')
. flip all involvedLocks $ \lock ->
(lock `elem` result)
|| (M.lookup lock oldOwned == M.lookup lock newOwned)
, printTestCase ("Locks not in the answer set " ++ show result
++ " must be as requested, but found "
++ show state')
. flip all involvedLocks $ \lock ->
notElem lock result
|| maybe False (flip elem req . (,) lock)
(M.lookup lock newOwned)
] | 1,210 | true | true | 0 | 22 | 524 | 367 | 188 | 179 | null | null |
Shou/Tombot | Tombot/Discord.hs | gpl-2.0 | onMessage :: Connection -> Dispatch MessageCreate -> IO ()
onMessage conn dsptch@(Dispatch op d s t) = do
putStrLn . mconcat $ [ show (messagecAuthor d)
, " — ", show (messagecContent d)
]
atomically $ swapTMVar stateSeq $ maybe 0 id s
atomically $ writeTChan recvTChan $ messagecContent d
allUsers <- atomically $ readTVar stateUsers
config <- atomically $ readTVar =<< readTMVar stateConfigt
tid <- myThreadId
let chanName = fromString $ messagecChannel_id d
ciChanName = CI.mk chanName
meta <- getChannelMeta chanName
let serverUsers = maybe Map.empty id $ Map.lookup (view _1 meta) allUsers
let chan :: Tombot.Channel Discord.Discord
chan = Tombot.Channel { Tombot._chanName = CI.mk $ view _2 meta
, Tombot._chanId = chanName
, Tombot._chanTopic = ""
, Tombot._chanJoin = True
, Tombot._chanAutoJoin = True
, Tombot._chanPrefix = ":"
, Tombot._chanFuncs = Tombot.funcs
, Tombot._chanService = def
}
chans = [ (chanName, chan) ]
-- XXX idiot???
nick = maybe "idiot" id . Map.lookup "username" $ messagecAuthor d
uid = maybe "" id . Map.lookup "id" $ messagecAuthor d
user = Tombot.User nick "" uid (Set.singleton ciChanName) Tombot.Online def
users' = flip Map.map serverUsers
$ Lens.over Tombot.userChannels $ Set.insert ciChanName
bot = Tombot.Bot { Tombot._botNick = "Tombot"
, Tombot._botName = "Tombot"
, Tombot._botId = ""
, Tombot._botService = def
}
server = Tombot.Server { Tombot._servId = view _1 meta
, Tombot._servChannels = chans
, Tombot._servBot = bot
, Tombot._servStatus = Tombot.Connected
, Tombot._servUsers = users'
, Tombot._servService = def
}
current = Tombot.Current { Tombot._currUser = user
, Tombot._currServer = server
, Tombot._currDestination = Right chan
, Tombot._currSender = sendMessage
, Tombot._currConfig = config
}
message = Tombot.Message (messagecContent d) uid chanName ()
s <- newTVarIO current
flip runReaderT s $ do
Discord.messageTell message
void . Tombot.forkMi $ Discord.messageMatch message
void . Tombot.forkMi $ Discord.messageInterpret message
Discord.messageLog message
Discord.messageTopicDetection message | 3,016 | onMessage :: Connection -> Dispatch MessageCreate -> IO ()
onMessage conn dsptch@(Dispatch op d s t) = do
putStrLn . mconcat $ [ show (messagecAuthor d)
, " — ", show (messagecContent d)
]
atomically $ swapTMVar stateSeq $ maybe 0 id s
atomically $ writeTChan recvTChan $ messagecContent d
allUsers <- atomically $ readTVar stateUsers
config <- atomically $ readTVar =<< readTMVar stateConfigt
tid <- myThreadId
let chanName = fromString $ messagecChannel_id d
ciChanName = CI.mk chanName
meta <- getChannelMeta chanName
let serverUsers = maybe Map.empty id $ Map.lookup (view _1 meta) allUsers
let chan :: Tombot.Channel Discord.Discord
chan = Tombot.Channel { Tombot._chanName = CI.mk $ view _2 meta
, Tombot._chanId = chanName
, Tombot._chanTopic = ""
, Tombot._chanJoin = True
, Tombot._chanAutoJoin = True
, Tombot._chanPrefix = ":"
, Tombot._chanFuncs = Tombot.funcs
, Tombot._chanService = def
}
chans = [ (chanName, chan) ]
-- XXX idiot???
nick = maybe "idiot" id . Map.lookup "username" $ messagecAuthor d
uid = maybe "" id . Map.lookup "id" $ messagecAuthor d
user = Tombot.User nick "" uid (Set.singleton ciChanName) Tombot.Online def
users' = flip Map.map serverUsers
$ Lens.over Tombot.userChannels $ Set.insert ciChanName
bot = Tombot.Bot { Tombot._botNick = "Tombot"
, Tombot._botName = "Tombot"
, Tombot._botId = ""
, Tombot._botService = def
}
server = Tombot.Server { Tombot._servId = view _1 meta
, Tombot._servChannels = chans
, Tombot._servBot = bot
, Tombot._servStatus = Tombot.Connected
, Tombot._servUsers = users'
, Tombot._servService = def
}
current = Tombot.Current { Tombot._currUser = user
, Tombot._currServer = server
, Tombot._currDestination = Right chan
, Tombot._currSender = sendMessage
, Tombot._currConfig = config
}
message = Tombot.Message (messagecContent d) uid chanName ()
s <- newTVarIO current
flip runReaderT s $ do
Discord.messageTell message
void . Tombot.forkMi $ Discord.messageMatch message
void . Tombot.forkMi $ Discord.messageInterpret message
Discord.messageLog message
Discord.messageTopicDetection message | 3,016 | onMessage conn dsptch@(Dispatch op d s t) = do
putStrLn . mconcat $ [ show (messagecAuthor d)
, " — ", show (messagecContent d)
]
atomically $ swapTMVar stateSeq $ maybe 0 id s
atomically $ writeTChan recvTChan $ messagecContent d
allUsers <- atomically $ readTVar stateUsers
config <- atomically $ readTVar =<< readTMVar stateConfigt
tid <- myThreadId
let chanName = fromString $ messagecChannel_id d
ciChanName = CI.mk chanName
meta <- getChannelMeta chanName
let serverUsers = maybe Map.empty id $ Map.lookup (view _1 meta) allUsers
let chan :: Tombot.Channel Discord.Discord
chan = Tombot.Channel { Tombot._chanName = CI.mk $ view _2 meta
, Tombot._chanId = chanName
, Tombot._chanTopic = ""
, Tombot._chanJoin = True
, Tombot._chanAutoJoin = True
, Tombot._chanPrefix = ":"
, Tombot._chanFuncs = Tombot.funcs
, Tombot._chanService = def
}
chans = [ (chanName, chan) ]
-- XXX idiot???
nick = maybe "idiot" id . Map.lookup "username" $ messagecAuthor d
uid = maybe "" id . Map.lookup "id" $ messagecAuthor d
user = Tombot.User nick "" uid (Set.singleton ciChanName) Tombot.Online def
users' = flip Map.map serverUsers
$ Lens.over Tombot.userChannels $ Set.insert ciChanName
bot = Tombot.Bot { Tombot._botNick = "Tombot"
, Tombot._botName = "Tombot"
, Tombot._botId = ""
, Tombot._botService = def
}
server = Tombot.Server { Tombot._servId = view _1 meta
, Tombot._servChannels = chans
, Tombot._servBot = bot
, Tombot._servStatus = Tombot.Connected
, Tombot._servUsers = users'
, Tombot._servService = def
}
current = Tombot.Current { Tombot._currUser = user
, Tombot._currServer = server
, Tombot._currDestination = Right chan
, Tombot._currSender = sendMessage
, Tombot._currConfig = config
}
message = Tombot.Message (messagecContent d) uid chanName ()
s <- newTVarIO current
flip runReaderT s $ do
Discord.messageTell message
void . Tombot.forkMi $ Discord.messageMatch message
void . Tombot.forkMi $ Discord.messageInterpret message
Discord.messageLog message
Discord.messageTopicDetection message | 2,957 | false | true | 0 | 13 | 1,252 | 727 | 369 | 358 | null | null |
dmcclean/HaTeX | Text/LaTeX/Base/Commands.hs | bsd-3-clause | thispagestyle :: LaTeXC l => PageStyle -> l
thispagestyle ps = fromLaTeX $ TeXComm "thispagestyle" [FixArg $ fromString ps] | 123 | thispagestyle :: LaTeXC l => PageStyle -> l
thispagestyle ps = fromLaTeX $ TeXComm "thispagestyle" [FixArg $ fromString ps] | 123 | thispagestyle ps = fromLaTeX $ TeXComm "thispagestyle" [FixArg $ fromString ps] | 79 | false | true | 0 | 9 | 18 | 44 | 21 | 23 | null | null |
olorin/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | The ARN of the IAM role that posts logs to CloudWatch Logs.
flDeliverLogsPermissionARN :: Lens' FlowLog (Maybe Text)
flDeliverLogsPermissionARN = lens _flDeliverLogsPermissionARN (\ s a -> s{_flDeliverLogsPermissionARN = a}) | 229 | flDeliverLogsPermissionARN :: Lens' FlowLog (Maybe Text)
flDeliverLogsPermissionARN = lens _flDeliverLogsPermissionARN (\ s a -> s{_flDeliverLogsPermissionARN = a}) | 164 | flDeliverLogsPermissionARN = lens _flDeliverLogsPermissionARN (\ s a -> s{_flDeliverLogsPermissionARN = a}) | 107 | true | true | 0 | 9 | 30 | 46 | 25 | 21 | null | null |
eval-so/cruncher | src/Evalso/Cruncher/Language/Idris.hs | bsd-3-clause | idris :: Language
idris = Language {
_codeFilename = "program.idr"
, _compileCommand = Just ["idris", "-o", "program", "program.idr"]
, _compileTimeout = Just 5
, _runCommand = ["./program"]
, _runTimeout = 5
, _codemirror = "idris"
, _rpm = "idris"
, _displayName = "Idris"
} | 294 | idris :: Language
idris = Language {
_codeFilename = "program.idr"
, _compileCommand = Just ["idris", "-o", "program", "program.idr"]
, _compileTimeout = Just 5
, _runCommand = ["./program"]
, _runTimeout = 5
, _codemirror = "idris"
, _rpm = "idris"
, _displayName = "Idris"
} | 294 | idris = Language {
_codeFilename = "program.idr"
, _compileCommand = Just ["idris", "-o", "program", "program.idr"]
, _compileTimeout = Just 5
, _runCommand = ["./program"]
, _runTimeout = 5
, _codemirror = "idris"
, _rpm = "idris"
, _displayName = "Idris"
} | 276 | false | true | 0 | 9 | 61 | 92 | 53 | 39 | null | null |
thomasjm/IHaskell | main/Main.hs | mit | -- | Create a new message header, given a parent message header.
createReplyHeader :: MessageHeader -> Interpreter MessageHeader
createReplyHeader parent = do
-- Generate a new message UUID.
newMessageId <- liftIO UUID.random
let repType = fromMaybe err (replyType $ msgType parent)
err = error $ "No reply for message " ++ show (msgType parent)
return
MessageHeader
{ identifiers = identifiers parent
, parentHeader = Just parent
, metadata = Map.fromList []
, messageId = newMessageId
, sessionId = sessionId parent
, username = username parent
, msgType = repType
}
-- | Compute a reply to a message. | 671 | createReplyHeader :: MessageHeader -> Interpreter MessageHeader
createReplyHeader parent = do
-- Generate a new message UUID.
newMessageId <- liftIO UUID.random
let repType = fromMaybe err (replyType $ msgType parent)
err = error $ "No reply for message " ++ show (msgType parent)
return
MessageHeader
{ identifiers = identifiers parent
, parentHeader = Just parent
, metadata = Map.fromList []
, messageId = newMessageId
, sessionId = sessionId parent
, username = username parent
, msgType = repType
}
-- | Compute a reply to a message. | 606 | createReplyHeader parent = do
-- Generate a new message UUID.
newMessageId <- liftIO UUID.random
let repType = fromMaybe err (replyType $ msgType parent)
err = error $ "No reply for message " ++ show (msgType parent)
return
MessageHeader
{ identifiers = identifiers parent
, parentHeader = Just parent
, metadata = Map.fromList []
, messageId = newMessageId
, sessionId = sessionId parent
, username = username parent
, msgType = repType
}
-- | Compute a reply to a message. | 542 | true | true | 0 | 14 | 165 | 155 | 79 | 76 | null | null |
josuf107/Adverb | Adverb/Common.hs | gpl-3.0 | apathetically = id | 18 | apathetically = id | 18 | apathetically = id | 18 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
Copilot-Language/sbv-for-copilot | Data/SBV/Examples/Puzzles/Euler185.hs | bsd-3-clause | solveEuler185 :: IO ()
solveEuler185 = do res <- allSat euler185
cnt <- displayModels disp res
putStrLn $ "Number of solutions: " ++ show cnt
where disp _ (_, ss) = putStrLn $ concatMap show (ss :: [Word8]) | 247 | solveEuler185 :: IO ()
solveEuler185 = do res <- allSat euler185
cnt <- displayModels disp res
putStrLn $ "Number of solutions: " ++ show cnt
where disp _ (_, ss) = putStrLn $ concatMap show (ss :: [Word8]) | 247 | solveEuler185 = do res <- allSat euler185
cnt <- displayModels disp res
putStrLn $ "Number of solutions: " ++ show cnt
where disp _ (_, ss) = putStrLn $ concatMap show (ss :: [Word8]) | 224 | false | true | 0 | 8 | 78 | 88 | 43 | 45 | null | null |
phischu/fragnix | builtins/base/Data.List.NonEmpty.hs | bsd-3-clause | -- | @'dropWhile' p xs@ returns the suffix remaining after
-- @'takeWhile' p xs@.
dropWhile :: (a -> Bool) -> NonEmpty a -> [a]
dropWhile p = List.dropWhile p . toList | 167 | dropWhile :: (a -> Bool) -> NonEmpty a -> [a]
dropWhile p = List.dropWhile p . toList | 85 | dropWhile p = List.dropWhile p . toList | 39 | true | true | 0 | 7 | 30 | 46 | 24 | 22 | null | null |
hvr/text | Data/Text/Lazy/Encoding.hs | bsd-2-clause | -- | Decode text from big endian UTF-32 encoding.
--
-- If the input contains any invalid big endian UTF-32 data, an
-- exception will be thrown. For more control over the handling of
-- invalid data, use 'decodeUtf32BEWith'.
decodeUtf32BE :: B.ByteString -> Text
decodeUtf32BE = decodeUtf32BEWith strictDecode | 311 | decodeUtf32BE :: B.ByteString -> Text
decodeUtf32BE = decodeUtf32BEWith strictDecode | 84 | decodeUtf32BE = decodeUtf32BEWith strictDecode | 46 | true | true | 0 | 6 | 48 | 25 | 15 | 10 | null | null |
markflorisson/hpack | testrepo/bytestring-0.10.4.1/Data/ByteString/Lazy.hs | bsd-3-clause | --TODO: use a better implementation
-- ---------------------------------------------------------------------
-- Searching for substrings
-- | /O(n)/ The 'isPrefixOf' function takes two ByteStrings and returns 'True'
-- iff the first is a prefix of the second.
isPrefixOf :: ByteString -> ByteString -> Bool
isPrefixOf Empty _ = True | 335 | isPrefixOf :: ByteString -> ByteString -> Bool
isPrefixOf Empty _ = True | 73 | isPrefixOf Empty _ = True | 26 | true | true | 0 | 6 | 47 | 29 | 17 | 12 | null | null |
fmapfmapfmap/amazonka | amazonka-autoscaling/gen/Network/AWS/AutoScaling/DescribeAutoScalingNotificationTypes.hs | mpl-2.0 | -- | Creates a value of 'DescribeAutoScalingNotificationTypesResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dasntrsAutoScalingNotificationTypes'
--
-- * 'dasntrsResponseStatus'
describeAutoScalingNotificationTypesResponse
:: Int -- ^ 'dasntrsResponseStatus'
-> DescribeAutoScalingNotificationTypesResponse
describeAutoScalingNotificationTypesResponse pResponseStatus_ =
DescribeAutoScalingNotificationTypesResponse'
{ _dasntrsAutoScalingNotificationTypes = Nothing
, _dasntrsResponseStatus = pResponseStatus_
} | 631 | describeAutoScalingNotificationTypesResponse
:: Int -- ^ 'dasntrsResponseStatus'
-> DescribeAutoScalingNotificationTypesResponse
describeAutoScalingNotificationTypesResponse pResponseStatus_ =
DescribeAutoScalingNotificationTypesResponse'
{ _dasntrsAutoScalingNotificationTypes = Nothing
, _dasntrsResponseStatus = pResponseStatus_
} | 357 | describeAutoScalingNotificationTypesResponse pResponseStatus_ =
DescribeAutoScalingNotificationTypesResponse'
{ _dasntrsAutoScalingNotificationTypes = Nothing
, _dasntrsResponseStatus = pResponseStatus_
} | 220 | true | true | 0 | 7 | 82 | 49 | 28 | 21 | null | null |
hvr/jhc | src/FrontEnd/Tc/Kind.hs | mit | kindArg = KBase KQuestQuest | 30 | kindArg = KBase KQuestQuest | 30 | kindArg = KBase KQuestQuest | 30 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
narrative/stack | src/Stack/Constants.hs | bsd-3-clause | -- | Output .o/.hi directory.
objectInterfaceDir :: (MonadReader env m, HasConfig env)
=> BuildConfig -> m (Path Abs Dir)
objectInterfaceDir bconfig = do
bcwd <- bcWorkDir bconfig
return (bcwd </> $(mkRelDir "odir/"))
-- | The filename used for dirtiness check of source files. | 284 | objectInterfaceDir :: (MonadReader env m, HasConfig env)
=> BuildConfig -> m (Path Abs Dir)
objectInterfaceDir bconfig = do
bcwd <- bcWorkDir bconfig
return (bcwd </> $(mkRelDir "odir/"))
-- | The filename used for dirtiness check of source files. | 254 | objectInterfaceDir bconfig = do
bcwd <- bcWorkDir bconfig
return (bcwd </> $(mkRelDir "odir/"))
-- | The filename used for dirtiness check of source files. | 160 | true | true | 0 | 12 | 49 | 78 | 38 | 40 | null | null |
grandpascorpion/canon | Math/NumberTheory/Internals.hs | gpl-3.0 | -- | Check if a CR_ represents an integer.
crIntegral :: CR_ -> Bool
crIntegral x = all (\(_,e) -> e > 0) x | 107 | crIntegral :: CR_ -> Bool
crIntegral x = all (\(_,e) -> e > 0) x | 64 | crIntegral x = all (\(_,e) -> e > 0) x | 38 | true | true | 0 | 8 | 23 | 48 | 24 | 24 | null | null |
santolucito/Euterpea_Projects | QuantumArt/GlossInterface.hs | mit | playYampa ::
Display ->
Color ->
Int ->
SF (Event G.Event) Picture ->
IO ()
playYampa display color frequency network =
do
vPic <- newIORef Blank
events <- newIORef NoEvent
handle <- reactInit
(return NoEvent)
(\_ changed pic ->
do
if changed then vPic `writeIORef` pic else return ()
return False)
network
_ <- react handle (infts, Just NoEvent)
-- Since `react` requires nonzero time intervals,
-- we pass infinitesimal time intervals and accumulate them on
-- the variable `t`. Then every frame `delta` is corrected by `t`.
G.playIO
display
color
frequency
infts -- initial t. This is for initial step
(const $ readIORef vPic)
-- does not handle multiple events within one update cycle
-- TODO make events :: IORef [Event]?
(\e t -> writeIORef events (Event e) >> return (t+infts))
(\delta t ->
let
delta' = realToFrac delta - t
in
if delta' > 0
then do
e <- readIORef events
_ <- react handle (delta', Just e)
atomicWriteIORef events NoEvent
return 0.0
else
return (-delta'))
where
infts = 0.01 / fromIntegral frequency | 1,420 | playYampa ::
Display ->
Color ->
Int ->
SF (Event G.Event) Picture ->
IO ()
playYampa display color frequency network =
do
vPic <- newIORef Blank
events <- newIORef NoEvent
handle <- reactInit
(return NoEvent)
(\_ changed pic ->
do
if changed then vPic `writeIORef` pic else return ()
return False)
network
_ <- react handle (infts, Just NoEvent)
-- Since `react` requires nonzero time intervals,
-- we pass infinitesimal time intervals and accumulate them on
-- the variable `t`. Then every frame `delta` is corrected by `t`.
G.playIO
display
color
frequency
infts -- initial t. This is for initial step
(const $ readIORef vPic)
-- does not handle multiple events within one update cycle
-- TODO make events :: IORef [Event]?
(\e t -> writeIORef events (Event e) >> return (t+infts))
(\delta t ->
let
delta' = realToFrac delta - t
in
if delta' > 0
then do
e <- readIORef events
_ <- react handle (delta', Just e)
atomicWriteIORef events NoEvent
return 0.0
else
return (-delta'))
where
infts = 0.01 / fromIntegral frequency | 1,419 | playYampa display color frequency network =
do
vPic <- newIORef Blank
events <- newIORef NoEvent
handle <- reactInit
(return NoEvent)
(\_ changed pic ->
do
if changed then vPic `writeIORef` pic else return ()
return False)
network
_ <- react handle (infts, Just NoEvent)
-- Since `react` requires nonzero time intervals,
-- we pass infinitesimal time intervals and accumulate them on
-- the variable `t`. Then every frame `delta` is corrected by `t`.
G.playIO
display
color
frequency
infts -- initial t. This is for initial step
(const $ readIORef vPic)
-- does not handle multiple events within one update cycle
-- TODO make events :: IORef [Event]?
(\e t -> writeIORef events (Event e) >> return (t+infts))
(\delta t ->
let
delta' = realToFrac delta - t
in
if delta' > 0
then do
e <- readIORef events
_ <- react handle (delta', Just e)
atomicWriteIORef events NoEvent
return 0.0
else
return (-delta'))
where
infts = 0.01 / fromIntegral frequency | 1,322 | false | true | 0 | 18 | 571 | 334 | 163 | 171 | null | null |
onponomarev/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | validIpVersions :: FrozenSet Int
validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version] | 95 | validIpVersions :: FrozenSet Int
validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version] | 95 | validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version] | 62 | false | true | 0 | 6 | 8 | 30 | 14 | 16 | null | null |
mimi1vx/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | prop_checkWhileReadPitfalls3 = verifyNot checkWhileReadPitfalls "while true; do ssh host uptime; done" | 102 | prop_checkWhileReadPitfalls3 = verifyNot checkWhileReadPitfalls "while true; do ssh host uptime; done" | 102 | prop_checkWhileReadPitfalls3 = verifyNot checkWhileReadPitfalls "while true; do ssh host uptime; done" | 102 | false | false | 0 | 5 | 10 | 11 | 5 | 6 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/nativeGen/RegAlloc/Graph/SpillClean.hs | bsd-3-clause | - | Clean out unneeded spill\/reloads from this top level thing.
cleanSpills
:: Instruction instr
=> Platform
-> LiveCmmDecl statics instr
-> LiveCmmDecl statics instr
cleanSpills platform cmm
= evalState (cleanSpin platform 0 cmm) initCleanS
| 286 | cleanSpills
:: Instruction instr
=> Platform
-> LiveCmmDecl statics instr
-> LiveCmmDecl statics instr
cleanSpills platform cmm
= evalState (cleanSpin platform 0 cmm) initCleanS | 219 | cleanSpills platform cmm
= evalState (cleanSpin platform 0 cmm) initCleanS | 82 | true | true | 2 | 10 | 78 | 65 | 32 | 33 | null | null |
kowey/pandoc-old | src/Text/Pandoc/Readers/TeXMath.hs | gpl-2.0 | subscript :: GenParser Char st [Inline]
subscript = try $ do
char '_'
arg <- scriptArg
return [Subscript arg] | 115 | subscript :: GenParser Char st [Inline]
subscript = try $ do
char '_'
arg <- scriptArg
return [Subscript arg] | 115 | subscript = try $ do
char '_'
arg <- scriptArg
return [Subscript arg] | 75 | false | true | 3 | 10 | 24 | 56 | 23 | 33 | null | null |
swian/minesweeper | src/App/Ui.hs | bsd-3-clause | keyEvent st (V.EvKey V.KLeft []) = M.continue $ st & position._1 %~ max (st^.board.minX) . subtract 1 | 107 | keyEvent st (V.EvKey V.KLeft []) = M.continue $ st & position._1 %~ max (st^.board.minX) . subtract 1 | 107 | keyEvent st (V.EvKey V.KLeft []) = M.continue $ st & position._1 %~ max (st^.board.minX) . subtract 1 | 107 | false | false | 0 | 10 | 22 | 60 | 29 | 31 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/book/2019-Program_Design_by_Calculation-Oliveira/2015-05-LambdaConf/Const.hs | unlicense | length0 [] = 0 | 14 | length0 [] = 0 | 14 | length0 [] = 0 | 14 | false | false | 1 | 5 | 3 | 15 | 5 | 10 | null | null |
spacekitteh/smcghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitPrimOp dflags res ReadOffAddrOp_Int32 args = doIndexOffAddrOp (Just (mo_s_32ToWord dflags)) b32 res args | 121 | emitPrimOp dflags res ReadOffAddrOp_Int32 args = doIndexOffAddrOp (Just (mo_s_32ToWord dflags)) b32 res args | 121 | emitPrimOp dflags res ReadOffAddrOp_Int32 args = doIndexOffAddrOp (Just (mo_s_32ToWord dflags)) b32 res args | 121 | false | false | 0 | 9 | 25 | 40 | 17 | 23 | null | null |
facebookarchive/lex-pass | src/Main.hs | bsd-3-clause | showStRes :: CanErrStrIO (Bool, [String]) -> CanErrStrIO Bool
showStRes f = do
(ret, st) <- f
liftIO . putStr $ unlines st
return ret | 139 | showStRes :: CanErrStrIO (Bool, [String]) -> CanErrStrIO Bool
showStRes f = do
(ret, st) <- f
liftIO . putStr $ unlines st
return ret | 139 | showStRes f = do
(ret, st) <- f
liftIO . putStr $ unlines st
return ret | 77 | false | true | 0 | 9 | 29 | 71 | 33 | 38 | null | null |
jmct/IterativeCompiler | frontend/GMachine.hs | mit | arithmetic2 :: (Int -> Int -> Int) -> GMState -> GMState
arithmetic2 = primitive2 boxInteger unboxInteger | 105 | arithmetic2 :: (Int -> Int -> Int) -> GMState -> GMState
arithmetic2 = primitive2 boxInteger unboxInteger | 105 | arithmetic2 = primitive2 boxInteger unboxInteger | 48 | false | true | 0 | 8 | 15 | 35 | 18 | 17 | null | null |
fpco/th-utilities | src/TH/Utilities.hs | mit | appsT :: Type -> [Type] -> Type
appsT x [] = x | 46 | appsT :: Type -> [Type] -> Type
appsT x [] = x | 46 | appsT x [] = x | 14 | false | true | 0 | 9 | 11 | 35 | 16 | 19 | null | null |
dorchard/camfort | src/Camfort/Specification/Stencils/Annotation.hs | apache-2.0 | -- | Retrieve the underlying (base) annotation from a stencil annotation.
getBaseAnnotation :: SA -> Ann.A
getBaseAnnotation = prevAnnotation . FA.prevAnnotation | 161 | getBaseAnnotation :: SA -> Ann.A
getBaseAnnotation = prevAnnotation . FA.prevAnnotation | 87 | getBaseAnnotation = prevAnnotation . FA.prevAnnotation | 54 | true | true | 1 | 8 | 20 | 32 | 14 | 18 | null | null |
ademinn/RefactoringVerification | src/lib/FJ/Semantic.hs | bsd-3-clause | checkUnique :: (a -> a -> Bool) -> (a -> String) -> [a] -> Checker ()
checkUnique eqFunc showErr ls = mapM_ checkElem ls
where
checkElem e = check (length (filter (eqFunc e) ls) == 1) $ showErr e | 207 | checkUnique :: (a -> a -> Bool) -> (a -> String) -> [a] -> Checker ()
checkUnique eqFunc showErr ls = mapM_ checkElem ls
where
checkElem e = check (length (filter (eqFunc e) ls) == 1) $ showErr e | 207 | checkUnique eqFunc showErr ls = mapM_ checkElem ls
where
checkElem e = check (length (filter (eqFunc e) ls) == 1) $ showErr e | 137 | false | true | 0 | 13 | 50 | 105 | 52 | 53 | null | null |
GaloisInc/halvm-ghc | compiler/main/DynFlags.hs | bsd-3-clause | tARGET_MAX_INT dflags
= case platformWordSize (targetPlatform dflags) of
4 -> toInteger (maxBound :: Int32)
8 -> toInteger (maxBound :: Int64)
w -> panic ("tARGET_MAX_INT: Unknown platformWordSize: " ++ show w) | 232 | tARGET_MAX_INT dflags
= case platformWordSize (targetPlatform dflags) of
4 -> toInteger (maxBound :: Int32)
8 -> toInteger (maxBound :: Int64)
w -> panic ("tARGET_MAX_INT: Unknown platformWordSize: " ++ show w) | 232 | tARGET_MAX_INT dflags
= case platformWordSize (targetPlatform dflags) of
4 -> toInteger (maxBound :: Int32)
8 -> toInteger (maxBound :: Int64)
w -> panic ("tARGET_MAX_INT: Unknown platformWordSize: " ++ show w) | 232 | false | false | 0 | 11 | 51 | 71 | 35 | 36 | null | null |
atsukotakahashi/wi | src/library/Yi/UI/Pango.hs | gpl-2.0 | mkCol :: Bool -- ^ is foreground?
-> Yi.Style.Color -> Gtk.Color
mkCol True Default = Color 0 0 0 | 104 | mkCol :: Bool -- ^ is foreground?
-> Yi.Style.Color -> Gtk.Color
mkCol True Default = Color 0 0 0 | 104 | mkCol True Default = Color 0 0 0 | 33 | false | true | 0 | 9 | 25 | 42 | 20 | 22 | null | null |
jmacmahon/syllabify | Linguisticks/Statistics/Processing.hs | agpl-3.0 | buildSyllablesSample :: (U.Syllables -> Double) -> [U.ParsedWord U.Syllables] -> S.Sample
buildSyllablesSample f = V.fromList . map f . rights . map U.wordSyllables | 164 | buildSyllablesSample :: (U.Syllables -> Double) -> [U.ParsedWord U.Syllables] -> S.Sample
buildSyllablesSample f = V.fromList . map f . rights . map U.wordSyllables | 164 | buildSyllablesSample f = V.fromList . map f . rights . map U.wordSyllables | 74 | false | true | 0 | 9 | 21 | 68 | 33 | 35 | null | null |
harendra-kumar/stack | src/Network/HTTP/Download/Verified.hs | bsd-3-clause | sinkHashUsing :: (Monad m, HashAlgorithm a) => a -> Consumer ByteString m (Digest a)
sinkHashUsing _ = sinkHash | 111 | sinkHashUsing :: (Monad m, HashAlgorithm a) => a -> Consumer ByteString m (Digest a)
sinkHashUsing _ = sinkHash | 111 | sinkHashUsing _ = sinkHash | 26 | false | true | 0 | 9 | 17 | 50 | 24 | 26 | null | null |
wereHamster/nauva | pkg/hs/color/src/Data/Color/Internal/Conversion.hs | mit | toCIELAB :: Chromaticity -> Iso' Color CIELAB
toCIELAB white = iso sa bt
where
Color {cX = xn, cY = yn, cZ = zn} = mkColor white 1
rho = 6 / 29
sa :: Color -> CIELAB
sa Color{..} = CIELAB (116 * fy - 16) (500 * (fx - fy)) (200 * (fy - fz))
where
(fx, fy, fz) = (f (cX/xn), f (cY/yn), f (cZ/zn))
f t = if t > (rho ** 3) then t ** (1/3) else (t / (3 * (rho ** 2))) + 4 / 29
bt (CIELAB l a b) = Color x y z
where
l' = (l + 16) / 116
x = xn * f (l' + (a / 500))
y = yn * f l'
z = zn * f (l' - (b / 200))
f t = if t > rho then t ** 3 else 3 * (rho ** 2) * (t - 4 / 29)
------------------------------------------------------------------------------
-- SRGB | 750 | toCIELAB :: Chromaticity -> Iso' Color CIELAB
toCIELAB white = iso sa bt
where
Color {cX = xn, cY = yn, cZ = zn} = mkColor white 1
rho = 6 / 29
sa :: Color -> CIELAB
sa Color{..} = CIELAB (116 * fy - 16) (500 * (fx - fy)) (200 * (fy - fz))
where
(fx, fy, fz) = (f (cX/xn), f (cY/yn), f (cZ/zn))
f t = if t > (rho ** 3) then t ** (1/3) else (t / (3 * (rho ** 2))) + 4 / 29
bt (CIELAB l a b) = Color x y z
where
l' = (l + 16) / 116
x = xn * f (l' + (a / 500))
y = yn * f l'
z = zn * f (l' - (b / 200))
f t = if t > rho then t ** 3 else 3 * (rho ** 2) * (t - 4 / 29)
------------------------------------------------------------------------------
-- SRGB | 750 | toCIELAB white = iso sa bt
where
Color {cX = xn, cY = yn, cZ = zn} = mkColor white 1
rho = 6 / 29
sa :: Color -> CIELAB
sa Color{..} = CIELAB (116 * fy - 16) (500 * (fx - fy)) (200 * (fy - fz))
where
(fx, fy, fz) = (f (cX/xn), f (cY/yn), f (cZ/zn))
f t = if t > (rho ** 3) then t ** (1/3) else (t / (3 * (rho ** 2))) + 4 / 29
bt (CIELAB l a b) = Color x y z
where
l' = (l + 16) / 116
x = xn * f (l' + (a / 500))
y = yn * f l'
z = zn * f (l' - (b / 200))
f t = if t > rho then t ** 3 else 3 * (rho ** 2) * (t - 4 / 29)
------------------------------------------------------------------------------
-- SRGB | 704 | false | true | 24 | 11 | 262 | 445 | 232 | 213 | null | null |
zporky/langs-and-paradigms | projects/ODGXAE/Haskell/FloatParse.hs | mit | double :: Parser Double
double = ((sign <*> double') <|> double') <* eof | 72 | double :: Parser Double
double = ((sign <*> double') <|> double') <* eof | 72 | double = ((sign <*> double') <|> double') <* eof | 48 | false | true | 0 | 9 | 12 | 32 | 17 | 15 | null | null |
pparkkin/eta | compiler/ETA/CodeGen/Rts.hs | bsd-3-clause | (storeF, loadF) = contextLoadStore "F" jfloat | 45 | (storeF, loadF) = contextLoadStore "F" jfloat | 45 | (storeF, loadF) = contextLoadStore "F" jfloat | 45 | false | false | 0 | 5 | 5 | 18 | 9 | 9 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/CARET_1.hs | mit | primMinusNat :: Nat -> Nat -> MyInt;
primMinusNat Zero Zero = Pos Zero | 74 | primMinusNat :: Nat -> Nat -> MyInt
primMinusNat Zero Zero = Pos Zero | 73 | primMinusNat Zero Zero = Pos Zero | 33 | false | true | 0 | 6 | 16 | 28 | 14 | 14 | null | null |
liamoc/hilbert | TreeWidget.hs | bsd-3-clause | keyActionToIO _ _ (MovePrev ) r = updateWidgetState r prev | 63 | keyActionToIO _ _ (MovePrev ) r = updateWidgetState r prev | 63 | keyActionToIO _ _ (MovePrev ) r = updateWidgetState r prev | 63 | false | false | 0 | 6 | 14 | 23 | 11 | 12 | null | null |
cjp256/manager | xenmgr/Vm/Queries.hs | gpl-2.0 | getVmNx uuid = readConfigPropertyDef uuid vmNx False | 52 | getVmNx uuid = readConfigPropertyDef uuid vmNx False | 52 | getVmNx uuid = readConfigPropertyDef uuid vmNx False | 52 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
romanofski/gtfsbrisbane | src/GTFS/Realtime/Internal/Com/Google/Transit/Realtime/TripDescriptor/ScheduleRelationship.hs | bsd-3-clause | toMaybe'Enum 1 = Prelude'.Just ADDED | 36 | toMaybe'Enum 1 = Prelude'.Just ADDED | 36 | toMaybe'Enum 1 = Prelude'.Just ADDED | 36 | false | false | 0 | 6 | 4 | 14 | 6 | 8 | null | null |
tpsinnem/Idris-dev | src/IRTS/JavaScript/AST.hs | bsd-3-clause | compileJS' indent (JSDelete js) =
"delete " `T.append` compileJS' 0 js | 72 | compileJS' indent (JSDelete js) =
"delete " `T.append` compileJS' 0 js | 72 | compileJS' indent (JSDelete js) =
"delete " `T.append` compileJS' 0 js | 72 | false | false | 0 | 7 | 12 | 30 | 15 | 15 | null | null |
brendanhay/gogol | gogol-apps-calendar/gen/Network/Google/Resource/Calendar/Events/Watch.hs | mpl-2.0 | -- | The maximum number of attendees to include in the response. If there are
-- more than the specified number of attendees, only the participant is
-- returned. Optional.
ewMaxAttendees :: Lens' EventsWatch (Maybe Int32)
ewMaxAttendees
= lens _ewMaxAttendees
(\ s a -> s{_ewMaxAttendees = a})
. mapping _Coerce | 326 | ewMaxAttendees :: Lens' EventsWatch (Maybe Int32)
ewMaxAttendees
= lens _ewMaxAttendees
(\ s a -> s{_ewMaxAttendees = a})
. mapping _Coerce | 153 | ewMaxAttendees
= lens _ewMaxAttendees
(\ s a -> s{_ewMaxAttendees = a})
. mapping _Coerce | 103 | true | true | 1 | 8 | 63 | 59 | 30 | 29 | null | null |
jgm/pandoc2 | Benchmark.hs | gpl-2.0 | main = do
inp <- B.readFile "README.markdown"
let poptions' = poptions
let convert :: B.ByteString -> Maybe Blocks
convert = markdownDoc poptions' . decodeUtf8
defaultMain [ bench ("markdown reader") $ whnf convert inp ] | 234 | main = do
inp <- B.readFile "README.markdown"
let poptions' = poptions
let convert :: B.ByteString -> Maybe Blocks
convert = markdownDoc poptions' . decodeUtf8
defaultMain [ bench ("markdown reader") $ whnf convert inp ] | 234 | main = do
inp <- B.readFile "README.markdown"
let poptions' = poptions
let convert :: B.ByteString -> Maybe Blocks
convert = markdownDoc poptions' . decodeUtf8
defaultMain [ bench ("markdown reader") $ whnf convert inp ] | 234 | false | false | 1 | 8 | 47 | 77 | 37 | 40 | null | null |
brownplt/strobe-old | src/BrownPLT/TypedJS/TypeErasure.hs | bsd-2-clause | expr (CallExpr p e _ es) = JS.CallExpr p (expr e) (map expr es) | 63 | expr (CallExpr p e _ es) = JS.CallExpr p (expr e) (map expr es) | 63 | expr (CallExpr p e _ es) = JS.CallExpr p (expr e) (map expr es) | 63 | false | false | 0 | 7 | 13 | 45 | 21 | 24 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 1673 = 1672 | 11 | 1673 = 1672 | 11 | 1673 = 1672 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
themoritz/cabal | cabal-install/tests/UnitTests/Distribution/Client/Store.hs | bsd-3-clause | tests :: [TestTree]
tests =
[ testCase "list content empty" testListEmpty
, testCase "install serial" testInstallSerial
--, testCase "install parallel" testInstallParallel
--TODO: figure out some way to do a parallel test, see issue below
] | 259 | tests :: [TestTree]
tests =
[ testCase "list content empty" testListEmpty
, testCase "install serial" testInstallSerial
--, testCase "install parallel" testInstallParallel
--TODO: figure out some way to do a parallel test, see issue below
] | 259 | tests =
[ testCase "list content empty" testListEmpty
, testCase "install serial" testInstallSerial
--, testCase "install parallel" testInstallParallel
--TODO: figure out some way to do a parallel test, see issue below
] | 239 | false | true | 0 | 7 | 53 | 39 | 19 | 20 | null | null |
Icelandjack/lens | src/Control/Lens/Setter.hs | bsd-3-clause | ------------------------------------------------------------------------------
-- Using Setters with State
------------------------------------------------------------------------------
-- | Replace the target of a 'Lens' or all of the targets of a 'Setter' or 'Traversal' in our monadic
-- state with a new value, irrespective of the old.
--
-- This is an alias for ('.=').
--
-- >>> execState (do assign _1 c; assign _2 d) (a,b)
-- (c,d)
--
-- >>> execState (both .= c) (a,b)
-- (c,c)
--
-- @
-- 'assign' :: 'MonadState' s m => 'Iso'' s a -> a -> m ()
-- 'assign' :: 'MonadState' s m => 'Lens'' s a -> a -> m ()
-- 'assign' :: 'MonadState' s m => 'Traversal'' s a -> a -> m ()
-- 'assign' :: 'MonadState' s m => 'Setter'' s a -> a -> m ()
-- @
assign :: MonadState s m => ASetter s s a b -> b -> m ()
assign l b = State.modify (set l b) | 853 | assign :: MonadState s m => ASetter s s a b -> b -> m ()
assign l b = State.modify (set l b) | 92 | assign l b = State.modify (set l b) | 35 | true | true | 0 | 9 | 173 | 84 | 49 | 35 | null | null |
kylcarte/structures | src/Data/Structure.hs | bsd-3-clause | g1 :: GExp Int
g1 = hole_ "3" | 29 | g1 :: GExp Int
g1 = hole_ "3" | 29 | g1 = hole_ "3" | 14 | false | true | 0 | 6 | 7 | 23 | 9 | 14 | null | null |
facebook/fbthrift | thrift/compiler/test/fixtures/includes/gen-hs/Module_Types.hs | apache-2.0 | -- | Write a 'MyStruct' with the given 'Thrift.Protocol'
write_MyStruct :: (Thrift.Protocol p, Thrift.Transport t) => p t -> MyStruct -> IO ()
write_MyStruct oprot record = Thrift.writeVal oprot $ from_MyStruct record | 217 | write_MyStruct :: (Thrift.Protocol p, Thrift.Transport t) => p t -> MyStruct -> IO ()
write_MyStruct oprot record = Thrift.writeVal oprot $ from_MyStruct record | 160 | write_MyStruct oprot record = Thrift.writeVal oprot $ from_MyStruct record | 74 | true | true | 0 | 9 | 31 | 64 | 31 | 33 | null | null |
hdevtools/hdevtools | src/Info.hs | mit | getTypeLHsExpr _ e = do
#else
getTypeLHsExpr tcm e = do
#endif
hs_env <- GHC.getSession
#if __GLASGOW_HASKELL__ >= 708
(_, mbe) <- liftIO $ Desugar.deSugarExpr hs_env e
#else
let modu = GHC.ms_mod $ GHC.pm_mod_summary $ GHC.tm_parsed_module tcm
rn_env = TcRnTypes.tcg_rdr_env $ fst $ GHC.tm_internals_ tcm
ty_env = TcRnTypes.tcg_type_env $ fst $ GHC.tm_internals_ tcm
(_, mbe) <- liftIO $ Desugar.deSugarExpr hs_env modu rn_env ty_env e
#endif
return ()
case mbe of
Nothing -> return Nothing
Just expr -> return $ Just (GHC.getLoc e, CoreUtils.exprType expr) | 616 | getTypeLHsExpr _ e = do
#else
getTypeLHsExpr tcm e = do
#endif
hs_env <- GHC.getSession
#if __GLASGOW_HASKELL__ >= 708
(_, mbe) <- liftIO $ Desugar.deSugarExpr hs_env e
#else
let modu = GHC.ms_mod $ GHC.pm_mod_summary $ GHC.tm_parsed_module tcm
rn_env = TcRnTypes.tcg_rdr_env $ fst $ GHC.tm_internals_ tcm
ty_env = TcRnTypes.tcg_type_env $ fst $ GHC.tm_internals_ tcm
(_, mbe) <- liftIO $ Desugar.deSugarExpr hs_env modu rn_env ty_env e
#endif
return ()
case mbe of
Nothing -> return Nothing
Just expr -> return $ Just (GHC.getLoc e, CoreUtils.exprType expr) | 616 | getTypeLHsExpr _ e = do
#else
getTypeLHsExpr tcm e = do
#endif
hs_env <- GHC.getSession
#if __GLASGOW_HASKELL__ >= 708
(_, mbe) <- liftIO $ Desugar.deSugarExpr hs_env e
#else
let modu = GHC.ms_mod $ GHC.pm_mod_summary $ GHC.tm_parsed_module tcm
rn_env = TcRnTypes.tcg_rdr_env $ fst $ GHC.tm_internals_ tcm
ty_env = TcRnTypes.tcg_type_env $ fst $ GHC.tm_internals_ tcm
(_, mbe) <- liftIO $ Desugar.deSugarExpr hs_env modu rn_env ty_env e
#endif
return ()
case mbe of
Nothing -> return Nothing
Just expr -> return $ Just (GHC.getLoc e, CoreUtils.exprType expr) | 616 | false | false | 1 | 15 | 141 | 106 | 51 | 55 | null | null |
jyp/ling | Ling/Compile/C.hs | bsd-3-clause | -- Of course this does not properlly handle dependent types
transSig :: Env -> Name -> Typ -> Maybe Term -> C.Def
transSig env0 f ty0 (Just t) = transErr "transSig: TODO unsupported def" t | 188 | transSig :: Env -> Name -> Typ -> Maybe Term -> C.Def
transSig env0 f ty0 (Just t) = transErr "transSig: TODO unsupported def" t | 128 | transSig env0 f ty0 (Just t) = transErr "transSig: TODO unsupported def" t | 74 | true | true | 0 | 9 | 34 | 53 | 26 | 27 | null | null |
Heather/Shake.it.off | src/Shake/It/Off.hs | bsd-3-clause | -- Phony' operator
(@@>) ∷ (String, [String]) → IO () → IO ()
(r, d) @@> a = phony d r a | 88 | (@@>) ∷ (String, [String]) → IO () → IO ()
(r, d) @@> a = phony d r a | 69 | (r, d) @@> a = phony d r a | 26 | true | true | 0 | 8 | 21 | 60 | 32 | 28 | null | null |
GaloisInc/sk-dev-platform | libs/lviz/LViz.hs | bsd-3-clause | figSouthNode :: [Text] -> M Fig
figSouthNode n = figNode pi n `hcatr` figRot90 (nodeLabel n `hcatc` rect (nodeLabelOffset,0)) | 125 | figSouthNode :: [Text] -> M Fig
figSouthNode n = figNode pi n `hcatr` figRot90 (nodeLabel n `hcatc` rect (nodeLabelOffset,0)) | 125 | figSouthNode n = figNode pi n `hcatr` figRot90 (nodeLabel n `hcatc` rect (nodeLabelOffset,0)) | 93 | false | true | 0 | 10 | 18 | 59 | 31 | 28 | null | null |
nkartashov/SplitMix | src/System/Random/SplitMix/Utils.hs | mit | goldenGamma :: Word64
goldenGamma = 0x9e3779b97f4a7c15 | 54 | goldenGamma :: Word64
goldenGamma = 0x9e3779b97f4a7c15 | 54 | goldenGamma = 0x9e3779b97f4a7c15 | 32 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
DanielAtSamraksh/checkReceivedSnapshots | testread.hs | mit | printChars :: Chars -> IO()
printChars cs = mapM_ print cs | 58 | printChars :: Chars -> IO()
printChars cs = mapM_ print cs | 58 | printChars cs = mapM_ print cs | 30 | false | true | 0 | 7 | 10 | 28 | 13 | 15 | null | null |
soumith/fbthrift | thrift/lib/hs/Thrift/Protocol/JSON.hs | apache-2.0 | buildJSONList :: [ThriftVal] -> Builder
buildJSONList = mconcat . intersperse "," . map buildJSONValue | 102 | buildJSONList :: [ThriftVal] -> Builder
buildJSONList = mconcat . intersperse "," . map buildJSONValue | 102 | buildJSONList = mconcat . intersperse "," . map buildJSONValue | 62 | false | true | 0 | 7 | 13 | 32 | 16 | 16 | null | null |
ekmett/bitwise | src/Data/Array/BitArray/IO.hs | bsd-3-clause | getElems :: Ix i => IOBitArray i -> IO [Bool]
getElems a = unsafeGetElems =<< copy a | 84 | getElems :: Ix i => IOBitArray i -> IO [Bool]
getElems a = unsafeGetElems =<< copy a | 84 | getElems a = unsafeGetElems =<< copy a | 38 | false | true | 0 | 9 | 16 | 45 | 20 | 25 | null | null |
kvanberendonck/gmoc | src/GMOC/GML/Parser.hs | mit | lineComment :: GMLParsing m => m ()
lineComment = string "//" *> manyTill anyChar eol *> pure ()
<?> "line comment" | 119 | lineComment :: GMLParsing m => m ()
lineComment = string "//" *> manyTill anyChar eol *> pure ()
<?> "line comment" | 119 | lineComment = string "//" *> manyTill anyChar eol *> pure ()
<?> "line comment" | 83 | false | true | 4 | 8 | 24 | 57 | 24 | 33 | null | null |
rockdragon/julia-programming | code/haskell/Test.hs | mit | tupleToElem :: (String, String, Int) -> Element
tupleToElem (n, s, a) = Element { name = n
, symbol = s
, atomicNumber = a } | 188 | tupleToElem :: (String, String, Int) -> Element
tupleToElem (n, s, a) = Element { name = n
, symbol = s
, atomicNumber = a } | 188 | tupleToElem (n, s, a) = Element { name = n
, symbol = s
, atomicNumber = a } | 140 | false | true | 0 | 6 | 89 | 60 | 35 | 25 | null | null |
bgold-cosmos/Tidal | src/Sound/Tidal/Stream.hs | gpl-3.0 | streamResetCycles :: Stream -> IO ()
streamResetCycles s = do _ <- T.resetCycles (sTempoMV s)
return () | 128 | streamResetCycles :: Stream -> IO ()
streamResetCycles s = do _ <- T.resetCycles (sTempoMV s)
return () | 128 | streamResetCycles s = do _ <- T.resetCycles (sTempoMV s)
return () | 91 | false | true | 0 | 10 | 41 | 49 | 22 | 27 | null | null |
romanb/amazonka | amazonka-ec2/gen/Network/AWS/EC2/CreateVpnConnection.hs | mpl-2.0 | -- | 'CreateVpnConnectionResponse' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'cvcrVpnConnection' @::@ 'Maybe' 'VpnConnection'
--
createVpnConnectionResponse :: CreateVpnConnectionResponse
createVpnConnectionResponse = CreateVpnConnectionResponse
{ _cvcrVpnConnection = Nothing
} | 327 | createVpnConnectionResponse :: CreateVpnConnectionResponse
createVpnConnectionResponse = CreateVpnConnectionResponse
{ _cvcrVpnConnection = Nothing
} | 157 | createVpnConnectionResponse = CreateVpnConnectionResponse
{ _cvcrVpnConnection = Nothing
} | 98 | true | true | 0 | 6 | 39 | 28 | 18 | 10 | null | null |
elitak/forest | Language/Forest/Parser.hs | epl-1.0 | identifier = PT.identifier lexer | 36 | identifier = PT.identifier lexer | 36 | identifier = PT.identifier lexer | 36 | false | false | 0 | 6 | 7 | 11 | 5 | 6 | null | null |
gridaphobe/ghc | compiler/hsSyn/HsLit.hs | bsd-3-clause | pmPprHsLit (HsWordPrim _ w) = integer w | 41 | pmPprHsLit (HsWordPrim _ w) = integer w | 41 | pmPprHsLit (HsWordPrim _ w) = integer w | 41 | false | false | 0 | 7 | 8 | 20 | 9 | 11 | null | null |
Sentenai/solr-query | src/Solr/Query/Param.hs | bsd-3-clause | compileSortParam :: (Text, SortWay) -> Builder
compileSortParam = \case
(s, Asc) -> thaw' s <> " asc"
(s, Desc) -> thaw' s <> " desc" | 138 | compileSortParam :: (Text, SortWay) -> Builder
compileSortParam = \case
(s, Asc) -> thaw' s <> " asc"
(s, Desc) -> thaw' s <> " desc" | 138 | compileSortParam = \case
(s, Asc) -> thaw' s <> " asc"
(s, Desc) -> thaw' s <> " desc" | 91 | false | true | 0 | 9 | 29 | 68 | 34 | 34 | null | null |
bgamari/shaking-up-ghc | src/Oracles/Setting.hs | bsd-3-clause | -- | Canonicalised GHC version number, used for integer version comparisons. We
-- expand GhcMinorVersion to two digits by adding a leading zero if necessary.
ghcCanonVersion :: Action String
ghcCanonVersion = do
ghcMajorVersion <- setting GhcMajorVersion
ghcMinorVersion <- setting GhcMinorVersion
let leadingZero = [ '0' | length ghcMinorVersion == 1 ]
return $ ghcMajorVersion ++ leadingZero ++ ghcMinorVersion
-- ref: https://ghc.haskell.org/trac/ghc/wiki/Building/Installing#HowGHCfindsitsfiles
-- | On Windows we normally build a relocatable installation, which assumes that
-- the library directory @libdir@ is in a fixed location relative to the GHC
-- binary, namely @../lib@. | 702 | ghcCanonVersion :: Action String
ghcCanonVersion = do
ghcMajorVersion <- setting GhcMajorVersion
ghcMinorVersion <- setting GhcMinorVersion
let leadingZero = [ '0' | length ghcMinorVersion == 1 ]
return $ ghcMajorVersion ++ leadingZero ++ ghcMinorVersion
-- ref: https://ghc.haskell.org/trac/ghc/wiki/Building/Installing#HowGHCfindsitsfiles
-- | On Windows we normally build a relocatable installation, which assumes that
-- the library directory @libdir@ is in a fixed location relative to the GHC
-- binary, namely @../lib@. | 543 | ghcCanonVersion = do
ghcMajorVersion <- setting GhcMajorVersion
ghcMinorVersion <- setting GhcMinorVersion
let leadingZero = [ '0' | length ghcMinorVersion == 1 ]
return $ ghcMajorVersion ++ leadingZero ++ ghcMinorVersion
-- ref: https://ghc.haskell.org/trac/ghc/wiki/Building/Installing#HowGHCfindsitsfiles
-- | On Windows we normally build a relocatable installation, which assumes that
-- the library directory @libdir@ is in a fixed location relative to the GHC
-- binary, namely @../lib@. | 510 | true | true | 0 | 13 | 108 | 78 | 39 | 39 | null | null |
eb-gh-cr/XMonadContrib1 | XMonad/Hooks/DebugEvents.hs | bsd-3-clause | runDecode :: Decode -> DecodeState -> Decoder Bool -> X (Bool,DecodeState)
runDecode c s (Decoder p) = runStateT (runReaderT p c) s | 148 | runDecode :: Decode -> DecodeState -> Decoder Bool -> X (Bool,DecodeState)
runDecode c s (Decoder p) = runStateT (runReaderT p c) s | 148 | runDecode c s (Decoder p) = runStateT (runReaderT p c) s | 57 | false | true | 0 | 9 | 38 | 61 | 30 | 31 | null | null |
kim/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types.hs | mpl-2.0 | -- | The AMI launch index, which can be used to find this instance in the launch
-- group.
i1AmiLaunchIndex :: Lens' Instance Int
i1AmiLaunchIndex = lens _i1AmiLaunchIndex (\s a -> s { _i1AmiLaunchIndex = a }) | 209 | i1AmiLaunchIndex :: Lens' Instance Int
i1AmiLaunchIndex = lens _i1AmiLaunchIndex (\s a -> s { _i1AmiLaunchIndex = a }) | 118 | i1AmiLaunchIndex = lens _i1AmiLaunchIndex (\s a -> s { _i1AmiLaunchIndex = a }) | 79 | true | true | 0 | 9 | 36 | 48 | 24 | 24 | null | null |
prowdsponsor/mangopay | mangopay/src/Web/MangoPay/Types.hs | bsd-3-clause | incomeBounds IncomeRange3 = (kEuros 30,kEuros 50) | 49 | incomeBounds IncomeRange3 = (kEuros 30,kEuros 50) | 49 | incomeBounds IncomeRange3 = (kEuros 30,kEuros 50) | 49 | false | false | 0 | 6 | 5 | 21 | 10 | 11 | null | null |
nagyf/wyas | src/Parser.hs | mit | readExprList :: String -> ThrowsError [LispVal]
readExprList = readOrThrow (endBy parseExpr spaces) | 99 | readExprList :: String -> ThrowsError [LispVal]
readExprList = readOrThrow (endBy parseExpr spaces) | 99 | readExprList = readOrThrow (endBy parseExpr spaces) | 51 | false | true | 0 | 8 | 11 | 37 | 17 | 20 | null | null |
rueshyna/gogol | gogol-taskqueue/gen/Network/Google/Resource/TaskQueue/Tasks/Patch.hs | mpl-2.0 | tpTask :: Lens' TasksPatch Text
tpTask = lens _tpTask (\ s a -> s{_tpTask = a}) | 79 | tpTask :: Lens' TasksPatch Text
tpTask = lens _tpTask (\ s a -> s{_tpTask = a}) | 79 | tpTask = lens _tpTask (\ s a -> s{_tpTask = a}) | 47 | false | true | 0 | 9 | 15 | 46 | 22 | 24 | null | null |
michaelficarra/purescript | src/Language/PureScript/TypeChecker.hs | mit | typeCheckModule :: forall m.
(Functor m, Applicative m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) =>
Module ->
m Module
typeCheckModule (Module _ _ _ _ Nothing) = internalError "exports should have been elaborated" | 262 | typeCheckModule :: forall m.
(Functor m, Applicative m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) =>
Module ->
m Module
typeCheckModule (Module _ _ _ _ Nothing) = internalError "exports should have been elaborated" | 262 | typeCheckModule (Module _ _ _ _ Nothing) = internalError "exports should have been elaborated" | 94 | false | true | 0 | 8 | 41 | 82 | 41 | 41 | null | null |
GaloisInc/haskell-tor | src/Tor/DataFormat/DirCertInfo.hs | bsd-3-clause | generateHash :: ByteString -> ByteString
generateHash infile = sha1 (run infile)
where
run bstr =
case BS.span (/= 10) bstr of
(start, finale) | "\ndir-key-certification\n" `BS.isPrefixOf` finale ->
start `BS.append` "\ndir-key-certification\n"
(start, rest) ->
start `BS.append` (BS.singleton 10) `BS.append` run (BS.drop 1 rest) | 365 | generateHash :: ByteString -> ByteString
generateHash infile = sha1 (run infile)
where
run bstr =
case BS.span (/= 10) bstr of
(start, finale) | "\ndir-key-certification\n" `BS.isPrefixOf` finale ->
start `BS.append` "\ndir-key-certification\n"
(start, rest) ->
start `BS.append` (BS.singleton 10) `BS.append` run (BS.drop 1 rest) | 365 | generateHash infile = sha1 (run infile)
where
run bstr =
case BS.span (/= 10) bstr of
(start, finale) | "\ndir-key-certification\n" `BS.isPrefixOf` finale ->
start `BS.append` "\ndir-key-certification\n"
(start, rest) ->
start `BS.append` (BS.singleton 10) `BS.append` run (BS.drop 1 rest) | 324 | false | true | 1 | 12 | 77 | 144 | 73 | 71 | null | null |
bitemyapp/ghc | compiler/typecheck/TcEvidence.hs | bsd-3-clause | -- See Note [Role twiddling functions] in Coercion
-- | Change the role of a 'TcCoercion'. Panics if this isn't a downgrade.
tcDowngradeRole :: Role -- ^ desired role
-> Role -- ^ current role
-> TcCoercion -> TcCoercion
tcDowngradeRole r1 r2 co
= case tcDowngradeRole_maybe r1 r2 co of
Just co' -> co'
Nothing -> pprPanic "tcDowngradeRole" (ppr r1 <+> ppr r2 <+> ppr co)
-- | If the EqRel is ReprEq, makes a TcSubCo; otherwise, does nothing.
-- Note that the input coercion should always be nominal. | 550 | tcDowngradeRole :: Role -- ^ desired role
-> Role -- ^ current role
-> TcCoercion -> TcCoercion
tcDowngradeRole r1 r2 co
= case tcDowngradeRole_maybe r1 r2 co of
Just co' -> co'
Nothing -> pprPanic "tcDowngradeRole" (ppr r1 <+> ppr r2 <+> ppr co)
-- | If the EqRel is ReprEq, makes a TcSubCo; otherwise, does nothing.
-- Note that the input coercion should always be nominal. | 425 | tcDowngradeRole r1 r2 co
= case tcDowngradeRole_maybe r1 r2 co of
Just co' -> co'
Nothing -> pprPanic "tcDowngradeRole" (ppr r1 <+> ppr r2 <+> ppr co)
-- | If the EqRel is ReprEq, makes a TcSubCo; otherwise, does nothing.
-- Note that the input coercion should always be nominal. | 295 | true | true | 0 | 12 | 138 | 87 | 44 | 43 | null | null |
greydot/dns | Network/DNS/StateBinary.hs | bsd-3-clause | getNByteString :: Int -> SGet ByteString
getNByteString n = ST.lift (A.take n) <* addPosition n | 95 | getNByteString :: Int -> SGet ByteString
getNByteString n = ST.lift (A.take n) <* addPosition n | 95 | getNByteString n = ST.lift (A.take n) <* addPosition n | 54 | false | true | 0 | 9 | 14 | 45 | 20 | 25 | null | null |
ddssff/rdf4h | testsuite/tests/W3C/Manifest.hs | bsd-3-clause | mkTestTurtleNegativeEval :: Triples -> TestEntry
mkTestTurtleNegativeEval ts = TestTurtleNegativeEval {
name = lnodeText $ objectByPredicate mfName ts,
comment = lnodeText $ objectByPredicate rdfsComment ts,
approval = objectByPredicate rdftApproval ts,
action = objectByPredicate mfAction ts
} | 452 | mkTestTurtleNegativeEval :: Triples -> TestEntry
mkTestTurtleNegativeEval ts = TestTurtleNegativeEval {
name = lnodeText $ objectByPredicate mfName ts,
comment = lnodeText $ objectByPredicate rdfsComment ts,
approval = objectByPredicate rdftApproval ts,
action = objectByPredicate mfAction ts
} | 452 | mkTestTurtleNegativeEval ts = TestTurtleNegativeEval {
name = lnodeText $ objectByPredicate mfName ts,
comment = lnodeText $ objectByPredicate rdfsComment ts,
approval = objectByPredicate rdftApproval ts,
action = objectByPredicate mfAction ts
} | 403 | false | true | 0 | 8 | 192 | 72 | 38 | 34 | null | null |
Bodigrim/katas | src/haskell/B-Writing-applicative-parsers-from-scratch.hs | bsd-2-clause | -- | Parse arithmetic expressions, with the following grammar:
--
-- expr ::= const | binOpExpr | neg | zero
-- const ::= int
-- binOpExpr ::= '(' expr ' ' binOp ' ' expr ')'
-- binOp ::= '+' | '*'
-- neg ::= '-' expr
-- zero ::= 'z'
--
parseExpr :: String -> Maybe Expr
parseExpr = runParserUnique pExpr where
pExpr = pConst <<>> pBinOpExpr <<>> pNeg <<>> pZero
pConst = pmap ConstE pInt
pBinOpExpr = pmap (\x y z -> BinOpE y x z) (charP '(' @> pExpr) <@> (charP ' ' @> pBinOp <@ charP ' ') <@> (pExpr <@ charP ')')
pBinOp = pmap (const AddBO) (charP '+') <<>> pmap (const MulBO) (charP '*')
pNeg = pmap NegE $ charP '-' @> pExpr
pZero = pmap (const ZeroE) (charP 'z')
pInt = pmap read (some pDigit)
pDigit = foldl (<<>>) emptyP [charP d | d<-['0'..'9']] | 837 | parseExpr :: String -> Maybe Expr
parseExpr = runParserUnique pExpr where
pExpr = pConst <<>> pBinOpExpr <<>> pNeg <<>> pZero
pConst = pmap ConstE pInt
pBinOpExpr = pmap (\x y z -> BinOpE y x z) (charP '(' @> pExpr) <@> (charP ' ' @> pBinOp <@ charP ' ') <@> (pExpr <@ charP ')')
pBinOp = pmap (const AddBO) (charP '+') <<>> pmap (const MulBO) (charP '*')
pNeg = pmap NegE $ charP '-' @> pExpr
pZero = pmap (const ZeroE) (charP 'z')
pInt = pmap read (some pDigit)
pDigit = foldl (<<>>) emptyP [charP d | d<-['0'..'9']] | 534 | parseExpr = runParserUnique pExpr where
pExpr = pConst <<>> pBinOpExpr <<>> pNeg <<>> pZero
pConst = pmap ConstE pInt
pBinOpExpr = pmap (\x y z -> BinOpE y x z) (charP '(' @> pExpr) <@> (charP ' ' @> pBinOp <@ charP ' ') <@> (pExpr <@ charP ')')
pBinOp = pmap (const AddBO) (charP '+') <<>> pmap (const MulBO) (charP '*')
pNeg = pmap NegE $ charP '-' @> pExpr
pZero = pmap (const ZeroE) (charP 'z')
pInt = pmap read (some pDigit)
pDigit = foldl (<<>>) emptyP [charP d | d<-['0'..'9']] | 500 | true | true | 15 | 10 | 232 | 306 | 140 | 166 | null | null |
IreneKnapp/Faction | libfaction/dist/build/autogen/Paths_libfaction.hs | bsd-3-clause | libdir = "/usr/local/lib/libfaction-1.0/ghc-7.6.2" | 54 | libdir = "/usr/local/lib/libfaction-1.0/ghc-7.6.2" | 54 | libdir = "/usr/local/lib/libfaction-1.0/ghc-7.6.2" | 54 | false | false | 1 | 5 | 6 | 10 | 3 | 7 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.