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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apyrgio/ganeti
|
src/Ganeti/Query/Exec.hs
|
bsd-2-clause
|
-- Code that is executed in a @fork@-ed process and that the replaces iteself
-- with the actual job process
runJobProcess :: JobId -> Client -> IO ()
runJobProcess jid s = withErrorLogAt CRITICAL (show jid) $
do
-- Close the standard error to prevent anything being written there
-- (for example by exceptions when closing unneeded FDs).
closeFd stdError
-- Currently, we discard any logging messages to prevent problems
-- with GHC's fork implementation, and they're kept
-- in the code just to document what is happening.
-- Later we might direct them to an appropriate file.
let logLater _ = return ()
logLater $ "Forking a new process for job " ++ show (fromJobId jid)
-- Create a livelock file for the job
(TOD ts _) <- getClockTime
lockfile <- P.livelockFile $ printf "job_%06d_%d" (fromJobId jid) ts
-- Lock the livelock file
logLater $ "Locking livelock file " ++ show lockfile
fd <- lockFile lockfile >>= annotateResult "Can't lock the livelock file"
logLater "Sending the lockfile name to the master process"
sendMsg s lockfile
logLater "Waiting for the master process to confirm the lock"
_ <- recvMsg s
-- close the client
logLater "Closing the client"
(clFdR, clFdW) <- clientToFd s
-- .. and use its file descriptors as stdin/out for the job process;
-- this way the job process can communicate with the master process
-- using stdin/out.
logLater "Reconnecting the file descriptors to stdin/out"
_ <- dupTo clFdR stdInput
_ <- dupTo clFdW stdOutput
logLater "Closing the old file descriptors"
closeFd clFdR
closeFd clFdW
fds <- (filter (> 2) . filter (/= fd)) <$> toErrorBase listOpenFds
logLater $ "Closing every superfluous file descriptor: " ++ show fds
mapM_ (tryIOError . closeFd) fds
-- the master process will send the job id and the livelock file name
-- using the same protocol to the job process
-- we pass the job id as the first argument to the process;
-- while the process never uses it, it's very convenient when listing
-- job processes
use_debug <- isDebugMode
env <- (M.insert "GNT_DEBUG" (if use_debug then "1" else "0")
. M.insert "PYTHONPATH" AC.versionedsharedir
. M.fromList)
`liftM` getEnvironment
execPy <- P.jqueueExecutorPy
logLater $ "Executing " ++ AC.pythonPath ++ " " ++ execPy
++ " with PYTHONPATH=" ++ AC.versionedsharedir
() <- executeFile AC.pythonPath True [execPy, show (fromJobId jid)]
(Just $ M.toList env)
failError $ "Failed to execute " ++ AC.pythonPath ++ " " ++ execPy
-- | Forks a child POSIX process, creating a bi-directional communication
-- channel between the master and the child processes.
-- Supplies the child action with its part of the pipe and returns
-- the master part of the pipe as its result.
| 2,935
|
runJobProcess :: JobId -> Client -> IO ()
runJobProcess jid s = withErrorLogAt CRITICAL (show jid) $
do
-- Close the standard error to prevent anything being written there
-- (for example by exceptions when closing unneeded FDs).
closeFd stdError
-- Currently, we discard any logging messages to prevent problems
-- with GHC's fork implementation, and they're kept
-- in the code just to document what is happening.
-- Later we might direct them to an appropriate file.
let logLater _ = return ()
logLater $ "Forking a new process for job " ++ show (fromJobId jid)
-- Create a livelock file for the job
(TOD ts _) <- getClockTime
lockfile <- P.livelockFile $ printf "job_%06d_%d" (fromJobId jid) ts
-- Lock the livelock file
logLater $ "Locking livelock file " ++ show lockfile
fd <- lockFile lockfile >>= annotateResult "Can't lock the livelock file"
logLater "Sending the lockfile name to the master process"
sendMsg s lockfile
logLater "Waiting for the master process to confirm the lock"
_ <- recvMsg s
-- close the client
logLater "Closing the client"
(clFdR, clFdW) <- clientToFd s
-- .. and use its file descriptors as stdin/out for the job process;
-- this way the job process can communicate with the master process
-- using stdin/out.
logLater "Reconnecting the file descriptors to stdin/out"
_ <- dupTo clFdR stdInput
_ <- dupTo clFdW stdOutput
logLater "Closing the old file descriptors"
closeFd clFdR
closeFd clFdW
fds <- (filter (> 2) . filter (/= fd)) <$> toErrorBase listOpenFds
logLater $ "Closing every superfluous file descriptor: " ++ show fds
mapM_ (tryIOError . closeFd) fds
-- the master process will send the job id and the livelock file name
-- using the same protocol to the job process
-- we pass the job id as the first argument to the process;
-- while the process never uses it, it's very convenient when listing
-- job processes
use_debug <- isDebugMode
env <- (M.insert "GNT_DEBUG" (if use_debug then "1" else "0")
. M.insert "PYTHONPATH" AC.versionedsharedir
. M.fromList)
`liftM` getEnvironment
execPy <- P.jqueueExecutorPy
logLater $ "Executing " ++ AC.pythonPath ++ " " ++ execPy
++ " with PYTHONPATH=" ++ AC.versionedsharedir
() <- executeFile AC.pythonPath True [execPy, show (fromJobId jid)]
(Just $ M.toList env)
failError $ "Failed to execute " ++ AC.pythonPath ++ " " ++ execPy
-- | Forks a child POSIX process, creating a bi-directional communication
-- channel between the master and the child processes.
-- Supplies the child action with its part of the pipe and returns
-- the master part of the pipe as its result.
| 2,826
|
runJobProcess jid s = withErrorLogAt CRITICAL (show jid) $
do
-- Close the standard error to prevent anything being written there
-- (for example by exceptions when closing unneeded FDs).
closeFd stdError
-- Currently, we discard any logging messages to prevent problems
-- with GHC's fork implementation, and they're kept
-- in the code just to document what is happening.
-- Later we might direct them to an appropriate file.
let logLater _ = return ()
logLater $ "Forking a new process for job " ++ show (fromJobId jid)
-- Create a livelock file for the job
(TOD ts _) <- getClockTime
lockfile <- P.livelockFile $ printf "job_%06d_%d" (fromJobId jid) ts
-- Lock the livelock file
logLater $ "Locking livelock file " ++ show lockfile
fd <- lockFile lockfile >>= annotateResult "Can't lock the livelock file"
logLater "Sending the lockfile name to the master process"
sendMsg s lockfile
logLater "Waiting for the master process to confirm the lock"
_ <- recvMsg s
-- close the client
logLater "Closing the client"
(clFdR, clFdW) <- clientToFd s
-- .. and use its file descriptors as stdin/out for the job process;
-- this way the job process can communicate with the master process
-- using stdin/out.
logLater "Reconnecting the file descriptors to stdin/out"
_ <- dupTo clFdR stdInput
_ <- dupTo clFdW stdOutput
logLater "Closing the old file descriptors"
closeFd clFdR
closeFd clFdW
fds <- (filter (> 2) . filter (/= fd)) <$> toErrorBase listOpenFds
logLater $ "Closing every superfluous file descriptor: " ++ show fds
mapM_ (tryIOError . closeFd) fds
-- the master process will send the job id and the livelock file name
-- using the same protocol to the job process
-- we pass the job id as the first argument to the process;
-- while the process never uses it, it's very convenient when listing
-- job processes
use_debug <- isDebugMode
env <- (M.insert "GNT_DEBUG" (if use_debug then "1" else "0")
. M.insert "PYTHONPATH" AC.versionedsharedir
. M.fromList)
`liftM` getEnvironment
execPy <- P.jqueueExecutorPy
logLater $ "Executing " ++ AC.pythonPath ++ " " ++ execPy
++ " with PYTHONPATH=" ++ AC.versionedsharedir
() <- executeFile AC.pythonPath True [execPy, show (fromJobId jid)]
(Just $ M.toList env)
failError $ "Failed to execute " ++ AC.pythonPath ++ " " ++ execPy
-- | Forks a child POSIX process, creating a bi-directional communication
-- channel between the master and the child processes.
-- Supplies the child action with its part of the pipe and returns
-- the master part of the pipe as its result.
| 2,784
| true
| true
| 0
| 15
| 711
| 514
| 247
| 267
| null | null |
rueshyna/gogol
|
gogol-apps-calendar/gen/Network/Google/AppsCalendar/Types/Product.hs
|
mpl-2.0
|
-- | Identifier of the calendar. To retrieve IDs call the calendarList.list()
-- method.
calId :: Lens' Calendar (Maybe Text)
calId = lens _calId (\ s a -> s{_calId = a})
| 170
|
calId :: Lens' Calendar (Maybe Text)
calId = lens _calId (\ s a -> s{_calId = a})
| 81
|
calId = lens _calId (\ s a -> s{_calId = a})
| 44
| true
| true
| 1
| 9
| 30
| 50
| 26
| 24
| null | null |
BlackBrane/shiva
|
src/Shiva/Storage.hs
|
mit
|
readMetadata :: Text -> ShivaM (Maybe FeedItem)
readMetadata = fmap (headMay . map toItem) . Meta.get
| 101
|
readMetadata :: Text -> ShivaM (Maybe FeedItem)
readMetadata = fmap (headMay . map toItem) . Meta.get
| 101
|
readMetadata = fmap (headMay . map toItem) . Meta.get
| 53
| false
| true
| 0
| 9
| 15
| 49
| 22
| 27
| null | null |
sgillespie/ghc
|
compiler/codeGen/StgCmmPrim.hs
|
bsd-3-clause
|
translateOp _ (VecNegOp FloatVec n w) = Just (MO_VF_Neg n w)
| 61
|
translateOp _ (VecNegOp FloatVec n w) = Just (MO_VF_Neg n w)
| 61
|
translateOp _ (VecNegOp FloatVec n w) = Just (MO_VF_Neg n w)
| 61
| false
| false
| 0
| 7
| 11
| 32
| 15
| 17
| null | null |
abakst/liquidhaskell
|
external/hsmisc/Lhs2Hs.hs
|
bsd-3-clause
|
--------------------------------------------------------------------------
txBeginEnd = stepFold step Comment
| 111
|
txBeginEnd = stepFold step Comment
| 36
|
txBeginEnd = stepFold step Comment
| 36
| true
| false
| 1
| 5
| 7
| 16
| 6
| 10
| null | null |
sdiehl/ghc
|
compiler/nativeGen/X86/Regs.hs
|
bsd-3-clause
|
xmm4 = regSingle 20
| 20
|
xmm4 = regSingle 20
| 20
|
xmm4 = regSingle 20
| 20
| false
| false
| 1
| 5
| 4
| 13
| 4
| 9
| null | null |
jkozlowski/kdb-haskell
|
src/Database/Kdb/Internal/IPC.hs
|
mit
|
qBytes v@(A (KTimespan !x)) = putType v <> Blaze.fromWord64host (unsafeCoerce x)
| 83
|
qBytes v@(A (KTimespan !x)) = putType v <> Blaze.fromWord64host (unsafeCoerce x)
| 83
|
qBytes v@(A (KTimespan !x)) = putType v <> Blaze.fromWord64host (unsafeCoerce x)
| 83
| false
| false
| 1
| 11
| 13
| 47
| 21
| 26
| null | null |
d3zd3z/harchive
|
test/HashMapFileCheck.hs
|
gpl-2.0
|
getInt :: Get Int
getInt = fromIntegral `fmap` getWord32be
| 58
|
getInt :: Get Int
getInt = fromIntegral `fmap` getWord32be
| 58
|
getInt = fromIntegral `fmap` getWord32be
| 40
| false
| true
| 0
| 5
| 8
| 20
| 11
| 9
| null | null |
rueshyna/gogol
|
gogol-games/gen/Network/Google/Games/Types/Product.hs
|
mpl-2.0
|
-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#playerScoreResponse.
psrKind :: Lens' PlayerScoreResponse Text
psrKind = lens _psrKind (\ s a -> s{_psrKind = a})
| 207
|
psrKind :: Lens' PlayerScoreResponse Text
psrKind = lens _psrKind (\ s a -> s{_psrKind = a})
| 92
|
psrKind = lens _psrKind (\ s a -> s{_psrKind = a})
| 50
| true
| true
| 0
| 9
| 32
| 41
| 23
| 18
| null | null |
nelk/aztex-compiler
|
src/Text/Aztex/CodeGeneration.hs
|
bsd-3-clause
|
generate (ImplicitModeSwitch new_mode) = do
st <- get
put $ st { latexMode = new_mode }
return mempty
| 107
|
generate (ImplicitModeSwitch new_mode) = do
st <- get
put $ st { latexMode = new_mode }
return mempty
| 107
|
generate (ImplicitModeSwitch new_mode) = do
st <- get
put $ st { latexMode = new_mode }
return mempty
| 107
| false
| false
| 0
| 9
| 23
| 44
| 20
| 24
| null | null |
ambiata/highlighting-kate
|
Text/Highlighting/Kate/Syntax/R.hs
|
gpl-2.0
|
regex_'5c'28 = compileRegex True "\\("
| 38
|
regex_'5c'28 = compileRegex True "\\("
| 38
|
regex_'5c'28 = compileRegex True "\\("
| 38
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
thielema/gitit
|
Network/Gitit/Config.hs
|
gpl-2.0
|
readfile :: MonadError CPError m
=> ConfigParser
-> FilePath
-> IO (m ConfigParser)
readfile cp path' = do
contents <- readFileUTF8 path'
return $ readstring cp contents
| 203
|
readfile :: MonadError CPError m
=> ConfigParser
-> FilePath
-> IO (m ConfigParser)
readfile cp path' = do
contents <- readFileUTF8 path'
return $ readstring cp contents
| 203
|
readfile cp path' = do
contents <- readFileUTF8 path'
return $ readstring cp contents
| 89
| false
| true
| 0
| 10
| 60
| 64
| 29
| 35
| null | null |
naushadh/persistent
|
persistent-postgresql/Database/Persist/Postgresql/JSON.hs
|
mit
|
fromPersistValueJsonB :: FromJSON a => PersistValue -> Either Text a
fromPersistValueJsonB (PersistText t) =
case eitherDecodeStrict $ TE.encodeUtf8 t of
Left str -> Left $ fromPersistValueParseError "FromJSON" t $ T.pack str
Right v -> Right v
| 260
|
fromPersistValueJsonB :: FromJSON a => PersistValue -> Either Text a
fromPersistValueJsonB (PersistText t) =
case eitherDecodeStrict $ TE.encodeUtf8 t of
Left str -> Left $ fromPersistValueParseError "FromJSON" t $ T.pack str
Right v -> Right v
| 260
|
fromPersistValueJsonB (PersistText t) =
case eitherDecodeStrict $ TE.encodeUtf8 t of
Left str -> Left $ fromPersistValueParseError "FromJSON" t $ T.pack str
Right v -> Right v
| 191
| false
| true
| 0
| 10
| 51
| 88
| 40
| 48
| null | null |
revnull/crashboard
|
src/App.hs
|
gpl-2.0
|
deletePost :: Word32 -> Handler App Sqlite [Only Int]
deletePost pid = query "DELETE FROM posts WHERE id = ?" (Only pid)
| 120
|
deletePost :: Word32 -> Handler App Sqlite [Only Int]
deletePost pid = query "DELETE FROM posts WHERE id = ?" (Only pid)
| 120
|
deletePost pid = query "DELETE FROM posts WHERE id = ?" (Only pid)
| 66
| false
| true
| 0
| 9
| 21
| 47
| 21
| 26
| null | null |
imh/plover
|
test/Simplify.hs
|
mit
|
teconvert (Lit 0) = Zero
| 24
|
teconvert (Lit 0) = Zero
| 24
|
teconvert (Lit 0) = Zero
| 24
| false
| false
| 0
| 7
| 4
| 15
| 7
| 8
| null | null |
ksaveljev/hake-2
|
src/Render/Fast/Light.hs
|
bsd-3-clause
|
-- didn't hit anything
recursiveLightPoint (MNodeChildReference nodeRef) start end = do
-- calculate mid point
node <- io $ readIORef nodeRef
plane <- io $ readIORef (node^.mnPlane)
let front = start `dot` (plane^.cpNormal) - (plane^.cpDist)
back = end `dot` (plane^.cpNormal) - (plane^.cpDist)
side = front < 0
sideIndex = if side then _2 else _1
sideIndex2 = if side then _1 else _2
if (back < 0) == side
then
recursiveLightPoint (node^.mnChildren.sideIndex) start end
else do
let frac = front / (front - back)
mid = start + fmap (* frac) (end - start)
-- go down front side
r <- recursiveLightPoint (node^.mnChildren.sideIndex) start mid
if | r >= 0 -> return r
| (back < 0) == side -> return (-1)
| otherwise -> do
-- check for impact on this node
fastRenderAPIGlobals.frLightSpot .= mid
Just worldModelRef <- use $ fastRenderAPIGlobals.frWorldModel
worldModel <- io $ readIORef worldModelRef
r' <- calcPointColor worldModel mid (node^.mnFirstSurface) 0 (node^.mnNumSurfaces)
case r' of
Just result -> return result
-- go down back side
Nothing -> recursiveLightPoint (node^.mnChildren.sideIndex2) mid end
where calcPointColor :: ModelT -> V3 Float -> Int -> Int -> Int -> Quake (Maybe Int)
calcPointColor worldModel mid surfIndex idx maxIdx
| idx >= maxIdx = return Nothing
| otherwise = do
let surfRef = (worldModel^.mSurfaces) V.! surfIndex
surf <- io $ readIORef surfRef
if (surf^.msFlags) .&. (Constants.surfDrawTurb .|. Constants.surfDrawSky) /= 0
then
-- no lightmaps
calcPointColor worldModel mid (surfIndex + 1) (idx + 1) maxIdx
else do
let tex = surf^.msTexInfo
s = truncate (mid `dot` (tex^.mtiVecs._1._xyz) + (tex^.mtiVecs._1._w)) :: Int
t = truncate (mid `dot` (tex^.mtiVecs._2._xyz) + (tex^.mtiVecs._2._w)) :: Int
if s < fromIntegral (surf^.msTextureMins._1) || t < fromIntegral (surf^.msTextureMins._2)
then
calcPointColor worldModel mid (surfIndex + 1) (idx + 1) maxIdx
else do
let ds = s - fromIntegral (surf^.msTextureMins._1)
dt = t - fromIntegral (surf^.msTextureMins._2)
if | ds > fromIntegral (surf^.msExtents._1) || dt > fromIntegral (surf^.msExtents._2) ->
calcPointColor worldModel mid (surfIndex + 1) (idx + 1) maxIdx
| isNothing (surf^.msSamples) ->
return (Just 0)
| otherwise -> do
let ds' = ds `shiftR` 4
dt' = dt `shiftR` 4
lightmap = fromJust (surf^.msSamples)
v3o <- use $ globals.gVec3Origin
newRefDef <- use $ fastRenderAPIGlobals.frNewRefDef
modulateValue <- liftM (^.cvValue) glModulateCVar
let lightmapIndex = 3 * (dt' * ((fromIntegral (surf^.msExtents._1) `shiftR` 4) + 1) + ds')
pointColor = calculate surf lightmap newRefDef modulateValue lightmapIndex v3o 0 Constants.maxLightMaps
fastRenderAPIGlobals.frPointColor .= pointColor
return (Just 1)
calculate :: MSurfaceT -> B.ByteString -> RefDefT -> Float -> Int -> V3 Float -> Int -> Int -> V3 Float
calculate surf lightmap newRefDef modulateValue lightmapIndex pointColor idx maxIdx
| idx >= maxIdx = pointColor
| (surf^.msStyles) `B.index` idx == 0xFF = pointColor
| otherwise =
let rgb = ((newRefDef^.rdLightStyles) V.! (fromIntegral $ (surf^.msStyles) `B.index` idx))^.lsRGB
scale = fmap (* modulateValue) rgb
a = (pointColor^._x) + (fromIntegral $ lightmap `B.index` (lightmapIndex + 0)) * (scale^._x) * (1 / 255)
b = (pointColor^._y) + (fromIntegral $ lightmap `B.index` (lightmapIndex + 1)) * (scale^._y) * (1 / 255)
c = (pointColor^._z) + (fromIntegral $ lightmap `B.index` (lightmapIndex + 2)) * (scale^._z) * (1 / 255)
lightmapIndex' = lightmapIndex + 3 * ((fromIntegral (surf^.msExtents._1) `shiftR` 4) + 1) * ((fromIntegral (surf^.msExtents._2) `shiftR` 4) + 1)
in calculate surf lightmap newRefDef modulateValue lightmapIndex' (V3 a b c) (idx + 1) maxIdx
| 4,884
|
recursiveLightPoint (MNodeChildReference nodeRef) start end = do
-- calculate mid point
node <- io $ readIORef nodeRef
plane <- io $ readIORef (node^.mnPlane)
let front = start `dot` (plane^.cpNormal) - (plane^.cpDist)
back = end `dot` (plane^.cpNormal) - (plane^.cpDist)
side = front < 0
sideIndex = if side then _2 else _1
sideIndex2 = if side then _1 else _2
if (back < 0) == side
then
recursiveLightPoint (node^.mnChildren.sideIndex) start end
else do
let frac = front / (front - back)
mid = start + fmap (* frac) (end - start)
-- go down front side
r <- recursiveLightPoint (node^.mnChildren.sideIndex) start mid
if | r >= 0 -> return r
| (back < 0) == side -> return (-1)
| otherwise -> do
-- check for impact on this node
fastRenderAPIGlobals.frLightSpot .= mid
Just worldModelRef <- use $ fastRenderAPIGlobals.frWorldModel
worldModel <- io $ readIORef worldModelRef
r' <- calcPointColor worldModel mid (node^.mnFirstSurface) 0 (node^.mnNumSurfaces)
case r' of
Just result -> return result
-- go down back side
Nothing -> recursiveLightPoint (node^.mnChildren.sideIndex2) mid end
where calcPointColor :: ModelT -> V3 Float -> Int -> Int -> Int -> Quake (Maybe Int)
calcPointColor worldModel mid surfIndex idx maxIdx
| idx >= maxIdx = return Nothing
| otherwise = do
let surfRef = (worldModel^.mSurfaces) V.! surfIndex
surf <- io $ readIORef surfRef
if (surf^.msFlags) .&. (Constants.surfDrawTurb .|. Constants.surfDrawSky) /= 0
then
-- no lightmaps
calcPointColor worldModel mid (surfIndex + 1) (idx + 1) maxIdx
else do
let tex = surf^.msTexInfo
s = truncate (mid `dot` (tex^.mtiVecs._1._xyz) + (tex^.mtiVecs._1._w)) :: Int
t = truncate (mid `dot` (tex^.mtiVecs._2._xyz) + (tex^.mtiVecs._2._w)) :: Int
if s < fromIntegral (surf^.msTextureMins._1) || t < fromIntegral (surf^.msTextureMins._2)
then
calcPointColor worldModel mid (surfIndex + 1) (idx + 1) maxIdx
else do
let ds = s - fromIntegral (surf^.msTextureMins._1)
dt = t - fromIntegral (surf^.msTextureMins._2)
if | ds > fromIntegral (surf^.msExtents._1) || dt > fromIntegral (surf^.msExtents._2) ->
calcPointColor worldModel mid (surfIndex + 1) (idx + 1) maxIdx
| isNothing (surf^.msSamples) ->
return (Just 0)
| otherwise -> do
let ds' = ds `shiftR` 4
dt' = dt `shiftR` 4
lightmap = fromJust (surf^.msSamples)
v3o <- use $ globals.gVec3Origin
newRefDef <- use $ fastRenderAPIGlobals.frNewRefDef
modulateValue <- liftM (^.cvValue) glModulateCVar
let lightmapIndex = 3 * (dt' * ((fromIntegral (surf^.msExtents._1) `shiftR` 4) + 1) + ds')
pointColor = calculate surf lightmap newRefDef modulateValue lightmapIndex v3o 0 Constants.maxLightMaps
fastRenderAPIGlobals.frPointColor .= pointColor
return (Just 1)
calculate :: MSurfaceT -> B.ByteString -> RefDefT -> Float -> Int -> V3 Float -> Int -> Int -> V3 Float
calculate surf lightmap newRefDef modulateValue lightmapIndex pointColor idx maxIdx
| idx >= maxIdx = pointColor
| (surf^.msStyles) `B.index` idx == 0xFF = pointColor
| otherwise =
let rgb = ((newRefDef^.rdLightStyles) V.! (fromIntegral $ (surf^.msStyles) `B.index` idx))^.lsRGB
scale = fmap (* modulateValue) rgb
a = (pointColor^._x) + (fromIntegral $ lightmap `B.index` (lightmapIndex + 0)) * (scale^._x) * (1 / 255)
b = (pointColor^._y) + (fromIntegral $ lightmap `B.index` (lightmapIndex + 1)) * (scale^._y) * (1 / 255)
c = (pointColor^._z) + (fromIntegral $ lightmap `B.index` (lightmapIndex + 2)) * (scale^._z) * (1 / 255)
lightmapIndex' = lightmapIndex + 3 * ((fromIntegral (surf^.msExtents._1) `shiftR` 4) + 1) * ((fromIntegral (surf^.msExtents._2) `shiftR` 4) + 1)
in calculate surf lightmap newRefDef modulateValue lightmapIndex' (V3 a b c) (idx + 1) maxIdx
| 4,861
|
recursiveLightPoint (MNodeChildReference nodeRef) start end = do
-- calculate mid point
node <- io $ readIORef nodeRef
plane <- io $ readIORef (node^.mnPlane)
let front = start `dot` (plane^.cpNormal) - (plane^.cpDist)
back = end `dot` (plane^.cpNormal) - (plane^.cpDist)
side = front < 0
sideIndex = if side then _2 else _1
sideIndex2 = if side then _1 else _2
if (back < 0) == side
then
recursiveLightPoint (node^.mnChildren.sideIndex) start end
else do
let frac = front / (front - back)
mid = start + fmap (* frac) (end - start)
-- go down front side
r <- recursiveLightPoint (node^.mnChildren.sideIndex) start mid
if | r >= 0 -> return r
| (back < 0) == side -> return (-1)
| otherwise -> do
-- check for impact on this node
fastRenderAPIGlobals.frLightSpot .= mid
Just worldModelRef <- use $ fastRenderAPIGlobals.frWorldModel
worldModel <- io $ readIORef worldModelRef
r' <- calcPointColor worldModel mid (node^.mnFirstSurface) 0 (node^.mnNumSurfaces)
case r' of
Just result -> return result
-- go down back side
Nothing -> recursiveLightPoint (node^.mnChildren.sideIndex2) mid end
where calcPointColor :: ModelT -> V3 Float -> Int -> Int -> Int -> Quake (Maybe Int)
calcPointColor worldModel mid surfIndex idx maxIdx
| idx >= maxIdx = return Nothing
| otherwise = do
let surfRef = (worldModel^.mSurfaces) V.! surfIndex
surf <- io $ readIORef surfRef
if (surf^.msFlags) .&. (Constants.surfDrawTurb .|. Constants.surfDrawSky) /= 0
then
-- no lightmaps
calcPointColor worldModel mid (surfIndex + 1) (idx + 1) maxIdx
else do
let tex = surf^.msTexInfo
s = truncate (mid `dot` (tex^.mtiVecs._1._xyz) + (tex^.mtiVecs._1._w)) :: Int
t = truncate (mid `dot` (tex^.mtiVecs._2._xyz) + (tex^.mtiVecs._2._w)) :: Int
if s < fromIntegral (surf^.msTextureMins._1) || t < fromIntegral (surf^.msTextureMins._2)
then
calcPointColor worldModel mid (surfIndex + 1) (idx + 1) maxIdx
else do
let ds = s - fromIntegral (surf^.msTextureMins._1)
dt = t - fromIntegral (surf^.msTextureMins._2)
if | ds > fromIntegral (surf^.msExtents._1) || dt > fromIntegral (surf^.msExtents._2) ->
calcPointColor worldModel mid (surfIndex + 1) (idx + 1) maxIdx
| isNothing (surf^.msSamples) ->
return (Just 0)
| otherwise -> do
let ds' = ds `shiftR` 4
dt' = dt `shiftR` 4
lightmap = fromJust (surf^.msSamples)
v3o <- use $ globals.gVec3Origin
newRefDef <- use $ fastRenderAPIGlobals.frNewRefDef
modulateValue <- liftM (^.cvValue) glModulateCVar
let lightmapIndex = 3 * (dt' * ((fromIntegral (surf^.msExtents._1) `shiftR` 4) + 1) + ds')
pointColor = calculate surf lightmap newRefDef modulateValue lightmapIndex v3o 0 Constants.maxLightMaps
fastRenderAPIGlobals.frPointColor .= pointColor
return (Just 1)
calculate :: MSurfaceT -> B.ByteString -> RefDefT -> Float -> Int -> V3 Float -> Int -> Int -> V3 Float
calculate surf lightmap newRefDef modulateValue lightmapIndex pointColor idx maxIdx
| idx >= maxIdx = pointColor
| (surf^.msStyles) `B.index` idx == 0xFF = pointColor
| otherwise =
let rgb = ((newRefDef^.rdLightStyles) V.! (fromIntegral $ (surf^.msStyles) `B.index` idx))^.lsRGB
scale = fmap (* modulateValue) rgb
a = (pointColor^._x) + (fromIntegral $ lightmap `B.index` (lightmapIndex + 0)) * (scale^._x) * (1 / 255)
b = (pointColor^._y) + (fromIntegral $ lightmap `B.index` (lightmapIndex + 1)) * (scale^._y) * (1 / 255)
c = (pointColor^._z) + (fromIntegral $ lightmap `B.index` (lightmapIndex + 2)) * (scale^._z) * (1 / 255)
lightmapIndex' = lightmapIndex + 3 * ((fromIntegral (surf^.msExtents._1) `shiftR` 4) + 1) * ((fromIntegral (surf^.msExtents._2) `shiftR` 4) + 1)
in calculate surf lightmap newRefDef modulateValue lightmapIndex' (V3 a b c) (idx + 1) maxIdx
| 4,861
| true
| false
| 0
| 34
| 1,769
| 1,587
| 822
| 765
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/BasicTypes/VarEnv.hs
|
bsd-3-clause
|
partitionDVarEnv :: (a -> Bool) -> DVarEnv a -> (DVarEnv a, DVarEnv a)
partitionDVarEnv = partitionUDFM
| 103
|
partitionDVarEnv :: (a -> Bool) -> DVarEnv a -> (DVarEnv a, DVarEnv a)
partitionDVarEnv = partitionUDFM
| 103
|
partitionDVarEnv = partitionUDFM
| 32
| false
| true
| 0
| 8
| 15
| 41
| 21
| 20
| null | null |
wz1000/haskell-lsp
|
lsp-test/src/Language/LSP/Test.hs
|
mit
|
-- | Returns the code lenses for the specified document.
getCodeLenses :: TextDocumentIdentifier -> Session [CodeLens]
getCodeLenses tId = do
rsp <- request STextDocumentCodeLens (CodeLensParams Nothing Nothing tId)
case getResponseResult rsp of
List res -> pure res
-- | Pass a param and return the response from `prepareCallHierarchy`
| 353
|
getCodeLenses :: TextDocumentIdentifier -> Session [CodeLens]
getCodeLenses tId = do
rsp <- request STextDocumentCodeLens (CodeLensParams Nothing Nothing tId)
case getResponseResult rsp of
List res -> pure res
-- | Pass a param and return the response from `prepareCallHierarchy`
| 296
|
getCodeLenses tId = do
rsp <- request STextDocumentCodeLens (CodeLensParams Nothing Nothing tId)
case getResponseResult rsp of
List res -> pure res
-- | Pass a param and return the response from `prepareCallHierarchy`
| 234
| true
| true
| 0
| 10
| 64
| 70
| 33
| 37
| null | null |
ocean0yohsuke/deepcontrol
|
DeepControl/Applicative.hs
|
bsd-3-clause
|
(|*>>) :: (Applicative f1, Applicative f2) => f1 (f2 (a -> b)) -> f1 (f2 a) -> f1 (f2 b)
-- (|*>>) = liftA2 (|*>)
f |*>> x = f <$|(|*>)|*> x
| 140
|
(|*>>) :: (Applicative f1, Applicative f2) => f1 (f2 (a -> b)) -> f1 (f2 a) -> f1 (f2 b)
f |*>> x = f <$|(|*>)|*> x
| 115
|
f |*>> x = f <$|(|*>)|*> x
| 26
| true
| true
| 0
| 12
| 31
| 87
| 45
| 42
| null | null |
daniel-beard/projecteulerhaskell
|
Problems/p43.hs
|
mit
|
main :: IO ()
main = print calculate
| 36
|
main :: IO ()
main = print calculate
| 36
|
main = print calculate
| 22
| false
| true
| 0
| 7
| 7
| 25
| 10
| 15
| null | null |
himura/twitter-conduit
|
sample/oauth_callback.hs
|
bsd-2-clause
|
main :: IO ()
main = do
tokens <- getTokens
mgr <- newManager tlsManagerSettings
putStrLn $ "browse URL: http://localhost:3000/signIn"
scotty 3000 $ app tokens mgr
| 179
|
main :: IO ()
main = do
tokens <- getTokens
mgr <- newManager tlsManagerSettings
putStrLn $ "browse URL: http://localhost:3000/signIn"
scotty 3000 $ app tokens mgr
| 179
|
main = do
tokens <- getTokens
mgr <- newManager tlsManagerSettings
putStrLn $ "browse URL: http://localhost:3000/signIn"
scotty 3000 $ app tokens mgr
| 165
| false
| true
| 0
| 9
| 40
| 61
| 25
| 36
| null | null |
thlorenz/WebToInk
|
webtoink-converter/WebToInk/Converter/ConverterService.hs
|
bsd-2-clause
|
handleException exception = do
let exceptionInfo = getExceptionInfo exception
loge (fst exceptionInfo)
return $ Left (snd exceptionInfo)
where
getExceptionInfo exception =
case exception of
TableOfContentsCouldNotBeDownloadedException -> ( "TableOfContentsCouldNotBeDownloadedException."
, "Could not download page. Please check the url and/or make sure that the server is available.")
ex@(KindlegenException code) -> ( show ex
, "The kindlegen tool was unable to convert the page. Please try another format.")
ex -> ( "Unknown Exception: " ++ show ex
, "An unexcpected error occured. Please try again later.")
| 924
|
handleException exception = do
let exceptionInfo = getExceptionInfo exception
loge (fst exceptionInfo)
return $ Left (snd exceptionInfo)
where
getExceptionInfo exception =
case exception of
TableOfContentsCouldNotBeDownloadedException -> ( "TableOfContentsCouldNotBeDownloadedException."
, "Could not download page. Please check the url and/or make sure that the server is available.")
ex@(KindlegenException code) -> ( show ex
, "The kindlegen tool was unable to convert the page. Please try another format.")
ex -> ( "Unknown Exception: " ++ show ex
, "An unexcpected error occured. Please try again later.")
| 924
|
handleException exception = do
let exceptionInfo = getExceptionInfo exception
loge (fst exceptionInfo)
return $ Left (snd exceptionInfo)
where
getExceptionInfo exception =
case exception of
TableOfContentsCouldNotBeDownloadedException -> ( "TableOfContentsCouldNotBeDownloadedException."
, "Could not download page. Please check the url and/or make sure that the server is available.")
ex@(KindlegenException code) -> ( show ex
, "The kindlegen tool was unable to convert the page. Please try another format.")
ex -> ( "Unknown Exception: " ++ show ex
, "An unexcpected error occured. Please try again later.")
| 924
| false
| false
| 0
| 10
| 396
| 119
| 58
| 61
| null | null |
deepfire/Ruin
|
Development/Ruin.hs
|
bsd-2-clause
|
invert_hashmap ∷ (Hashable a, Hashable b, Eq b) ⇒ HashMap a b → HashMap b a
invert_hashmap = fromList ∘ (map swap) ∘ toList
| 123
|
invert_hashmap ∷ (Hashable a, Hashable b, Eq b) ⇒ HashMap a b → HashMap b a
invert_hashmap = fromList ∘ (map swap) ∘ toList
| 123
|
invert_hashmap = fromList ∘ (map swap) ∘ toList
| 47
| false
| true
| 0
| 8
| 23
| 60
| 30
| 30
| null | null |
clockworkdevstudio/Idlewild-Lang
|
DWARF.hs
|
bsd-2-clause
|
dwarfAttributeEncodings =
[(0x1,"DW_ATE_address"),
(0x2,"DW_ATE_boolean"),
(0x3,"DW_ATE_complex_float"),
(0x4,"DW_ATE_float"),
(0x5,"DW_ATE_signed"),
(0x6,"DW_ATE_signed_char"),
(0x7,"DW_ATE_unsigned"),
(0x8,"DW_ATE_unsigned_char"),
(0x9,"DW_ATE_imaginary_float"),
(0xa,"DW_ATE_packed_decimal"),
(0xb,"DW_ATE_numeric_string"),
(0xc,"DW_ATE_edited"),
(0xd,"DW_ATE_signed_fixed"),
(0xe,"DW_ATE_unsigned_fixed"),
(0xf,"DW_ATE_decimal_float"),
(0x10,"DW_ATE_UTF"),
(0x80,"DW_ATE_lo_user"),
(0xff,"DW_ATE_hi_user")]
| 563
|
dwarfAttributeEncodings =
[(0x1,"DW_ATE_address"),
(0x2,"DW_ATE_boolean"),
(0x3,"DW_ATE_complex_float"),
(0x4,"DW_ATE_float"),
(0x5,"DW_ATE_signed"),
(0x6,"DW_ATE_signed_char"),
(0x7,"DW_ATE_unsigned"),
(0x8,"DW_ATE_unsigned_char"),
(0x9,"DW_ATE_imaginary_float"),
(0xa,"DW_ATE_packed_decimal"),
(0xb,"DW_ATE_numeric_string"),
(0xc,"DW_ATE_edited"),
(0xd,"DW_ATE_signed_fixed"),
(0xe,"DW_ATE_unsigned_fixed"),
(0xf,"DW_ATE_decimal_float"),
(0x10,"DW_ATE_UTF"),
(0x80,"DW_ATE_lo_user"),
(0xff,"DW_ATE_hi_user")]
| 563
|
dwarfAttributeEncodings =
[(0x1,"DW_ATE_address"),
(0x2,"DW_ATE_boolean"),
(0x3,"DW_ATE_complex_float"),
(0x4,"DW_ATE_float"),
(0x5,"DW_ATE_signed"),
(0x6,"DW_ATE_signed_char"),
(0x7,"DW_ATE_unsigned"),
(0x8,"DW_ATE_unsigned_char"),
(0x9,"DW_ATE_imaginary_float"),
(0xa,"DW_ATE_packed_decimal"),
(0xb,"DW_ATE_numeric_string"),
(0xc,"DW_ATE_edited"),
(0xd,"DW_ATE_signed_fixed"),
(0xe,"DW_ATE_unsigned_fixed"),
(0xf,"DW_ATE_decimal_float"),
(0x10,"DW_ATE_UTF"),
(0x80,"DW_ATE_lo_user"),
(0xff,"DW_ATE_hi_user")]
| 563
| false
| false
| 0
| 6
| 72
| 168
| 111
| 57
| null | null |
da-x/Algorithm-W-Step-By-Step
|
Lamdu/Expr/Lens.hs
|
gpl-3.0
|
_TFun :: Prism' Type (Type, Type)
_TFun = prism' (uncurry T.TFun) get
where
get (T.TFun arg res) = Just (arg, res)
get _ = Nothing
| 152
|
_TFun :: Prism' Type (Type, Type)
_TFun = prism' (uncurry T.TFun) get
where
get (T.TFun arg res) = Just (arg, res)
get _ = Nothing
| 152
|
_TFun = prism' (uncurry T.TFun) get
where
get (T.TFun arg res) = Just (arg, res)
get _ = Nothing
| 118
| false
| true
| 0
| 10
| 46
| 72
| 37
| 35
| null | null |
kowey/GenI
|
src/NLP/GenI/Console.hs
|
gpl-2.0
|
withGeniTimeOut :: Int -- ^ seconds
-> IO ()
-> IO ()
withGeniTimeOut t job = do
status <- timeout (fromIntegral t * 1000000) job
case status of
Just () -> return ()
Nothing -> do
ePutStrLn $ "GenI timed out after " ++ show t ++ "s"
exitWith (ExitFailure 2)
-- | Run GenI without reading any test suites, just grab semantics from stdin
| 408
|
withGeniTimeOut :: Int -- ^ seconds
-> IO ()
-> IO ()
withGeniTimeOut t job = do
status <- timeout (fromIntegral t * 1000000) job
case status of
Just () -> return ()
Nothing -> do
ePutStrLn $ "GenI timed out after " ++ show t ++ "s"
exitWith (ExitFailure 2)
-- | Run GenI without reading any test suites, just grab semantics from stdin
| 408
|
withGeniTimeOut t job = do
status <- timeout (fromIntegral t * 1000000) job
case status of
Just () -> return ()
Nothing -> do
ePutStrLn $ "GenI timed out after " ++ show t ++ "s"
exitWith (ExitFailure 2)
-- | Run GenI without reading any test suites, just grab semantics from stdin
| 322
| false
| true
| 0
| 14
| 137
| 117
| 54
| 63
| null | null |
SuperDrew/sql-server-gen
|
src/Database/SqlServer/Definition/DataType.hs
|
bsd-2-clause
|
storageOptions (SmallDateTime s) = s
| 36
|
storageOptions (SmallDateTime s) = s
| 36
|
storageOptions (SmallDateTime s) = s
| 36
| false
| false
| 0
| 6
| 4
| 16
| 7
| 9
| null | null |
juliagoda/givenfind
|
src/GivenFind/Chemistry.hs
|
bsd-3-clause
|
-- finds groups and periods in the periodic table. Finds for example "group IIIA" or "Period 6" or "group IIA and IIIB"
getFromTable :: Maybe [String] -> [String] -> Maybe [String]
getFromTable (Just (x:y:z:s:xs)) wordsList = case any (==True) . map (==x) $ wordsList of
True -> case (any (isDigit) y || (any (=='A') y || any (=='B') y)) && any (isDigit) s || (any (=='A') s || any (=='B') s) of
True -> liftM (y:) $ liftM (s :) (getFromTable (liftM (y :) (liftM (z :) (liftM (s :) (Just xs)))) wordsList)
False -> case any (isDigit) y || (any (=='A') y || any (=='B') y) of
True -> liftM (y :) (getFromTable (liftM (y :) (liftM (z :) (liftM (s :) (Just xs)))) wordsList)
_ -> getFromTable (liftM (y :) (liftM (z :) (liftM (s :) $ Just xs))) wordsList
False -> getFromTable (liftM (y :) (liftM (z :) (liftM (s :) $ Just xs))) wordsList
| 1,187
|
getFromTable :: Maybe [String] -> [String] -> Maybe [String]
getFromTable (Just (x:y:z:s:xs)) wordsList = case any (==True) . map (==x) $ wordsList of
True -> case (any (isDigit) y || (any (=='A') y || any (=='B') y)) && any (isDigit) s || (any (=='A') s || any (=='B') s) of
True -> liftM (y:) $ liftM (s :) (getFromTable (liftM (y :) (liftM (z :) (liftM (s :) (Just xs)))) wordsList)
False -> case any (isDigit) y || (any (=='A') y || any (=='B') y) of
True -> liftM (y :) (getFromTable (liftM (y :) (liftM (z :) (liftM (s :) (Just xs)))) wordsList)
_ -> getFromTable (liftM (y :) (liftM (z :) (liftM (s :) $ Just xs))) wordsList
False -> getFromTable (liftM (y :) (liftM (z :) (liftM (s :) $ Just xs))) wordsList
| 1,066
|
getFromTable (Just (x:y:z:s:xs)) wordsList = case any (==True) . map (==x) $ wordsList of
True -> case (any (isDigit) y || (any (=='A') y || any (=='B') y)) && any (isDigit) s || (any (=='A') s || any (=='B') s) of
True -> liftM (y:) $ liftM (s :) (getFromTable (liftM (y :) (liftM (z :) (liftM (s :) (Just xs)))) wordsList)
False -> case any (isDigit) y || (any (=='A') y || any (=='B') y) of
True -> liftM (y :) (getFromTable (liftM (y :) (liftM (z :) (liftM (s :) (Just xs)))) wordsList)
_ -> getFromTable (liftM (y :) (liftM (z :) (liftM (s :) $ Just xs))) wordsList
False -> getFromTable (liftM (y :) (liftM (z :) (liftM (s :) $ Just xs))) wordsList
| 1,005
| true
| true
| 0
| 24
| 509
| 474
| 256
| 218
| null | null |
AccelerateHS/accelerate-cuda
|
Data/Array/Accelerate/CUDA/Analysis/Launch.hs
|
bsd-3-clause
|
gridSize _ acc@(Fold1 _ _) size cta = if preAccDim delayedDim acc == 0 then split size cta else max 1 size
| 108
|
gridSize _ acc@(Fold1 _ _) size cta = if preAccDim delayedDim acc == 0 then split size cta else max 1 size
| 108
|
gridSize _ acc@(Fold1 _ _) size cta = if preAccDim delayedDim acc == 0 then split size cta else max 1 size
| 108
| false
| false
| 2
| 8
| 23
| 59
| 26
| 33
| null | null |
andorp/grin
|
grin/src/Grin/EffectMap.hs
|
bsd-3-clause
|
hasSideEffectingPrimop :: Name -> EffectMap -> Bool
hasSideEffectingPrimop = hasSomeEffect _effectfulPrimops
| 108
|
hasSideEffectingPrimop :: Name -> EffectMap -> Bool
hasSideEffectingPrimop = hasSomeEffect _effectfulPrimops
| 108
|
hasSideEffectingPrimop = hasSomeEffect _effectfulPrimops
| 56
| false
| true
| 0
| 6
| 10
| 22
| 11
| 11
| null | null |
Heather/clay
|
src/Clay/Size.hs
|
bsd-3-clause
|
-- | Size in pixels.
px i = Size (value i <> "px")
| 50
|
px i = Size (value i <> "px")
| 29
|
px i = Size (value i <> "px")
| 29
| true
| false
| 0
| 8
| 12
| 23
| 11
| 12
| null | null |
wouwouwou/2017_module_8
|
src/haskell/PP-project-2017/CodeGen.hs
|
apache-2.0
|
-- Resolves the memory address of the argument (in local memory)
-- and pushes it to stack. Only found in procedure declarations, so
-- it does not return its value, as one might expect.
codeGen (ASTArg astType astVar
checkType@(functions, globals, variables,_)) threads
= getMemAddr astStr variables ++
[ Push regE ]
where
astStr = getStr astVar
-- Starts a block statement. Any block is preceded by opening a new scope
-- with an AR-like structure, that simply contains a pointer to the
-- higher scope's parent AR, followed by any variables declared
-- in this scope.
| 639
|
codeGen (ASTArg astType astVar
checkType@(functions, globals, variables,_)) threads
= getMemAddr astStr variables ++
[ Push regE ]
where
astStr = getStr astVar
-- Starts a block statement. Any block is preceded by opening a new scope
-- with an AR-like structure, that simply contains a pointer to the
-- higher scope's parent AR, followed by any variables declared
-- in this scope.
| 451
|
codeGen (ASTArg astType astVar
checkType@(functions, globals, variables,_)) threads
= getMemAddr astStr variables ++
[ Push regE ]
where
astStr = getStr astVar
-- Starts a block statement. Any block is preceded by opening a new scope
-- with an AR-like structure, that simply contains a pointer to the
-- higher scope's parent AR, followed by any variables declared
-- in this scope.
| 451
| true
| false
| 1
| 9
| 164
| 74
| 39
| 35
| null | null |
esmolanka/sexp-grammar
|
sexp-grammar/test/Main.hs
|
bsd-3-clause
|
testArithExpr :: ArithExpr
testArithExpr =
Add (Lit 0) (Mul [])
| 65
|
testArithExpr :: ArithExpr
testArithExpr =
Add (Lit 0) (Mul [])
| 65
|
testArithExpr =
Add (Lit 0) (Mul [])
| 38
| false
| true
| 0
| 8
| 11
| 30
| 15
| 15
| null | null |
apyrgio/snf-ganeti
|
src/Ganeti/OpParams.hs
|
bsd-2-clause
|
pInstCreateMode :: Field
pInstCreateMode =
withDoc "Instance creation mode" .
renameField "InstCreateMode" $ simpleField "mode" [t| InstCreateMode |]
| 153
|
pInstCreateMode :: Field
pInstCreateMode =
withDoc "Instance creation mode" .
renameField "InstCreateMode" $ simpleField "mode" [t| InstCreateMode |]
| 153
|
pInstCreateMode =
withDoc "Instance creation mode" .
renameField "InstCreateMode" $ simpleField "mode" [t| InstCreateMode |]
| 128
| false
| true
| 0
| 7
| 21
| 34
| 18
| 16
| null | null |
mettekou/ghc
|
compiler/typecheck/TcRnTypes.hs
|
bsd-3-clause
|
isKindLevel :: TypeOrKind -> Bool
isKindLevel TypeLevel = False
| 63
|
isKindLevel :: TypeOrKind -> Bool
isKindLevel TypeLevel = False
| 63
|
isKindLevel TypeLevel = False
| 29
| false
| true
| 0
| 7
| 8
| 24
| 10
| 14
| null | null |
apunktbau/co4
|
test/CO4/Thesis/Loop.hs
|
gpl-3.0
|
maxTermDepth = 2
| 16
|
maxTermDepth = 2
| 16
|
maxTermDepth = 2
| 16
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
Rotsor/wheeled-vehicle
|
Car.hs
|
bsd-3-clause
|
v2l :: (a, a) -> [a]
v2l (x,y) = [x,y]
| 38
|
v2l :: (a, a) -> [a]
v2l (x,y) = [x,y]
| 38
|
v2l (x,y) = [x,y]
| 17
| false
| true
| 0
| 6
| 9
| 39
| 23
| 16
| null | null |
tekul/cryptonite
|
Crypto/PubKey/RSA/PKCS15.hs
|
bsd-3-clause
|
encrypt :: MonadRandom m => PublicKey -> ByteString -> m (Either Error ByteString)
encrypt pk m = do
r <- pad (public_size pk) m
case r of
Left err -> return $ Left err
Right em -> return $ Right (ep pk em)
-- | sign message using private key, a hash and its ASN1 description
--
-- When the signature is not in a context where an attacker could gain
-- information from the timing of the operation, the blinder can be set to None.
--
-- If unsure always set a blinder or use signSafer
| 509
|
encrypt :: MonadRandom m => PublicKey -> ByteString -> m (Either Error ByteString)
encrypt pk m = do
r <- pad (public_size pk) m
case r of
Left err -> return $ Left err
Right em -> return $ Right (ep pk em)
-- | sign message using private key, a hash and its ASN1 description
--
-- When the signature is not in a context where an attacker could gain
-- information from the timing of the operation, the blinder can be set to None.
--
-- If unsure always set a blinder or use signSafer
| 509
|
encrypt pk m = do
r <- pad (public_size pk) m
case r of
Left err -> return $ Left err
Right em -> return $ Right (ep pk em)
-- | sign message using private key, a hash and its ASN1 description
--
-- When the signature is not in a context where an attacker could gain
-- information from the timing of the operation, the blinder can be set to None.
--
-- If unsure always set a blinder or use signSafer
| 426
| false
| true
| 0
| 13
| 121
| 113
| 55
| 58
| null | null |
treeowl/bound
|
examples/Simple.hs
|
bsd-3-clause
|
whnf (Let bs b) = whnf (inst b)
where es = map inst bs
inst = instantiate (es !!)
| 91
|
whnf (Let bs b) = whnf (inst b)
where es = map inst bs
inst = instantiate (es !!)
| 91
|
whnf (Let bs b) = whnf (inst b)
where es = map inst bs
inst = instantiate (es !!)
| 91
| false
| false
| 1
| 7
| 28
| 51
| 25
| 26
| null | null |
ecaustin/haskhol-math
|
src/HaskHOL/Lib/CalcNum.hs
|
bsd-2-clause
|
ruleNUM_MUL :: WFCtxt thry => Int -> Int -> HOLTerm
-> HOLTerm -> HOL cls thry HOLThm
ruleNUM_MUL _ _ ZERO tm' = primINST [(tmN, tm')] (ruleNUM_MUL_pth_0 !! 0)
| 172
|
ruleNUM_MUL :: WFCtxt thry => Int -> Int -> HOLTerm
-> HOLTerm -> HOL cls thry HOLThm
ruleNUM_MUL _ _ ZERO tm' = primINST [(tmN, tm')] (ruleNUM_MUL_pth_0 !! 0)
| 172
|
ruleNUM_MUL _ _ ZERO tm' = primINST [(tmN, tm')] (ruleNUM_MUL_pth_0 !! 0)
| 73
| false
| true
| 0
| 11
| 41
| 75
| 37
| 38
| null | null |
bitraten/hands
|
src/View/Posts.hs
|
gpl-3.0
|
index :: User -> [Post] -> Html
index user posts = do
forM_ posts $ do
View.Posts.show user
| 103
|
index :: User -> [Post] -> Html
index user posts = do
forM_ posts $ do
View.Posts.show user
| 103
|
index user posts = do
forM_ posts $ do
View.Posts.show user
| 71
| false
| true
| 0
| 11
| 29
| 46
| 22
| 24
| null | null |
irreverent-pixel-feats/bitbucket
|
bitbucket-json/src/Irreverent/Bitbucket/Json/Common.hs
|
bsd-3-clause
|
parseHasWikiJson :: Value -> Parser HasWiki
parseHasWikiJson v = flip fmap (parseJSON v) $ \case
True -> HasWiki
False -> NoWiki
| 133
|
parseHasWikiJson :: Value -> Parser HasWiki
parseHasWikiJson v = flip fmap (parseJSON v) $ \case
True -> HasWiki
False -> NoWiki
| 133
|
parseHasWikiJson v = flip fmap (parseJSON v) $ \case
True -> HasWiki
False -> NoWiki
| 89
| false
| true
| 0
| 8
| 25
| 50
| 24
| 26
| null | null |
adamschoenemann/simple-frp
|
src/FRP/Parser/Construct.hs
|
mit
|
tmlit :: Parser (Lit -> ParsedTerm)
tmlit = TmLit <$> getPosition
| 65
|
tmlit :: Parser (Lit -> ParsedTerm)
tmlit = TmLit <$> getPosition
| 65
|
tmlit = TmLit <$> getPosition
| 29
| false
| true
| 0
| 7
| 10
| 25
| 13
| 12
| null | null |
mapinguari/SC_HS_Proxy
|
src/Proxy/Query/Unit.hs
|
mit
|
race TerranCommandCenter = Terran
| 33
|
race TerranCommandCenter = Terran
| 33
|
race TerranCommandCenter = Terran
| 33
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
bgamari/pandoc
|
src/Text/Pandoc/Readers/Markdown.hs
|
gpl-2.0
|
identifier :: MarkdownParser String
identifier = do
first <- letter
rest <- many $ alphaNum <|> oneOf "-_:."
return (first:rest)
| 134
|
identifier :: MarkdownParser String
identifier = do
first <- letter
rest <- many $ alphaNum <|> oneOf "-_:."
return (first:rest)
| 134
|
identifier = do
first <- letter
rest <- many $ alphaNum <|> oneOf "-_:."
return (first:rest)
| 98
| false
| true
| 0
| 9
| 25
| 52
| 24
| 28
| null | null |
fpco/fay
|
src/Fay/Compiler/Print.hs
|
bsd-3-clause
|
-- | Print an unqualified name.
printConsUnQual :: N.QName -> Printer ()
printConsUnQual (UnQual _ x) = printJS x
| 113
|
printConsUnQual :: N.QName -> Printer ()
printConsUnQual (UnQual _ x) = printJS x
| 81
|
printConsUnQual (UnQual _ x) = printJS x
| 40
| true
| true
| 0
| 7
| 18
| 37
| 18
| 19
| null | null |
dorchard/array-memoize
|
unfix-heat-example.hs
|
bsd-2-clause
|
delx = 0.1 :: Float
| 20
|
delx = 0.1 :: Float
| 20
|
delx = 0.1 :: Float
| 20
| false
| false
| 0
| 4
| 5
| 9
| 5
| 4
| null | null |
brendanhay/gogol
|
gogol-games-management/gen/Network/Google/GamesManagement/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'HiddenPlayerList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'hplNextPageToken'
--
-- * 'hplKind'
--
-- * 'hplItems'
hiddenPlayerList
:: HiddenPlayerList
hiddenPlayerList =
HiddenPlayerList'
{_hplNextPageToken = Nothing, _hplKind = Nothing, _hplItems = Nothing}
| 386
|
hiddenPlayerList
:: HiddenPlayerList
hiddenPlayerList =
HiddenPlayerList'
{_hplNextPageToken = Nothing, _hplKind = Nothing, _hplItems = Nothing}
| 154
|
hiddenPlayerList =
HiddenPlayerList'
{_hplNextPageToken = Nothing, _hplKind = Nothing, _hplItems = Nothing}
| 113
| true
| true
| 0
| 7
| 66
| 50
| 30
| 20
| null | null |
exbb2/BlastItWithPiss
|
src/BlastItWithPiss/Blast.hs
|
gpl-3.0
|
httpGetStrTags :: String -> Blast [Tag Text]
httpGetStrTags u = do
g <- httpGet u
let x = liftIO $ runResourceT $
parseTagsT . S.concat <$> (responseBody g $$+- consume)
x
| 199
|
httpGetStrTags :: String -> Blast [Tag Text]
httpGetStrTags u = do
g <- httpGet u
let x = liftIO $ runResourceT $
parseTagsT . S.concat <$> (responseBody g $$+- consume)
x
| 199
|
httpGetStrTags u = do
g <- httpGet u
let x = liftIO $ runResourceT $
parseTagsT . S.concat <$> (responseBody g $$+- consume)
x
| 154
| false
| true
| 0
| 13
| 58
| 77
| 36
| 41
| null | null |
adinapoli/threads-supervisor
|
test/Tests.hs
|
mit
|
testTooManyRestarts :: Assertion
testTooManyRestarts = do
sup <- newSupervisor OneForOne
_ <- forkSupervised sup (limitRetries 5) $ error "die"
threadDelay 2000000
q <- qToList (eventStream sup)
assertContainsNLimitReached 1 q
shutdownSupervisor sup
| 261
|
testTooManyRestarts :: Assertion
testTooManyRestarts = do
sup <- newSupervisor OneForOne
_ <- forkSupervised sup (limitRetries 5) $ error "die"
threadDelay 2000000
q <- qToList (eventStream sup)
assertContainsNLimitReached 1 q
shutdownSupervisor sup
| 261
|
testTooManyRestarts = do
sup <- newSupervisor OneForOne
_ <- forkSupervised sup (limitRetries 5) $ error "die"
threadDelay 2000000
q <- qToList (eventStream sup)
assertContainsNLimitReached 1 q
shutdownSupervisor sup
| 228
| false
| true
| 0
| 11
| 42
| 82
| 35
| 47
| null | null |
jystic/sandwich-press
|
doc/Experiment.hs
|
bsd-3-clause
|
------------------------------------------------------------------------
provides :: Capability c -> Fragment cs (c ': cs)
provides Capability = Fragment []
| 157
|
provides :: Capability c -> Fragment cs (c ': cs)
provides Capability = Fragment []
| 83
|
provides Capability = Fragment []
| 33
| true
| true
| 0
| 8
| 16
| 41
| 20
| 21
| null | null |
lordi/flowskell
|
src/Flowskell/InputActions.hs
|
gpl-2.0
|
keyboardAct (SpecialKey KeyHome) = actionModifyInputLine IL.pos1
| 64
|
keyboardAct (SpecialKey KeyHome) = actionModifyInputLine IL.pos1
| 64
|
keyboardAct (SpecialKey KeyHome) = actionModifyInputLine IL.pos1
| 64
| false
| false
| 0
| 6
| 5
| 21
| 9
| 12
| null | null |
mlite/hLLVM
|
src/Llvm/Asm/Simplification.hs
|
bsd-3-clause
|
rnPointer :: (a -> MS a) -> Pointer a -> MS (Pointer a)
rnPointer f (Pointer v) = S.liftM Pointer (f v)
| 103
|
rnPointer :: (a -> MS a) -> Pointer a -> MS (Pointer a)
rnPointer f (Pointer v) = S.liftM Pointer (f v)
| 103
|
rnPointer f (Pointer v) = S.liftM Pointer (f v)
| 47
| false
| true
| 0
| 10
| 21
| 71
| 32
| 39
| null | null |
capital-match/bake
|
src/Development/Bake/Core/Send.hs
|
bsd-3-clause
|
sendAddSkip :: (Host,Port) -> Author -> String -> IO ()
sendAddSkip hp author x = void $ sendMessage hp $ AddSkip author $ toTest x
| 131
|
sendAddSkip :: (Host,Port) -> Author -> String -> IO ()
sendAddSkip hp author x = void $ sendMessage hp $ AddSkip author $ toTest x
| 131
|
sendAddSkip hp author x = void $ sendMessage hp $ AddSkip author $ toTest x
| 75
| false
| true
| 0
| 9
| 24
| 67
| 31
| 36
| null | null |
cullina/Extractor
|
src/Util.hs
|
bsd-3-clause
|
(...) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
f ... g = \x y -> f (g x y)
| 77
|
(...) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
f ... g = \x y -> f (g x y)
| 77
|
f ... g = \x y -> f (g x y)
| 27
| false
| true
| 0
| 11
| 27
| 75
| 38
| 37
| null | null |
rzil/honours
|
LeavittPathAlgebras/Polynomial.hs
|
mit
|
--reversePolynomial :: (Eq a, Num a) => Polynomial a -> (Polynomial a, Int)
reversePolynomial isZero (Polynomial xs) = (Polynomial (reverse cs),length zs)
where (zs,cs) = break (not . isZero) xs
| 196
|
reversePolynomial isZero (Polynomial xs) = (Polynomial (reverse cs),length zs)
where (zs,cs) = break (not . isZero) xs
| 120
|
reversePolynomial isZero (Polynomial xs) = (Polynomial (reverse cs),length zs)
where (zs,cs) = break (not . isZero) xs
| 120
| true
| false
| 0
| 8
| 31
| 62
| 32
| 30
| null | null |
xnning/fcore
|
lib/Src.hs
|
bsd-2-clause
|
opPrec (Logic J.CAnd) = 11
| 30
|
opPrec (Logic J.CAnd) = 11
| 30
|
opPrec (Logic J.CAnd) = 11
| 30
| false
| false
| 0
| 8
| 8
| 17
| 8
| 9
| null | null |
niteria/haddock
|
haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
|
bsd-2-clause
|
ppAppNameTypes :: DocName -> [HsType DocName] -> [HsType DocName]
-> Unicode -> Qualification -> Html
ppAppNameTypes n ks ts unicode qual =
ppTypeApp n ks ts (\p -> ppDocName qual p True) (ppParendType unicode qual)
| 234
|
ppAppNameTypes :: DocName -> [HsType DocName] -> [HsType DocName]
-> Unicode -> Qualification -> Html
ppAppNameTypes n ks ts unicode qual =
ppTypeApp n ks ts (\p -> ppDocName qual p True) (ppParendType unicode qual)
| 234
|
ppAppNameTypes n ks ts unicode qual =
ppTypeApp n ks ts (\p -> ppDocName qual p True) (ppParendType unicode qual)
| 117
| false
| true
| 0
| 9
| 53
| 88
| 44
| 44
| null | null |
kmilner/tamarin-prover
|
lib/term/src/Term/Substitution/SubstVFree.hs
|
gpl-3.0
|
-- Application
----------------------------------------------------------------------
-- | @applyLit subst l@ applies the substitution @subst@ to the literal @l@.
applyLit :: IsVar v => Subst c v -> Lit c v -> VTerm c v
applyLit subst v@(Var i) = fromMaybe (lit v) $ M.lookup i (sMap subst)
| 292
|
applyLit :: IsVar v => Subst c v -> Lit c v -> VTerm c v
applyLit subst v@(Var i) = fromMaybe (lit v) $ M.lookup i (sMap subst)
| 128
|
applyLit subst v@(Var i) = fromMaybe (lit v) $ M.lookup i (sMap subst)
| 71
| true
| true
| 0
| 8
| 46
| 84
| 41
| 43
| null | null |
jessica-taylor/quipp2
|
src/Main.hs
|
mit
|
pyInferState :: FactorGraphTemplate Value -> Int -> FST -> IO (FactorGraphState Value)
pyInferState templ iters (state, params) = do
let factorGraph = instantiateTemplate templ params
return $ iterate (fromJust . stepVmp factorGraph) state !! iters
| 252
|
pyInferState :: FactorGraphTemplate Value -> Int -> FST -> IO (FactorGraphState Value)
pyInferState templ iters (state, params) = do
let factorGraph = instantiateTemplate templ params
return $ iterate (fromJust . stepVmp factorGraph) state !! iters
| 252
|
pyInferState templ iters (state, params) = do
let factorGraph = instantiateTemplate templ params
return $ iterate (fromJust . stepVmp factorGraph) state !! iters
| 165
| false
| true
| 0
| 12
| 38
| 93
| 43
| 50
| null | null |
chrra/iCalendar
|
Text/ICalendar/Parser/Content.hs
|
bsd-3-clause
|
isControl', isSafe, isValue, isQSafe, isName :: Char -> Bool
isControl' c = c /= '\t' && isControl c
| 100
|
isControl', isSafe, isValue, isQSafe, isName :: Char -> Bool
isControl' c = c /= '\t' && isControl c
| 100
|
isControl' c = c /= '\t' && isControl c
| 39
| false
| true
| 7
| 6
| 17
| 50
| 23
| 27
| null | null |
spechub/Hets
|
Driver/WriteFn.hs
|
gpl-2.0
|
writeTheory :: [String] -> String -> HetcatsOpts -> FilePath -> GlobalAnnos
-> G_theory -> LibName -> IRI -> OutType -> IO ()
writeTheory ins nam opts filePrefix ga
raw_gTh@(G_theory lid _ (ExtSign sign0 _) _ sens0 _) ln i ot =
let fp = filePrefix ++ "_" ++ i'
i' = encode (iriToStringShortUnsecure $ setAngles False i)
f = fp ++ "." ++ show ot
th = (sign0, toNamedList sens0)
lang = language_name lid
in case ot of
FreeCADOut -> writeFreeCADFile opts filePrefix raw_gTh
ThyFile -> writeIsaFile opts filePrefix raw_gTh ln i
DfgFile c -> writeSoftFOL opts f raw_gTh i c 0 "DFG"
TPTPFile
| lang == language_name TPTP -> do
th2 <- coerceBasicTheory lid TPTP "" th
let tptpText = show (TPTPPretty.printBasicTheory th2)
writeVerbFile opts f tptpText
| otherwise -> putIfVerbose opts 0 $ wrongLogicMsg f "TPTP" lang
TheoryFile d -> do
if null $ show d then
writeVerbFile opts f $ shows (DG.printTh ga i raw_gTh) "\n"
else putIfVerbose opts 0 "printing theory delta is not implemented"
when (lang == language_name VSE) $ do
(sign, sens) <- coerceBasicTheory lid VSE "" th
let (sign', sens') = addUniformRestr sign sens
lse = map (namedSenToSExpr sign') sens'
unless (null lse) $ writeVerbFile opts (fp ++ ".sexpr")
$ shows (prettySExpr $ SList lse) "\n"
SigFile d -> do
if null $ show d then
writeVerbFile opts f $ shows (pretty $ signOf raw_gTh) "\n"
else putIfVerbose opts 0 "printing signature delta is not implemented"
when (lang == language_name VSE) $ do
(sign, sens) <- coerceBasicTheory lid VSE "" th
let (sign', _sens') = addUniformRestr sign sens
writeVerbFile opts (f ++ ".sexpr")
$ shows (prettySExpr $ vseSignToSExpr sign') "\n"
SymXml -> writeVerbFile opts f $ ppTopElement
$ ToXml.showSymbolsTh opts ins nam ga raw_gTh
#ifdef PROGRAMATICA
HaskellOut -> case printModule raw_gTh of
Nothing ->
putIfVerbose opts 0 $ "could not translate to Haskell file: " ++ f
Just d -> writeVerbFile opts f $ shows d "\n"
#endif
ComptableXml -> if lang == language_name CASL then do
th2 <- coerceBasicTheory lid CASL "" th
let Result ds res = computeCompTable i th2
showDiags opts ds
case res of
Just td -> writeVerbFile opts f $ tableXmlStr td
Nothing -> return ()
else putIfVerbose opts 0 $ wrongLogicMsg f "CASL" lang
MedusaJson -> if lang == language_name OWL2 then do
th2 <- coerceBasicTheory lid OWL2 "" th
let Result ds res = medusa i th2
showDiags opts ds
case res of
Just td -> writeVerbFile opts f $ medusaToJsonString td
Nothing -> return ()
else putIfVerbose opts 0 $ wrongLogicMsg f "OWL2" lang
#ifdef RDFLOGIC
RDFOut
| lang == language_name RDF -> do
th2 <- coerceBasicTheory lid RDF "" th
let rdftext = shows (RDF.printRDFBasicTheory th2) "\n"
writeVerbFile opts f rdftext
| otherwise -> putIfVerbose opts 0 $ wrongLogicMsg f "RDF" lang
#endif
#ifndef NOOWLLOGIC
OWLOut ty -> case ty of
Manchester -> case createOWLTheory raw_gTh of
Result _ Nothing ->
putIfVerbose opts 0 $ wrongLogicMsg f "Manchester OWL" $ show ty
Result ds (Just th2) -> do
let sy = defSyntax opts
ms = if null sy then Nothing
else Just $ simpleIdToIRI $ mkSimpleId sy
owltext = shows
(printTheory ms OWL2 $ OWL2.prepareBasicTheory th2) "\n"
showDiags opts ds
when (null sy)
$ case parse (OWL2.parseOntologyDocument Map.empty >> eof) f owltext of
Left err -> putIfVerbose opts 0 $ show err
_ -> putIfVerbose opts 3 $ "reparsed: " ++ f
writeVerbFile opts f owltext
_ -> let flp = getFilePath ln in case guess flp GuessIn of
OWLIn _ -> writeVerbFile opts f =<< convertOWL flp (show ty)
_ -> putIfVerbose opts 0
$ "OWL output only supported for owl input types ("
++ intercalate ", " (map show plainOwlFormats) ++ ")"
#endif
CLIFOut
| lang == language_name CommonLogic -> do
(_, th2) <- coerceBasicTheory lid CommonLogic "" th
let cltext = shows (CL_AS.exportCLIF th2) "\n"
case parse (many (CL_Parse.cltext Map.empty) >> eof) f cltext of
Left err -> putIfVerbose opts 0 $ show err
_ -> putIfVerbose opts 3 $ "reparsed: " ++ f
writeVerbFile opts f cltext
| otherwise -> putIfVerbose opts 0 $ wrongLogicMsg f "Common Logic" lang
KIFOut
| lang == language_name CommonLogic -> do
(_, th2) <- coerceBasicTheory lid CommonLogic "" th
let kiftext = shows (Print_KIF.exportKIF th2) "\n"
writeVerbFile opts f kiftext
| otherwise -> putIfVerbose opts 0 $ wrongLogicMsg f "Common Logic" lang
_ -> return () -- ignore other file types
| 5,199
|
writeTheory :: [String] -> String -> HetcatsOpts -> FilePath -> GlobalAnnos
-> G_theory -> LibName -> IRI -> OutType -> IO ()
writeTheory ins nam opts filePrefix ga
raw_gTh@(G_theory lid _ (ExtSign sign0 _) _ sens0 _) ln i ot =
let fp = filePrefix ++ "_" ++ i'
i' = encode (iriToStringShortUnsecure $ setAngles False i)
f = fp ++ "." ++ show ot
th = (sign0, toNamedList sens0)
lang = language_name lid
in case ot of
FreeCADOut -> writeFreeCADFile opts filePrefix raw_gTh
ThyFile -> writeIsaFile opts filePrefix raw_gTh ln i
DfgFile c -> writeSoftFOL opts f raw_gTh i c 0 "DFG"
TPTPFile
| lang == language_name TPTP -> do
th2 <- coerceBasicTheory lid TPTP "" th
let tptpText = show (TPTPPretty.printBasicTheory th2)
writeVerbFile opts f tptpText
| otherwise -> putIfVerbose opts 0 $ wrongLogicMsg f "TPTP" lang
TheoryFile d -> do
if null $ show d then
writeVerbFile opts f $ shows (DG.printTh ga i raw_gTh) "\n"
else putIfVerbose opts 0 "printing theory delta is not implemented"
when (lang == language_name VSE) $ do
(sign, sens) <- coerceBasicTheory lid VSE "" th
let (sign', sens') = addUniformRestr sign sens
lse = map (namedSenToSExpr sign') sens'
unless (null lse) $ writeVerbFile opts (fp ++ ".sexpr")
$ shows (prettySExpr $ SList lse) "\n"
SigFile d -> do
if null $ show d then
writeVerbFile opts f $ shows (pretty $ signOf raw_gTh) "\n"
else putIfVerbose opts 0 "printing signature delta is not implemented"
when (lang == language_name VSE) $ do
(sign, sens) <- coerceBasicTheory lid VSE "" th
let (sign', _sens') = addUniformRestr sign sens
writeVerbFile opts (f ++ ".sexpr")
$ shows (prettySExpr $ vseSignToSExpr sign') "\n"
SymXml -> writeVerbFile opts f $ ppTopElement
$ ToXml.showSymbolsTh opts ins nam ga raw_gTh
#ifdef PROGRAMATICA
HaskellOut -> case printModule raw_gTh of
Nothing ->
putIfVerbose opts 0 $ "could not translate to Haskell file: " ++ f
Just d -> writeVerbFile opts f $ shows d "\n"
#endif
ComptableXml -> if lang == language_name CASL then do
th2 <- coerceBasicTheory lid CASL "" th
let Result ds res = computeCompTable i th2
showDiags opts ds
case res of
Just td -> writeVerbFile opts f $ tableXmlStr td
Nothing -> return ()
else putIfVerbose opts 0 $ wrongLogicMsg f "CASL" lang
MedusaJson -> if lang == language_name OWL2 then do
th2 <- coerceBasicTheory lid OWL2 "" th
let Result ds res = medusa i th2
showDiags opts ds
case res of
Just td -> writeVerbFile opts f $ medusaToJsonString td
Nothing -> return ()
else putIfVerbose opts 0 $ wrongLogicMsg f "OWL2" lang
#ifdef RDFLOGIC
RDFOut
| lang == language_name RDF -> do
th2 <- coerceBasicTheory lid RDF "" th
let rdftext = shows (RDF.printRDFBasicTheory th2) "\n"
writeVerbFile opts f rdftext
| otherwise -> putIfVerbose opts 0 $ wrongLogicMsg f "RDF" lang
#endif
#ifndef NOOWLLOGIC
OWLOut ty -> case ty of
Manchester -> case createOWLTheory raw_gTh of
Result _ Nothing ->
putIfVerbose opts 0 $ wrongLogicMsg f "Manchester OWL" $ show ty
Result ds (Just th2) -> do
let sy = defSyntax opts
ms = if null sy then Nothing
else Just $ simpleIdToIRI $ mkSimpleId sy
owltext = shows
(printTheory ms OWL2 $ OWL2.prepareBasicTheory th2) "\n"
showDiags opts ds
when (null sy)
$ case parse (OWL2.parseOntologyDocument Map.empty >> eof) f owltext of
Left err -> putIfVerbose opts 0 $ show err
_ -> putIfVerbose opts 3 $ "reparsed: " ++ f
writeVerbFile opts f owltext
_ -> let flp = getFilePath ln in case guess flp GuessIn of
OWLIn _ -> writeVerbFile opts f =<< convertOWL flp (show ty)
_ -> putIfVerbose opts 0
$ "OWL output only supported for owl input types ("
++ intercalate ", " (map show plainOwlFormats) ++ ")"
#endif
CLIFOut
| lang == language_name CommonLogic -> do
(_, th2) <- coerceBasicTheory lid CommonLogic "" th
let cltext = shows (CL_AS.exportCLIF th2) "\n"
case parse (many (CL_Parse.cltext Map.empty) >> eof) f cltext of
Left err -> putIfVerbose opts 0 $ show err
_ -> putIfVerbose opts 3 $ "reparsed: " ++ f
writeVerbFile opts f cltext
| otherwise -> putIfVerbose opts 0 $ wrongLogicMsg f "Common Logic" lang
KIFOut
| lang == language_name CommonLogic -> do
(_, th2) <- coerceBasicTheory lid CommonLogic "" th
let kiftext = shows (Print_KIF.exportKIF th2) "\n"
writeVerbFile opts f kiftext
| otherwise -> putIfVerbose opts 0 $ wrongLogicMsg f "Common Logic" lang
_ -> return () -- ignore other file types
| 5,199
|
writeTheory ins nam opts filePrefix ga
raw_gTh@(G_theory lid _ (ExtSign sign0 _) _ sens0 _) ln i ot =
let fp = filePrefix ++ "_" ++ i'
i' = encode (iriToStringShortUnsecure $ setAngles False i)
f = fp ++ "." ++ show ot
th = (sign0, toNamedList sens0)
lang = language_name lid
in case ot of
FreeCADOut -> writeFreeCADFile opts filePrefix raw_gTh
ThyFile -> writeIsaFile opts filePrefix raw_gTh ln i
DfgFile c -> writeSoftFOL opts f raw_gTh i c 0 "DFG"
TPTPFile
| lang == language_name TPTP -> do
th2 <- coerceBasicTheory lid TPTP "" th
let tptpText = show (TPTPPretty.printBasicTheory th2)
writeVerbFile opts f tptpText
| otherwise -> putIfVerbose opts 0 $ wrongLogicMsg f "TPTP" lang
TheoryFile d -> do
if null $ show d then
writeVerbFile opts f $ shows (DG.printTh ga i raw_gTh) "\n"
else putIfVerbose opts 0 "printing theory delta is not implemented"
when (lang == language_name VSE) $ do
(sign, sens) <- coerceBasicTheory lid VSE "" th
let (sign', sens') = addUniformRestr sign sens
lse = map (namedSenToSExpr sign') sens'
unless (null lse) $ writeVerbFile opts (fp ++ ".sexpr")
$ shows (prettySExpr $ SList lse) "\n"
SigFile d -> do
if null $ show d then
writeVerbFile opts f $ shows (pretty $ signOf raw_gTh) "\n"
else putIfVerbose opts 0 "printing signature delta is not implemented"
when (lang == language_name VSE) $ do
(sign, sens) <- coerceBasicTheory lid VSE "" th
let (sign', _sens') = addUniformRestr sign sens
writeVerbFile opts (f ++ ".sexpr")
$ shows (prettySExpr $ vseSignToSExpr sign') "\n"
SymXml -> writeVerbFile opts f $ ppTopElement
$ ToXml.showSymbolsTh opts ins nam ga raw_gTh
#ifdef PROGRAMATICA
HaskellOut -> case printModule raw_gTh of
Nothing ->
putIfVerbose opts 0 $ "could not translate to Haskell file: " ++ f
Just d -> writeVerbFile opts f $ shows d "\n"
#endif
ComptableXml -> if lang == language_name CASL then do
th2 <- coerceBasicTheory lid CASL "" th
let Result ds res = computeCompTable i th2
showDiags opts ds
case res of
Just td -> writeVerbFile opts f $ tableXmlStr td
Nothing -> return ()
else putIfVerbose opts 0 $ wrongLogicMsg f "CASL" lang
MedusaJson -> if lang == language_name OWL2 then do
th2 <- coerceBasicTheory lid OWL2 "" th
let Result ds res = medusa i th2
showDiags opts ds
case res of
Just td -> writeVerbFile opts f $ medusaToJsonString td
Nothing -> return ()
else putIfVerbose opts 0 $ wrongLogicMsg f "OWL2" lang
#ifdef RDFLOGIC
RDFOut
| lang == language_name RDF -> do
th2 <- coerceBasicTheory lid RDF "" th
let rdftext = shows (RDF.printRDFBasicTheory th2) "\n"
writeVerbFile opts f rdftext
| otherwise -> putIfVerbose opts 0 $ wrongLogicMsg f "RDF" lang
#endif
#ifndef NOOWLLOGIC
OWLOut ty -> case ty of
Manchester -> case createOWLTheory raw_gTh of
Result _ Nothing ->
putIfVerbose opts 0 $ wrongLogicMsg f "Manchester OWL" $ show ty
Result ds (Just th2) -> do
let sy = defSyntax opts
ms = if null sy then Nothing
else Just $ simpleIdToIRI $ mkSimpleId sy
owltext = shows
(printTheory ms OWL2 $ OWL2.prepareBasicTheory th2) "\n"
showDiags opts ds
when (null sy)
$ case parse (OWL2.parseOntologyDocument Map.empty >> eof) f owltext of
Left err -> putIfVerbose opts 0 $ show err
_ -> putIfVerbose opts 3 $ "reparsed: " ++ f
writeVerbFile opts f owltext
_ -> let flp = getFilePath ln in case guess flp GuessIn of
OWLIn _ -> writeVerbFile opts f =<< convertOWL flp (show ty)
_ -> putIfVerbose opts 0
$ "OWL output only supported for owl input types ("
++ intercalate ", " (map show plainOwlFormats) ++ ")"
#endif
CLIFOut
| lang == language_name CommonLogic -> do
(_, th2) <- coerceBasicTheory lid CommonLogic "" th
let cltext = shows (CL_AS.exportCLIF th2) "\n"
case parse (many (CL_Parse.cltext Map.empty) >> eof) f cltext of
Left err -> putIfVerbose opts 0 $ show err
_ -> putIfVerbose opts 3 $ "reparsed: " ++ f
writeVerbFile opts f cltext
| otherwise -> putIfVerbose opts 0 $ wrongLogicMsg f "Common Logic" lang
KIFOut
| lang == language_name CommonLogic -> do
(_, th2) <- coerceBasicTheory lid CommonLogic "" th
let kiftext = shows (Print_KIF.exportKIF th2) "\n"
writeVerbFile opts f kiftext
| otherwise -> putIfVerbose opts 0 $ wrongLogicMsg f "Common Logic" lang
_ -> return () -- ignore other file types
| 5,071
| false
| true
| 167
| 10
| 1,638
| 1,535
| 799
| 736
| null | null |
green-haskell/ghc
|
compiler/coreSyn/TrieMap.hs
|
bsd-3-clause
|
foldMaybe k (Just a) b = k a b
| 30
|
foldMaybe k (Just a) b = k a b
| 30
|
foldMaybe k (Just a) b = k a b
| 30
| false
| false
| 0
| 7
| 8
| 24
| 11
| 13
| null | null |
green-haskell/ghc
|
compiler/codeGen/StgCmmClosure.hs
|
bsd-3-clause
|
isKnownFun LFLetNoEscape = True
| 39
|
isKnownFun LFLetNoEscape = True
| 39
|
isKnownFun LFLetNoEscape = True
| 39
| false
| false
| 0
| 5
| 11
| 9
| 4
| 5
| null | null |
keithodulaigh/Hets
|
OMDoc/Import.hs
|
gpl-2.0
|
rPut :: ImpEnv -> String -> ResultT IO ()
rPut e = rPutIfVerbose e 1
| 68
|
rPut :: ImpEnv -> String -> ResultT IO ()
rPut e = rPutIfVerbose e 1
| 68
|
rPut e = rPutIfVerbose e 1
| 26
| false
| true
| 0
| 9
| 14
| 38
| 17
| 21
| null | null |
hdgarrood/bower-json
|
src/Web/Bower/PackageMeta/Internal.hs
|
mit
|
runPackageName :: PackageName -> Text
runPackageName (PackageName s) = s
| 72
|
runPackageName :: PackageName -> Text
runPackageName (PackageName s) = s
| 72
|
runPackageName (PackageName s) = s
| 34
| false
| true
| 0
| 7
| 9
| 24
| 12
| 12
| null | null |
danr/hipspec
|
testsuite/prod/zeno_version/PropT42.hs
|
gpl-3.0
|
-- Lists
length :: [a] -> Nat
length [] = Z
| 44
|
length :: [a] -> Nat
length [] = Z
| 34
|
length [] = Z
| 13
| true
| true
| 0
| 8
| 11
| 30
| 14
| 16
| null | null |
siddhanathan/yi
|
yi-core/src/Yi/Layout.hs
|
gpl-2.0
|
stack _ [l] = fst l
| 19
|
stack _ [l] = fst l
| 19
|
stack _ [l] = fst l
| 19
| false
| false
| 1
| 5
| 5
| 20
| 8
| 12
| null | null |
hsyl20/ViperVM
|
haskus-system/src/lib/Haskus/System/Linux/Network.hs
|
bsd-3-clause
|
-- | Create a socket
sysSocket :: MonadIO m => SocketType -> [SocketOption] -> FlowT '[ErrorCode] m Handle
sysSocket typ opts =
case typ of
SockTypeTCP IPv4 -> sysSocket' SockRawTypeStream SockProtIPv4 0 opts
SockTypeTCP IPv6 -> sysSocket' SockRawTypeStream SockProtIPv6 0 opts
SockTypeUDP IPv4 -> sysSocket' SockRawTypeDatagram SockProtIPv4 0 opts
SockTypeUDP IPv6 -> sysSocket' SockRawTypeDatagram SockProtIPv6 0 opts
SockTypeNetlink nt -> sysSocket' SockRawTypeDatagram SockProtNETLINK (fromEnum nt) opts
-- | Create a socket pair
| 575
|
sysSocket :: MonadIO m => SocketType -> [SocketOption] -> FlowT '[ErrorCode] m Handle
sysSocket typ opts =
case typ of
SockTypeTCP IPv4 -> sysSocket' SockRawTypeStream SockProtIPv4 0 opts
SockTypeTCP IPv6 -> sysSocket' SockRawTypeStream SockProtIPv6 0 opts
SockTypeUDP IPv4 -> sysSocket' SockRawTypeDatagram SockProtIPv4 0 opts
SockTypeUDP IPv6 -> sysSocket' SockRawTypeDatagram SockProtIPv6 0 opts
SockTypeNetlink nt -> sysSocket' SockRawTypeDatagram SockProtNETLINK (fromEnum nt) opts
-- | Create a socket pair
| 554
|
sysSocket typ opts =
case typ of
SockTypeTCP IPv4 -> sysSocket' SockRawTypeStream SockProtIPv4 0 opts
SockTypeTCP IPv6 -> sysSocket' SockRawTypeStream SockProtIPv6 0 opts
SockTypeUDP IPv4 -> sysSocket' SockRawTypeDatagram SockProtIPv4 0 opts
SockTypeUDP IPv6 -> sysSocket' SockRawTypeDatagram SockProtIPv6 0 opts
SockTypeNetlink nt -> sysSocket' SockRawTypeDatagram SockProtNETLINK (fromEnum nt) opts
-- | Create a socket pair
| 468
| true
| true
| 0
| 10
| 113
| 148
| 70
| 78
| null | null |
mightymoose/liquidhaskell
|
benchmarks/bytestring-0.9.2.1/Data/ByteString/Fusion.T.hs
|
bsd-3-clause
|
{-@ loopAcc :: p:(PairS acc arr) -> {v:acc | v = (pfst p)} @-}
loopAcc :: (PairS acc arr) -> acc
loopAcc (acc :*: _) = acc
| 122
|
loopAcc :: (PairS acc arr) -> acc
loopAcc (acc :*: _) = acc
| 59
|
loopAcc (acc :*: _) = acc
| 25
| true
| true
| 0
| 7
| 26
| 34
| 18
| 16
| null | null |
pbrisbin/renters-reality
|
Helpers/Review.hs
|
bsd-2-clause
|
reviewForm :: Maybe Review -> Maybe Text -> Text -> Form ReviewForm
reviewForm mr ml ip = renderBootstrap $ ReviewForm
<$> areq hiddenField "" (Just ip)
<*> areq textField "Landlord"
{ fsId = Just "landlord-input" } ml
<*> areq selectGrade "Grade" (fmap reviewGrade mr)
<*> areq textField "Time frame" (fmap reviewTimeframe mr)
<*> areq textareaField "Address" (fmap reviewAddress mr)
<*> areq markdownField "Review"
{ fsAttrs = [("class","review-entry")]
} (fmap reviewContent mr)
where
--selectGrade :: Field App Grade
selectGrade = selectFieldList grades
grades :: [(Text,Grade)] -- need explicit type
grades = [ ("A+", Aplus), ("A", A), ("A-", Aminus)
, ("B+", Bplus), ("B", B), ("B-", Bminus)
, ("C+", Cplus), ("C", C), ("C-", Cminus)
, ("D+", Dplus), ("D", D), ("D-", Dminus)
, ("F" , F )
]
| 991
|
reviewForm :: Maybe Review -> Maybe Text -> Text -> Form ReviewForm
reviewForm mr ml ip = renderBootstrap $ ReviewForm
<$> areq hiddenField "" (Just ip)
<*> areq textField "Landlord"
{ fsId = Just "landlord-input" } ml
<*> areq selectGrade "Grade" (fmap reviewGrade mr)
<*> areq textField "Time frame" (fmap reviewTimeframe mr)
<*> areq textareaField "Address" (fmap reviewAddress mr)
<*> areq markdownField "Review"
{ fsAttrs = [("class","review-entry")]
} (fmap reviewContent mr)
where
--selectGrade :: Field App Grade
selectGrade = selectFieldList grades
grades :: [(Text,Grade)] -- need explicit type
grades = [ ("A+", Aplus), ("A", A), ("A-", Aminus)
, ("B+", Bplus), ("B", B), ("B-", Bminus)
, ("C+", Cplus), ("C", C), ("C-", Cminus)
, ("D+", Dplus), ("D", D), ("D-", Dminus)
, ("F" , F )
]
| 991
|
reviewForm mr ml ip = renderBootstrap $ ReviewForm
<$> areq hiddenField "" (Just ip)
<*> areq textField "Landlord"
{ fsId = Just "landlord-input" } ml
<*> areq selectGrade "Grade" (fmap reviewGrade mr)
<*> areq textField "Time frame" (fmap reviewTimeframe mr)
<*> areq textareaField "Address" (fmap reviewAddress mr)
<*> areq markdownField "Review"
{ fsAttrs = [("class","review-entry")]
} (fmap reviewContent mr)
where
--selectGrade :: Field App Grade
selectGrade = selectFieldList grades
grades :: [(Text,Grade)] -- need explicit type
grades = [ ("A+", Aplus), ("A", A), ("A-", Aminus)
, ("B+", Bplus), ("B", B), ("B-", Bminus)
, ("C+", Cplus), ("C", C), ("C-", Cminus)
, ("D+", Dplus), ("D", D), ("D-", Dminus)
, ("F" , F )
]
| 923
| false
| true
| 17
| 9
| 318
| 349
| 195
| 154
| null | null |
romanb/amazonka
|
amazonka-lambda/gen/Network/AWS/Lambda/GetEventSourceMapping.hs
|
mpl-2.0
|
-- | The reason the event source mapping is in its current state. It is either
-- user-requested or an AWS Lambda-initiated state transition.
gesmrStateTransitionReason :: Lens' GetEventSourceMappingResponse (Maybe Text)
gesmrStateTransitionReason =
lens _gesmrStateTransitionReason
(\s a -> s { _gesmrStateTransitionReason = a })
| 342
|
gesmrStateTransitionReason :: Lens' GetEventSourceMappingResponse (Maybe Text)
gesmrStateTransitionReason =
lens _gesmrStateTransitionReason
(\s a -> s { _gesmrStateTransitionReason = a })
| 200
|
gesmrStateTransitionReason =
lens _gesmrStateTransitionReason
(\s a -> s { _gesmrStateTransitionReason = a })
| 121
| true
| true
| 0
| 9
| 54
| 47
| 26
| 21
| null | null |
akru/nlp-opus
|
src/bin/UnionByLang.hs
|
mit
|
main :: IO ()
main = do
(lang : caName : cbName : _) <- getArgs
ca <- load caName
cb <- load cbName
save "corpus.gz" $ unionByLang lang ca cb
putStrLn "corpus.gz saved"
| 188
|
main :: IO ()
main = do
(lang : caName : cbName : _) <- getArgs
ca <- load caName
cb <- load cbName
save "corpus.gz" $ unionByLang lang ca cb
putStrLn "corpus.gz saved"
| 188
|
main = do
(lang : caName : cbName : _) <- getArgs
ca <- load caName
cb <- load cbName
save "corpus.gz" $ unionByLang lang ca cb
putStrLn "corpus.gz saved"
| 174
| false
| true
| 0
| 11
| 53
| 81
| 36
| 45
| null | null |
chetant/bioSpace
|
Handler/Project.hs
|
bsd-2-clause
|
getProjectsR :: Handler RepHtml
getProjectsR = do
mu <- maybeAuthId
projects <- map snd <$> (runDB $ selectList [] [] 0 0)
isAdmin <- maybe (return False) checkAdmin mu
let grid = gridWidget 3 projects
defaultLayout $ do
setTitle "Genspace - Projects"
addWidget $(widgetFile "projects")
| 326
|
getProjectsR :: Handler RepHtml
getProjectsR = do
mu <- maybeAuthId
projects <- map snd <$> (runDB $ selectList [] [] 0 0)
isAdmin <- maybe (return False) checkAdmin mu
let grid = gridWidget 3 projects
defaultLayout $ do
setTitle "Genspace - Projects"
addWidget $(widgetFile "projects")
| 326
|
getProjectsR = do
mu <- maybeAuthId
projects <- map snd <$> (runDB $ selectList [] [] 0 0)
isAdmin <- maybe (return False) checkAdmin mu
let grid = gridWidget 3 projects
defaultLayout $ do
setTitle "Genspace - Projects"
addWidget $(widgetFile "projects")
| 294
| false
| true
| 1
| 14
| 84
| 117
| 51
| 66
| null | null |
grnet/snf-ganeti
|
src/Ganeti/Query/Query.hs
|
bsd-2-clause
|
queryInner cfg live (Query (ItemTypeLuxi QRFilter) fields qfilter) wanted =
genericQuery FilterRules.fieldsMap (CollectorSimple dummyCollectLiveData)
frUuid configFilters getFilterRule cfg live fields qfilter wanted
| 232
|
queryInner cfg live (Query (ItemTypeLuxi QRFilter) fields qfilter) wanted =
genericQuery FilterRules.fieldsMap (CollectorSimple dummyCollectLiveData)
frUuid configFilters getFilterRule cfg live fields qfilter wanted
| 232
|
queryInner cfg live (Query (ItemTypeLuxi QRFilter) fields qfilter) wanted =
genericQuery FilterRules.fieldsMap (CollectorSimple dummyCollectLiveData)
frUuid configFilters getFilterRule cfg live fields qfilter wanted
| 232
| false
| false
| 0
| 9
| 38
| 60
| 29
| 31
| null | null |
ivokosir/cogh
|
src/Graphics/Cogh/Element.hs
|
mit
|
rectangle :: Size -> Color -> Element a
rectangle rectSize c = emptyElement & size .~ rectSize & render .~ rectRender
where
rectRender window matrix = drawRect window matrix c
| 181
|
rectangle :: Size -> Color -> Element a
rectangle rectSize c = emptyElement & size .~ rectSize & render .~ rectRender
where
rectRender window matrix = drawRect window matrix c
| 181
|
rectangle rectSize c = emptyElement & size .~ rectSize & render .~ rectRender
where
rectRender window matrix = drawRect window matrix c
| 141
| false
| true
| 0
| 8
| 35
| 62
| 30
| 32
| null | null |
olsner/ghc
|
utils/genapply/Main.hs
|
bsd-3-clause
|
showArg V16 = "v16"
| 19
|
showArg V16 = "v16"
| 19
|
showArg V16 = "v16"
| 19
| false
| false
| 1
| 5
| 3
| 13
| 4
| 9
| null | null |
sgillespie/ghc
|
compiler/cmm/CmmUtils.hs
|
bsd-3-clause
|
primElemRepCmmType Int64ElemRep = b64
| 38
|
primElemRepCmmType Int64ElemRep = b64
| 38
|
primElemRepCmmType Int64ElemRep = b64
| 38
| false
| false
| 0
| 5
| 4
| 9
| 4
| 5
| null | null |
brendanhay/gogol
|
gogol-compute/gen/Network/Google/Resource/Compute/Disks/SetLabels.hs
|
mpl-2.0
|
-- | An optional request ID to identify requests. Specify a unique request ID
-- so that if you must retry your request, the server will know to ignore
-- the request if it has already been completed. For example, consider a
-- situation where you make an initial request and the request times out.
-- If you make the request again with the same request ID, the server can
-- check if original operation with the same request ID was received, and
-- if so, will ignore the second request. This prevents clients from
-- accidentally creating duplicate commitments. The request ID must be a
-- valid UUID with the exception that zero UUID is not supported
-- (00000000-0000-0000-0000-000000000000).
dslRequestId :: Lens' DisksSetLabels (Maybe Text)
dslRequestId
= lens _dslRequestId (\ s a -> s{_dslRequestId = a})
| 814
|
dslRequestId :: Lens' DisksSetLabels (Maybe Text)
dslRequestId
= lens _dslRequestId (\ s a -> s{_dslRequestId = a})
| 117
|
dslRequestId
= lens _dslRequestId (\ s a -> s{_dslRequestId = a})
| 67
| true
| true
| 1
| 9
| 138
| 59
| 34
| 25
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/DeSugar/StaticPtrTable.hs
|
bsd-3-clause
|
sptInitCode _this_mod _entries = vcat
[
Outputable.empty
-- text "static void hs_spt_init_" <> ppr this_mod
-- <> text "(void) __attribute__((constructor));"
-- , text "static void hs_spt_init_" <> ppr this_mod <> text "(void)"
-- , braces $ vcat $
-- [ text "static StgWord64 k" <> int i <> text "[2] = "
-- <> pprFingerprint fp <> semi
-- $$ text "extern StgPtr "
-- <> (ppr $ mkClosureLabel (idName n) (idCafInfo n)) <> semi
-- $$ text "hs_spt_insert" <> parens
-- (hcat $ punctuate comma
-- [ char 'k' <> int i
-- , char '&' <> ppr (mkClosureLabel (idName n) (idCafInfo n))
-- ]
-- )
-- <> semi
-- | (i, (fp, (n, _))) <- zip [0..] entries
-- ]
-- , text "static void hs_spt_fini_" <> ppr this_mod
-- <> text "(void) __attribute__((destructor));"
-- , text "static void hs_spt_fini_" <> ppr this_mod <> text "(void)"
-- , braces $ vcat $
-- [ text "StgWord64 k" <> int i <> text "[2] = "
-- <> pprFingerprint fp <> semi
-- $$ text "hs_spt_remove" <> parens (char 'k' <> int i) <> semi
-- | (i, (fp, _)) <- zip [0..] entries
-- ]
]
| 1,283
|
sptInitCode _this_mod _entries = vcat
[
Outputable.empty
-- text "static void hs_spt_init_" <> ppr this_mod
-- <> text "(void) __attribute__((constructor));"
-- , text "static void hs_spt_init_" <> ppr this_mod <> text "(void)"
-- , braces $ vcat $
-- [ text "static StgWord64 k" <> int i <> text "[2] = "
-- <> pprFingerprint fp <> semi
-- $$ text "extern StgPtr "
-- <> (ppr $ mkClosureLabel (idName n) (idCafInfo n)) <> semi
-- $$ text "hs_spt_insert" <> parens
-- (hcat $ punctuate comma
-- [ char 'k' <> int i
-- , char '&' <> ppr (mkClosureLabel (idName n) (idCafInfo n))
-- ]
-- )
-- <> semi
-- | (i, (fp, (n, _))) <- zip [0..] entries
-- ]
-- , text "static void hs_spt_fini_" <> ppr this_mod
-- <> text "(void) __attribute__((destructor));"
-- , text "static void hs_spt_fini_" <> ppr this_mod <> text "(void)"
-- , braces $ vcat $
-- [ text "StgWord64 k" <> int i <> text "[2] = "
-- <> pprFingerprint fp <> semi
-- $$ text "hs_spt_remove" <> parens (char 'k' <> int i) <> semi
-- | (i, (fp, _)) <- zip [0..] entries
-- ]
]
| 1,283
|
sptInitCode _this_mod _entries = vcat
[
Outputable.empty
-- text "static void hs_spt_init_" <> ppr this_mod
-- <> text "(void) __attribute__((constructor));"
-- , text "static void hs_spt_init_" <> ppr this_mod <> text "(void)"
-- , braces $ vcat $
-- [ text "static StgWord64 k" <> int i <> text "[2] = "
-- <> pprFingerprint fp <> semi
-- $$ text "extern StgPtr "
-- <> (ppr $ mkClosureLabel (idName n) (idCafInfo n)) <> semi
-- $$ text "hs_spt_insert" <> parens
-- (hcat $ punctuate comma
-- [ char 'k' <> int i
-- , char '&' <> ppr (mkClosureLabel (idName n) (idCafInfo n))
-- ]
-- )
-- <> semi
-- | (i, (fp, (n, _))) <- zip [0..] entries
-- ]
-- , text "static void hs_spt_fini_" <> ppr this_mod
-- <> text "(void) __attribute__((destructor));"
-- , text "static void hs_spt_fini_" <> ppr this_mod <> text "(void)"
-- , braces $ vcat $
-- [ text "StgWord64 k" <> int i <> text "[2] = "
-- <> pprFingerprint fp <> semi
-- $$ text "hs_spt_remove" <> parens (char 'k' <> int i) <> semi
-- | (i, (fp, _)) <- zip [0..] entries
-- ]
]
| 1,283
| false
| false
| 0
| 7
| 448
| 45
| 35
| 10
| null | null |
google/codeworld
|
codeworld-compiler/src/CodeWorld/Compile/Stages.hs
|
apache-2.0
|
isGoodExpAppLhs (NegApp _ _) = False
| 36
|
isGoodExpAppLhs (NegApp _ _) = False
| 36
|
isGoodExpAppLhs (NegApp _ _) = False
| 36
| false
| false
| 0
| 6
| 5
| 18
| 8
| 10
| null | null |
kazu-yamamoto/domain-auth
|
Network/DomainAuth/SPF/Parser.hs
|
bsd-3-clause
|
----------------------------------------------------------------
modifier :: Parser SPF
modifier = SPF_Redirect <$> (P.string "redirect=" *> domain)
| 149
|
modifier :: Parser SPF
modifier = SPF_Redirect <$> (P.string "redirect=" *> domain)
| 83
|
modifier = SPF_Redirect <$> (P.string "redirect=" *> domain)
| 60
| true
| true
| 0
| 9
| 13
| 31
| 16
| 15
| null | null |
Altech/haScm
|
src/Scheme/Internal.hs
|
gpl-3.0
|
eqVal (String x) (String y) = x == y
| 42
|
eqVal (String x) (String y) = x == y
| 42
|
eqVal (String x) (String y) = x == y
| 42
| false
| false
| 0
| 6
| 14
| 29
| 13
| 16
| null | null |
jgm/citeproc
|
src/Citeproc/Types.hs
|
bsd-2-clause
|
variableType "contributor" = NameVariable
| 41
|
variableType "contributor" = NameVariable
| 41
|
variableType "contributor" = NameVariable
| 41
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
vialette/ppattern
|
src/Data/Algorithm/PPattern/Geometry/ColorPoint.hs
|
mit
|
{-|
'mkBlank' makes a blank point from two coordinates.
-}
mkBlank :: Int -> Int -> ColorPoint
mkBlank x y = mkBlank' p
where
p = Point.mk x y
{-|
'mkPoint' makes a blank point from a point.
-}
| 222
|
mkBlank :: Int -> Int -> ColorPoint
mkBlank x y = mkBlank' p
where
p = Point.mk x y
{-|
'mkPoint' makes a blank point from a point.
-}
| 153
|
mkBlank x y = mkBlank' p
where
p = Point.mk x y
{-|
'mkPoint' makes a blank point from a point.
-}
| 117
| true
| true
| 1
| 8
| 67
| 54
| 23
| 31
| null | null |
mrBliss/haddock
|
haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
|
bsd-2-clause
|
ppFixities :: [(DocName, Fixity)] -> Qualification -> Html
ppFixities [] _ = noHtml
| 83
|
ppFixities :: [(DocName, Fixity)] -> Qualification -> Html
ppFixities [] _ = noHtml
| 83
|
ppFixities [] _ = noHtml
| 24
| false
| true
| 0
| 7
| 12
| 35
| 19
| 16
| null | null |
zaxtax/hakaru-old
|
Examples/Examples.hs
|
bsd-3-clause
|
item_response_theory = undefined
| 32
|
item_response_theory = undefined
| 32
|
item_response_theory = undefined
| 32
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
bgaster/blocks
|
Blocks.hs
|
mit
|
blockIDT = 2 :: BlockID
| 24
|
blockIDT = 2 :: BlockID
| 24
|
blockIDT = 2 :: BlockID
| 24
| false
| false
| 0
| 4
| 5
| 9
| 5
| 4
| null | null |
oden-lang/oden
|
src/Oden/Backend/Go.hs
|
mit
|
getFmtImport :: [ForeignPackageImport] -> (GI.Identifier, Maybe AST.ImportDecl)
getFmtImport pkgs =
case find isFmtPackage pkgs of
Just (ForeignPackageImport _ (Identifier alias) _) ->
(GI.Identifier alias, Nothing)
Nothing ->
let fmt = GI.Identifier "fmt"
in (fmt, Just (AST.ImportDecl fmt (AST.InterpretedStringLiteral "fmt")))
where
isFmtPackage (ForeignPackageImport _ _ "fmt") = True
isFmtPackage _ = False
| 449
|
getFmtImport :: [ForeignPackageImport] -> (GI.Identifier, Maybe AST.ImportDecl)
getFmtImport pkgs =
case find isFmtPackage pkgs of
Just (ForeignPackageImport _ (Identifier alias) _) ->
(GI.Identifier alias, Nothing)
Nothing ->
let fmt = GI.Identifier "fmt"
in (fmt, Just (AST.ImportDecl fmt (AST.InterpretedStringLiteral "fmt")))
where
isFmtPackage (ForeignPackageImport _ _ "fmt") = True
isFmtPackage _ = False
| 449
|
getFmtImport pkgs =
case find isFmtPackage pkgs of
Just (ForeignPackageImport _ (Identifier alias) _) ->
(GI.Identifier alias, Nothing)
Nothing ->
let fmt = GI.Identifier "fmt"
in (fmt, Just (AST.ImportDecl fmt (AST.InterpretedStringLiteral "fmt")))
where
isFmtPackage (ForeignPackageImport _ _ "fmt") = True
isFmtPackage _ = False
| 369
| false
| true
| 1
| 16
| 88
| 157
| 78
| 79
| null | null |
HIPERFIT/futhark
|
src/Futhark/IR/Traversals.hs
|
isc
|
mapExpM tv (BasicOp (Rearrange perm e)) =
BasicOp <$> (Rearrange perm <$> mapOnVName tv e)
| 92
|
mapExpM tv (BasicOp (Rearrange perm e)) =
BasicOp <$> (Rearrange perm <$> mapOnVName tv e)
| 92
|
mapExpM tv (BasicOp (Rearrange perm e)) =
BasicOp <$> (Rearrange perm <$> mapOnVName tv e)
| 92
| false
| false
| 0
| 9
| 16
| 45
| 21
| 24
| null | null |
gromakovsky/Orchid
|
src/Orchid/Codegen/Body.hs
|
mit
|
nameToPtrMaybe :: Text -> BodyGen (Maybe TypedOperand)
nameToPtrMaybe varName =
(<|>) <$>
use
(bsVariables .
at varName . to (fmap variableDataToTypedOperand)) <*>
getThisMemberPtr varName
| 217
|
nameToPtrMaybe :: Text -> BodyGen (Maybe TypedOperand)
nameToPtrMaybe varName =
(<|>) <$>
use
(bsVariables .
at varName . to (fmap variableDataToTypedOperand)) <*>
getThisMemberPtr varName
| 217
|
nameToPtrMaybe varName =
(<|>) <$>
use
(bsVariables .
at varName . to (fmap variableDataToTypedOperand)) <*>
getThisMemberPtr varName
| 162
| false
| true
| 0
| 12
| 52
| 66
| 32
| 34
| null | null |
noteed/humming
|
Database/PostgreSQL/Schedule.hs
|
bsd-3-clause
|
dropFunctionsQuery :: Query
dropFunctionsQuery =
"DROP FUNCTION IF EXISTS humming_schedule_notify() cascade;"
| 111
|
dropFunctionsQuery :: Query
dropFunctionsQuery =
"DROP FUNCTION IF EXISTS humming_schedule_notify() cascade;"
| 111
|
dropFunctionsQuery =
"DROP FUNCTION IF EXISTS humming_schedule_notify() cascade;"
| 83
| false
| true
| 0
| 4
| 12
| 11
| 6
| 5
| null | null |
konn/FRP2048
|
Main.hs
|
bsd-3-clause
|
dic :: [(Int, Direction)]
dic = [(keyLeftD, LeftD)
,(keyUpD, UpD)
,(keyRightD, RightD)
,(keyDownD, DownD)
]
| 136
|
dic :: [(Int, Direction)]
dic = [(keyLeftD, LeftD)
,(keyUpD, UpD)
,(keyRightD, RightD)
,(keyDownD, DownD)
]
| 136
|
dic = [(keyLeftD, LeftD)
,(keyUpD, UpD)
,(keyRightD, RightD)
,(keyDownD, DownD)
]
| 110
| false
| true
| 0
| 8
| 43
| 63
| 37
| 26
| null | null |
keithodulaigh/Hets
|
CommonLogic/Morphism.hs
|
gpl-2.0
|
{- | sentence (text) translation along signature morphism
here just the renaming of formulae -}
mapSentence :: Morphism -> AS.TEXT_META -> Result.Result AS.TEXT_META
mapSentence mor tm =
return $ tm { getText = mapSen_txt mor $ getText tm }
| 242
|
mapSentence :: Morphism -> AS.TEXT_META -> Result.Result AS.TEXT_META
mapSentence mor tm =
return $ tm { getText = mapSen_txt mor $ getText tm }
| 146
|
mapSentence mor tm =
return $ tm { getText = mapSen_txt mor $ getText tm }
| 76
| true
| true
| 0
| 9
| 40
| 56
| 28
| 28
| null | null |
phischu/pem-images
|
src/GUI.hs
|
bsd-3-clause
|
-- | Effect of the given request on the program and responses.
model :: Model Program Request Response
model = asPipe (forever (do
request <- await
case request of
RequestSaveProgram filepath -> do
imagequerystatements <- gets imageQueryStatements
yield (ResponseSaveProgram filepath imagequerystatements)
RequestLoadProgram imagequerystatements -> do
inputpath <- gets inputPath
put (Program imagequerystatements inputpath)
yield (ResponseProgramChanged imagequerystatements)
RequestRunProgram -> do
Program imagequerystatements inputpath <- get
yield (ResponseRunProgram inputpath imagequerystatements)
RequestAddStatement index imagequerystatement -> do
imagequerystatements <- gets imageQueryStatements
inputpath <- gets inputPath
let (prefix,suffix) = splitAt index imagequerystatements
imagequerystatements' = prefix ++ [imagequerystatement] ++ suffix
put (Program imagequerystatements' inputpath)
yield (ResponseProgramChanged imagequerystatements')
RequestInputPath inputpath -> do
program <- get
put (program {inputPath = inputpath})
yield (ResponseInputPath inputpath)
RequestDeleteStatement index -> do
imagequerystatements <- gets imageQueryStatements
inputpath <- gets inputPath
when (index < length imagequerystatements) (do
let (prefix,suffix) = splitAt index imagequerystatements
imagequerystatements' = prefix ++ tail suffix
put (Program imagequerystatements' inputpath)
yield (ResponseProgramChanged imagequerystatements'))))
| 1,799
|
model :: Model Program Request Response
model = asPipe (forever (do
request <- await
case request of
RequestSaveProgram filepath -> do
imagequerystatements <- gets imageQueryStatements
yield (ResponseSaveProgram filepath imagequerystatements)
RequestLoadProgram imagequerystatements -> do
inputpath <- gets inputPath
put (Program imagequerystatements inputpath)
yield (ResponseProgramChanged imagequerystatements)
RequestRunProgram -> do
Program imagequerystatements inputpath <- get
yield (ResponseRunProgram inputpath imagequerystatements)
RequestAddStatement index imagequerystatement -> do
imagequerystatements <- gets imageQueryStatements
inputpath <- gets inputPath
let (prefix,suffix) = splitAt index imagequerystatements
imagequerystatements' = prefix ++ [imagequerystatement] ++ suffix
put (Program imagequerystatements' inputpath)
yield (ResponseProgramChanged imagequerystatements')
RequestInputPath inputpath -> do
program <- get
put (program {inputPath = inputpath})
yield (ResponseInputPath inputpath)
RequestDeleteStatement index -> do
imagequerystatements <- gets imageQueryStatements
inputpath <- gets inputPath
when (index < length imagequerystatements) (do
let (prefix,suffix) = splitAt index imagequerystatements
imagequerystatements' = prefix ++ tail suffix
put (Program imagequerystatements' inputpath)
yield (ResponseProgramChanged imagequerystatements'))))
| 1,736
|
model = asPipe (forever (do
request <- await
case request of
RequestSaveProgram filepath -> do
imagequerystatements <- gets imageQueryStatements
yield (ResponseSaveProgram filepath imagequerystatements)
RequestLoadProgram imagequerystatements -> do
inputpath <- gets inputPath
put (Program imagequerystatements inputpath)
yield (ResponseProgramChanged imagequerystatements)
RequestRunProgram -> do
Program imagequerystatements inputpath <- get
yield (ResponseRunProgram inputpath imagequerystatements)
RequestAddStatement index imagequerystatement -> do
imagequerystatements <- gets imageQueryStatements
inputpath <- gets inputPath
let (prefix,suffix) = splitAt index imagequerystatements
imagequerystatements' = prefix ++ [imagequerystatement] ++ suffix
put (Program imagequerystatements' inputpath)
yield (ResponseProgramChanged imagequerystatements')
RequestInputPath inputpath -> do
program <- get
put (program {inputPath = inputpath})
yield (ResponseInputPath inputpath)
RequestDeleteStatement index -> do
imagequerystatements <- gets imageQueryStatements
inputpath <- gets inputPath
when (index < length imagequerystatements) (do
let (prefix,suffix) = splitAt index imagequerystatements
imagequerystatements' = prefix ++ tail suffix
put (Program imagequerystatements' inputpath)
yield (ResponseProgramChanged imagequerystatements'))))
| 1,696
| true
| true
| 1
| 24
| 508
| 409
| 182
| 227
| null | null |
KHs000/haskellToys
|
src/scripts/H-99.hs
|
mit
|
encodeDirect :: (Eq a) => [a] -> [ListItem a]
encodeDirect [] = []
| 66
|
encodeDirect :: (Eq a) => [a] -> [ListItem a]
encodeDirect [] = []
| 66
|
encodeDirect [] = []
| 20
| false
| true
| 0
| 10
| 12
| 46
| 22
| 24
| null | null |
a143753/AOJ
|
0513.hs
|
apache-2.0
|
merge (x:xs) (y:ys) = (x:y:(merge xs ys))
| 41
|
merge (x:xs) (y:ys) = (x:y:(merge xs ys))
| 41
|
merge (x:xs) (y:ys) = (x:y:(merge xs ys))
| 41
| false
| false
| 0
| 8
| 6
| 44
| 23
| 21
| null | null |
ekmett/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxLANGUAGE_ENGLISH_CANADA :: Int
wxLANGUAGE_ENGLISH_CANADA = 62
| 63
|
wxLANGUAGE_ENGLISH_CANADA :: Int
wxLANGUAGE_ENGLISH_CANADA = 62
| 63
|
wxLANGUAGE_ENGLISH_CANADA = 62
| 30
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
nevrenato/Hets_Fork
|
OWL2/Print.hs
|
gpl-2.0
|
printFV :: (ConstrainingFacet, RestrictionValue) -> Doc
printFV (facet, restValue) = pretty (fromCF facet) <+> pretty restValue
| 127
|
printFV :: (ConstrainingFacet, RestrictionValue) -> Doc
printFV (facet, restValue) = pretty (fromCF facet) <+> pretty restValue
| 127
|
printFV (facet, restValue) = pretty (fromCF facet) <+> pretty restValue
| 71
| false
| true
| 0
| 8
| 15
| 46
| 24
| 22
| null | null |
luisgepeto/HaskellLearning
|
05 Recursion/03_more_recursive.hs
|
mit
|
zip' [] _ = []
| 14
|
zip' [] _ = []
| 14
|
zip' [] _ = []
| 14
| false
| false
| 0
| 6
| 4
| 15
| 7
| 8
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.