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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
JerrySun/league-famous
|
Util.hs
|
bsd-2-clause
|
globFile :: String -> String -> FilePath
globFile kind x = "templates/" ++ x ++ "." ++ kind
| 91
|
globFile :: String -> String -> FilePath
globFile kind x = "templates/" ++ x ++ "." ++ kind
| 91
|
globFile kind x = "templates/" ++ x ++ "." ++ kind
| 50
| false
| true
| 0
| 7
| 17
| 36
| 18
| 18
| null | null |
mfpi/OpenGL
|
Graphics/Rendering/OpenGL/GL/Shaders/Variables.hs
|
bsd-3-clause
|
unmarshalVariableType :: GLenum -> VariableType
unmarshalVariableType x
| x == gl_FLOAT = Float'
| x == gl_FLOAT_VEC2 = FloatVec2
| x == gl_FLOAT_VEC3 = FloatVec3
| x == gl_FLOAT_VEC4 = FloatVec4
| x == gl_INT = Int'
| x == gl_INT_VEC2 = IntVec2
| x == gl_INT_VEC3 = IntVec3
| x == gl_INT_VEC4 = IntVec4
| x == gl_UNSIGNED_INT = UnsignedInt'
| x == gl_UNSIGNED_INT_VEC2 = UnsignedIntVec2
| x == gl_UNSIGNED_INT_VEC3 = UnsignedIntVec3
| x == gl_UNSIGNED_INT_VEC4 = UnsignedIntVec4
| x == gl_BOOL = Bool
| x == gl_BOOL_VEC2 = BoolVec2
| x == gl_BOOL_VEC3 = BoolVec3
| x == gl_BOOL_VEC4 = BoolVec4
| x == gl_FLOAT_MAT2 = FloatMat2
| x == gl_FLOAT_MAT3 = FloatMat3
| x == gl_FLOAT_MAT4 = FloatMat4
| x == gl_FLOAT_MAT2x3 = FloatMat2x3
| x == gl_FLOAT_MAT2x4 = FloatMat2x4
| x == gl_FLOAT_MAT3x2 = FloatMat3x2
| x == gl_FLOAT_MAT3x4 = FloatMat3x4
| x == gl_FLOAT_MAT4x2 = FloatMat4x2
| x == gl_FLOAT_MAT4x3 = FloatMat4x3
| x == gl_SAMPLER_1D = Sampler1D
| x == gl_SAMPLER_2D = Sampler2D
| x == gl_SAMPLER_3D = Sampler3D
| x == gl_SAMPLER_CUBE = SamplerCube
| x == gl_SAMPLER_1D_SHADOW = Sampler1DShadow
| x == gl_SAMPLER_2D_SHADOW = Sampler2DShadow
| x == gl_SAMPLER_1D_ARRAY = Sampler1DArray
| x == gl_SAMPLER_2D_ARRAY = Sampler2DArray
| x == gl_SAMPLER_1D_ARRAY_SHADOW = Sampler1DArrayShadow
| x == gl_SAMPLER_2D_ARRAY_SHADOW = Sampler2DArrayShadow
| x == gl_SAMPLER_CUBE_SHADOW = SamplerCubeShadow
| x == gl_SAMPLER_2D_RECT = Sampler2DRect
| x == gl_SAMPLER_2D_RECT_SHADOW = Sampler2DRectShadow
| x == gl_INT_SAMPLER_1D = IntSampler1D
| x == gl_INT_SAMPLER_2D = IntSampler2D
| x == gl_INT_SAMPLER_3D = IntSampler3D
| x == gl_INT_SAMPLER_CUBE = IntSamplerCube
| x == gl_INT_SAMPLER_1D_ARRAY = IntSampler1DArray
| x == gl_INT_SAMPLER_2D_ARRAY = IntSampler2DArray
| x == gl_UNSIGNED_INT_SAMPLER_1D = UnsignedIntSampler1D
| x == gl_UNSIGNED_INT_SAMPLER_2D = UnsignedIntSampler2D
| x == gl_UNSIGNED_INT_SAMPLER_3D = UnsignedIntSampler3D
| x == gl_UNSIGNED_INT_SAMPLER_CUBE = UnsignedIntSamplerCube
| x == gl_UNSIGNED_INT_SAMPLER_1D_ARRAY = UnsignedIntSampler1DArray
| x == gl_UNSIGNED_INT_SAMPLER_2D_ARRAY = UnsignedIntSampler2DArray
| otherwise = error ("unmarshalVariableType: illegal value " ++ show x)
| 2,351
|
unmarshalVariableType :: GLenum -> VariableType
unmarshalVariableType x
| x == gl_FLOAT = Float'
| x == gl_FLOAT_VEC2 = FloatVec2
| x == gl_FLOAT_VEC3 = FloatVec3
| x == gl_FLOAT_VEC4 = FloatVec4
| x == gl_INT = Int'
| x == gl_INT_VEC2 = IntVec2
| x == gl_INT_VEC3 = IntVec3
| x == gl_INT_VEC4 = IntVec4
| x == gl_UNSIGNED_INT = UnsignedInt'
| x == gl_UNSIGNED_INT_VEC2 = UnsignedIntVec2
| x == gl_UNSIGNED_INT_VEC3 = UnsignedIntVec3
| x == gl_UNSIGNED_INT_VEC4 = UnsignedIntVec4
| x == gl_BOOL = Bool
| x == gl_BOOL_VEC2 = BoolVec2
| x == gl_BOOL_VEC3 = BoolVec3
| x == gl_BOOL_VEC4 = BoolVec4
| x == gl_FLOAT_MAT2 = FloatMat2
| x == gl_FLOAT_MAT3 = FloatMat3
| x == gl_FLOAT_MAT4 = FloatMat4
| x == gl_FLOAT_MAT2x3 = FloatMat2x3
| x == gl_FLOAT_MAT2x4 = FloatMat2x4
| x == gl_FLOAT_MAT3x2 = FloatMat3x2
| x == gl_FLOAT_MAT3x4 = FloatMat3x4
| x == gl_FLOAT_MAT4x2 = FloatMat4x2
| x == gl_FLOAT_MAT4x3 = FloatMat4x3
| x == gl_SAMPLER_1D = Sampler1D
| x == gl_SAMPLER_2D = Sampler2D
| x == gl_SAMPLER_3D = Sampler3D
| x == gl_SAMPLER_CUBE = SamplerCube
| x == gl_SAMPLER_1D_SHADOW = Sampler1DShadow
| x == gl_SAMPLER_2D_SHADOW = Sampler2DShadow
| x == gl_SAMPLER_1D_ARRAY = Sampler1DArray
| x == gl_SAMPLER_2D_ARRAY = Sampler2DArray
| x == gl_SAMPLER_1D_ARRAY_SHADOW = Sampler1DArrayShadow
| x == gl_SAMPLER_2D_ARRAY_SHADOW = Sampler2DArrayShadow
| x == gl_SAMPLER_CUBE_SHADOW = SamplerCubeShadow
| x == gl_SAMPLER_2D_RECT = Sampler2DRect
| x == gl_SAMPLER_2D_RECT_SHADOW = Sampler2DRectShadow
| x == gl_INT_SAMPLER_1D = IntSampler1D
| x == gl_INT_SAMPLER_2D = IntSampler2D
| x == gl_INT_SAMPLER_3D = IntSampler3D
| x == gl_INT_SAMPLER_CUBE = IntSamplerCube
| x == gl_INT_SAMPLER_1D_ARRAY = IntSampler1DArray
| x == gl_INT_SAMPLER_2D_ARRAY = IntSampler2DArray
| x == gl_UNSIGNED_INT_SAMPLER_1D = UnsignedIntSampler1D
| x == gl_UNSIGNED_INT_SAMPLER_2D = UnsignedIntSampler2D
| x == gl_UNSIGNED_INT_SAMPLER_3D = UnsignedIntSampler3D
| x == gl_UNSIGNED_INT_SAMPLER_CUBE = UnsignedIntSamplerCube
| x == gl_UNSIGNED_INT_SAMPLER_1D_ARRAY = UnsignedIntSampler1DArray
| x == gl_UNSIGNED_INT_SAMPLER_2D_ARRAY = UnsignedIntSampler2DArray
| otherwise = error ("unmarshalVariableType: illegal value " ++ show x)
| 2,351
|
unmarshalVariableType x
| x == gl_FLOAT = Float'
| x == gl_FLOAT_VEC2 = FloatVec2
| x == gl_FLOAT_VEC3 = FloatVec3
| x == gl_FLOAT_VEC4 = FloatVec4
| x == gl_INT = Int'
| x == gl_INT_VEC2 = IntVec2
| x == gl_INT_VEC3 = IntVec3
| x == gl_INT_VEC4 = IntVec4
| x == gl_UNSIGNED_INT = UnsignedInt'
| x == gl_UNSIGNED_INT_VEC2 = UnsignedIntVec2
| x == gl_UNSIGNED_INT_VEC3 = UnsignedIntVec3
| x == gl_UNSIGNED_INT_VEC4 = UnsignedIntVec4
| x == gl_BOOL = Bool
| x == gl_BOOL_VEC2 = BoolVec2
| x == gl_BOOL_VEC3 = BoolVec3
| x == gl_BOOL_VEC4 = BoolVec4
| x == gl_FLOAT_MAT2 = FloatMat2
| x == gl_FLOAT_MAT3 = FloatMat3
| x == gl_FLOAT_MAT4 = FloatMat4
| x == gl_FLOAT_MAT2x3 = FloatMat2x3
| x == gl_FLOAT_MAT2x4 = FloatMat2x4
| x == gl_FLOAT_MAT3x2 = FloatMat3x2
| x == gl_FLOAT_MAT3x4 = FloatMat3x4
| x == gl_FLOAT_MAT4x2 = FloatMat4x2
| x == gl_FLOAT_MAT4x3 = FloatMat4x3
| x == gl_SAMPLER_1D = Sampler1D
| x == gl_SAMPLER_2D = Sampler2D
| x == gl_SAMPLER_3D = Sampler3D
| x == gl_SAMPLER_CUBE = SamplerCube
| x == gl_SAMPLER_1D_SHADOW = Sampler1DShadow
| x == gl_SAMPLER_2D_SHADOW = Sampler2DShadow
| x == gl_SAMPLER_1D_ARRAY = Sampler1DArray
| x == gl_SAMPLER_2D_ARRAY = Sampler2DArray
| x == gl_SAMPLER_1D_ARRAY_SHADOW = Sampler1DArrayShadow
| x == gl_SAMPLER_2D_ARRAY_SHADOW = Sampler2DArrayShadow
| x == gl_SAMPLER_CUBE_SHADOW = SamplerCubeShadow
| x == gl_SAMPLER_2D_RECT = Sampler2DRect
| x == gl_SAMPLER_2D_RECT_SHADOW = Sampler2DRectShadow
| x == gl_INT_SAMPLER_1D = IntSampler1D
| x == gl_INT_SAMPLER_2D = IntSampler2D
| x == gl_INT_SAMPLER_3D = IntSampler3D
| x == gl_INT_SAMPLER_CUBE = IntSamplerCube
| x == gl_INT_SAMPLER_1D_ARRAY = IntSampler1DArray
| x == gl_INT_SAMPLER_2D_ARRAY = IntSampler2DArray
| x == gl_UNSIGNED_INT_SAMPLER_1D = UnsignedIntSampler1D
| x == gl_UNSIGNED_INT_SAMPLER_2D = UnsignedIntSampler2D
| x == gl_UNSIGNED_INT_SAMPLER_3D = UnsignedIntSampler3D
| x == gl_UNSIGNED_INT_SAMPLER_CUBE = UnsignedIntSamplerCube
| x == gl_UNSIGNED_INT_SAMPLER_1D_ARRAY = UnsignedIntSampler1DArray
| x == gl_UNSIGNED_INT_SAMPLER_2D_ARRAY = UnsignedIntSampler2DArray
| otherwise = error ("unmarshalVariableType: illegal value " ++ show x)
| 2,303
| false
| true
| 0
| 9
| 470
| 687
| 317
| 370
| null | null |
tolysz/dsp
|
DSP/Correlation.hs
|
gpl-2.0
|
----------------------------------------------------------------------------
-- test routines
----------------------------------------------------------------------------
xt, yt :: Array Int (Complex Double)
xt = array (0,4)
[ (0, 1 :+ 0),
(1, 0 :+ 1),
(2, (-1) :+ 0),
(3, 0 :+ (-1)),
(4, 1 :+ 0) ]
| 323
|
xt, yt :: Array Int (Complex Double)
xt = array (0,4)
[ (0, 1 :+ 0),
(1, 0 :+ 1),
(2, (-1) :+ 0),
(3, 0 :+ (-1)),
(4, 1 :+ 0) ]
| 151
|
xt = array (0,4)
[ (0, 1 :+ 0),
(1, 0 :+ 1),
(2, (-1) :+ 0),
(3, 0 :+ (-1)),
(4, 1 :+ 0) ]
| 114
| true
| true
| 2
| 9
| 62
| 120
| 68
| 52
| null | null |
hanshoglund/imitator
|
src/Music/Imitator.hs
|
gpl-3.0
|
allocateBuffers :: [OscMessage]
allocateBuffers = mempty
<> [newBuffer index frames channels]
where
(index, channels, frames) = kMainBuffer
-- |
-- Create groups 5, 6, 7 for record, play and decode respectively.
--
| 245
|
allocateBuffers :: [OscMessage]
allocateBuffers = mempty
<> [newBuffer index frames channels]
where
(index, channels, frames) = kMainBuffer
-- |
-- Create groups 5, 6, 7 for record, play and decode respectively.
--
| 245
|
allocateBuffers = mempty
<> [newBuffer index frames channels]
where
(index, channels, frames) = kMainBuffer
-- |
-- Create groups 5, 6, 7 for record, play and decode respectively.
--
| 213
| false
| true
| 2
| 7
| 62
| 57
| 29
| 28
| null | null |
exitmouse/proper
|
src/Visnov.hs
|
gpl-3.0
|
setPose :: Character -> String -> Event u
setPose character s = do
let m_frame = M.lookup s (characterFrames character)
case m_frame of
Nothing -> error "No such pose"
Just frame -> do
promote . modify $ \state -> state { currentPose = s }
drawChar frame :: Event u
| 289
|
setPose :: Character -> String -> Event u
setPose character s = do
let m_frame = M.lookup s (characterFrames character)
case m_frame of
Nothing -> error "No such pose"
Just frame -> do
promote . modify $ \state -> state { currentPose = s }
drawChar frame :: Event u
| 289
|
setPose character s = do
let m_frame = M.lookup s (characterFrames character)
case m_frame of
Nothing -> error "No such pose"
Just frame -> do
promote . modify $ \state -> state { currentPose = s }
drawChar frame :: Event u
| 247
| false
| true
| 1
| 14
| 73
| 109
| 52
| 57
| null | null |
yiannist/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
opStatusQueued :: String
opStatusQueued = "queued"
| 50
|
opStatusQueued :: String
opStatusQueued = "queued"
| 50
|
opStatusQueued = "queued"
| 25
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
cloudhead/spinsv
|
src/Daemon/Daemon.hs
|
gpl-3.0
|
runJob :: Job -> Config -> IO Main.Result
runJob Job{..} Config{..} = do
putStrLn $ unwords ["JOB", cRunner, unwords args]
createProcess (proc cRunner args){ close_fds = True, cwd = _cwd }
return Ok
where
args = (inCmd : inArgs)
++ (outCmd : outArgs)
++ catMaybes [ fmap (\x -> "--port=" ++ show x) _port
, fmap (\x -> "--max-restarts=" ++ show x) _maxFailures
, fmap (\x -> "--restart-delay=" ++ show x) _restartDelay
]
inCmd = "--in.cmd=" ++ cmdName _worker
outCmd = "--out.cmd=" ++ cmdName _logger
inArgs = map (\x -> "--in.arg=" ++ x) (cmdArgs _worker)
outArgs = map (\x -> "--out.arg=" ++ x) (cmdArgs _logger)
| 776
|
runJob :: Job -> Config -> IO Main.Result
runJob Job{..} Config{..} = do
putStrLn $ unwords ["JOB", cRunner, unwords args]
createProcess (proc cRunner args){ close_fds = True, cwd = _cwd }
return Ok
where
args = (inCmd : inArgs)
++ (outCmd : outArgs)
++ catMaybes [ fmap (\x -> "--port=" ++ show x) _port
, fmap (\x -> "--max-restarts=" ++ show x) _maxFailures
, fmap (\x -> "--restart-delay=" ++ show x) _restartDelay
]
inCmd = "--in.cmd=" ++ cmdName _worker
outCmd = "--out.cmd=" ++ cmdName _logger
inArgs = map (\x -> "--in.arg=" ++ x) (cmdArgs _worker)
outArgs = map (\x -> "--out.arg=" ++ x) (cmdArgs _logger)
| 776
|
runJob Job{..} Config{..} = do
putStrLn $ unwords ["JOB", cRunner, unwords args]
createProcess (proc cRunner args){ close_fds = True, cwd = _cwd }
return Ok
where
args = (inCmd : inArgs)
++ (outCmd : outArgs)
++ catMaybes [ fmap (\x -> "--port=" ++ show x) _port
, fmap (\x -> "--max-restarts=" ++ show x) _maxFailures
, fmap (\x -> "--restart-delay=" ++ show x) _restartDelay
]
inCmd = "--in.cmd=" ++ cmdName _worker
outCmd = "--out.cmd=" ++ cmdName _logger
inArgs = map (\x -> "--in.arg=" ++ x) (cmdArgs _worker)
outArgs = map (\x -> "--out.arg=" ++ x) (cmdArgs _logger)
| 734
| false
| true
| 4
| 14
| 266
| 281
| 143
| 138
| null | null |
ghc-android/ghc
|
compiler/codeGen/StgCmmPrim.hs
|
bsd-3-clause
|
emitPrimOp _ res WriteByteArrayOp_Double args = doWriteByteArrayOp Nothing f64 res args
| 102
|
emitPrimOp _ res WriteByteArrayOp_Double args = doWriteByteArrayOp Nothing f64 res args
| 102
|
emitPrimOp _ res WriteByteArrayOp_Double args = doWriteByteArrayOp Nothing f64 res args
| 102
| false
| false
| 0
| 5
| 25
| 24
| 11
| 13
| null | null |
toddmohney/json-api
|
test/Network/JSONApi/PaginationSpec.hs
|
mit
|
main :: IO ()
main = hspec spec
| 31
|
main :: IO ()
main = hspec spec
| 31
|
main = hspec spec
| 17
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
leepike/copilot-language
|
src/Copilot/Language/Operators/Extern.hs
|
bsd-3-clause
|
externI32 :: String -> Maybe [Int32] -> Stream Int32
externI32 = extern
| 71
|
externI32 :: String -> Maybe [Int32] -> Stream Int32
externI32 = extern
| 71
|
externI32 = extern
| 18
| false
| true
| 0
| 8
| 11
| 28
| 14
| 14
| null | null |
gorkinovich/Haskell
|
Modules/Fibonacci.hs
|
mit
|
fibonacci' :: Integer -> Integer
fibonacci' x =
let fib i n (v0, v1) = if i == n then v0
else fib (i + 1) n (v1, v0 + v1)
in fib 0 x (0, 1)
| 174
|
fibonacci' :: Integer -> Integer
fibonacci' x =
let fib i n (v0, v1) = if i == n then v0
else fib (i + 1) n (v1, v0 + v1)
in fib 0 x (0, 1)
| 174
|
fibonacci' x =
let fib i n (v0, v1) = if i == n then v0
else fib (i + 1) n (v1, v0 + v1)
in fib 0 x (0, 1)
| 141
| false
| true
| 0
| 12
| 71
| 91
| 48
| 43
| null | null |
roelvandijk/numerals-base
|
src/Text/Numeral/Rules.hs
|
bsd-3-clause
|
longScale ∷ (Integral α, E.Scale α, E.Unknown β, E.Add β, E.Mul β, E.Scale β)
⇒ Side -- ^ Add side.
→ Side -- ^ Mul side.
→ Rule α β -- ^ Big num rule.
→ Rule α β
longScale = mulScale 6 0
| 235
|
longScale ∷ (Integral α, E.Scale α, E.Unknown β, E.Add β, E.Mul β, E.Scale β)
⇒ Side -- ^ Add side.
→ Side -- ^ Mul side.
→ Rule α β -- ^ Big num rule.
→ Rule α β
longScale = mulScale 6 0
| 235
|
longScale = mulScale 6 0
| 24
| false
| true
| 0
| 9
| 91
| 90
| 46
| 44
| null | null |
christiaanb/ghc
|
compiler/hsSyn/HsDecls.hs
|
bsd-3-clause
|
-- | open type family info
isOpenTypeFamilyInfo :: FamilyInfo name -> Bool
isOpenTypeFamilyInfo OpenTypeFamily = True
| 117
|
isOpenTypeFamilyInfo :: FamilyInfo name -> Bool
isOpenTypeFamilyInfo OpenTypeFamily = True
| 90
|
isOpenTypeFamilyInfo OpenTypeFamily = True
| 42
| true
| true
| 0
| 6
| 15
| 22
| 11
| 11
| null | null |
fpco/stackage-server
|
src/Stackage/Database/Query.hs
|
mit
|
getSnapshotPackagePageInfoQuery :: SnapshotPackageInfo -> Int -> ReaderT SqlBackend (RIO env) SnapshotPackagePageInfo
getSnapshotPackagePageInfoQuery spi maxDisplayedDeps = do
mhciLatest <- getHackageLatestVersion $ spiPackageName spi
-- TODO: check for `spiOrigin spi` once other than `Hackage` are implemented
forwardDepsCount <- getForwardDepsCount spi
reverseDepsCount <- getReverseDepsCount spi
forwardDeps <-
if forwardDepsCount > 0
then getForwardDeps spi (Just maxDisplayedDeps)
else pure []
reverseDeps <-
if reverseDepsCount > 0
then getReverseDeps spi (Just maxDisplayedDeps)
else pure []
latestInfo <- getLatests (spiPackageName spi)
moduleNames <- getModuleNames (spiSnapshotPackageId spi)
mcabalBlobKey <- traverse getBlobKey $ spiCabalBlobId spi
pure
SnapshotPackagePageInfo
{ sppiSnapshotPackageInfo = spi
, sppiLatestHackageCabalInfo = mhciLatest
, sppiForwardDeps = map (first dropVersionRev) forwardDeps
, sppiForwardDepsCount = forwardDepsCount
, sppiReverseDeps = map (first dropVersionRev) reverseDeps
, sppiReverseDepsCount = reverseDepsCount
, sppiLatestInfo = latestInfo
, sppiModuleNames = moduleNames
, sppiPantryCabal =
mcabalBlobKey RIO.<&> \cabalBlobKey ->
PantryCabal
{ pcPackageName = spiPackageName spi
, pcVersion = spiVersion spi
, pcCabalKey = cabalBlobKey
}
, sppiVersion =
listToMaybe
[ spiVersionRev spi
| VersionRev ver mrev <-
maybe [] (pure . hciVersionRev) mhciLatest ++
map liVersionRev latestInfo
, ver > curVer ||
(ver == curVer &&
fromMaybe (Revision 0) mrev > fromMaybe (Revision 0) mcurRev)
]
}
where
VersionRev curVer mcurRev = spiVersionRev spi
| 2,380
|
getSnapshotPackagePageInfoQuery :: SnapshotPackageInfo -> Int -> ReaderT SqlBackend (RIO env) SnapshotPackagePageInfo
getSnapshotPackagePageInfoQuery spi maxDisplayedDeps = do
mhciLatest <- getHackageLatestVersion $ spiPackageName spi
-- TODO: check for `spiOrigin spi` once other than `Hackage` are implemented
forwardDepsCount <- getForwardDepsCount spi
reverseDepsCount <- getReverseDepsCount spi
forwardDeps <-
if forwardDepsCount > 0
then getForwardDeps spi (Just maxDisplayedDeps)
else pure []
reverseDeps <-
if reverseDepsCount > 0
then getReverseDeps spi (Just maxDisplayedDeps)
else pure []
latestInfo <- getLatests (spiPackageName spi)
moduleNames <- getModuleNames (spiSnapshotPackageId spi)
mcabalBlobKey <- traverse getBlobKey $ spiCabalBlobId spi
pure
SnapshotPackagePageInfo
{ sppiSnapshotPackageInfo = spi
, sppiLatestHackageCabalInfo = mhciLatest
, sppiForwardDeps = map (first dropVersionRev) forwardDeps
, sppiForwardDepsCount = forwardDepsCount
, sppiReverseDeps = map (first dropVersionRev) reverseDeps
, sppiReverseDepsCount = reverseDepsCount
, sppiLatestInfo = latestInfo
, sppiModuleNames = moduleNames
, sppiPantryCabal =
mcabalBlobKey RIO.<&> \cabalBlobKey ->
PantryCabal
{ pcPackageName = spiPackageName spi
, pcVersion = spiVersion spi
, pcCabalKey = cabalBlobKey
}
, sppiVersion =
listToMaybe
[ spiVersionRev spi
| VersionRev ver mrev <-
maybe [] (pure . hciVersionRev) mhciLatest ++
map liVersionRev latestInfo
, ver > curVer ||
(ver == curVer &&
fromMaybe (Revision 0) mrev > fromMaybe (Revision 0) mcurRev)
]
}
where
VersionRev curVer mcurRev = spiVersionRev spi
| 2,380
|
getSnapshotPackagePageInfoQuery spi maxDisplayedDeps = do
mhciLatest <- getHackageLatestVersion $ spiPackageName spi
-- TODO: check for `spiOrigin spi` once other than `Hackage` are implemented
forwardDepsCount <- getForwardDepsCount spi
reverseDepsCount <- getReverseDepsCount spi
forwardDeps <-
if forwardDepsCount > 0
then getForwardDeps spi (Just maxDisplayedDeps)
else pure []
reverseDeps <-
if reverseDepsCount > 0
then getReverseDeps spi (Just maxDisplayedDeps)
else pure []
latestInfo <- getLatests (spiPackageName spi)
moduleNames <- getModuleNames (spiSnapshotPackageId spi)
mcabalBlobKey <- traverse getBlobKey $ spiCabalBlobId spi
pure
SnapshotPackagePageInfo
{ sppiSnapshotPackageInfo = spi
, sppiLatestHackageCabalInfo = mhciLatest
, sppiForwardDeps = map (first dropVersionRev) forwardDeps
, sppiForwardDepsCount = forwardDepsCount
, sppiReverseDeps = map (first dropVersionRev) reverseDeps
, sppiReverseDepsCount = reverseDepsCount
, sppiLatestInfo = latestInfo
, sppiModuleNames = moduleNames
, sppiPantryCabal =
mcabalBlobKey RIO.<&> \cabalBlobKey ->
PantryCabal
{ pcPackageName = spiPackageName spi
, pcVersion = spiVersion spi
, pcCabalKey = cabalBlobKey
}
, sppiVersion =
listToMaybe
[ spiVersionRev spi
| VersionRev ver mrev <-
maybe [] (pure . hciVersionRev) mhciLatest ++
map liVersionRev latestInfo
, ver > curVer ||
(ver == curVer &&
fromMaybe (Revision 0) mrev > fromMaybe (Revision 0) mcurRev)
]
}
where
VersionRev curVer mcurRev = spiVersionRev spi
| 2,262
| false
| true
| 0
| 19
| 983
| 429
| 215
| 214
| null | null |
shicks/shsh
|
Language/Sh/Expansion.hs
|
bsd-3-clause
|
expandWith f (Quoted (Expand x):xs) = do x' <- f True x
xs' <- expandWith f xs
return $ x' ++ xs'
| 179
|
expandWith f (Quoted (Expand x):xs) = do x' <- f True x
xs' <- expandWith f xs
return $ x' ++ xs'
| 179
|
expandWith f (Quoted (Expand x):xs) = do x' <- f True x
xs' <- expandWith f xs
return $ x' ++ xs'
| 179
| false
| false
| 0
| 9
| 103
| 64
| 28
| 36
| null | null |
capello/Haskell_Premier
|
Premier.hs
|
bsd-2-clause
|
prem = 2:[a | a <- [3,5..], (product (map (\x -> mod a x) ([3,5..truncate(sqrt (fromIntegral a::Float))]))) /= 0 ]
| 114
|
prem = 2:[a | a <- [3,5..], (product (map (\x -> mod a x) ([3,5..truncate(sqrt (fromIntegral a::Float))]))) /= 0 ]
| 114
|
prem = 2:[a | a <- [3,5..], (product (map (\x -> mod a x) ([3,5..truncate(sqrt (fromIntegral a::Float))]))) /= 0 ]
| 114
| false
| false
| 3
| 19
| 19
| 97
| 49
| 48
| null | null |
ihc/futhark
|
src/Language/Futhark/TypeChecker/Types.hs
|
isc
|
unifyTypes (Array at1) (Array at2) =
Array <$> unifyArrayTypes at1 at2
| 72
|
unifyTypes (Array at1) (Array at2) =
Array <$> unifyArrayTypes at1 at2
| 72
|
unifyTypes (Array at1) (Array at2) =
Array <$> unifyArrayTypes at1 at2
| 72
| false
| false
| 0
| 7
| 12
| 32
| 15
| 17
| null | null |
danchoi/geochat
|
src/Main.hs
|
mit
|
main :: IO ()
main = do
httpServe simpleConfig $ site -- run with snap
-- WS.runServer "0.0.0.0" 9160 $ application state -- run without snap
| 150
|
main :: IO ()
main = do
httpServe simpleConfig $ site -- run with snap
-- WS.runServer "0.0.0.0" 9160 $ application state -- run without snap
| 150
|
main = do
httpServe simpleConfig $ site -- run with snap
-- WS.runServer "0.0.0.0" 9160 $ application state -- run without snap
| 136
| false
| true
| 0
| 8
| 34
| 34
| 15
| 19
| null | null |
ComputationWithBoundedResources/ara-inference
|
doc/tpdb_trs/Haskell/basic_haskell/abs_1.hs
|
mit
|
esEsOrdering :: Ordering -> Ordering -> MyBool
esEsOrdering LT LT = MyTrue
| 78
|
esEsOrdering :: Ordering -> Ordering -> MyBool
esEsOrdering LT LT = MyTrue
| 78
|
esEsOrdering LT LT = MyTrue
| 27
| false
| true
| 0
| 6
| 15
| 24
| 12
| 12
| null | null |
joom/Guguk
|
src/Guguk/Phonetics.hs
|
mit
|
-- Phoneme general functions
getSurfaceForm :: Phoneme -> SurfaceForm
getSurfaceForm (VowelPhoneme x _) = x
| 111
|
getSurfaceForm :: Phoneme -> SurfaceForm
getSurfaceForm (VowelPhoneme x _) = x
| 82
|
getSurfaceForm (VowelPhoneme x _) = x
| 41
| true
| true
| 0
| 7
| 18
| 27
| 14
| 13
| null | null |
eriksvedang/Carp
|
src/Obj.hs
|
mpl-2.0
|
-- | Helper function to create binding pairs for registering external functions.
register :: String -> Ty -> (String, Binder)
register name t = (name, Binder emptyMeta
(XObj (Lst [XObj (External Nothing) Nothing Nothing,
XObj (Sym (SymPath [] name) Symbol) Nothing Nothing])
(Just dummyInfo) (Just t)))
| 376
|
register :: String -> Ty -> (String, Binder)
register name t = (name, Binder emptyMeta
(XObj (Lst [XObj (External Nothing) Nothing Nothing,
XObj (Sym (SymPath [] name) Symbol) Nothing Nothing])
(Just dummyInfo) (Just t)))
| 295
|
register name t = (name, Binder emptyMeta
(XObj (Lst [XObj (External Nothing) Nothing Nothing,
XObj (Sym (SymPath [] name) Symbol) Nothing Nothing])
(Just dummyInfo) (Just t)))
| 250
| true
| true
| 0
| 18
| 119
| 120
| 60
| 60
| null | null |
mcschroeder/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
addIncludePath p =
upd (\s -> s{includePaths = includePaths s ++ splitPathList p})
| 84
|
addIncludePath p =
upd (\s -> s{includePaths = includePaths s ++ splitPathList p})
| 84
|
addIncludePath p =
upd (\s -> s{includePaths = includePaths s ++ splitPathList p})
| 84
| false
| false
| 0
| 10
| 14
| 38
| 19
| 19
| null | null |
phischu/fragnix
|
builtins/ghc-prim/GHC.PrimopWrappers.hs
|
bsd-3-clause
|
addr2Int# :: Addr# -> Int#
addr2Int# a1 = (GHC.Prim.addr2Int#) a1
| 65
|
addr2Int# :: Addr# -> Int#
addr2Int# a1 = (GHC.Prim.addr2Int#) a1
| 65
|
addr2Int# a1 = (GHC.Prim.addr2Int#) a1
| 38
| false
| true
| 0
| 7
| 9
| 27
| 14
| 13
| null | null |
frantisekfarka/ghc-dsi
|
libraries/base/GHC/Event/Array.hs
|
bsd-3-clause
|
ensureCapacity' :: Storable a => AC a -> Int -> IO (AC a)
ensureCapacity' ac@(AC es len cap) c = do
if c > cap
then do
es' <- reallocArray es cap' cap
return (AC es' len cap')
else
return ac
where
cap' = firstPowerOf2 c
| 265
|
ensureCapacity' :: Storable a => AC a -> Int -> IO (AC a)
ensureCapacity' ac@(AC es len cap) c = do
if c > cap
then do
es' <- reallocArray es cap' cap
return (AC es' len cap')
else
return ac
where
cap' = firstPowerOf2 c
| 265
|
ensureCapacity' ac@(AC es len cap) c = do
if c > cap
then do
es' <- reallocArray es cap' cap
return (AC es' len cap')
else
return ac
where
cap' = firstPowerOf2 c
| 207
| false
| true
| 0
| 12
| 91
| 115
| 54
| 61
| null | null |
mbakke/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
-- * Allocator framework constants
iallocatorVersion :: Int
iallocatorVersion = 2
| 82
|
iallocatorVersion :: Int
iallocatorVersion = 2
| 46
|
iallocatorVersion = 2
| 21
| true
| true
| 0
| 4
| 11
| 12
| 7
| 5
| null | null |
sukhmel/algorithms.intro
|
part_1/chapter_4/MatrixProduct.hs
|
mit
|
splitProduct :: Num a
=> MatFunc a
splitProduct a b = if small a || small b
then simpleProduct a b
else joinFromFour (c00, c01, c10, c11)
where small = (\ (x, y) -> x < 2 || y < 2) . size
c00 = splitProduct a00 b00 `plus`
splitProduct a01 b10
c01 = splitProduct a00 b01 `plus`
splitProduct a01 b11
c10 = splitProduct a10 b00 `plus`
splitProduct a11 b10
c11 = splitProduct a10 b01 `plus`
splitProduct a11 b11
plus = zipWith (zipWith (+))
(a00, a01, a10, a11) = splitInFour a
(b00, b01, b10, b11) = splitInFour b
-- | Make an NxN matrix out of a list.
| 776
|
splitProduct :: Num a
=> MatFunc a
splitProduct a b = if small a || small b
then simpleProduct a b
else joinFromFour (c00, c01, c10, c11)
where small = (\ (x, y) -> x < 2 || y < 2) . size
c00 = splitProduct a00 b00 `plus`
splitProduct a01 b10
c01 = splitProduct a00 b01 `plus`
splitProduct a01 b11
c10 = splitProduct a10 b00 `plus`
splitProduct a11 b10
c11 = splitProduct a10 b01 `plus`
splitProduct a11 b11
plus = zipWith (zipWith (+))
(a00, a01, a10, a11) = splitInFour a
(b00, b01, b10, b11) = splitInFour b
-- | Make an NxN matrix out of a list.
| 776
|
splitProduct a b = if small a || small b
then simpleProduct a b
else joinFromFour (c00, c01, c10, c11)
where small = (\ (x, y) -> x < 2 || y < 2) . size
c00 = splitProduct a00 b00 `plus`
splitProduct a01 b10
c01 = splitProduct a00 b01 `plus`
splitProduct a01 b11
c10 = splitProduct a10 b00 `plus`
splitProduct a11 b10
c11 = splitProduct a10 b01 `plus`
splitProduct a11 b11
plus = zipWith (zipWith (+))
(a00, a01, a10, a11) = splitInFour a
(b00, b01, b10, b11) = splitInFour b
-- | Make an NxN matrix out of a list.
| 726
| false
| true
| 7
| 14
| 334
| 244
| 131
| 113
| null | null |
CulpaBS/wbBach
|
src/futhark-test.hs
|
bsd-3-clause
|
compileTestProgram :: [String] -> String -> FilePath -> TestRun -> TestM ()
compileTestProgram extra_options futharkc program (TestRun _ inputValues expectedResult) = do
input <- getValuesText dir inputValues
expectedResult' <- getExpectedResult dir expectedResult
(futcode, _, futerr) <-
io $ readProcessWithExitCode futharkc
[program, "-o", binOutputf] ""
case futcode of
ExitFailure 127 -> throwError $ progNotFound $ T.pack futharkc
ExitFailure _ -> throwError futerr
ExitSuccess -> return ()
-- Explicitly prefixing the current directory is necessary for
-- readProcessWithExitCode to find the binary when binOutputf has
-- no path component.
let binpath = "." </> binOutputf
context ("Running " <> T.pack (unwords $ binpath : extra_options)) $ do
(progCode, output, progerr) <-
io $ readProcessWithExitCode binpath extra_options input
withExceptT validating $
compareResult program expectedResult' =<< runResult program progCode output progerr
where binOutputf = program `replaceExtension` "bin"
dir = takeDirectory program
validating = ("validating test result:\n"<>)
| 1,156
|
compileTestProgram :: [String] -> String -> FilePath -> TestRun -> TestM ()
compileTestProgram extra_options futharkc program (TestRun _ inputValues expectedResult) = do
input <- getValuesText dir inputValues
expectedResult' <- getExpectedResult dir expectedResult
(futcode, _, futerr) <-
io $ readProcessWithExitCode futharkc
[program, "-o", binOutputf] ""
case futcode of
ExitFailure 127 -> throwError $ progNotFound $ T.pack futharkc
ExitFailure _ -> throwError futerr
ExitSuccess -> return ()
-- Explicitly prefixing the current directory is necessary for
-- readProcessWithExitCode to find the binary when binOutputf has
-- no path component.
let binpath = "." </> binOutputf
context ("Running " <> T.pack (unwords $ binpath : extra_options)) $ do
(progCode, output, progerr) <-
io $ readProcessWithExitCode binpath extra_options input
withExceptT validating $
compareResult program expectedResult' =<< runResult program progCode output progerr
where binOutputf = program `replaceExtension` "bin"
dir = takeDirectory program
validating = ("validating test result:\n"<>)
| 1,156
|
compileTestProgram extra_options futharkc program (TestRun _ inputValues expectedResult) = do
input <- getValuesText dir inputValues
expectedResult' <- getExpectedResult dir expectedResult
(futcode, _, futerr) <-
io $ readProcessWithExitCode futharkc
[program, "-o", binOutputf] ""
case futcode of
ExitFailure 127 -> throwError $ progNotFound $ T.pack futharkc
ExitFailure _ -> throwError futerr
ExitSuccess -> return ()
-- Explicitly prefixing the current directory is necessary for
-- readProcessWithExitCode to find the binary when binOutputf has
-- no path component.
let binpath = "." </> binOutputf
context ("Running " <> T.pack (unwords $ binpath : extra_options)) $ do
(progCode, output, progerr) <-
io $ readProcessWithExitCode binpath extra_options input
withExceptT validating $
compareResult program expectedResult' =<< runResult program progCode output progerr
where binOutputf = program `replaceExtension` "bin"
dir = takeDirectory program
validating = ("validating test result:\n"<>)
| 1,080
| false
| true
| 3
| 14
| 223
| 318
| 151
| 167
| null | null |
ruiting/opencog
|
opencog/nlp/lojban/HaskellLib/src/OpenCog/Lojban/Syntax.hs
|
agpl-3.0
|
luP' :: SyntaxReader Atom
luP' = sepSelmaho "LU" *> lojban <* optSelmaho "LIhU"
| 79
|
luP' :: SyntaxReader Atom
luP' = sepSelmaho "LU" *> lojban <* optSelmaho "LIhU"
| 79
|
luP' = sepSelmaho "LU" *> lojban <* optSelmaho "LIhU"
| 53
| false
| true
| 4
| 6
| 12
| 37
| 16
| 21
| null | null |
mettekou/ghc
|
libraries/ghc-boot/GHC/PackageDb.hs
|
bsd-3-clause
|
-- | Read the part of the package DB that GHC is interested in.
--
readPackageDbForGhc :: RepInstalledPackageInfo a b c d e f g =>
FilePath -> IO [InstalledPackageInfo a b c d e f g]
readPackageDbForGhc file =
decodeFromFile file getDbForGhc
where
getDbForGhc = do
_version <- getHeader
_ghcPartLen <- get :: Get Word32
ghcPart <- get
-- the next part is for ghc-pkg, but we stop here.
return ghcPart
-- | Read the part of the package DB that ghc-pkg is interested in
--
-- Note that the Binary instance for ghc-pkg's representation of packages
-- is not defined in this package. This is because ghc-pkg uses Cabal types
-- (and Binary instances for these) which this package does not depend on.
--
| 769
|
readPackageDbForGhc :: RepInstalledPackageInfo a b c d e f g =>
FilePath -> IO [InstalledPackageInfo a b c d e f g]
readPackageDbForGhc file =
decodeFromFile file getDbForGhc
where
getDbForGhc = do
_version <- getHeader
_ghcPartLen <- get :: Get Word32
ghcPart <- get
-- the next part is for ghc-pkg, but we stop here.
return ghcPart
-- | Read the part of the package DB that ghc-pkg is interested in
--
-- Note that the Binary instance for ghc-pkg's representation of packages
-- is not defined in this package. This is because ghc-pkg uses Cabal types
-- (and Binary instances for these) which this package does not depend on.
--
| 702
|
readPackageDbForGhc file =
decodeFromFile file getDbForGhc
where
getDbForGhc = do
_version <- getHeader
_ghcPartLen <- get :: Get Word32
ghcPart <- get
-- the next part is for ghc-pkg, but we stop here.
return ghcPart
-- | Read the part of the package DB that ghc-pkg is interested in
--
-- Note that the Binary instance for ghc-pkg's representation of packages
-- is not defined in this package. This is because ghc-pkg uses Cabal types
-- (and Binary instances for these) which this package does not depend on.
--
| 563
| true
| true
| 0
| 9
| 196
| 113
| 57
| 56
| null | null |
plcplc/typed-rest
|
types/src/Network/HTTP/Rest/Match.hs
|
gpl-3.0
|
rd' e False = MatchErr (e False)
m
| 35
|
guard' e False = MatchErr (e False)
| 35
|
guard' e False = MatchErr (e False)
| 35
| false
| false
| 1
| 6
| 8
| 28
| 10
| 18
| null | null |
silkapp/stylish-haskell
|
lib/Language/Haskell/Stylish.hs
|
bsd-3-clause
|
--------------------------------------------------------------------------------
languagePragmas :: Int -- ^ columns
-> LanguagePragmas.Style
-> Bool -- ^ Pad to same length in vertical mode?
-> Bool -- ^ remove redundant?
-> Step
languagePragmas = LanguagePragmas.step
| 333
|
languagePragmas :: Int -- ^ columns
-> LanguagePragmas.Style
-> Bool -- ^ Pad to same length in vertical mode?
-> Bool -- ^ remove redundant?
-> Step
languagePragmas = LanguagePragmas.step
| 252
|
languagePragmas = LanguagePragmas.step
| 38
| true
| true
| 0
| 8
| 94
| 35
| 20
| 15
| null | null |
gckeller/shades
|
Shades.hsproj/Constants.hs
|
bsd-2-clause
|
blocksInCol = 8 :: Int
| 22
|
blocksInCol = 8 :: Int
| 22
|
blocksInCol = 8 :: Int
| 22
| false
| false
| 0
| 4
| 4
| 9
| 5
| 4
| null | null |
music-suite/musicxml2
|
src/Data/Music/MusicXml/Pitch.hs
|
bsd-3-clause
|
-- ^ Line number, from bottom (i.e. 1-5)
noSemitones :: Maybe Semitones
noSemitones = Nothing
| 95
|
noSemitones :: Maybe Semitones
noSemitones = Nothing
| 52
|
noSemitones = Nothing
| 21
| true
| true
| 0
| 5
| 16
| 15
| 8
| 7
| null | null |
forked-upstream-packages-for-ghcjs/ghc
|
compiler/typecheck/TcType.hs
|
bsd-3-clause
|
pprUserTypeCtxt (RuleSigCtxt n) = ptext (sLit "a RULE for") <+> quotes (ppr n)
| 80
|
pprUserTypeCtxt (RuleSigCtxt n) = ptext (sLit "a RULE for") <+> quotes (ppr n)
| 80
|
pprUserTypeCtxt (RuleSigCtxt n) = ptext (sLit "a RULE for") <+> quotes (ppr n)
| 80
| false
| false
| 0
| 8
| 14
| 37
| 17
| 20
| null | null |
mboes/dedukti
|
Dedukti/Runtime.hs
|
gpl-3.0
|
convertible :: Int -> Code -> Code -> ()
convertible n t1 t2 | conv n t1 t2 = ()
| otherwise = throw $ ConvError (prettyCode n t1) (prettyCode n t2)
where conv n (Var x) (Var x') = x == x'
conv n (Con c) (Con c') = c == c'
conv n (Lam t) (Lam t') =
conv (n + 1) (t (Var n)) (t' (Var n))
conv n (Pi ty1 ty2) (Pi ty3 ty4) =
conv n ty1 ty3 && conv (n + 1) (ty2 (Var n)) (ty4 (Var n))
conv n (App t1 t2) (App t3 t4) =
conv n t1 t3 && conv n t2 t4
conv n Type Type = True
conv n Kind Kind = True
conv n _ _ = False
| 617
|
convertible :: Int -> Code -> Code -> ()
convertible n t1 t2 | conv n t1 t2 = ()
| otherwise = throw $ ConvError (prettyCode n t1) (prettyCode n t2)
where conv n (Var x) (Var x') = x == x'
conv n (Con c) (Con c') = c == c'
conv n (Lam t) (Lam t') =
conv (n + 1) (t (Var n)) (t' (Var n))
conv n (Pi ty1 ty2) (Pi ty3 ty4) =
conv n ty1 ty3 && conv (n + 1) (ty2 (Var n)) (ty4 (Var n))
conv n (App t1 t2) (App t3 t4) =
conv n t1 t3 && conv n t2 t4
conv n Type Type = True
conv n Kind Kind = True
conv n _ _ = False
| 617
|
convertible n t1 t2 | conv n t1 t2 = ()
| otherwise = throw $ ConvError (prettyCode n t1) (prettyCode n t2)
where conv n (Var x) (Var x') = x == x'
conv n (Con c) (Con c') = c == c'
conv n (Lam t) (Lam t') =
conv (n + 1) (t (Var n)) (t' (Var n))
conv n (Pi ty1 ty2) (Pi ty3 ty4) =
conv n ty1 ty3 && conv (n + 1) (ty2 (Var n)) (ty4 (Var n))
conv n (App t1 t2) (App t3 t4) =
conv n t1 t3 && conv n t2 t4
conv n Type Type = True
conv n Kind Kind = True
conv n _ _ = False
| 576
| false
| true
| 9
| 10
| 237
| 396
| 177
| 219
| null | null |
fffej/HS-Poker
|
LookupPatternMatch.hs
|
bsd-3-clause
|
getValueFromProduct 455469 = 4256
| 33
|
getValueFromProduct 455469 = 4256
| 33
|
getValueFromProduct 455469 = 4256
| 33
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
GaloisInc/halvm-ghc
|
compiler/types/Coercion.hs
|
bsd-3-clause
|
seqProv (PhantomProv co) = seqCo co
| 38
|
seqProv (PhantomProv co) = seqCo co
| 38
|
seqProv (PhantomProv co) = seqCo co
| 38
| false
| false
| 0
| 6
| 8
| 19
| 8
| 11
| null | null |
rCEx/feldspar-lang-small
|
tests/Feldspar/Range/Test.hs
|
bsd-3-clause
|
fromRange :: BoundedInt a => Random a => Range a -> Gen a
fromRange r
| isEmpty r = error "fromRange: empty range"
| otherwise = choose (lowerBound r, upperBound r)
| 172
|
fromRange :: BoundedInt a => Random a => Range a -> Gen a
fromRange r
| isEmpty r = error "fromRange: empty range"
| otherwise = choose (lowerBound r, upperBound r)
| 172
|
fromRange r
| isEmpty r = error "fromRange: empty range"
| otherwise = choose (lowerBound r, upperBound r)
| 114
| false
| true
| 1
| 8
| 38
| 72
| 32
| 40
| null | null |
airt/Haskell-99
|
src/NinetyNine/P2X.hs
|
mit
|
group' :: (Integral n, Eq a) => [n] -> [a] -> [[[a]]]
group' [] _ = [[]]
| 72
|
group' :: (Integral n, Eq a) => [n] -> [a] -> [[[a]]]
group' [] _ = [[]]
| 72
|
group' [] _ = [[]]
| 18
| false
| true
| 0
| 10
| 16
| 66
| 35
| 31
| null | null |
AlexanderPankiv/ghc
|
compiler/simplCore/SetLevels.hs
|
bsd-3-clause
|
countFreeIds :: VarSet -> Int
countFreeIds = foldVarSet add 0
where
add :: Var -> Int -> Int
add v n | isId v = n+1
| otherwise = n
{-
************************************************************************
* *
\subsection{Free-To-Level Monad}
* *
************************************************************************
-}
| 488
|
countFreeIds :: VarSet -> Int
countFreeIds = foldVarSet add 0
where
add :: Var -> Int -> Int
add v n | isId v = n+1
| otherwise = n
{-
************************************************************************
* *
\subsection{Free-To-Level Monad}
* *
************************************************************************
-}
| 488
|
countFreeIds = foldVarSet add 0
where
add :: Var -> Int -> Int
add v n | isId v = n+1
| otherwise = n
{-
************************************************************************
* *
\subsection{Free-To-Level Monad}
* *
************************************************************************
-}
| 458
| false
| true
| 0
| 8
| 203
| 84
| 36
| 48
| null | null |
y-usuzumi/survive-the-course
|
www.icourse163.org/ZJU-93001/第四周编程作业/3.hs
|
bsd-3-clause
|
split (' ':as) = "":split as
| 28
|
split (' ':as) = "":split as
| 28
|
split (' ':as) = "":split as
| 28
| false
| false
| 0
| 7
| 5
| 23
| 11
| 12
| null | null |
DavidAlphaFox/ghc
|
utils/hsc2hs/Common.hs
|
bsd-3-clause
|
rawSystemWithStdOutL :: String -> Bool -> FilePath -> [String] -> FilePath -> IO ()
rawSystemWithStdOutL action flg prog args outFile = do
let cmdLine = prog++" "++unwords args++" >"++outFile
when flg (hPutStrLn stderr ("Executing: " ++ cmdLine))
hOut <- openFile outFile WriteMode
process <- runProcess prog args Nothing Nothing Nothing (Just hOut) Nothing
exitStatus <- waitForProcess process
hClose hOut
case exitStatus of
ExitFailure exitCode -> die $ action ++ " failed "
++ "(exit code " ++ show exitCode ++ ")\n"
++ "command was: " ++ cmdLine ++ "\n"
_ -> return ()
-- delay the cleanup of generated files until the end; attempts to
-- get around intermittent failure to delete files which has
-- just been exec'ed by a sub-process (Win32 only.)
| 856
|
rawSystemWithStdOutL :: String -> Bool -> FilePath -> [String] -> FilePath -> IO ()
rawSystemWithStdOutL action flg prog args outFile = do
let cmdLine = prog++" "++unwords args++" >"++outFile
when flg (hPutStrLn stderr ("Executing: " ++ cmdLine))
hOut <- openFile outFile WriteMode
process <- runProcess prog args Nothing Nothing Nothing (Just hOut) Nothing
exitStatus <- waitForProcess process
hClose hOut
case exitStatus of
ExitFailure exitCode -> die $ action ++ " failed "
++ "(exit code " ++ show exitCode ++ ")\n"
++ "command was: " ++ cmdLine ++ "\n"
_ -> return ()
-- delay the cleanup of generated files until the end; attempts to
-- get around intermittent failure to delete files which has
-- just been exec'ed by a sub-process (Win32 only.)
| 856
|
rawSystemWithStdOutL action flg prog args outFile = do
let cmdLine = prog++" "++unwords args++" >"++outFile
when flg (hPutStrLn stderr ("Executing: " ++ cmdLine))
hOut <- openFile outFile WriteMode
process <- runProcess prog args Nothing Nothing Nothing (Just hOut) Nothing
exitStatus <- waitForProcess process
hClose hOut
case exitStatus of
ExitFailure exitCode -> die $ action ++ " failed "
++ "(exit code " ++ show exitCode ++ ")\n"
++ "command was: " ++ cmdLine ++ "\n"
_ -> return ()
-- delay the cleanup of generated files until the end; attempts to
-- get around intermittent failure to delete files which has
-- just been exec'ed by a sub-process (Win32 only.)
| 772
| false
| true
| 0
| 17
| 227
| 222
| 105
| 117
| null | null |
nau/lasca-compiler
|
src/lib/Lasca/Codegen.hs
|
bsd-3-clause
|
stringTypePtr = global ptrType "String_LaType"
| 46
|
stringTypePtr = global ptrType "String_LaType"
| 46
|
stringTypePtr = global ptrType "String_LaType"
| 46
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
rkoeninger/GameCom
|
src/lib/CPU.hs
|
mit
|
decode 0xc6 = (dec, zpgMode, 5)
| 31
|
decode 0xc6 = (dec, zpgMode, 5)
| 31
|
decode 0xc6 = (dec, zpgMode, 5)
| 31
| false
| false
| 0
| 5
| 5
| 18
| 10
| 8
| null | null |
LambdaHack/LambdaHack
|
engine-src/Game/LambdaHack/Atomic/HandleAtomicWrite.hs
|
bsd-3-clause
|
updLeadFaction :: MonadStateWrite m
=> FactionId
-> Maybe ActorId
-> Maybe ActorId
-> m ()
updLeadFaction fid source target = assert (source /= target) $ do
fact <- getsState $ (EM.! fid) . sfactionD
let !_A = assert (fhasPointman (gkind fact)) ()
-- @PosNone@ ensures this
mtb <- getsState $ \s -> flip getActorBody s <$> target
let !_A = assert (maybe True (not . bproj) mtb
`blame` (fid, source, target, mtb, fact)) ()
let !_A = assert (source == gleader fact
`blame` "unexpected actor leader"
`swith` (fid, source, target, mtb, fact)) ()
let adj fa = fa {_gleader = target}
updateFaction fid adj
| 737
|
updLeadFaction :: MonadStateWrite m
=> FactionId
-> Maybe ActorId
-> Maybe ActorId
-> m ()
updLeadFaction fid source target = assert (source /= target) $ do
fact <- getsState $ (EM.! fid) . sfactionD
let !_A = assert (fhasPointman (gkind fact)) ()
-- @PosNone@ ensures this
mtb <- getsState $ \s -> flip getActorBody s <$> target
let !_A = assert (maybe True (not . bproj) mtb
`blame` (fid, source, target, mtb, fact)) ()
let !_A = assert (source == gleader fact
`blame` "unexpected actor leader"
`swith` (fid, source, target, mtb, fact)) ()
let adj fa = fa {_gleader = target}
updateFaction fid adj
| 737
|
updLeadFaction fid source target = assert (source /= target) $ do
fact <- getsState $ (EM.! fid) . sfactionD
let !_A = assert (fhasPointman (gkind fact)) ()
-- @PosNone@ ensures this
mtb <- getsState $ \s -> flip getActorBody s <$> target
let !_A = assert (maybe True (not . bproj) mtb
`blame` (fid, source, target, mtb, fact)) ()
let !_A = assert (source == gleader fact
`blame` "unexpected actor leader"
`swith` (fid, source, target, mtb, fact)) ()
let adj fa = fa {_gleader = target}
updateFaction fid adj
| 586
| false
| true
| 0
| 16
| 241
| 278
| 139
| 139
| null | null |
capitanbatata/functional-systems-in-haskell
|
fsh-exercises/src/GenericProgramming.hs
|
mit
|
-- > λ> safeIO g
-- > "AppError"
-- > λ> safeIO h
-- > "AppError"
-- > λ> safeIODB g
-- > "DBError"
-- > λ> safeIODB h
-- > *** Exception: App error: UserError
-- * The 'Data' class
raiseSalaries :: (Data x) => x -> x
raiseSalaries x = runIdentity $ gfoldl step return (raiseSalary x)
where
step :: Data d => Identity (d -> b) -> d -> Identity b
step cdb d = cdb <*> pure (raiseSalaries d)
-- Wow! A generic traversal!
--
-- > λ> raiseSalaries $ Just (1, Salary 4, True, (Salary 7, ()))
-- > Just (1,Salary 4.16,True,(Salary 7.28,()))
| 552
|
raiseSalaries :: (Data x) => x -> x
raiseSalaries x = runIdentity $ gfoldl step return (raiseSalary x)
where
step :: Data d => Identity (d -> b) -> d -> Identity b
step cdb d = cdb <*> pure (raiseSalaries d)
-- Wow! A generic traversal!
--
-- > λ> raiseSalaries $ Just (1, Salary 4, True, (Salary 7, ()))
-- > Just (1,Salary 4.16,True,(Salary 7.28,()))
| 369
|
raiseSalaries x = runIdentity $ gfoldl step return (raiseSalary x)
where
step :: Data d => Identity (d -> b) -> d -> Identity b
step cdb d = cdb <*> pure (raiseSalaries d)
-- Wow! A generic traversal!
--
-- > λ> raiseSalaries $ Just (1, Salary 4, True, (Salary 7, ()))
-- > Just (1,Salary 4.16,True,(Salary 7.28,()))
| 333
| true
| true
| 4
| 8
| 125
| 113
| 63
| 50
| null | null |
cleichner/gitit
|
src/Network/Gitit/Export.hs
|
gpl-2.0
|
respondAsciiDoc :: String -> Pandoc -> Handler
respondAsciiDoc = respondS "asciidoc" "text/plain; charset=utf-8" ""
writeAsciiDoc defaultRespOptions
| 150
|
respondAsciiDoc :: String -> Pandoc -> Handler
respondAsciiDoc = respondS "asciidoc" "text/plain; charset=utf-8" ""
writeAsciiDoc defaultRespOptions
| 150
|
respondAsciiDoc = respondS "asciidoc" "text/plain; charset=utf-8" ""
writeAsciiDoc defaultRespOptions
| 103
| false
| true
| 0
| 6
| 17
| 32
| 15
| 17
| null | null |
hanshoglund/modulo
|
src/Language/Modulo/Lisp.hs
|
gpl-3.0
|
symbol :: String -> Lisp
symbol = Symbol . pack
| 47
|
symbol :: String -> Lisp
symbol = Symbol . pack
| 47
|
symbol = Symbol . pack
| 22
| false
| true
| 0
| 5
| 9
| 19
| 10
| 9
| null | null |
ocramz/petsc-hs
|
src/Numerical/PETSc/Internal/InlineC.hs
|
gpl-3.0
|
-- | -- MatNullSpace
-- PetscErrorCode MatNullSpaceCreate(MPI_Comm comm,PetscBool has_cnst,PetscInt n,const Vec vecs[],MatNullSpace *SP) -- Collective on MPI_Comm
-- Creates a data structure used to project vectors out of null spaces.
-- Input Parameters :
-- comm - the MPI communicator associated with the object
-- has_cnst - PETSC_TRUE if the null space contains the constant vector; otherwise PETSC_FALSE
-- n - number of vectors (excluding constant vector) in null space
-- vecs - the vectors that span the null space (excluding the constant vector); these vectors must be orthonormal. These vectors are NOT copied, so do not change them after this call. You should free the array that you pass in and destroy the vectors (this will reduce the reference count for them by one).
-- Notes: See MatNullSpaceSetFunction() as an alternative way of providing the null space information instead of setting vecs.
-- If has_cnst is PETSC_TRUE you do not need to pass a constant vector in as a fourth argument to this routine, nor do you need to pass in a function that eliminates the constant function into MatNullSpaceSetFunction().
-- Output Parameter:
-- SP -the null space context
matNullSpaceCreate' :: Comm -> Bool -> Int -> VS.Vector Vec -> IO (MatNullSpace, CInt)
matNullSpaceCreate' cc hasc n vecs = withPtr $ \sp ->
VS.unsafeWith vecs $ \vecsp ->
[C.exp|int{MatNullSpaceCreate($(int c),$(PetscBool hascc),$(PetscInt nn),$(const Vec* vecsp),$(MatNullSpace* sp))}|]
where c = unComm cc
hascc = boolToPetscBoolC hasc
nn = toCInt n
| 1,562
|
matNullSpaceCreate' :: Comm -> Bool -> Int -> VS.Vector Vec -> IO (MatNullSpace, CInt)
matNullSpaceCreate' cc hasc n vecs = withPtr $ \sp ->
VS.unsafeWith vecs $ \vecsp ->
[C.exp|int{MatNullSpaceCreate($(int c),$(PetscBool hascc),$(PetscInt nn),$(const Vec* vecsp),$(MatNullSpace* sp))}|]
where c = unComm cc
hascc = boolToPetscBoolC hasc
nn = toCInt n
| 376
|
matNullSpaceCreate' cc hasc n vecs = withPtr $ \sp ->
VS.unsafeWith vecs $ \vecsp ->
[C.exp|int{MatNullSpaceCreate($(int c),$(PetscBool hascc),$(PetscInt nn),$(const Vec* vecsp),$(MatNullSpace* sp))}|]
where c = unComm cc
hascc = boolToPetscBoolC hasc
nn = toCInt n
| 289
| true
| true
| 2
| 10
| 266
| 123
| 67
| 56
| null | null |
xkollar/handy-haskell
|
other/pt-2012-03/fasttree.hs
|
gpl-3.0
|
treeLabelPost :: [a] -> BinTree b -> BinTree a
treeLabelPost s t = fst (f t s) where
f Empty s = (Empty,s)
f (Node _ l r) [] = error "Not enough labels"
f (Node _ l r) s = (Node x ll lr,s3) where
(ll,s1) = f l s
(lr,s2) = f r s1
(x:s3) = s2
| 287
|
treeLabelPost :: [a] -> BinTree b -> BinTree a
treeLabelPost s t = fst (f t s) where
f Empty s = (Empty,s)
f (Node _ l r) [] = error "Not enough labels"
f (Node _ l r) s = (Node x ll lr,s3) where
(ll,s1) = f l s
(lr,s2) = f r s1
(x:s3) = s2
| 287
|
treeLabelPost s t = fst (f t s) where
f Empty s = (Empty,s)
f (Node _ l r) [] = error "Not enough labels"
f (Node _ l r) s = (Node x ll lr,s3) where
(ll,s1) = f l s
(lr,s2) = f r s1
(x:s3) = s2
| 240
| false
| true
| 2
| 8
| 105
| 182
| 88
| 94
| null | null |
JohnLato/scryptic
|
src/Scryptic/Language/LayoutScrypt.hs
|
gpl-3.0
|
incrGlobal :: Position -- ^ If the token is on the same line
-- as this position, update the column position.
-> Int -- ^ Number of characters to add to the position.
-> Token -> Token
incrGlobal (Pn _ l0 _) i (PT (Pn g l c) t) =
if l /= l0 then PT (Pn (g + i) l c) t
else PT (Pn (g + i) l (c + i)) t
| 367
|
incrGlobal :: Position -- ^ If the token is on the same line
-- as this position, update the column position.
-> Int -- ^ Number of characters to add to the position.
-> Token -> Token
incrGlobal (Pn _ l0 _) i (PT (Pn g l c) t) =
if l /= l0 then PT (Pn (g + i) l c) t
else PT (Pn (g + i) l (c + i)) t
| 367
|
incrGlobal (Pn _ l0 _) i (PT (Pn g l c) t) =
if l /= l0 then PT (Pn (g + i) l c) t
else PT (Pn (g + i) l (c + i)) t
| 130
| false
| true
| 0
| 10
| 140
| 124
| 65
| 59
| null | null |
sol/hexpat
|
Text/XML/Expat/Extended.hs
|
bsd-3-clause
|
-- | Modify the annotation of every node in the document recursively.
mapDocumentAnnotation :: (a -> b) -> Document a tag text -> Document b tag text
mapDocumentAnnotation f doc = Document {
dXMLDeclaration = dXMLDeclaration doc,
dDocumentTypeDeclaration = dDocumentTypeDeclaration doc,
dTopLevelMiscs = dTopLevelMiscs doc,
dRoot = mapAnnotation f (dRoot doc)
}
| 435
|
mapDocumentAnnotation :: (a -> b) -> Document a tag text -> Document b tag text
mapDocumentAnnotation f doc = Document {
dXMLDeclaration = dXMLDeclaration doc,
dDocumentTypeDeclaration = dDocumentTypeDeclaration doc,
dTopLevelMiscs = dTopLevelMiscs doc,
dRoot = mapAnnotation f (dRoot doc)
}
| 365
|
mapDocumentAnnotation f doc = Document {
dXMLDeclaration = dXMLDeclaration doc,
dDocumentTypeDeclaration = dDocumentTypeDeclaration doc,
dTopLevelMiscs = dTopLevelMiscs doc,
dRoot = mapAnnotation f (dRoot doc)
}
| 285
| true
| true
| 0
| 9
| 125
| 92
| 48
| 44
| null | null |
Drezil/subhask
|
src/SubHask/SubType.hs
|
bsd-3-clause
|
stripForall :: Type -> Type
stripForall (ForallT _ _ t) = stripForall t
| 71
|
stripForall :: Type -> Type
stripForall (ForallT _ _ t) = stripForall t
| 71
|
stripForall (ForallT _ _ t) = stripForall t
| 43
| false
| true
| 0
| 7
| 12
| 31
| 15
| 16
| null | null |
danchoi/mustache-haskell
|
Text/Mustache/Parse.hs
|
mit
|
closeTag :: KeyPath -> Parser String
closeTag k = try (inDelimiters (char '/' *> string k'))
where k' = keyPathToString k
| 124
|
closeTag :: KeyPath -> Parser String
closeTag k = try (inDelimiters (char '/' *> string k'))
where k' = keyPathToString k
| 124
|
closeTag k = try (inDelimiters (char '/' *> string k'))
where k' = keyPathToString k
| 87
| false
| true
| 0
| 10
| 23
| 54
| 25
| 29
| null | null |
brendanhay/gogol
|
gogol-gmail/gen/Network/Google/Resource/Gmail/Users/Settings/SendAs/SmimeInfo/Delete.hs
|
mpl-2.0
|
-- | The email address that appears in the \"From:\" header for mail sent
-- using this alias.
ussasidSendAsEmail :: Lens' UsersSettingsSendAsSmimeInfoDelete Text
ussasidSendAsEmail
= lens _ussasidSendAsEmail
(\ s a -> s{_ussasidSendAsEmail = a})
| 254
|
ussasidSendAsEmail :: Lens' UsersSettingsSendAsSmimeInfoDelete Text
ussasidSendAsEmail
= lens _ussasidSendAsEmail
(\ s a -> s{_ussasidSendAsEmail = a})
| 159
|
ussasidSendAsEmail
= lens _ussasidSendAsEmail
(\ s a -> s{_ussasidSendAsEmail = a})
| 91
| true
| true
| 1
| 9
| 41
| 46
| 23
| 23
| null | null |
lukexi/rumpus
|
src/Rumpus/Systems/KeyPads.hs
|
bsd-3-clause
|
shiftMap, unshiftMap :: Map Char Char
shiftMap = Map.fromList (zip lowerChars upperChars)
| 91
|
shiftMap, unshiftMap :: Map Char Char
shiftMap = Map.fromList (zip lowerChars upperChars)
| 91
|
shiftMap = Map.fromList (zip lowerChars upperChars)
| 53
| false
| true
| 0
| 7
| 13
| 31
| 16
| 15
| null | null |
mpickering/hlint
|
src/Util.hs
|
bsd-3-clause
|
readEncoding :: String -> IO Encoding
-- GHC's mkTextEncoding function is fairly poor - it doesn't support lots of fun things,
-- so we fake them up, and then try mkTextEncoding last
readEncoding "" = return defaultEncoding
| 223
|
readEncoding :: String -> IO Encoding
readEncoding "" = return defaultEncoding
| 78
|
readEncoding "" = return defaultEncoding
| 40
| true
| true
| 0
| 7
| 36
| 31
| 14
| 17
| null | null |
gbenison/fasta-utils
|
fastaorf.hs
|
gpl-3.0
|
isComment _ = False
| 19
|
isComment _ = False
| 19
|
isComment _ = False
| 19
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
spacekitteh/smcghc
|
compiler/codeGen/StgCmmPrim.hs
|
bsd-3-clause
|
emitMemsetCall :: CmmExpr -> CmmExpr -> CmmExpr -> CmmExpr -> FCode ()
emitMemsetCall dst c n align = do
emitPrimCall
[ {- no results -} ]
MO_Memset
[ dst, c, n, align ]
| 197
|
emitMemsetCall :: CmmExpr -> CmmExpr -> CmmExpr -> CmmExpr -> FCode ()
emitMemsetCall dst c n align = do
emitPrimCall
[ {- no results -} ]
MO_Memset
[ dst, c, n, align ]
| 197
|
emitMemsetCall dst c n align = do
emitPrimCall
[ {- no results -} ]
MO_Memset
[ dst, c, n, align ]
| 126
| false
| true
| 0
| 11
| 60
| 71
| 35
| 36
| null | null |
didmar/helm
|
src/FRP/Helm/Keyboard.hs
|
mit
|
arrows' :: Bool -> Bool -> Bool -> Bool -> (Int, Int)
arrows' u l d r = (-1 * fromEnum l + 1 * fromEnum r, -1 * fromEnum u + 1 * fromEnum d)
| 140
|
arrows' :: Bool -> Bool -> Bool -> Bool -> (Int, Int)
arrows' u l d r = (-1 * fromEnum l + 1 * fromEnum r, -1 * fromEnum u + 1 * fromEnum d)
| 140
|
arrows' u l d r = (-1 * fromEnum l + 1 * fromEnum r, -1 * fromEnum u + 1 * fromEnum d)
| 86
| false
| true
| 0
| 11
| 35
| 94
| 45
| 49
| null | null |
merijn/SNet2.0
|
SNet/Record.hs
|
gpl-3.0
|
flowInherit :: Pattern p -> Record Data -> Record Data -> Record Data
flowInherit pat base new = merge new $ clean pat base
where clean :: Pattern p -> Record Data -> Record Data
clean p = foldPattern p delete
| 219
|
flowInherit :: Pattern p -> Record Data -> Record Data -> Record Data
flowInherit pat base new = merge new $ clean pat base
where clean :: Pattern p -> Record Data -> Record Data
clean p = foldPattern p delete
| 219
|
flowInherit pat base new = merge new $ clean pat base
where clean :: Pattern p -> Record Data -> Record Data
clean p = foldPattern p delete
| 149
| false
| true
| 3
| 8
| 50
| 89
| 41
| 48
| null | null |
markus1189/optparse-applicative
|
tests/Tests.hs
|
bsd-3-clause
|
case_issue_52 :: Assertion
case_issue_52 = do
let p = subparser
( metavar "FOO"
<> command "run" (info (pure "foo") idm) )
i = info p idm
assertError (run i []) $ \failure -> do
let text = head . lines . fst $ renderFailure failure "test"
"Usage: test FOO" @=? text
| 299
|
case_issue_52 :: Assertion
case_issue_52 = do
let p = subparser
( metavar "FOO"
<> command "run" (info (pure "foo") idm) )
i = info p idm
assertError (run i []) $ \failure -> do
let text = head . lines . fst $ renderFailure failure "test"
"Usage: test FOO" @=? text
| 299
|
case_issue_52 = do
let p = subparser
( metavar "FOO"
<> command "run" (info (pure "foo") idm) )
i = info p idm
assertError (run i []) $ \failure -> do
let text = head . lines . fst $ renderFailure failure "test"
"Usage: test FOO" @=? text
| 272
| false
| true
| 0
| 17
| 84
| 127
| 58
| 69
| null | null |
odi/xmonad-ext
|
src/XMonad/Libs/Prompts.hs
|
bsd-3-clause
|
switchExec :: String -> String
switchExec name = chkList $ execList name
where
execList n = filter ((==n) . fst . fst) switchProgs
chkList [] = ""
chkList ls = (snd . fst) $ head ls
| 195
|
switchExec :: String -> String
switchExec name = chkList $ execList name
where
execList n = filter ((==n) . fst . fst) switchProgs
chkList [] = ""
chkList ls = (snd . fst) $ head ls
| 195
|
switchExec name = chkList $ execList name
where
execList n = filter ((==n) . fst . fst) switchProgs
chkList [] = ""
chkList ls = (snd . fst) $ head ls
| 164
| false
| true
| 0
| 9
| 49
| 88
| 44
| 44
| null | null |
jyp/gasp
|
Algebra/Morphism/LinComb.hs
|
gpl-3.0
|
-- | transform variables. coefficients are not touched
mapVars :: Ord x => (t -> x) -> LinComb t c -> LinComb x c
mapVars f (LinComb m) = unsafeFromList [(f x, e) | (x,e) <- M.assocs m]
| 185
|
mapVars :: Ord x => (t -> x) -> LinComb t c -> LinComb x c
mapVars f (LinComb m) = unsafeFromList [(f x, e) | (x,e) <- M.assocs m]
| 130
|
mapVars f (LinComb m) = unsafeFromList [(f x, e) | (x,e) <- M.assocs m]
| 71
| true
| true
| 0
| 10
| 37
| 89
| 45
| 44
| null | null |
M42/mikrokosmos
|
source/Ski.hs
|
gpl-3.0
|
skiabs (TypedAbort a) = Comb Sabort (skiabs a)
| 46
|
skiabs (TypedAbort a) = Comb Sabort (skiabs a)
| 46
|
skiabs (TypedAbort a) = Comb Sabort (skiabs a)
| 46
| false
| false
| 0
| 6
| 7
| 28
| 12
| 16
| null | null |
cbpark/GluinoStopPolarization
|
lib/Parton/Variables.hs
|
gpl-3.0
|
eRatioByM :: EventEntry -> ByteString
eRatioByM = runReader $ eRatioBLpair pairByM
| 82
|
eRatioByM :: EventEntry -> ByteString
eRatioByM = runReader $ eRatioBLpair pairByM
| 82
|
eRatioByM = runReader $ eRatioBLpair pairByM
| 44
| false
| true
| 0
| 6
| 10
| 22
| 11
| 11
| null | null |
fffej/HS-Poker
|
LookupPatternMatch.hs
|
bsd-3-clause
|
getValueFromProduct 10631543 = 3832
| 35
|
getValueFromProduct 10631543 = 3832
| 35
|
getValueFromProduct 10631543 = 3832
| 35
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
TristanAllwood/lazyCrossCheck
|
LazyCrossCheck.hs
|
bsd-3-clause
|
printCT :: ComparisonTable -> IO ()
printCT ct@(ComparisonTable rows) = do
let (passes, possible) = tableStats ct
putStrLn $ "Results Summary: " ++ show passes ++ " / " ++ show possible
forM_ rows $ \row -> do
let txt = PP.renderStyle (PP.style { lineLength = 72 }) (format row)
putStrLn txt
| 306
|
printCT :: ComparisonTable -> IO ()
printCT ct@(ComparisonTable rows) = do
let (passes, possible) = tableStats ct
putStrLn $ "Results Summary: " ++ show passes ++ " / " ++ show possible
forM_ rows $ \row -> do
let txt = PP.renderStyle (PP.style { lineLength = 72 }) (format row)
putStrLn txt
| 306
|
printCT ct@(ComparisonTable rows) = do
let (passes, possible) = tableStats ct
putStrLn $ "Results Summary: " ++ show passes ++ " / " ++ show possible
forM_ rows $ \row -> do
let txt = PP.renderStyle (PP.style { lineLength = 72 }) (format row)
putStrLn txt
| 270
| false
| true
| 0
| 17
| 66
| 132
| 63
| 69
| null | null |
CulpaBS/wbBach
|
src/Futhark/Representation/Primitive.hs
|
bsd-3-clause
|
-- | Convert an unsigned integer to a floating-point value.
doUIToFP :: IntValue -> FloatType -> FloatValue
doUIToFP v t = floatValue t $ intToWord64 v
| 151
|
doUIToFP :: IntValue -> FloatType -> FloatValue
doUIToFP v t = floatValue t $ intToWord64 v
| 91
|
doUIToFP v t = floatValue t $ intToWord64 v
| 43
| true
| true
| 0
| 8
| 25
| 40
| 18
| 22
| null | null |
gspia/reflex-dom-htmlea
|
lib/src/Reflex/Dom/HTML5/Elements/Elements.hs
|
bsd-3-clause
|
-- | A short-hand notion for @ elDynAttr\' \"rp\" ... @
rpD' ∷ forall t m a. (DomBuilder t m, PostBuild t m) ⇒ Dynamic t Rp → m a → m (Element EventResult (DomBuilderSpace m) t, a)
rpD' bm = elDynAttr' "rp" (A.attrMap <$> bm)
| 226
|
rpD' ∷ forall t m a. (DomBuilder t m, PostBuild t m) ⇒ Dynamic t Rp → m a → m (Element EventResult (DomBuilderSpace m) t, a)
rpD' bm = elDynAttr' "rp" (A.attrMap <$> bm)
| 170
|
rpD' bm = elDynAttr' "rp" (A.attrMap <$> bm)
| 45
| true
| true
| 0
| 14
| 46
| 97
| 49
| 48
| null | null |
tjakway/ghcjvm
|
compiler/ghci/ByteCodeAsm.hs
|
bsd-3-clause
|
isLarge :: Word -> Bool
isLarge n = n > 65535
| 45
|
isLarge :: Word -> Bool
isLarge n = n > 65535
| 45
|
isLarge n = n > 65535
| 21
| false
| true
| 2
| 7
| 10
| 29
| 12
| 17
| null | null |
brendanhay/gogol
|
gogol-cloudsearch/gen/Network/Google/CloudSearch/Types/Product.hs
|
mpl-2.0
|
-- | Can this operator be used to sort results.
qoIsSortable :: Lens' QueryOperator (Maybe Bool)
qoIsSortable
= lens _qoIsSortable (\ s a -> s{_qoIsSortable = a})
| 164
|
qoIsSortable :: Lens' QueryOperator (Maybe Bool)
qoIsSortable
= lens _qoIsSortable (\ s a -> s{_qoIsSortable = a})
| 116
|
qoIsSortable
= lens _qoIsSortable (\ s a -> s{_qoIsSortable = a})
| 67
| true
| true
| 1
| 9
| 28
| 52
| 25
| 27
| null | null |
ekmett/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxSTC_KIX_COMMENT :: Int
wxSTC_KIX_COMMENT = 1
| 46
|
wxSTC_KIX_COMMENT :: Int
wxSTC_KIX_COMMENT = 1
| 46
|
wxSTC_KIX_COMMENT = 1
| 21
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
simonced/haskell-kata
|
training/7_intersec_lists.hs
|
gpl-3.0
|
-- url: https://leetcode.com/problems/intersection-of-two-arrays/
-- Given two arrays, write a function to compute their intersection.
-- Example:
-- Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].
-- Note:
-- Each element in the result must be unique.
-- The result can be in any order.
list1 :: [Int]
list1 = [1,2,3,4,5,6,7]
| 338
|
list1 :: [Int]
list1 = [1,2,3,4,5,6,7]
| 38
|
list1 = [1,2,3,4,5,6,7]
| 23
| true
| true
| 0
| 5
| 58
| 42
| 29
| 13
| null | null |
yxm4109/pandoc
|
src/Text/Pandoc/Readers/LaTeX.hs
|
gpl-2.0
|
--
-- list blocks
--
list :: GenParser Char ParserState Block
list = bulletList <|> orderedList <|> definitionList <?> "list"
| 126
|
list :: GenParser Char ParserState Block
list = bulletList <|> orderedList <|> definitionList <?> "list"
| 104
|
list = bulletList <|> orderedList <|> definitionList <?> "list"
| 63
| true
| true
| 4
| 6
| 20
| 41
| 20
| 21
| null | null |
jbracker/supermonad-plugin
|
examples/monad/hmtc/original/PPTAMCode.hs
|
bsd-3-clause
|
ppTAMInst (LOADL n) = ppOA "LOADL" (show n)
| 49
|
ppTAMInst (LOADL n) = ppOA "LOADL" (show n)
| 49
|
ppTAMInst (LOADL n) = ppOA "LOADL" (show n)
| 49
| false
| false
| 0
| 7
| 13
| 26
| 12
| 14
| null | null |
jbearer/hspl
|
src/Control/Hspl/Internal/Unification.hs
|
mit
|
renameTerm (Sum t1 t2) = renameBinaryTerm Sum t1 t2
| 51
|
renameTerm (Sum t1 t2) = renameBinaryTerm Sum t1 t2
| 51
|
renameTerm (Sum t1 t2) = renameBinaryTerm Sum t1 t2
| 51
| false
| false
| 0
| 6
| 8
| 25
| 11
| 14
| null | null |
luciferous/vintage
|
generator/Syntax.hs
|
bsd-3-clause
|
brackets = P.brackets lexer
| 27
|
brackets = P.brackets lexer
| 27
|
brackets = P.brackets lexer
| 27
| false
| false
| 0
| 6
| 3
| 11
| 5
| 6
| null | null |
gambogi/csh-eval
|
src/CSH/Eval/Frontend/Projects.hs
|
mit
|
title name member status = [whamlet|
<strong>
#{name}
<span .project-status>
#{status}
<br />
<span .project-author>
by
<strong>
#{member}
|]
| 183
|
title name member status = [whamlet|
<strong>
#{name}
<span .project-status>
#{status}
<br />
<span .project-author>
by
<strong>
#{member}
|]
| 183
|
title name member status = [whamlet|
<strong>
#{name}
<span .project-status>
#{status}
<br />
<span .project-author>
by
<strong>
#{member}
|]
| 183
| false
| false
| 0
| 5
| 60
| 19
| 10
| 9
| null | null |
seckcoder/vector
|
Data/Vector/Generic.hs
|
bsd-3-clause
|
postscanl f z = unstream . inplace (S.postscanl f z) id . stream
| 64
|
postscanl f z = unstream . inplace (S.postscanl f z) id . stream
| 64
|
postscanl f z = unstream . inplace (S.postscanl f z) id . stream
| 64
| false
| false
| 1
| 10
| 12
| 39
| 16
| 23
| null | null |
mhuesch/scheme_compiler
|
src/L1Tox64/Compile.hs
|
bsd-3-clause
|
xLowByte (Xw RDX) = "%bl"
| 25
|
xLowByte (Xw RDX) = "%bl"
| 25
|
xLowByte (Xw RDX) = "%bl"
| 25
| false
| false
| 0
| 7
| 4
| 15
| 7
| 8
| null | null |
goshakkk/lisley
|
src/Lisley/Eval.hs
|
mit
|
fullEval :: Env -> Expr -> Action Expr
fullEval env expr = expand env expr >>= eval env
| 87
|
fullEval :: Env -> Expr -> Action Expr
fullEval env expr = expand env expr >>= eval env
| 87
|
fullEval env expr = expand env expr >>= eval env
| 48
| false
| true
| 0
| 8
| 17
| 43
| 19
| 24
| null | null |
kawu/crf-chain2-generic
|
Data/CRF/Chain2/Generic/Internal.hs
|
bsd-2-clause
|
-- | Y constructor.
mkY :: Ord t => [(t, Double)] -> Y t
mkY = Y . mkAVec2
| 74
|
mkY :: Ord t => [(t, Double)] -> Y t
mkY = Y . mkAVec2
| 54
|
mkY = Y . mkAVec2
| 17
| true
| true
| 1
| 9
| 18
| 46
| 22
| 24
| null | null |
nymacro/hs-kmip
|
src/Ttlv/Parser/Serialize.hs
|
bsd-3-clause
|
parseTtlvString :: Int -> Get TtlvData
parseTtlvString n = do
val <- getByteString $ fromIntegral n
return $ TtlvString $ decodeUtf8 val
| 140
|
parseTtlvString :: Int -> Get TtlvData
parseTtlvString n = do
val <- getByteString $ fromIntegral n
return $ TtlvString $ decodeUtf8 val
| 140
|
parseTtlvString n = do
val <- getByteString $ fromIntegral n
return $ TtlvString $ decodeUtf8 val
| 101
| false
| true
| 0
| 10
| 25
| 54
| 23
| 31
| null | null |
ak1211/tractor
|
src/BrokerBackend.hs
|
agpl-3.0
|
wquote :: Ap.Parser Char
wquote = Ap.char '\"'
| 46
|
wquote :: Ap.Parser Char
wquote = Ap.char '\"'
| 46
|
wquote = Ap.char '\"'
| 21
| false
| true
| 1
| 6
| 7
| 24
| 10
| 14
| null | null |
unknownloner/calccomp
|
C/Parser.hs
|
mit
|
var :: Parser Expr
var = do
name <- identifier
return $ Var name
| 72
|
var :: Parser Expr
var = do
name <- identifier
return $ Var name
| 72
|
var = do
name <- identifier
return $ Var name
| 53
| false
| true
| 1
| 9
| 21
| 35
| 14
| 21
| null | null |
ku-fpg/sunroof-compiler
|
Language/Sunroof/Selector.hs
|
bsd-3-clause
|
-- | Operator to use a selector on a Javascript object. Examples:
--
-- > array ! label "length"
-- > array ! index 4
(!) :: forall o a . (Sunroof o, Sunroof a) => o -> JSSelector a -> a
(!) arr (JSSelector idx) = box $ Dot (ExprE $ unbox arr)
(ExprE $ idx)
(typeOf (Proxy :: Proxy a))
| 359
|
(!) :: forall o a . (Sunroof o, Sunroof a) => o -> JSSelector a -> a
(!) arr (JSSelector idx) = box $ Dot (ExprE $ unbox arr)
(ExprE $ idx)
(typeOf (Proxy :: Proxy a))
| 241
|
(!) arr (JSSelector idx) = box $ Dot (ExprE $ unbox arr)
(ExprE $ idx)
(typeOf (Proxy :: Proxy a))
| 172
| true
| true
| 0
| 10
| 135
| 105
| 58
| 47
| null | null |
nshepperd/funn
|
AI/Funn/Common.hs
|
mit
|
newRunningAverage :: Double -> RunningAverage
newRunningAverage alpha = Avg alpha 0 0
| 85
|
newRunningAverage :: Double -> RunningAverage
newRunningAverage alpha = Avg alpha 0 0
| 85
|
newRunningAverage alpha = Avg alpha 0 0
| 39
| false
| true
| 0
| 5
| 11
| 25
| 12
| 13
| null | null |
ducis/haAni
|
hs/common/Graphics/Rendering/OpenGL/GL/VertexArrays.hs
|
gpl-2.0
|
setVertexAttribArray Enabled (AttribLocation location) = glEnableVertexAttribArray location
| 91
|
setVertexAttribArray Enabled (AttribLocation location) = glEnableVertexAttribArray location
| 91
|
setVertexAttribArray Enabled (AttribLocation location) = glEnableVertexAttribArray location
| 91
| false
| false
| 0
| 7
| 6
| 20
| 9
| 11
| null | null |
nevrenato/Hets_Fork
|
HasCASL/Builtin.hs
|
gpl-2.0
|
unitTerm :: Id -> Range -> Term
unitTerm i = mkQualOp i unitTypeScheme []
| 73
|
unitTerm :: Id -> Range -> Term
unitTerm i = mkQualOp i unitTypeScheme []
| 73
|
unitTerm i = mkQualOp i unitTypeScheme []
| 41
| false
| true
| 0
| 8
| 13
| 36
| 16
| 20
| null | null |
kowey/pandoc-old
|
src/Text/Pandoc/Blocks.hs
|
gpl-2.0
|
-- | Centers the contents of a @TextBlock@ within the block.
centerAlignBlock :: TextBlock -> TextBlock
centerAlignBlock (TextBlock width height lns) =
let centerAlignLine ln =
let ln' = hPad width ln
(startSpaces, rest) = span isWhitespace ln'
endSpaces = takeWhile isWhitespace (reverse ln')
numSpaces = length (startSpaces ++ endSpaces)
startSpaces' = replicate (quot numSpaces 2) ' '
in startSpaces' ++ rest
in TextBlock width height $ map centerAlignLine lns
| 535
|
centerAlignBlock :: TextBlock -> TextBlock
centerAlignBlock (TextBlock width height lns) =
let centerAlignLine ln =
let ln' = hPad width ln
(startSpaces, rest) = span isWhitespace ln'
endSpaces = takeWhile isWhitespace (reverse ln')
numSpaces = length (startSpaces ++ endSpaces)
startSpaces' = replicate (quot numSpaces 2) ' '
in startSpaces' ++ rest
in TextBlock width height $ map centerAlignLine lns
| 474
|
centerAlignBlock (TextBlock width height lns) =
let centerAlignLine ln =
let ln' = hPad width ln
(startSpaces, rest) = span isWhitespace ln'
endSpaces = takeWhile isWhitespace (reverse ln')
numSpaces = length (startSpaces ++ endSpaces)
startSpaces' = replicate (quot numSpaces 2) ' '
in startSpaces' ++ rest
in TextBlock width height $ map centerAlignLine lns
| 431
| true
| true
| 0
| 15
| 141
| 143
| 70
| 73
| null | null |
honux77/practice
|
haskell/day2/ex2.hs
|
mit
|
notCapital str = [ x | x <- str, x `notElem` ['A'..'Z']]
| 56
|
notCapital str = [ x | x <- str, x `notElem` ['A'..'Z']]
| 56
|
notCapital str = [ x | x <- str, x `notElem` ['A'..'Z']]
| 56
| false
| false
| 1
| 9
| 11
| 39
| 19
| 20
| null | null |
kmels/xmonad-launcher
|
XMonad/Actions/Launcher.hs
|
bsd-3-clause
|
completionFunctionWith :: String -> [String] -> IO [String]
completionFunctionWith cmd args = do fmap lines $ runProcessWithInput cmd args ""
-- | Creates a prompt with the given modes
| 185
|
completionFunctionWith :: String -> [String] -> IO [String]
completionFunctionWith cmd args = do fmap lines $ runProcessWithInput cmd args ""
-- | Creates a prompt with the given modes
| 185
|
completionFunctionWith cmd args = do fmap lines $ runProcessWithInput cmd args ""
-- | Creates a prompt with the given modes
| 125
| false
| true
| 0
| 8
| 29
| 51
| 25
| 26
| null | null |
jsavatgy/xroads-game
|
code/io-vecs.hs
|
gpl-2.0
|
dirTriplets = transpose [rotList r dirPoints | r <- [-1,0,1]]
| 61
|
dirTriplets = transpose [rotList r dirPoints | r <- [-1,0,1]]
| 61
|
dirTriplets = transpose [rotList r dirPoints | r <- [-1,0,1]]
| 61
| false
| false
| 0
| 10
| 9
| 36
| 19
| 17
| null | null |
davesque/timeshifter
|
ParseSubrip.hs
|
mit
|
subTime :: Parser SubTime
subTime = (do
h <- twoDigitInt
colon
m <- twoDigitInt
colon
s <- seconds
return $ SubTime h m s) `or` err "Illegal sub rip time entry"
| 184
|
subTime :: Parser SubTime
subTime = (do
h <- twoDigitInt
colon
m <- twoDigitInt
colon
s <- seconds
return $ SubTime h m s) `or` err "Illegal sub rip time entry"
| 184
|
subTime = (do
h <- twoDigitInt
colon
m <- twoDigitInt
colon
s <- seconds
return $ SubTime h m s) `or` err "Illegal sub rip time entry"
| 158
| false
| true
| 1
| 10
| 54
| 70
| 31
| 39
| null | null |
forked-upstream-packages-for-ghcjs/ghc
|
compiler/typecheck/TcGenDeriv.hs
|
bsd-3-clause
|
eqResult OrdLE = true_Expr
| 31
|
eqResult OrdLE = true_Expr
| 31
|
eqResult OrdLE = true_Expr
| 31
| false
| false
| 0
| 5
| 8
| 9
| 4
| 5
| null | null |
travitch/dalvik
|
src/Dalvik/AccessFlags.hs
|
bsd-3-clause
|
codeFlag AClass 0x04000 = ACC_ENUM
| 35
|
codeFlag AClass 0x04000 = ACC_ENUM
| 35
|
codeFlag AClass 0x04000 = ACC_ENUM
| 35
| false
| false
| 0
| 5
| 5
| 11
| 5
| 6
| null | null |
Oblosys/webviews
|
src/lib/BlazeHtml.hs
|
mit
|
min_ = A.min
| 12
|
min_ = A.min
| 12
|
min_ = A.min
| 12
| false
| false
| 1
| 6
| 2
| 12
| 4
| 8
| null | null |
futufeld/eclogues
|
eclogues-impl/gen-hs/AuroraSchedulerManager.hs
|
bsd-3-clause
|
decode_PulseJobUpdate_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> PulseJobUpdate_result
decode_PulseJobUpdate_result iprot bs = to_PulseJobUpdate_result $ T.deserializeVal iprot (T.T_STRUCT typemap_PulseJobUpdate_result) bs
| 247
|
decode_PulseJobUpdate_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> PulseJobUpdate_result
decode_PulseJobUpdate_result iprot bs = to_PulseJobUpdate_result $ T.deserializeVal iprot (T.T_STRUCT typemap_PulseJobUpdate_result) bs
| 247
|
decode_PulseJobUpdate_result iprot bs = to_PulseJobUpdate_result $ T.deserializeVal iprot (T.T_STRUCT typemap_PulseJobUpdate_result) bs
| 135
| false
| true
| 0
| 9
| 23
| 69
| 34
| 35
| null | null |
michaelt/streaming
|
src/Streaming/Internal.hs
|
bsd-3-clause
|
run :: Monad m => Stream m m r -> m r
run = loop where
loop stream = case stream of
Return r -> return r
Effect m -> m >>= loop
Step mrest -> mrest >>= loop
| 172
|
run :: Monad m => Stream m m r -> m r
run = loop where
loop stream = case stream of
Return r -> return r
Effect m -> m >>= loop
Step mrest -> mrest >>= loop
| 172
|
run = loop where
loop stream = case stream of
Return r -> return r
Effect m -> m >>= loop
Step mrest -> mrest >>= loop
| 134
| false
| true
| 0
| 10
| 54
| 89
| 40
| 49
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.