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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
martrik/COMP101
|
Term1/COMP101/Lab4/LabSheet4.hs
|
mit
|
procStack xs numString = read numString : xs
| 44 |
procStack xs numString = read numString : xs
| 44 |
procStack xs numString = read numString : xs
| 44 | false | false | 0 | 6 | 7 | 18 | 8 | 10 | null | null |
gcampax/ghc
|
compiler/basicTypes/MkId.hs
|
bsd-3-clause
|
-- These Ids are exported from GHC.Prim
ghcPrimIds :: [Id]
ghcPrimIds
= [ -- These can't be defined in Haskell, but they have
-- perfectly reasonable unfoldings in Core
realWorldPrimId,
voidPrimId,
unsafeCoerceId,
nullAddrId,
seqId,
magicDictId,
coerceId,
proxyHashId
]
| 317 |
ghcPrimIds :: [Id]
ghcPrimIds
= [ -- These can't be defined in Haskell, but they have
-- perfectly reasonable unfoldings in Core
realWorldPrimId,
voidPrimId,
unsafeCoerceId,
nullAddrId,
seqId,
magicDictId,
coerceId,
proxyHashId
]
| 277 |
ghcPrimIds
= [ -- These can't be defined in Haskell, but they have
-- perfectly reasonable unfoldings in Core
realWorldPrimId,
voidPrimId,
unsafeCoerceId,
nullAddrId,
seqId,
magicDictId,
coerceId,
proxyHashId
]
| 258 | true | true | 0 | 7 | 85 | 44 | 27 | 17 | null | null |
unisonweb/platform
|
parser-typechecker/src/Unison/Runtime/Machine.hs
|
mit
|
uprim1 !ustk ABSF !i = do
d <- peekOffD ustk i
ustk <- bump ustk
pokeD ustk (abs d)
pure ustk
| 101 |
uprim1 !ustk ABSF !i = do
d <- peekOffD ustk i
ustk <- bump ustk
pokeD ustk (abs d)
pure ustk
| 101 |
uprim1 !ustk ABSF !i = do
d <- peekOffD ustk i
ustk <- bump ustk
pokeD ustk (abs d)
pure ustk
| 101 | false | false | 2 | 10 | 28 | 58 | 24 | 34 | null | null |
pikajude/melvin
|
src/Melvin/Damn.hs
|
mit
|
res_join :: ClientT m => Callback m
res_join Packet { pktParameter = p
, pktArgs = args } sta = do
let user = sta ^. username
channel <- toChannel $ $fromJst p
case args ^. ix "e" of
"ok" -> do
modifyState (joining %~ S.insert channel)
writeClient $ cmdJoin user channel
"not privileged" -> writeClient $ errBannedFromChan user channel
_ -> return ()
return True
| 442 |
res_join :: ClientT m => Callback m
res_join Packet { pktParameter = p
, pktArgs = args } sta = do
let user = sta ^. username
channel <- toChannel $ $fromJst p
case args ^. ix "e" of
"ok" -> do
modifyState (joining %~ S.insert channel)
writeClient $ cmdJoin user channel
"not privileged" -> writeClient $ errBannedFromChan user channel
_ -> return ()
return True
| 442 |
res_join Packet { pktParameter = p
, pktArgs = args } sta = do
let user = sta ^. username
channel <- toChannel $ $fromJst p
case args ^. ix "e" of
"ok" -> do
modifyState (joining %~ S.insert channel)
writeClient $ cmdJoin user channel
"not privileged" -> writeClient $ errBannedFromChan user channel
_ -> return ()
return True
| 406 | false | true | 0 | 16 | 145 | 151 | 69 | 82 | null | null |
advancedtelematic/quickcheck-state-machine-model
|
test/ProcessRegistry.hs
|
bsd-3-clause
|
semantics :: Action Concrete -> IO (Response Concrete)
semantics act = fmap success (semantics' act)
`catch`
(return . failure . handler)
where
handler :: IOError -> Error
handler err = case ioeGetErrorString err of
"ioRegister: name already registered" -> NameAlreadyRegisteredError
"ioRegister: pid already registered" -> PidAlreadyRegisteredError
"ioRegister: pid is dead" -> PidDeadRegisterError
"ioUnregister: not registered" -> NameNotRegisteredError
_ -> UnknownError
| 568 |
semantics :: Action Concrete -> IO (Response Concrete)
semantics act = fmap success (semantics' act)
`catch`
(return . failure . handler)
where
handler :: IOError -> Error
handler err = case ioeGetErrorString err of
"ioRegister: name already registered" -> NameAlreadyRegisteredError
"ioRegister: pid already registered" -> PidAlreadyRegisteredError
"ioRegister: pid is dead" -> PidDeadRegisterError
"ioUnregister: not registered" -> NameNotRegisteredError
_ -> UnknownError
| 568 |
semantics act = fmap success (semantics' act)
`catch`
(return . failure . handler)
where
handler :: IOError -> Error
handler err = case ioeGetErrorString err of
"ioRegister: name already registered" -> NameAlreadyRegisteredError
"ioRegister: pid already registered" -> PidAlreadyRegisteredError
"ioRegister: pid is dead" -> PidDeadRegisterError
"ioUnregister: not registered" -> NameNotRegisteredError
_ -> UnknownError
| 513 | false | true | 2 | 8 | 153 | 116 | 57 | 59 | null | null |
chreekat/stack
|
src/Stack/Setup.hs
|
bsd-3-clause
|
toFilePathNoTrailingSlash :: Path loc Dir -> FilePath
toFilePathNoTrailingSlash = FP.dropTrailingPathSeparator . toFilePath
| 123 |
toFilePathNoTrailingSlash :: Path loc Dir -> FilePath
toFilePathNoTrailingSlash = FP.dropTrailingPathSeparator . toFilePath
| 123 |
toFilePathNoTrailingSlash = FP.dropTrailingPathSeparator . toFilePath
| 69 | false | true | 0 | 6 | 11 | 26 | 13 | 13 | null | null |
mono0926/ParallelConcurrentHaskell
|
timetable2.hs
|
bsd-3-clause
|
test = timetable testPersons cs 2 2
where
cs@[c1,c2,c3,c4] = map Talk [1..4]
testPersons =
[ Person "P" [c1,c2]
, Person "Q" [c2,c3]
, Person "R" [c3,c4]
]
| 179 |
test = timetable testPersons cs 2 2
where
cs@[c1,c2,c3,c4] = map Talk [1..4]
testPersons =
[ Person "P" [c1,c2]
, Person "Q" [c2,c3]
, Person "R" [c3,c4]
]
| 179 |
test = timetable testPersons cs 2 2
where
cs@[c1,c2,c3,c4] = map Talk [1..4]
testPersons =
[ Person "P" [c1,c2]
, Person "Q" [c2,c3]
, Person "R" [c3,c4]
]
| 179 | false | false | 1 | 8 | 51 | 96 | 53 | 43 | null | null |
mkloczko/derive-storable
|
test/Basic/MemoryCSpec.hs
|
mit
|
same_alignment a = getAlignment a `shouldReturn` alignment a
| 60 |
same_alignment a = getAlignment a `shouldReturn` alignment a
| 60 |
same_alignment a = getAlignment a `shouldReturn` alignment a
| 60 | false | false | 0 | 6 | 7 | 21 | 10 | 11 | null | null |
ambiata/mismi
|
mismi-s3/src/Mismi/S3/Patch/PutObjectACL.hs
|
bsd-3-clause
|
-- | Creates a value of 'PutObjectACLResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'poarsRequestCharged'
--
-- * 'poarsResponseStatus'
putObjectACLResponse
:: Int -- ^ 'poarsResponseStatus'
-> PutObjectACLResponse
putObjectACLResponse pResponseStatus_ =
PutObjectACLResponse'
{ _poarsRequestCharged = Nothing
, _poarsResponseStatus = pResponseStatus_
}
| 473 |
putObjectACLResponse
:: Int -- ^ 'poarsResponseStatus'
-> PutObjectACLResponse
putObjectACLResponse pResponseStatus_ =
PutObjectACLResponse'
{ _poarsRequestCharged = Nothing
, _poarsResponseStatus = pResponseStatus_
}
| 241 |
putObjectACLResponse pResponseStatus_ =
PutObjectACLResponse'
{ _poarsRequestCharged = Nothing
, _poarsResponseStatus = pResponseStatus_
}
| 154 | true | true | 0 | 6 | 82 | 40 | 26 | 14 | null | null |
ellej/mire
|
src/Mire/Data/Flow.hs
|
bsd-3-clause
|
flowError m s = FlowMeta (MetaError m s)
| 40 |
flowError m s = FlowMeta (MetaError m s)
| 40 |
flowError m s = FlowMeta (MetaError m s)
| 40 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
adityashah30/haskellchess
|
chessEngine/Search2.hs
|
gpl-2.0
|
displayBoards ((b,val):xs) = do{
displayBoard b;
putStrLn "-----";
print( show(val));
putStrLn "-----";
displayBoards xs;
}
| 287 |
displayBoards ((b,val):xs) = do{
displayBoard b;
putStrLn "-----";
print( show(val));
putStrLn "-----";
displayBoards xs;
}
| 287 |
displayBoards ((b,val):xs) = do{
displayBoard b;
putStrLn "-----";
print( show(val));
putStrLn "-----";
displayBoards xs;
}
| 287 | false | false | 0 | 10 | 178 | 68 | 34 | 34 | null | null |
wmarvel/haskellrogue
|
src/FOV.hs
|
mit
|
fov :: Coord -> RaySet -> Level -> [Coord]
fov off rays lvl = foldl maybeAdd [] rays
where
maybeAdd result [] = result
maybeAdd result (x:xs) =
if isWall coord lvl || isClosedDoor coord lvl
then result'
else maybeAdd result' xs
where
result' = coord : result
coord = x |+| off
| 330 |
fov :: Coord -> RaySet -> Level -> [Coord]
fov off rays lvl = foldl maybeAdd [] rays
where
maybeAdd result [] = result
maybeAdd result (x:xs) =
if isWall coord lvl || isClosedDoor coord lvl
then result'
else maybeAdd result' xs
where
result' = coord : result
coord = x |+| off
| 330 |
fov off rays lvl = foldl maybeAdd [] rays
where
maybeAdd result [] = result
maybeAdd result (x:xs) =
if isWall coord lvl || isClosedDoor coord lvl
then result'
else maybeAdd result' xs
where
result' = coord : result
coord = x |+| off
| 287 | false | true | 1 | 8 | 106 | 122 | 61 | 61 | null | null |
d-day/relation
|
include/pointfree-style/pointless-haskell-0.0.8/src/Generics/Pointless/RecursionPatterns.hs
|
bsd-3-clause
|
ix :: (a -> a) -> a
fix = hylo (ann :: Ann (K (a -> a) :*!: I)) app (id /\ id)
| 79 |
fix :: (a -> a) -> a
fix = hylo (ann :: Ann (K (a -> a) :*!: I)) app (id /\ id)
| 79 |
fix = hylo (ann :: Ann (K (a -> a) :*!: I)) app (id /\ id)
| 58 | false | true | 0 | 12 | 23 | 62 | 33 | 29 | null | null |
sherwoodwang/wxHaskell
|
samples/wx/Controls.hs
|
lgpl-2.1
|
kindof obj className
= do classInfo <- classInfoFindClass className
if (objectIsNull classInfo)
then logMessage ("kindof " ++ className ++ ": no such class")
else if (objectIsNull obj)
then logMessage ("kindof " ++ className ++ ": null object")
else do haskind <- objectIsKindOf obj classInfo
logMessage ("kindof " ++ className ++ ": " ++ show haskind)
| 427 |
kindof obj className
= do classInfo <- classInfoFindClass className
if (objectIsNull classInfo)
then logMessage ("kindof " ++ className ++ ": no such class")
else if (objectIsNull obj)
then logMessage ("kindof " ++ className ++ ": null object")
else do haskind <- objectIsKindOf obj classInfo
logMessage ("kindof " ++ className ++ ": " ++ show haskind)
| 427 |
kindof obj className
= do classInfo <- classInfoFindClass className
if (objectIsNull classInfo)
then logMessage ("kindof " ++ className ++ ": no such class")
else if (objectIsNull obj)
then logMessage ("kindof " ++ className ++ ": null object")
else do haskind <- objectIsKindOf obj classInfo
logMessage ("kindof " ++ className ++ ": " ++ show haskind)
| 427 | false | false | 0 | 15 | 129 | 116 | 56 | 60 | null | null |
bgamari/pandoc
|
src/Text/Pandoc/Writers/Docx.hs
|
gpl-2.0
|
inlineToOpenXML opts (Link txt (src,_)) = do
contents <- withTextProp (rStyle "Link") $ inlinesToOpenXML opts txt
extlinks <- gets stExternalLinks
id' <- case M.lookup src extlinks of
Just i -> return i
Nothing -> do
i <- ("rId"++) `fmap` getUniqueId
modify $ \st -> st{ stExternalLinks =
M.insert src i extlinks }
return i
return [ mknode "w:hyperlink" [("r:id",id')] contents ]
| 480 |
inlineToOpenXML opts (Link txt (src,_)) = do
contents <- withTextProp (rStyle "Link") $ inlinesToOpenXML opts txt
extlinks <- gets stExternalLinks
id' <- case M.lookup src extlinks of
Just i -> return i
Nothing -> do
i <- ("rId"++) `fmap` getUniqueId
modify $ \st -> st{ stExternalLinks =
M.insert src i extlinks }
return i
return [ mknode "w:hyperlink" [("r:id",id')] contents ]
| 480 |
inlineToOpenXML opts (Link txt (src,_)) = do
contents <- withTextProp (rStyle "Link") $ inlinesToOpenXML opts txt
extlinks <- gets stExternalLinks
id' <- case M.lookup src extlinks of
Just i -> return i
Nothing -> do
i <- ("rId"++) `fmap` getUniqueId
modify $ \st -> st{ stExternalLinks =
M.insert src i extlinks }
return i
return [ mknode "w:hyperlink" [("r:id",id')] contents ]
| 480 | false | false | 0 | 18 | 161 | 173 | 84 | 89 | null | null |
kelnage/tamarin-prover
|
lib/theory/src/Theory/Model/Rule.hs
|
gpl-3.0
|
-- | Enumerate all premises of a rule.
enumPrems :: Rule i -> [(PremIdx, LNFact)]
enumPrems = zip [(PremIdx 0)..] . L.get rPrems
| 128 |
enumPrems :: Rule i -> [(PremIdx, LNFact)]
enumPrems = zip [(PremIdx 0)..] . L.get rPrems
| 89 |
enumPrems = zip [(PremIdx 0)..] . L.get rPrems
| 46 | true | true | 0 | 9 | 22 | 49 | 26 | 23 | null | null |
kadena-io/pact
|
src-ghc/Pact/GasModel/GasTests.hs
|
bsd-3-clause
|
subOptTests :: NativeDefName -> GasUnitTests
subOptTests = defGasUnitTests allExprs
where
subExpr x =
[text| (- $x $x) |]
subDecimalExpr x =
[text| (- $x.0 $x.0) |]
subBothExpr x =
[text| (- $x.0 $x) |]
subOneExpr x =
[text| (- $x) |]
subOneDecimalExpr x =
[text| (- $x.0) |]
allExprs = NEL.map (createPactExpr subExpr) sizesExpr
<> NEL.map (createPactExpr subDecimalExpr) sizesExpr
<> NEL.map (createPactExpr subBothExpr) sizesExpr
<> NEL.map (createPactExpr subOneExpr) sizesExpr
<> NEL.map (createPactExpr subOneDecimalExpr) sizesExpr
| 618 |
subOptTests :: NativeDefName -> GasUnitTests
subOptTests = defGasUnitTests allExprs
where
subExpr x =
[text| (- $x $x) |]
subDecimalExpr x =
[text| (- $x.0 $x.0) |]
subBothExpr x =
[text| (- $x.0 $x) |]
subOneExpr x =
[text| (- $x) |]
subOneDecimalExpr x =
[text| (- $x.0) |]
allExprs = NEL.map (createPactExpr subExpr) sizesExpr
<> NEL.map (createPactExpr subDecimalExpr) sizesExpr
<> NEL.map (createPactExpr subBothExpr) sizesExpr
<> NEL.map (createPactExpr subOneExpr) sizesExpr
<> NEL.map (createPactExpr subOneDecimalExpr) sizesExpr
| 618 |
subOptTests = defGasUnitTests allExprs
where
subExpr x =
[text| (- $x $x) |]
subDecimalExpr x =
[text| (- $x.0 $x.0) |]
subBothExpr x =
[text| (- $x.0 $x) |]
subOneExpr x =
[text| (- $x) |]
subOneDecimalExpr x =
[text| (- $x.0) |]
allExprs = NEL.map (createPactExpr subExpr) sizesExpr
<> NEL.map (createPactExpr subDecimalExpr) sizesExpr
<> NEL.map (createPactExpr subBothExpr) sizesExpr
<> NEL.map (createPactExpr subOneExpr) sizesExpr
<> NEL.map (createPactExpr subOneDecimalExpr) sizesExpr
| 573 | false | true | 5 | 11 | 154 | 167 | 91 | 76 | null | null |
rubenmoor/skull
|
skull-server/src/Auth.hs
|
mit
|
lookupSession :: (Db.Read m, Db.Delete m, Db.Update m, MonadIO m, MonadError AppError m)
=> SessionKey
-> m UserInfo
lookupSession key = do
(Entity sId Session{..}, Entity uId User{..}) <- sessionQuery
now <- liftIO Clock.getCurrentTime
if now > sessionExpiry
then do Db.deleteByKey sId
throwError $ ErrUnauthorized "session expired"
else do
let newExpiry = Clock.addUTCTime sessionLength now
Db.update $ \s -> do
set s [ SessionExpiry =. val newExpiry ]
where_ $ s ^. SessionId ==. val sId
pure UserInfo
{ _uiUserId = uId
, _uiUserName = userName
, _uiEmail = userEmail
, _uiActiveBotKey = Nothing
}
where
sessionQuery = do
ls <- Db.select $ from $ \(s `InnerJoin` u) -> do
where_ $ (s ^. SessionKey ==. val key)
&&. (u ^. UserId ==. s ^. SessionFkUser)
pure (s, u)
case ls of
[] -> throwError $ ErrUnauthorized "session not found"
_:_:_ -> throwError $ ErrUnauthorized "multiple sessions found"
[res] -> pure res
-- authHandler that optionally allows authentification via botkey OR session
| 1,263 |
lookupSession :: (Db.Read m, Db.Delete m, Db.Update m, MonadIO m, MonadError AppError m)
=> SessionKey
-> m UserInfo
lookupSession key = do
(Entity sId Session{..}, Entity uId User{..}) <- sessionQuery
now <- liftIO Clock.getCurrentTime
if now > sessionExpiry
then do Db.deleteByKey sId
throwError $ ErrUnauthorized "session expired"
else do
let newExpiry = Clock.addUTCTime sessionLength now
Db.update $ \s -> do
set s [ SessionExpiry =. val newExpiry ]
where_ $ s ^. SessionId ==. val sId
pure UserInfo
{ _uiUserId = uId
, _uiUserName = userName
, _uiEmail = userEmail
, _uiActiveBotKey = Nothing
}
where
sessionQuery = do
ls <- Db.select $ from $ \(s `InnerJoin` u) -> do
where_ $ (s ^. SessionKey ==. val key)
&&. (u ^. UserId ==. s ^. SessionFkUser)
pure (s, u)
case ls of
[] -> throwError $ ErrUnauthorized "session not found"
_:_:_ -> throwError $ ErrUnauthorized "multiple sessions found"
[res] -> pure res
-- authHandler that optionally allows authentification via botkey OR session
| 1,263 |
lookupSession key = do
(Entity sId Session{..}, Entity uId User{..}) <- sessionQuery
now <- liftIO Clock.getCurrentTime
if now > sessionExpiry
then do Db.deleteByKey sId
throwError $ ErrUnauthorized "session expired"
else do
let newExpiry = Clock.addUTCTime sessionLength now
Db.update $ \s -> do
set s [ SessionExpiry =. val newExpiry ]
where_ $ s ^. SessionId ==. val sId
pure UserInfo
{ _uiUserId = uId
, _uiUserName = userName
, _uiEmail = userEmail
, _uiActiveBotKey = Nothing
}
where
sessionQuery = do
ls <- Db.select $ from $ \(s `InnerJoin` u) -> do
where_ $ (s ^. SessionKey ==. val key)
&&. (u ^. UserId ==. s ^. SessionFkUser)
pure (s, u)
case ls of
[] -> throwError $ ErrUnauthorized "session not found"
_:_:_ -> throwError $ ErrUnauthorized "multiple sessions found"
[res] -> pure res
-- authHandler that optionally allows authentification via botkey OR session
| 1,118 | false | true | 1 | 17 | 433 | 395 | 192 | 203 | null | null |
brendanhay/gogol
|
gogol-firebase-dynamiclinks/gen/Network/Google/Resource/FirebaseDynamicLinks/ManagedShortLinks/Create.hs
|
mpl-2.0
|
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
mslcUploadType :: Lens' ManagedShortLinksCreate (Maybe Text)
mslcUploadType
= lens _mslcUploadType
(\ s a -> s{_mslcUploadType = a})
| 211 |
mslcUploadType :: Lens' ManagedShortLinksCreate (Maybe Text)
mslcUploadType
= lens _mslcUploadType
(\ s a -> s{_mslcUploadType = a})
| 140 |
mslcUploadType
= lens _mslcUploadType
(\ s a -> s{_mslcUploadType = a})
| 79 | true | true | 0 | 8 | 34 | 49 | 25 | 24 | null | null |
aycanirican/jmacro-rpc-examples
|
Main.hs
|
bsd-3-clause
|
jsScript f = script (primHtml f) ! [thetype "text/javascript"]
| 62 |
jsScript f = script (primHtml f) ! [thetype "text/javascript"]
| 62 |
jsScript f = script (primHtml f) ! [thetype "text/javascript"]
| 62 | false | false | 0 | 8 | 8 | 28 | 13 | 15 | null | null |
batterseapower/supercompilation-by-evaluation
|
Utilities.hs
|
bsd-3-clause
|
fmapSet :: (Ord a, Ord b) => (a -> b) -> S.Set a -> S.Set b
fmapSet f = S.fromList . map f . S.toList
| 101 |
fmapSet :: (Ord a, Ord b) => (a -> b) -> S.Set a -> S.Set b
fmapSet f = S.fromList . map f . S.toList
| 101 |
fmapSet f = S.fromList . map f . S.toList
| 41 | false | true | 0 | 9 | 24 | 69 | 34 | 35 | null | null |
TransformingMusicology/libaudioDB-haskell
|
src/Sound/Audio/Database/Query.hs
|
gpl-3.0
|
transformSequencePerTrackQuery :: (ADBDatum -> ADBDatum) -- query features
-> FeatureRate
-> FrameSize
-> (Int -> Int) -- number of tracks
-> (Seconds -> Seconds) -- sequence start
-> (Seconds -> Seconds) -- sequence length
-> (Maybe [DistanceFlag] -> Maybe [DistanceFlag])
-> (Maybe Double -> Maybe Double) -- absolute power threshold)
-> ADBQueryResultsPtr
-> QueryAllocator
-> ADBQuerySpecPtr
-> IO ()
transformSequencePerTrackQuery tDatum secToFrames framesToSec tResultLen tSqStart tSqLen tDist tAbsThrsh resPtr fromAlloc = newAlloc
where
newAlloc toPtr = withDetachedQueryPtr fromAlloc $ \fromPtr -> do
q <- peek fromPtr
let datumPtr = (queryid_datum . query_spec_qid) q
datum <- peek datumPtr
let datum' = tDatum datum
resultLen = tResultLen $ (query_parameters_ntracks . query_spec_params) q
sqStart = (withSeconds secToFrames framesToSec tSqStart ((queryid_sequence_start . query_spec_qid) q))
sqLen = (withSeconds secToFrames framesToSec tSqLen ((queryid_sequence_length . query_spec_qid) q))
dist = tDist $ Just $ (query_parameters_distance . query_spec_params) q
absThrsh = tAbsThrsh $ Just $ (query_refine_absolute_threshold . query_spec_refine) q
putStrLn "transformSequencePerTrackQuery calling mkSequencePerTrackQuery"
mkSequencePerTrackQuery datum' secToFrames resultLen (framesToSec sqStart) (framesToSec sqLen) dist absThrsh toPtr
| 1,887 |
transformSequencePerTrackQuery :: (ADBDatum -> ADBDatum) -- query features
-> FeatureRate
-> FrameSize
-> (Int -> Int) -- number of tracks
-> (Seconds -> Seconds) -- sequence start
-> (Seconds -> Seconds) -- sequence length
-> (Maybe [DistanceFlag] -> Maybe [DistanceFlag])
-> (Maybe Double -> Maybe Double) -- absolute power threshold)
-> ADBQueryResultsPtr
-> QueryAllocator
-> ADBQuerySpecPtr
-> IO ()
transformSequencePerTrackQuery tDatum secToFrames framesToSec tResultLen tSqStart tSqLen tDist tAbsThrsh resPtr fromAlloc = newAlloc
where
newAlloc toPtr = withDetachedQueryPtr fromAlloc $ \fromPtr -> do
q <- peek fromPtr
let datumPtr = (queryid_datum . query_spec_qid) q
datum <- peek datumPtr
let datum' = tDatum datum
resultLen = tResultLen $ (query_parameters_ntracks . query_spec_params) q
sqStart = (withSeconds secToFrames framesToSec tSqStart ((queryid_sequence_start . query_spec_qid) q))
sqLen = (withSeconds secToFrames framesToSec tSqLen ((queryid_sequence_length . query_spec_qid) q))
dist = tDist $ Just $ (query_parameters_distance . query_spec_params) q
absThrsh = tAbsThrsh $ Just $ (query_refine_absolute_threshold . query_spec_refine) q
putStrLn "transformSequencePerTrackQuery calling mkSequencePerTrackQuery"
mkSequencePerTrackQuery datum' secToFrames resultLen (framesToSec sqStart) (framesToSec sqLen) dist absThrsh toPtr
| 1,887 |
transformSequencePerTrackQuery tDatum secToFrames framesToSec tResultLen tSqStart tSqLen tDist tAbsThrsh resPtr fromAlloc = newAlloc
where
newAlloc toPtr = withDetachedQueryPtr fromAlloc $ \fromPtr -> do
q <- peek fromPtr
let datumPtr = (queryid_datum . query_spec_qid) q
datum <- peek datumPtr
let datum' = tDatum datum
resultLen = tResultLen $ (query_parameters_ntracks . query_spec_params) q
sqStart = (withSeconds secToFrames framesToSec tSqStart ((queryid_sequence_start . query_spec_qid) q))
sqLen = (withSeconds secToFrames framesToSec tSqLen ((queryid_sequence_length . query_spec_qid) q))
dist = tDist $ Just $ (query_parameters_distance . query_spec_params) q
absThrsh = tAbsThrsh $ Just $ (query_refine_absolute_threshold . query_spec_refine) q
putStrLn "transformSequencePerTrackQuery calling mkSequencePerTrackQuery"
mkSequencePerTrackQuery datum' secToFrames resultLen (framesToSec sqStart) (framesToSec sqLen) dist absThrsh toPtr
| 1,058 | false | true | 0 | 17 | 702 | 382 | 193 | 189 | null | null |
acowley/ghc
|
compiler/types/TypeRep.hs
|
bsd-3-clause
|
tidyType env (AppTy fun arg) = (AppTy $! (tidyType env fun)) $! (tidyType env arg)
| 87 |
tidyType env (AppTy fun arg) = (AppTy $! (tidyType env fun)) $! (tidyType env arg)
| 87 |
tidyType env (AppTy fun arg) = (AppTy $! (tidyType env fun)) $! (tidyType env arg)
| 87 | false | false | 0 | 9 | 19 | 46 | 23 | 23 | null | null |
thoferon/seakale
|
tests/SpecHelpers.hs
|
bsd-3-clause
|
post1 :: Post
post1 = Post "Seakale 101" "Seakale is a Haskell library"
| 71 |
post1 :: Post
post1 = Post "Seakale 101" "Seakale is a Haskell library"
| 71 |
post1 = Post "Seakale 101" "Seakale is a Haskell library"
| 57 | false | true | 0 | 5 | 12 | 16 | 8 | 8 | null | null |
naoto-ogawa/h-xproto-mysql
|
src/DataBase/MySQLX/Model.hs
|
mit
|
-- | Session State Chagend Frame Type
frame_session_state_changed :: W.Word32
frame_session_state_changed = 3
| 110 |
frame_session_state_changed :: W.Word32
frame_session_state_changed = 3
| 71 |
frame_session_state_changed = 3
| 31 | true | true | 0 | 5 | 13 | 14 | 8 | 6 | null | null |
MaxDaten/yage-rendering
|
src/Yage/Rendering/Textures/TextureImage.hs
|
mit
|
pixelDataType :: forall pixel. (Pixel pixel, HasGLType (PixelBaseComponent pixel)) => GLTexture pixel -> GL.DataType
pixelDataType _ = glType ( error "pixelDataType: invalid access" :: PixelBaseComponent pixel)
| 210 |
pixelDataType :: forall pixel. (Pixel pixel, HasGLType (PixelBaseComponent pixel)) => GLTexture pixel -> GL.DataType
pixelDataType _ = glType ( error "pixelDataType: invalid access" :: PixelBaseComponent pixel)
| 210 |
pixelDataType _ = glType ( error "pixelDataType: invalid access" :: PixelBaseComponent pixel)
| 93 | false | true | 0 | 9 | 25 | 64 | 32 | 32 | null | null |
elfeck/elfeckcom
|
src/Web/BetterMdParser.hs
|
mit
|
isEquals _ = False
| 18 |
isEquals _ = False
| 18 |
isEquals _ = False
| 18 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
bacchanalia/KitchenSink
|
KitchenSink/Combinators.hs
|
gpl-3.0
|
-- | Just a value given a condition or Nothing
(?) :: Bool -> a -> Maybe a
b ? x = if b then Just x else Nothing
| 112 |
(?) :: Bool -> a -> Maybe a
b ? x = if b then Just x else Nothing
| 65 |
b ? x = if b then Just x else Nothing
| 37 | true | true | 0 | 9 | 28 | 42 | 22 | 20 | null | null |
bradclawsie/haskell-Finance.Quote.Yahoo
|
quotes.hs
|
bsd-3-clause
|
main = do
q <- getQuote quoteSymbolList quoteFieldsList
case q of
Nothing -> error "no map"
Just m -> case (Data.Map.lookup ("YHOO","l1") m) of
Nothing -> print "no match"
Just a -> print a
let startDate = Data.Time.Calendar.fromGregorian 2013 07 01
let endDate = Data.Time.Calendar.fromGregorian 2013 08 01
h <- getHistoricalQuote (head quoteSymbolList) startDate endDate Monthly
case h of
Nothing -> error "no historical"
Just l -> sequence $ Prelude.map print l
return ()
| 543 |
main = do
q <- getQuote quoteSymbolList quoteFieldsList
case q of
Nothing -> error "no map"
Just m -> case (Data.Map.lookup ("YHOO","l1") m) of
Nothing -> print "no match"
Just a -> print a
let startDate = Data.Time.Calendar.fromGregorian 2013 07 01
let endDate = Data.Time.Calendar.fromGregorian 2013 08 01
h <- getHistoricalQuote (head quoteSymbolList) startDate endDate Monthly
case h of
Nothing -> error "no historical"
Just l -> sequence $ Prelude.map print l
return ()
| 543 |
main = do
q <- getQuote quoteSymbolList quoteFieldsList
case q of
Nothing -> error "no map"
Just m -> case (Data.Map.lookup ("YHOO","l1") m) of
Nothing -> print "no match"
Just a -> print a
let startDate = Data.Time.Calendar.fromGregorian 2013 07 01
let endDate = Data.Time.Calendar.fromGregorian 2013 08 01
h <- getHistoricalQuote (head quoteSymbolList) startDate endDate Monthly
case h of
Nothing -> error "no historical"
Just l -> sequence $ Prelude.map print l
return ()
| 543 | false | false | 1 | 14 | 142 | 195 | 89 | 106 | null | null |
factisresearch/dockercook
|
src/lib/Cook/Docker/API.hs
|
mit
|
optionsFromEnv :: IO (Options, String)
optionsFromEnv =
do (urlScheme, host, opts) <-
do host <- getEnv "DOCKER_HOST"
tls <- fromMaybe "0" <$> lookupEnv "DOCKER_TLS_VERIFY"
(urlScheme, opts) <-
case tls of
"1" ->
let hostname =
maybe "localhost" uriRegName $ uriAuthority =<< parseURI host
in ("https", ) <$> tlsDockerOpts hostname
_ -> return ("http", defaults)
return (urlScheme, host, opts)
let urlPrefix =
T.replace "tcp://" (urlScheme <> "://" ) (T.pack host) <> "/v1.19/"
return (opts, T.unpack urlPrefix)
| 735 |
optionsFromEnv :: IO (Options, String)
optionsFromEnv =
do (urlScheme, host, opts) <-
do host <- getEnv "DOCKER_HOST"
tls <- fromMaybe "0" <$> lookupEnv "DOCKER_TLS_VERIFY"
(urlScheme, opts) <-
case tls of
"1" ->
let hostname =
maybe "localhost" uriRegName $ uriAuthority =<< parseURI host
in ("https", ) <$> tlsDockerOpts hostname
_ -> return ("http", defaults)
return (urlScheme, host, opts)
let urlPrefix =
T.replace "tcp://" (urlScheme <> "://" ) (T.pack host) <> "/v1.19/"
return (opts, T.unpack urlPrefix)
| 735 |
optionsFromEnv =
do (urlScheme, host, opts) <-
do host <- getEnv "DOCKER_HOST"
tls <- fromMaybe "0" <$> lookupEnv "DOCKER_TLS_VERIFY"
(urlScheme, opts) <-
case tls of
"1" ->
let hostname =
maybe "localhost" uriRegName $ uriAuthority =<< parseURI host
in ("https", ) <$> tlsDockerOpts hostname
_ -> return ("http", defaults)
return (urlScheme, host, opts)
let urlPrefix =
T.replace "tcp://" (urlScheme <> "://" ) (T.pack host) <> "/v1.19/"
return (opts, T.unpack urlPrefix)
| 696 | false | true | 2 | 21 | 298 | 206 | 103 | 103 | null | null |
schell/germs
|
src/Moore.hs
|
mit
|
stepMoore :: Moore -> Germ -> Moore
stepMoore m [] = m
| 54 |
stepMoore :: Moore -> Germ -> Moore
stepMoore m [] = m
| 54 |
stepMoore m [] = m
| 18 | false | true | 0 | 6 | 11 | 26 | 13 | 13 | null | null |
LambdaHack/LambdaHack
|
engine-src/Game/LambdaHack/Client/UI/SessionUI.hs
|
bsd-3-clause
|
cycleMarkVision :: Int -> SessionUI -> SessionUI
cycleMarkVision delta sess =
sess {smarkVision = (smarkVision sess + delta) `mod` 3}
| 135 |
cycleMarkVision :: Int -> SessionUI -> SessionUI
cycleMarkVision delta sess =
sess {smarkVision = (smarkVision sess + delta) `mod` 3}
| 135 |
cycleMarkVision delta sess =
sess {smarkVision = (smarkVision sess + delta) `mod` 3}
| 86 | false | true | 0 | 11 | 21 | 57 | 28 | 29 | null | null |
HJvT/GeBoP
|
GUI.hs
|
bsd-3-clause
|
nameplayer 2 = "green"
| 22 |
nameplayer 2 = "green"
| 22 |
nameplayer 2 = "green"
| 22 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
danidiaz/lens
|
tests/templates.hs
|
bsd-3-clause
|
checkR2length :: Getter Rank2Tests ([a] -> Int)
checkR2length = r2length
| 72 |
checkR2length :: Getter Rank2Tests ([a] -> Int)
checkR2length = r2length
| 72 |
checkR2length = r2length
| 24 | false | true | 0 | 8 | 9 | 26 | 14 | 12 | null | null |
anton-dessiatov/stack
|
test/integration/IntegrationSpec.hs
|
bsd-3-clause
|
hasTest :: FilePath -> FilePath -> IO Bool
hasTest root dir = doesFileExist $ root </> dir </> "Main.hs"
| 104 |
hasTest :: FilePath -> FilePath -> IO Bool
hasTest root dir = doesFileExist $ root </> dir </> "Main.hs"
| 104 |
hasTest root dir = doesFileExist $ root </> dir </> "Main.hs"
| 61 | false | true | 0 | 7 | 18 | 39 | 19 | 20 | null | null |
lapets/compilation
|
Control/Compilation.hs
|
mit
|
get :: StateExtension a => Compilation a a
get = Compilation $ \(State e) -> (State e, e)
| 89 |
get :: StateExtension a => Compilation a a
get = Compilation $ \(State e) -> (State e, e)
| 89 |
get = Compilation $ \(State e) -> (State e, e)
| 46 | false | true | 2 | 8 | 17 | 54 | 25 | 29 | null | null |
ezyang/ghc
|
compiler/codeGen/StgCmmPrim.hs
|
bsd-3-clause
|
callishOp DoubleAcosOp = Just MO_F64_Acos
| 43 |
callishOp DoubleAcosOp = Just MO_F64_Acos
| 43 |
callishOp DoubleAcosOp = Just MO_F64_Acos
| 43 | false | false | 1 | 5 | 6 | 15 | 5 | 10 | null | null |
fjarri/wigner
|
src/Wigner/Symbols.hs
|
bsd-3-clause
|
symbol = Symbol
| 15 |
symbol = Symbol
| 15 |
symbol = Symbol
| 15 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
vladfi1/game-ai
|
connect4/Main.hs
|
mit
|
players X = humanPlayer
| 23 |
players X = humanPlayer
| 23 |
players X = humanPlayer
| 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
hvr/jhc
|
regress/tests/1_typecheck/4_fail/ghc/tcfail087.hs
|
mit
|
f :: (# Int,Int #) -> Int
f x = error "urk"
| 43 |
f :: (# Int,Int #) -> Int
f x = error "urk"
| 43 |
f x = error "urk"
| 17 | false | true | 0 | 7 | 11 | 31 | 14 | 17 | null | null |
todays-mitsui/lambda2ski
|
src/CLI.hs
|
mit
|
loadContext (Just filepath) = do
eitherContext <- parse context "" <$> BS.readFile filepath
case eitherContext of
Left parseError -> do putStrLn . show $ parseError
return emptyContext
Right context -> return context
| 268 |
loadContext (Just filepath) = do
eitherContext <- parse context "" <$> BS.readFile filepath
case eitherContext of
Left parseError -> do putStrLn . show $ parseError
return emptyContext
Right context -> return context
| 268 |
loadContext (Just filepath) = do
eitherContext <- parse context "" <$> BS.readFile filepath
case eitherContext of
Left parseError -> do putStrLn . show $ parseError
return emptyContext
Right context -> return context
| 268 | false | false | 0 | 13 | 83 | 81 | 35 | 46 | null | null |
elieux/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
toRationalName = varQual gHC_REAL (fsLit "toRational") toRationalClassOpKey
| 82 |
toRationalName = varQual gHC_REAL (fsLit "toRational") toRationalClassOpKey
| 82 |
toRationalName = varQual gHC_REAL (fsLit "toRational") toRationalClassOpKey
| 82 | false | false | 0 | 7 | 13 | 19 | 9 | 10 | null | null |
phaazon/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
|
bsd-3-clause
|
gl_ACTIVE_ATTRIBUTE_MAX_LENGTH :: GLenum
gl_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A
| 80 |
gl_ACTIVE_ATTRIBUTE_MAX_LENGTH :: GLenum
gl_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A
| 80 |
gl_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A
| 39 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
bgamari/text
|
tests/Tests/Properties.hs
|
bsd-2-clause
|
shiftR_Int = shiftR :: Int -> Property
| 41 |
shiftR_Int = shiftR :: Int -> Property
| 41 |
shiftR_Int = shiftR :: Int -> Property
| 41 | false | false | 0 | 5 | 9 | 13 | 7 | 6 | null | null |
nushio3/ghc
|
utils/genprimopcode/Main.hs
|
bsd-3-clause
|
gen_switch_from_attribs :: String -> String -> Info -> String
gen_switch_from_attribs attrib_name fn_name (Info defaults entries)
= let defv = lookup_attrib attrib_name defaults
alternatives = catMaybes (map mkAlt (filter is_primop entries))
getAltRhs (OptionFalse _) = "False"
getAltRhs (OptionTrue _) = "True"
getAltRhs (OptionInteger _ i) = show i
getAltRhs (OptionString _ s) = s
getAltRhs (OptionVector _) = "True"
getAltRhs (OptionFixity mf) = show mf
mkAlt po
= case lookup_attrib attrib_name (opts po) of
Nothing -> Nothing
Just xx -> case vecOptions po of
[] -> Just (fn_name ++ " " ++ cons po ++ " = " ++ getAltRhs xx)
_ -> Just (fn_name ++ " (" ++ cons po ++ " _ _ _) = " ++ getAltRhs xx)
in
case defv of
Nothing -> error ("gen_switch_from: " ++ attrib_name)
Just xx
-> unlines alternatives
++ fn_name ++ " _ = " ++ getAltRhs xx ++ "\n"
------------------------------------------------------------------
-- Create PrimOpInfo text from PrimOpSpecs -----------------------
------------------------------------------------------------------
| 1,313 |
gen_switch_from_attribs :: String -> String -> Info -> String
gen_switch_from_attribs attrib_name fn_name (Info defaults entries)
= let defv = lookup_attrib attrib_name defaults
alternatives = catMaybes (map mkAlt (filter is_primop entries))
getAltRhs (OptionFalse _) = "False"
getAltRhs (OptionTrue _) = "True"
getAltRhs (OptionInteger _ i) = show i
getAltRhs (OptionString _ s) = s
getAltRhs (OptionVector _) = "True"
getAltRhs (OptionFixity mf) = show mf
mkAlt po
= case lookup_attrib attrib_name (opts po) of
Nothing -> Nothing
Just xx -> case vecOptions po of
[] -> Just (fn_name ++ " " ++ cons po ++ " = " ++ getAltRhs xx)
_ -> Just (fn_name ++ " (" ++ cons po ++ " _ _ _) = " ++ getAltRhs xx)
in
case defv of
Nothing -> error ("gen_switch_from: " ++ attrib_name)
Just xx
-> unlines alternatives
++ fn_name ++ " _ = " ++ getAltRhs xx ++ "\n"
------------------------------------------------------------------
-- Create PrimOpInfo text from PrimOpSpecs -----------------------
------------------------------------------------------------------
| 1,313 |
gen_switch_from_attribs attrib_name fn_name (Info defaults entries)
= let defv = lookup_attrib attrib_name defaults
alternatives = catMaybes (map mkAlt (filter is_primop entries))
getAltRhs (OptionFalse _) = "False"
getAltRhs (OptionTrue _) = "True"
getAltRhs (OptionInteger _ i) = show i
getAltRhs (OptionString _ s) = s
getAltRhs (OptionVector _) = "True"
getAltRhs (OptionFixity mf) = show mf
mkAlt po
= case lookup_attrib attrib_name (opts po) of
Nothing -> Nothing
Just xx -> case vecOptions po of
[] -> Just (fn_name ++ " " ++ cons po ++ " = " ++ getAltRhs xx)
_ -> Just (fn_name ++ " (" ++ cons po ++ " _ _ _) = " ++ getAltRhs xx)
in
case defv of
Nothing -> error ("gen_switch_from: " ++ attrib_name)
Just xx
-> unlines alternatives
++ fn_name ++ " _ = " ++ getAltRhs xx ++ "\n"
------------------------------------------------------------------
-- Create PrimOpInfo text from PrimOpSpecs -----------------------
------------------------------------------------------------------
| 1,251 | false | true | 0 | 20 | 421 | 341 | 165 | 176 | null | null |
ksaveljev/hake-2
|
src/Client/CLTEnt.hs
|
bsd-3-clause
|
parseBeam :: IORef ModelT -> Quake Int
parseBeam modelRef = do
ent <- MSG.readShort (globals.gNetMessage)
start <- MSG.readPos (globals.gNetMessage)
end <- MSG.readPos (globals.gNetMessage)
ok <- updateBeam ent start end 0 Constants.maxBeams
unless ok $
Com.printf "beam list overflow!\n"
return ent
where updateBeam :: Int -> V3 Float -> V3 Float -> Int -> Int -> Quake Bool
updateBeam ent start end idx maxIdx
| idx >= maxIdx = findFreeBeam ent start end 0 Constants.maxBeams
| otherwise = do
Just beam <- preuse $ clTEntGlobals.clteBeams.ix idx
if (beam^.bEntity) == ent
then do
time <- use $ globals.gCl.csTime
zoom (clTEntGlobals.clteBeams.ix idx) $ do
bEntity .= ent
bModel .= Just modelRef
bEndTime .= time + 200
bStart .= start
bEnd .= end
bOffset .= V3 0 0 0
return True
else
updateBeam ent start end (idx + 1) maxIdx
findFreeBeam :: Int -> V3 Float -> V3 Float -> Int -> Int -> Quake Bool
findFreeBeam ent start end idx maxIdx
| idx >= maxIdx = return False
| otherwise = do
Just beam <- preuse $ clTEntGlobals.clteBeams.ix idx
time <- use $ globals.gCl.csTime
if isNothing (beam^.bModel) || (beam^.bEndTime) < time
then do
zoom (clTEntGlobals.clteBeams.ix idx) $ do
bEntity .= ent
bModel .= Just modelRef
bEndTime .= time + 200
bStart .= start
bEnd .= end
bOffset .= V3 0 0 0
return True
else
findFreeBeam ent start end (idx + 1) maxIdx
| 1,959 |
parseBeam :: IORef ModelT -> Quake Int
parseBeam modelRef = do
ent <- MSG.readShort (globals.gNetMessage)
start <- MSG.readPos (globals.gNetMessage)
end <- MSG.readPos (globals.gNetMessage)
ok <- updateBeam ent start end 0 Constants.maxBeams
unless ok $
Com.printf "beam list overflow!\n"
return ent
where updateBeam :: Int -> V3 Float -> V3 Float -> Int -> Int -> Quake Bool
updateBeam ent start end idx maxIdx
| idx >= maxIdx = findFreeBeam ent start end 0 Constants.maxBeams
| otherwise = do
Just beam <- preuse $ clTEntGlobals.clteBeams.ix idx
if (beam^.bEntity) == ent
then do
time <- use $ globals.gCl.csTime
zoom (clTEntGlobals.clteBeams.ix idx) $ do
bEntity .= ent
bModel .= Just modelRef
bEndTime .= time + 200
bStart .= start
bEnd .= end
bOffset .= V3 0 0 0
return True
else
updateBeam ent start end (idx + 1) maxIdx
findFreeBeam :: Int -> V3 Float -> V3 Float -> Int -> Int -> Quake Bool
findFreeBeam ent start end idx maxIdx
| idx >= maxIdx = return False
| otherwise = do
Just beam <- preuse $ clTEntGlobals.clteBeams.ix idx
time <- use $ globals.gCl.csTime
if isNothing (beam^.bModel) || (beam^.bEndTime) < time
then do
zoom (clTEntGlobals.clteBeams.ix idx) $ do
bEntity .= ent
bModel .= Just modelRef
bEndTime .= time + 200
bStart .= start
bEnd .= end
bOffset .= V3 0 0 0
return True
else
findFreeBeam ent start end (idx + 1) maxIdx
| 1,959 |
parseBeam modelRef = do
ent <- MSG.readShort (globals.gNetMessage)
start <- MSG.readPos (globals.gNetMessage)
end <- MSG.readPos (globals.gNetMessage)
ok <- updateBeam ent start end 0 Constants.maxBeams
unless ok $
Com.printf "beam list overflow!\n"
return ent
where updateBeam :: Int -> V3 Float -> V3 Float -> Int -> Int -> Quake Bool
updateBeam ent start end idx maxIdx
| idx >= maxIdx = findFreeBeam ent start end 0 Constants.maxBeams
| otherwise = do
Just beam <- preuse $ clTEntGlobals.clteBeams.ix idx
if (beam^.bEntity) == ent
then do
time <- use $ globals.gCl.csTime
zoom (clTEntGlobals.clteBeams.ix idx) $ do
bEntity .= ent
bModel .= Just modelRef
bEndTime .= time + 200
bStart .= start
bEnd .= end
bOffset .= V3 0 0 0
return True
else
updateBeam ent start end (idx + 1) maxIdx
findFreeBeam :: Int -> V3 Float -> V3 Float -> Int -> Int -> Quake Bool
findFreeBeam ent start end idx maxIdx
| idx >= maxIdx = return False
| otherwise = do
Just beam <- preuse $ clTEntGlobals.clteBeams.ix idx
time <- use $ globals.gCl.csTime
if isNothing (beam^.bModel) || (beam^.bEndTime) < time
then do
zoom (clTEntGlobals.clteBeams.ix idx) $ do
bEntity .= ent
bModel .= Just modelRef
bEndTime .= time + 200
bStart .= start
bEnd .= end
bOffset .= V3 0 0 0
return True
else
findFreeBeam ent start end (idx + 1) maxIdx
| 1,920 | false | true | 2 | 16 | 841 | 603 | 276 | 327 | null | null |
AlexanderPankiv/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
defaultFlags :: Settings -> [GeneralFlag]
defaultFlags settings
-- See Note [Updating flag description in the User's Guide]
= [ Opt_AutoLinkPackages,
Opt_EmbedManifest,
Opt_FlatCache,
Opt_GenManifest,
Opt_GhciHistory,
Opt_GhciSandbox,
Opt_HelpfulErrors,
Opt_OmitYields,
Opt_PrintBindContents,
Opt_ProfCountEntries,
Opt_RPath,
Opt_SharedImplib,
Opt_SimplPreInlining
]
++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]
-- The default -O0 options
++ default_PIC platform
++ (if pc_DYNAMIC_BY_DEFAULT (sPlatformConstants settings)
then wayGeneralFlags platform WayDyn
else [Opt_Static])
-- Opt_Static needs to be set if and only if WayDyn is not used (#7478)
where platform = sTargetPlatform settings
| 827 |
defaultFlags :: Settings -> [GeneralFlag]
defaultFlags settings
-- See Note [Updating flag description in the User's Guide]
= [ Opt_AutoLinkPackages,
Opt_EmbedManifest,
Opt_FlatCache,
Opt_GenManifest,
Opt_GhciHistory,
Opt_GhciSandbox,
Opt_HelpfulErrors,
Opt_OmitYields,
Opt_PrintBindContents,
Opt_ProfCountEntries,
Opt_RPath,
Opt_SharedImplib,
Opt_SimplPreInlining
]
++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]
-- The default -O0 options
++ default_PIC platform
++ (if pc_DYNAMIC_BY_DEFAULT (sPlatformConstants settings)
then wayGeneralFlags platform WayDyn
else [Opt_Static])
-- Opt_Static needs to be set if and only if WayDyn is not used (#7478)
where platform = sTargetPlatform settings
| 827 |
defaultFlags settings
-- See Note [Updating flag description in the User's Guide]
= [ Opt_AutoLinkPackages,
Opt_EmbedManifest,
Opt_FlatCache,
Opt_GenManifest,
Opt_GhciHistory,
Opt_GhciSandbox,
Opt_HelpfulErrors,
Opt_OmitYields,
Opt_PrintBindContents,
Opt_ProfCountEntries,
Opt_RPath,
Opt_SharedImplib,
Opt_SimplPreInlining
]
++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]
-- The default -O0 options
++ default_PIC platform
++ (if pc_DYNAMIC_BY_DEFAULT (sPlatformConstants settings)
then wayGeneralFlags platform WayDyn
else [Opt_Static])
-- Opt_Static needs to be set if and only if WayDyn is not used (#7478)
where platform = sTargetPlatform settings
| 785 | false | true | 6 | 9 | 215 | 147 | 83 | 64 | null | null |
Pochoir/Pochoir
|
src/PShow.hs
|
gpl-3.0
|
pShowRawForHeader :: [PName] -> String
pShowRawForHeader [] = ""
| 64 |
pShowRawForHeader :: [PName] -> String
pShowRawForHeader [] = ""
| 64 |
pShowRawForHeader [] = ""
| 25 | false | true | 0 | 8 | 8 | 29 | 13 | 16 | null | null |
nevrenato/Hets_Fork
|
DFOL/Comorphism.hs
|
gpl-2.0
|
senTransl sig (Implication f g) =
makeImplication (senTransl sig f) (senTransl sig g)
| 87 |
senTransl sig (Implication f g) =
makeImplication (senTransl sig f) (senTransl sig g)
| 87 |
senTransl sig (Implication f g) =
makeImplication (senTransl sig f) (senTransl sig g)
| 87 | false | false | 0 | 7 | 14 | 40 | 19 | 21 | null | null |
demhydraz/ligand
|
src/Compiler.hs
|
mit
|
incindent :: Compiler
incindent
= modify $ \(CompilerState x y z) -> CompilerState (x + 1) y z
| 96 |
incindent :: Compiler
incindent
= modify $ \(CompilerState x y z) -> CompilerState (x + 1) y z
| 96 |
incindent
= modify $ \(CompilerState x y z) -> CompilerState (x + 1) y z
| 74 | false | true | 2 | 8 | 19 | 51 | 24 | 27 | null | null |
ajdunlap/yesod-markdown
|
Yesod/Markdown.hs
|
bsd-3-clause
|
-- | A set of default Pandoc reader options good for Yesod websites /where the data input is trusted/. Disables
-- HTML sanitization and enables smart parsing and raw HTML parsing.
yesodDefaultParserStateTrusted :: ParserState
yesodDefaultParserStateTrusted = yesodDefaultParserState { stateSanitizeHTML = False }
| 313 |
yesodDefaultParserStateTrusted :: ParserState
yesodDefaultParserStateTrusted = yesodDefaultParserState { stateSanitizeHTML = False }
| 132 |
yesodDefaultParserStateTrusted = yesodDefaultParserState { stateSanitizeHTML = False }
| 86 | true | true | 0 | 6 | 41 | 21 | 13 | 8 | null | null |
teleshoes/taffybar
|
src/System/Taffybar/Information/StreamInfo.hs
|
bsd-3-clause
|
probe :: (Num a, RealFrac b) => IO [a] -> b -> IO [a]
probe action delay = do
a <- action
threadDelay $ round (delay * 1e6)
b <- action
return $ zipWith (-) b a
-- | Execute the given action once and return the difference between the
-- obtained sample and the one contained in the given IORef.
| 311 |
probe :: (Num a, RealFrac b) => IO [a] -> b -> IO [a]
probe action delay = do
a <- action
threadDelay $ round (delay * 1e6)
b <- action
return $ zipWith (-) b a
-- | Execute the given action once and return the difference between the
-- obtained sample and the one contained in the given IORef.
| 311 |
probe action delay = do
a <- action
threadDelay $ round (delay * 1e6)
b <- action
return $ zipWith (-) b a
-- | Execute the given action once and return the difference between the
-- obtained sample and the one contained in the given IORef.
| 257 | false | true | 0 | 10 | 77 | 100 | 50 | 50 | null | null |
jacekszymanski/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
-- lay out toolbar at the bottom of the window
wxTB_BOTTOM :: Int
wxTB_BOTTOM = 0x2000
| 100 |
wxTB_BOTTOM :: Int
wxTB_BOTTOM = 0x2000
| 53 |
wxTB_BOTTOM = 0x2000
| 27 | true | true | 0 | 4 | 29 | 12 | 7 | 5 | null | null |
hypermania/QuantumComputer
|
Parser.hs
|
gpl-2.0
|
double :: ReadP Double
double = read <$> (doubForm +++ parenth doubForm)
where doubForm = (noDec <++> string "." <++> digits) <++ noDec
noDec = option "" (string "-") <++> digits
| 188 |
double :: ReadP Double
double = read <$> (doubForm +++ parenth doubForm)
where doubForm = (noDec <++> string "." <++> digits) <++ noDec
noDec = option "" (string "-") <++> digits
| 188 |
double = read <$> (doubForm +++ parenth doubForm)
where doubForm = (noDec <++> string "." <++> digits) <++ noDec
noDec = option "" (string "-") <++> digits
| 165 | false | true | 1 | 10 | 40 | 75 | 37 | 38 | null | null |
phadej/denotational-frp
|
example/Main.hs
|
mit
|
main :: IO ()
main = do
zipExample s1 s2
mergeExample s1 s2
fairExample s1 s2
where s1 = toEvents [(0, 'a'), (6, 'b'), (21, 'c')]
s2 = toEvents [(2, '1'), (4, '2'), (6, '3')]
{-
a.....b..............c.......
..1.2.3......................
-}
| 257 |
main :: IO ()
main = do
zipExample s1 s2
mergeExample s1 s2
fairExample s1 s2
where s1 = toEvents [(0, 'a'), (6, 'b'), (21, 'c')]
s2 = toEvents [(2, '1'), (4, '2'), (6, '3')]
{-
a.....b..............c.......
..1.2.3......................
-}
| 257 |
main = do
zipExample s1 s2
mergeExample s1 s2
fairExample s1 s2
where s1 = toEvents [(0, 'a'), (6, 'b'), (21, 'c')]
s2 = toEvents [(2, '1'), (4, '2'), (6, '3')]
{-
a.....b..............c.......
..1.2.3......................
-}
| 243 | false | true | 1 | 7 | 55 | 114 | 63 | 51 | null | null |
julienschmaltz/madl
|
examples/Examples/MergeBlock.hs
|
mit
|
-- | Network mergeblock: Contains a merge and a switch directly behind it. Is deadlockfree, but could easily be mistaken for having a deadlock.
mergeBlock :: MadlNetwork
mergeBlock = mkNetwork (NSpec components channels ports) where
src0 = PatientSource "src0" nul
src1 = Source "src1" req
merge = Merge "merge"
switch = Switch "switch" [isReq, isRsp]
sink0 = Sink "sink0"
sink1 = DeadSink "sink1"
src0_merge = "src0_merge"
src1_merge = "src1_merge"
merge_switch = "merge_switch"
switch_sink0 = "switch_sink0"
switch_sink1 = "switch_sink1"
src0_o = ("src0", "src0_merge")
src1_o = ("src1", "src1_merge")
merge_a = ("src0_merge", "merge")
merge_b = ("src1_merge", "merge")
merge_o = ("merge", "merge_switch")
switch_i = ("merge_switch", "switch")
switch_a = ("switch", "switch_sink0")
switch_b = ("switch", "switch_sink1")
sink0_i = ("switch_sink0", "sink0")
sink1_i = ("switch_sink1", "sink1")
components = map C [src0, src1, merge, switch, sink0, sink1]
channels = map Channel [src0_merge, src1_merge, merge_switch, switch_sink0, switch_sink1]
ports :: [(Text, Text)]
ports = [src0_o, src1_o, merge_a, merge_b, merge_o, switch_i, switch_a, switch_b, sink0_i, sink1_i]
| 1,271 |
mergeBlock :: MadlNetwork
mergeBlock = mkNetwork (NSpec components channels ports) where
src0 = PatientSource "src0" nul
src1 = Source "src1" req
merge = Merge "merge"
switch = Switch "switch" [isReq, isRsp]
sink0 = Sink "sink0"
sink1 = DeadSink "sink1"
src0_merge = "src0_merge"
src1_merge = "src1_merge"
merge_switch = "merge_switch"
switch_sink0 = "switch_sink0"
switch_sink1 = "switch_sink1"
src0_o = ("src0", "src0_merge")
src1_o = ("src1", "src1_merge")
merge_a = ("src0_merge", "merge")
merge_b = ("src1_merge", "merge")
merge_o = ("merge", "merge_switch")
switch_i = ("merge_switch", "switch")
switch_a = ("switch", "switch_sink0")
switch_b = ("switch", "switch_sink1")
sink0_i = ("switch_sink0", "sink0")
sink1_i = ("switch_sink1", "sink1")
components = map C [src0, src1, merge, switch, sink0, sink1]
channels = map Channel [src0_merge, src1_merge, merge_switch, switch_sink0, switch_sink1]
ports :: [(Text, Text)]
ports = [src0_o, src1_o, merge_a, merge_b, merge_o, switch_i, switch_a, switch_b, sink0_i, sink1_i]
| 1,127 |
mergeBlock = mkNetwork (NSpec components channels ports) where
src0 = PatientSource "src0" nul
src1 = Source "src1" req
merge = Merge "merge"
switch = Switch "switch" [isReq, isRsp]
sink0 = Sink "sink0"
sink1 = DeadSink "sink1"
src0_merge = "src0_merge"
src1_merge = "src1_merge"
merge_switch = "merge_switch"
switch_sink0 = "switch_sink0"
switch_sink1 = "switch_sink1"
src0_o = ("src0", "src0_merge")
src1_o = ("src1", "src1_merge")
merge_a = ("src0_merge", "merge")
merge_b = ("src1_merge", "merge")
merge_o = ("merge", "merge_switch")
switch_i = ("merge_switch", "switch")
switch_a = ("switch", "switch_sink0")
switch_b = ("switch", "switch_sink1")
sink0_i = ("switch_sink0", "sink0")
sink1_i = ("switch_sink1", "sink1")
components = map C [src0, src1, merge, switch, sink0, sink1]
channels = map Channel [src0_merge, src1_merge, merge_switch, switch_sink0, switch_sink1]
ports :: [(Text, Text)]
ports = [src0_o, src1_o, merge_a, merge_b, merge_o, switch_i, switch_a, switch_b, sink0_i, sink1_i]
| 1,101 | true | true | 23 | 8 | 255 | 412 | 196 | 216 | null | null |
tomahawkins/cil
|
Language/CIL/Parse.hs
|
bsd-3-clause
|
cFunDef :: CFunDef -> Stmt
cFunDef (CFunDef specs (CDeclr (Just (Ident name _ _)) (CFunDeclr (Right (args', False)) [] _ : rest) Nothing [] _) [] stat n) = FunctionDef name (foldr cDerivedDeclr (cDeclSpec specs) rest) args (cStat stat) (posOf n)
where
args :: [(Name, Type)]
args = [ (name, cDeclType decl) | decl@(CDecl _ [(Just (CDeclr (Just (Ident name _ _)) _ Nothing [] _), Nothing, Nothing)] _) <- args' ]
| 417 |
cFunDef :: CFunDef -> Stmt
cFunDef (CFunDef specs (CDeclr (Just (Ident name _ _)) (CFunDeclr (Right (args', False)) [] _ : rest) Nothing [] _) [] stat n) = FunctionDef name (foldr cDerivedDeclr (cDeclSpec specs) rest) args (cStat stat) (posOf n)
where
args :: [(Name, Type)]
args = [ (name, cDeclType decl) | decl@(CDecl _ [(Just (CDeclr (Just (Ident name _ _)) _ Nothing [] _), Nothing, Nothing)] _) <- args' ]
| 417 |
cFunDef (CFunDef specs (CDeclr (Just (Ident name _ _)) (CFunDeclr (Right (args', False)) [] _ : rest) Nothing [] _) [] stat n) = FunctionDef name (foldr cDerivedDeclr (cDeclSpec specs) rest) args (cStat stat) (posOf n)
where
args :: [(Name, Type)]
args = [ (name, cDeclType decl) | decl@(CDecl _ [(Just (CDeclr (Just (Ident name _ _)) _ Nothing [] _), Nothing, Nothing)] _) <- args' ]
| 390 | false | true | 0 | 19 | 77 | 235 | 123 | 112 | null | null |
tjakway/blackjack-simulator
|
src/Jakway/Blackjack/IO/Action.hs
|
mit
|
--collapse all of the individual transacPerformMatchIO calls into one huge IO (Either String Integer)
collapseMatches :: (IConnection a) =>
Integer ->
--state parameters
Conf.Config ->
a ->
IO (Either String Integer)
collapseMatches matches_per_transaction conf conn = do
let (Conf.Config beVerbose dealerAI playerAIs numGames tableNames _) = conf
perTransactionConf = conf { Conf.numGames = matches_per_transaction }
--get the statements and the RNG
(insHandStatement, insMatchStatement) <- getStatements conn tableNames
initialGen <- getStdGen
(resGen, matchesRes) <- foldr (\_ ioRes -> ioRes >>= (\(mutatedGen, res) ->
case res of (Left _) -> return (mutatedGen, res)
(Right ngames) -> transacPerformMatchIO perTransactionConf initialGen insHandStatement insMatchStatement conn)) (return (initialGen, Right 0)) [1..(numGames `div` matches_per_transaction)]
--run a separate transaction with the remaining games
let numRemainderGames = numGames `mod` matches_per_transaction
remainderConf = conf { Conf.numGames = numRemainderGames }
if numRemainderGames > 0 then case matchesRes of (Left s) -> return . Left $ s
(Right ng) -> transacPerformMatchIO remainderConf resGen insHandStatement insMatchStatement conn >>= (\(_, eitherTransacRes) -> return $ eitherTransacRes >>= (\remainderNumGames -> Right $ ng + remainderNumGames))
else return matchesRes
--get the hand and match insert statements
where getStatements c names = insertHandStatement c names >>=
(\ihs -> insertMatchStatement c names >>=
(\ims -> return (ihs, ims)))
transacPerformMatchIO :: (IConnection a, RandomGen g) =>
--state parameters
Conf.Config ->
g ->
--IO parameters
Statement ->
Statement ->
a ->
IO (g, Either String Integer)
--commit before starting the transaction so we don't rollback
--farther than we wanted
transacPerformMatchIO conf gen insHandStatement insMatchStatement conn = commit conn >> trans
where trans = withTransaction conn (\transacConn -> performMatchIO conf gen insHandStatement insMatchStatement transacConn)
-- |The public interface to recursivePerformMatch
performMatchIO :: (IConnection a, RandomGen g) =>
--state parameters
Conf.Config ->
g ->
--IO parameters
Statement ->
Statement ->
a ->
IO (g, Either String Integer)
performMatchIO = recursivePerformMatch 0
recursivePerformMatch :: (IConnection a, RandomGen g) =>
--state parameters
Integer ->
Conf.Config ->
g ->
--IO parameters
Statement ->
Statement ->
a ->
IO (g, Either String Integer)
recursivePerformMatch numGames conf gen insHandStatement insMatchStatement conn =
let maxGames = Conf.numGames conf
nextRNG = snd . split $ gen
in performMatch numGames conf gen insHandStatement insMatchStatement conn >>= (\res ->
case res of (Right newNumGames) -> if (newNumGames < maxGames) then recursivePerformMatch (newNumGames) conf nextRNG insHandStatement insMatchStatement conn else return (nextRNG, Right newNumGames)
Left _ -> return (nextRNG, res))
-- |Returns an IO action that yields either a string describing an error or
-- the number of games written
-- the generator passed by RandomGen is reused so that this function ought
-- to be deterministic (i.e. it does not get a new generator from IO)
--
-- + pass 0 for numGames when calling this function externally
performMatch :: (IConnection a, RandomGen g) =>
--state parameters
Integer ->
Conf.Config ->
g ->
--IO parameters
Statement ->
Statement ->
a ->
IO (Either String Integer)
performMatch numGames conf gen insHandStatement insMatchStatement conn =
let dealerAI = Conf.whichDealer conf
playerAIs = Conf.playerAIs conf
tableNames = Conf.tableNames conf
--if e == Left it short circuits and we stop updating the total
--number of games
deck = infiniteShuffledDeck gen
maybeMatch = evalGame dealerAI playerAIs deck
in case maybeMatch of Nothing -> return $ Left (matchFailedMessage numGames)
Just (justMatch) -> do
insRes <- insertMatch insHandStatement insMatchStatement conn tableNames justMatch
--recurse with left to short
--circuit
if (insRes < 0) then return (Left $ insertFailedMessage numGames)
else return (Right $ numGames + 1)
where matchFailedMessage num = "Match number " ++ (show num) ++ "failed!"
insertFailedMessage res = "Error inserting match, database returned: " ++ (show res)
| 5,592 |
collapseMatches :: (IConnection a) =>
Integer ->
--state parameters
Conf.Config ->
a ->
IO (Either String Integer)
collapseMatches matches_per_transaction conf conn = do
let (Conf.Config beVerbose dealerAI playerAIs numGames tableNames _) = conf
perTransactionConf = conf { Conf.numGames = matches_per_transaction }
--get the statements and the RNG
(insHandStatement, insMatchStatement) <- getStatements conn tableNames
initialGen <- getStdGen
(resGen, matchesRes) <- foldr (\_ ioRes -> ioRes >>= (\(mutatedGen, res) ->
case res of (Left _) -> return (mutatedGen, res)
(Right ngames) -> transacPerformMatchIO perTransactionConf initialGen insHandStatement insMatchStatement conn)) (return (initialGen, Right 0)) [1..(numGames `div` matches_per_transaction)]
--run a separate transaction with the remaining games
let numRemainderGames = numGames `mod` matches_per_transaction
remainderConf = conf { Conf.numGames = numRemainderGames }
if numRemainderGames > 0 then case matchesRes of (Left s) -> return . Left $ s
(Right ng) -> transacPerformMatchIO remainderConf resGen insHandStatement insMatchStatement conn >>= (\(_, eitherTransacRes) -> return $ eitherTransacRes >>= (\remainderNumGames -> Right $ ng + remainderNumGames))
else return matchesRes
--get the hand and match insert statements
where getStatements c names = insertHandStatement c names >>=
(\ihs -> insertMatchStatement c names >>=
(\ims -> return (ihs, ims)))
transacPerformMatchIO :: (IConnection a, RandomGen g) =>
--state parameters
Conf.Config ->
g ->
--IO parameters
Statement ->
Statement ->
a ->
IO (g, Either String Integer)
--commit before starting the transaction so we don't rollback
--farther than we wanted
transacPerformMatchIO conf gen insHandStatement insMatchStatement conn = commit conn >> trans
where trans = withTransaction conn (\transacConn -> performMatchIO conf gen insHandStatement insMatchStatement transacConn)
-- |The public interface to recursivePerformMatch
performMatchIO :: (IConnection a, RandomGen g) =>
--state parameters
Conf.Config ->
g ->
--IO parameters
Statement ->
Statement ->
a ->
IO (g, Either String Integer)
performMatchIO = recursivePerformMatch 0
recursivePerformMatch :: (IConnection a, RandomGen g) =>
--state parameters
Integer ->
Conf.Config ->
g ->
--IO parameters
Statement ->
Statement ->
a ->
IO (g, Either String Integer)
recursivePerformMatch numGames conf gen insHandStatement insMatchStatement conn =
let maxGames = Conf.numGames conf
nextRNG = snd . split $ gen
in performMatch numGames conf gen insHandStatement insMatchStatement conn >>= (\res ->
case res of (Right newNumGames) -> if (newNumGames < maxGames) then recursivePerformMatch (newNumGames) conf nextRNG insHandStatement insMatchStatement conn else return (nextRNG, Right newNumGames)
Left _ -> return (nextRNG, res))
-- |Returns an IO action that yields either a string describing an error or
-- the number of games written
-- the generator passed by RandomGen is reused so that this function ought
-- to be deterministic (i.e. it does not get a new generator from IO)
--
-- + pass 0 for numGames when calling this function externally
performMatch :: (IConnection a, RandomGen g) =>
--state parameters
Integer ->
Conf.Config ->
g ->
--IO parameters
Statement ->
Statement ->
a ->
IO (Either String Integer)
performMatch numGames conf gen insHandStatement insMatchStatement conn =
let dealerAI = Conf.whichDealer conf
playerAIs = Conf.playerAIs conf
tableNames = Conf.tableNames conf
--if e == Left it short circuits and we stop updating the total
--number of games
deck = infiniteShuffledDeck gen
maybeMatch = evalGame dealerAI playerAIs deck
in case maybeMatch of Nothing -> return $ Left (matchFailedMessage numGames)
Just (justMatch) -> do
insRes <- insertMatch insHandStatement insMatchStatement conn tableNames justMatch
--recurse with left to short
--circuit
if (insRes < 0) then return (Left $ insertFailedMessage numGames)
else return (Right $ numGames + 1)
where matchFailedMessage num = "Match number " ++ (show num) ++ "failed!"
insertFailedMessage res = "Error inserting match, database returned: " ++ (show res)
| 5,490 |
collapseMatches matches_per_transaction conf conn = do
let (Conf.Config beVerbose dealerAI playerAIs numGames tableNames _) = conf
perTransactionConf = conf { Conf.numGames = matches_per_transaction }
--get the statements and the RNG
(insHandStatement, insMatchStatement) <- getStatements conn tableNames
initialGen <- getStdGen
(resGen, matchesRes) <- foldr (\_ ioRes -> ioRes >>= (\(mutatedGen, res) ->
case res of (Left _) -> return (mutatedGen, res)
(Right ngames) -> transacPerformMatchIO perTransactionConf initialGen insHandStatement insMatchStatement conn)) (return (initialGen, Right 0)) [1..(numGames `div` matches_per_transaction)]
--run a separate transaction with the remaining games
let numRemainderGames = numGames `mod` matches_per_transaction
remainderConf = conf { Conf.numGames = numRemainderGames }
if numRemainderGames > 0 then case matchesRes of (Left s) -> return . Left $ s
(Right ng) -> transacPerformMatchIO remainderConf resGen insHandStatement insMatchStatement conn >>= (\(_, eitherTransacRes) -> return $ eitherTransacRes >>= (\remainderNumGames -> Right $ ng + remainderNumGames))
else return matchesRes
--get the hand and match insert statements
where getStatements c names = insertHandStatement c names >>=
(\ihs -> insertMatchStatement c names >>=
(\ims -> return (ihs, ims)))
transacPerformMatchIO :: (IConnection a, RandomGen g) =>
--state parameters
Conf.Config ->
g ->
--IO parameters
Statement ->
Statement ->
a ->
IO (g, Either String Integer)
--commit before starting the transaction so we don't rollback
--farther than we wanted
transacPerformMatchIO conf gen insHandStatement insMatchStatement conn = commit conn >> trans
where trans = withTransaction conn (\transacConn -> performMatchIO conf gen insHandStatement insMatchStatement transacConn)
-- |The public interface to recursivePerformMatch
performMatchIO :: (IConnection a, RandomGen g) =>
--state parameters
Conf.Config ->
g ->
--IO parameters
Statement ->
Statement ->
a ->
IO (g, Either String Integer)
performMatchIO = recursivePerformMatch 0
recursivePerformMatch :: (IConnection a, RandomGen g) =>
--state parameters
Integer ->
Conf.Config ->
g ->
--IO parameters
Statement ->
Statement ->
a ->
IO (g, Either String Integer)
recursivePerformMatch numGames conf gen insHandStatement insMatchStatement conn =
let maxGames = Conf.numGames conf
nextRNG = snd . split $ gen
in performMatch numGames conf gen insHandStatement insMatchStatement conn >>= (\res ->
case res of (Right newNumGames) -> if (newNumGames < maxGames) then recursivePerformMatch (newNumGames) conf nextRNG insHandStatement insMatchStatement conn else return (nextRNG, Right newNumGames)
Left _ -> return (nextRNG, res))
-- |Returns an IO action that yields either a string describing an error or
-- the number of games written
-- the generator passed by RandomGen is reused so that this function ought
-- to be deterministic (i.e. it does not get a new generator from IO)
--
-- + pass 0 for numGames when calling this function externally
performMatch :: (IConnection a, RandomGen g) =>
--state parameters
Integer ->
Conf.Config ->
g ->
--IO parameters
Statement ->
Statement ->
a ->
IO (Either String Integer)
performMatch numGames conf gen insHandStatement insMatchStatement conn =
let dealerAI = Conf.whichDealer conf
playerAIs = Conf.playerAIs conf
tableNames = Conf.tableNames conf
--if e == Left it short circuits and we stop updating the total
--number of games
deck = infiniteShuffledDeck gen
maybeMatch = evalGame dealerAI playerAIs deck
in case maybeMatch of Nothing -> return $ Left (matchFailedMessage numGames)
Just (justMatch) -> do
insRes <- insertMatch insHandStatement insMatchStatement conn tableNames justMatch
--recurse with left to short
--circuit
if (insRes < 0) then return (Left $ insertFailedMessage numGames)
else return (Right $ numGames + 1)
where matchFailedMessage num = "Match number " ++ (show num) ++ "failed!"
insertFailedMessage res = "Error inserting match, database returned: " ++ (show res)
| 5,315 | true | true | 1 | 19 | 1,964 | 1,120 | 586 | 534 | null | null |
keithodulaigh/Hets
|
OMDoc/Import.hs
|
gpl-2.0
|
{- | We lookup the theory referenced by the cd in the environment
and add it if neccessary to the environment. -}
followTheory :: LibName -> (ImpEnv, DGraph) -> OMCD
-> ResultT IO ((ImpEnv, DGraph), LinkNode)
followTheory ln (e, dg) cd = do
(e', ln', dg', lnode) <- importTheory e (ln, dg) cd
let mLn = if ln == ln' then Nothing else Just ln'
return ((e', dg'), (mLn, lnode))
-- * Development Graph and LibEnv interface
{- | returns a function compatible with mapAccumLM for TCElement processing.
Used in localSig. -}
| 540 |
followTheory :: LibName -> (ImpEnv, DGraph) -> OMCD
-> ResultT IO ((ImpEnv, DGraph), LinkNode)
followTheory ln (e, dg) cd = do
(e', ln', dg', lnode) <- importTheory e (ln, dg) cd
let mLn = if ln == ln' then Nothing else Just ln'
return ((e', dg'), (mLn, lnode))
-- * Development Graph and LibEnv interface
{- | returns a function compatible with mapAccumLM for TCElement processing.
Used in localSig. -}
| 426 |
followTheory ln (e, dg) cd = do
(e', ln', dg', lnode) <- importTheory e (ln, dg) cd
let mLn = if ln == ln' then Nothing else Just ln'
return ((e', dg'), (mLn, lnode))
-- * Development Graph and LibEnv interface
{- | returns a function compatible with mapAccumLM for TCElement processing.
Used in localSig. -}
| 318 | true | true | 0 | 11 | 114 | 142 | 80 | 62 | null | null |
aesadde/AccObsBenchmarks
|
Matrix/haskell/src/MatMulOpt.hs
|
bsd-3-clause
|
transpose :: Pull Word32 (Pull Word32 a) -> Pull Word32 (Pull Word32 a)
transpose arr = mkPull n1 (\i -> mkPull n2 (\j -> (arr ! j) ! i))
where
n2 = len arr
n1 = len (arr ! 0)
| 185 |
transpose :: Pull Word32 (Pull Word32 a) -> Pull Word32 (Pull Word32 a)
transpose arr = mkPull n1 (\i -> mkPull n2 (\j -> (arr ! j) ! i))
where
n2 = len arr
n1 = len (arr ! 0)
| 185 |
transpose arr = mkPull n1 (\i -> mkPull n2 (\j -> (arr ! j) ! i))
where
n2 = len arr
n1 = len (arr ! 0)
| 113 | false | true | 4 | 13 | 49 | 116 | 54 | 62 | null | null |
blasterpal/my_migrate
|
lib/parse.hs
|
mit
|
betweenTicks :: GenParser Char st String
betweenTicks = char '`' >> many (noneOf "`") <* (char '`' >> spaces)
| 109 |
betweenTicks :: GenParser Char st String
betweenTicks = char '`' >> many (noneOf "`") <* (char '`' >> spaces)
| 109 |
betweenTicks = char '`' >> many (noneOf "`") <* (char '`' >> spaces)
| 68 | false | true | 2 | 9 | 18 | 55 | 24 | 31 | null | null |
OS2World/DEV-UTIL-HUGS
|
oldlib/SimpleQueue.hs
|
bsd-3-clause
|
rtail (Q xs []) = Q (L.rtail xs) []
| 35 |
rtail (Q xs []) = Q (L.rtail xs) []
| 35 |
rtail (Q xs []) = Q (L.rtail xs) []
| 35 | false | false | 0 | 8 | 8 | 35 | 16 | 19 | null | null |
sdiehl/ghc
|
compiler/typecheck/TcType.hs
|
bsd-3-clause
|
isIntegerTy = is_tc integerTyConKey
| 38 |
isIntegerTy = is_tc integerTyConKey
| 38 |
isIntegerTy = is_tc integerTyConKey
| 38 | false | false | 1 | 5 | 6 | 13 | 4 | 9 | null | null |
shayan-najd/HsParser
|
Language/Haskell/Utility/FastString.hs
|
gpl-3.0
|
zString :: FastZString -> String
zString (FastZString bs) =
inlinePerformIO $ BS.unsafeUseAsCStringLen bs peekCAStringLen
| 125 |
zString :: FastZString -> String
zString (FastZString bs) =
inlinePerformIO $ BS.unsafeUseAsCStringLen bs peekCAStringLen
| 125 |
zString (FastZString bs) =
inlinePerformIO $ BS.unsafeUseAsCStringLen bs peekCAStringLen
| 92 | false | true | 2 | 9 | 17 | 41 | 18 | 23 | null | null |
k0001/haskell-opaleye
|
Opaleye/Internal/Print.hs
|
bsd-3-clause
|
ppValues :: [[S.SqlExpr]] -> Doc
ppValues v = PP.ppAs "V" (parens (text "VALUES" $$ PP.commaV ppValuesRow v))
| 109 |
ppValues :: [[S.SqlExpr]] -> Doc
ppValues v = PP.ppAs "V" (parens (text "VALUES" $$ PP.commaV ppValuesRow v))
| 109 |
ppValues v = PP.ppAs "V" (parens (text "VALUES" $$ PP.commaV ppValuesRow v))
| 76 | false | true | 0 | 11 | 16 | 56 | 28 | 28 | null | null |
blender/Rome
|
src/Configuration.hs
|
mit
|
getAWSConfigFilePath :: MonadIO m => m FilePath
getAWSConfigFilePath = (</> awsConfigFilePath) `liftM` liftIO getHomeDirectory where awsConfigFilePath = ".aws/config"
| 166 |
getAWSConfigFilePath :: MonadIO m => m FilePath
getAWSConfigFilePath = (</> awsConfigFilePath) `liftM` liftIO getHomeDirectory where awsConfigFilePath = ".aws/config"
| 166 |
getAWSConfigFilePath = (</> awsConfigFilePath) `liftM` liftIO getHomeDirectory where awsConfigFilePath = ".aws/config"
| 118 | false | true | 0 | 6 | 17 | 41 | 22 | 19 | null | null |
shayan-najd/HsParser
|
OutputableInstances.hs
|
gpl-3.0
|
hsPatNeedsParens (ViewPat {}) = True
| 43 |
hsPatNeedsParens (ViewPat {}) = True
| 43 |
hsPatNeedsParens (ViewPat {}) = True
| 43 | false | false | 0 | 6 | 11 | 17 | 8 | 9 | null | null |
karknu/rws
|
src/Packet.hs
|
bsd-3-clause
|
defaultIPv4Packet :: IPv4Pkt
defaultIPv4Packet = IPv4Pkt defaultIPv4 [PPayload defaultPayload]
| 94 |
defaultIPv4Packet :: IPv4Pkt
defaultIPv4Packet = IPv4Pkt defaultIPv4 [PPayload defaultPayload]
| 94 |
defaultIPv4Packet = IPv4Pkt defaultIPv4 [PPayload defaultPayload]
| 65 | false | true | 0 | 7 | 8 | 22 | 11 | 11 | null | null |
hvr/ansi-wl-pprint
|
Text/PrettyPrint/ANSI/Leijen.hs
|
bsd-2-clause
|
plain (Nesting f) = Nesting (plain . f)
| 43 |
plain (Nesting f) = Nesting (plain . f)
| 43 |
plain (Nesting f) = Nesting (plain . f)
| 43 | false | false | 0 | 7 | 11 | 25 | 12 | 13 | null | null |
glguy/GhcPkgUtils
|
Outdated.hs
|
bsd-3-clause
|
defaultCabalDir :: IO FilePath
defaultCabalDir = getAppUserDataDirectory "cabal"
| 80 |
defaultCabalDir :: IO FilePath
defaultCabalDir = getAppUserDataDirectory "cabal"
| 80 |
defaultCabalDir = getAppUserDataDirectory "cabal"
| 49 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
pranjaltale16/codeworld
|
codeworld-server/src/Util.hs
|
apache-2.0
|
projectFileNames :: FilePath -> IO [Text]
projectFileNames dir = do
subHashedDirs <- listDirectoryWithPrefix dir
hashedFiles <- dirFilter subHashedDirs 'S'
projects <- fmap catMaybes $
forM hashedFiles $ \f -> do
exists <- doesFileExist f
if exists
then decode <$> LB.readFile f
else return Nothing
return $ map projectName projects
| 412 |
projectFileNames :: FilePath -> IO [Text]
projectFileNames dir = do
subHashedDirs <- listDirectoryWithPrefix dir
hashedFiles <- dirFilter subHashedDirs 'S'
projects <- fmap catMaybes $
forM hashedFiles $ \f -> do
exists <- doesFileExist f
if exists
then decode <$> LB.readFile f
else return Nothing
return $ map projectName projects
| 412 |
projectFileNames dir = do
subHashedDirs <- listDirectoryWithPrefix dir
hashedFiles <- dirFilter subHashedDirs 'S'
projects <- fmap catMaybes $
forM hashedFiles $ \f -> do
exists <- doesFileExist f
if exists
then decode <$> LB.readFile f
else return Nothing
return $ map projectName projects
| 370 | false | true | 0 | 15 | 128 | 117 | 53 | 64 | null | null |
lindenbaum/mediabus
|
src/Data/MediaBus/Basics/Ticks.hs
|
bsd-3-clause
|
-- | Utility around 'coerceRate' to set the sample rate to 48000 Hz.
coerceRateTo48kHz ::
CoerceRate x y rx (Hz 48000) =>
x ->
y
coerceRateTo48kHz = coerceRate (Proxy :: Proxy (Hz 48000))
| 193 |
coerceRateTo48kHz ::
CoerceRate x y rx (Hz 48000) =>
x ->
y
coerceRateTo48kHz = coerceRate (Proxy :: Proxy (Hz 48000))
| 124 |
coerceRateTo48kHz = coerceRate (Proxy :: Proxy (Hz 48000))
| 58 | true | true | 0 | 9 | 38 | 53 | 27 | 26 | null | null |
rueshyna/gogol
|
gogol-containerbuilder/gen/Network/Google/ContainerBuilder/Types/Product.hs
|
mpl-2.0
|
-- | A developer-facing error message, which should be in English. Any
-- user-facing error message should be localized and sent in the
-- google.rpc.Status.details field, or localized by the client.
sMessage :: Lens' Status (Maybe Text)
sMessage = lens _sMessage (\ s a -> s{_sMessage = a})
| 291 |
sMessage :: Lens' Status (Maybe Text)
sMessage = lens _sMessage (\ s a -> s{_sMessage = a})
| 91 |
sMessage = lens _sMessage (\ s a -> s{_sMessage = a})
| 53 | true | true | 1 | 9 | 47 | 53 | 27 | 26 | null | null |
flowbox-public/language-c-quote
|
Language/C/Quote/Base.hs
|
bsd-3-clause
|
qqConstP :: C.Const -> Maybe (Q Pat)
qqConstP = go
where
go (C.AntiInt v _) =
Just $ (con "C.IntConst") [wildP, signed, antiVarP v, wildP]
go (C.AntiUInt v _) =
Just $ (con "C.IntConst") [wildP, unsigned, antiVarP v, wildP]
go (C.AntiLInt v _) =
Just $ (con "C.LongIntConst") [wildP, signed, antiVarP v, wildP]
go (C.AntiULInt v _) =
Just $ (con "C.LongIntConst") [wildP, unsigned, antiVarP v, wildP]
go (C.AntiFloat v _) =
Just $ (con "C.FloatConst") [wildP, antiVarP v, wildP]
go (C.AntiDouble v _) =
Just $ (con "C.DoubleConst") [wildP, antiVarP v, wildP]
go (C.AntiLongDouble v _) =
Just $ (con "C.LongDoubleConst") [wildP, antiVarP v, wildP]
go (C.AntiChar v _) =
Just $ (con "C.CharConst") [wildP, antiVarP v, wildP]
go (C.AntiString v _) =
Just $ (con "C.StringConst") [wildP, antiVarP v, wildP]
go _ =
Nothing
con n = conP (mkName n)
signed = conP (mkName "C.Signed") []
unsigned = conP (mkName "C.Unsigned") []
| 1,057 |
qqConstP :: C.Const -> Maybe (Q Pat)
qqConstP = go
where
go (C.AntiInt v _) =
Just $ (con "C.IntConst") [wildP, signed, antiVarP v, wildP]
go (C.AntiUInt v _) =
Just $ (con "C.IntConst") [wildP, unsigned, antiVarP v, wildP]
go (C.AntiLInt v _) =
Just $ (con "C.LongIntConst") [wildP, signed, antiVarP v, wildP]
go (C.AntiULInt v _) =
Just $ (con "C.LongIntConst") [wildP, unsigned, antiVarP v, wildP]
go (C.AntiFloat v _) =
Just $ (con "C.FloatConst") [wildP, antiVarP v, wildP]
go (C.AntiDouble v _) =
Just $ (con "C.DoubleConst") [wildP, antiVarP v, wildP]
go (C.AntiLongDouble v _) =
Just $ (con "C.LongDoubleConst") [wildP, antiVarP v, wildP]
go (C.AntiChar v _) =
Just $ (con "C.CharConst") [wildP, antiVarP v, wildP]
go (C.AntiString v _) =
Just $ (con "C.StringConst") [wildP, antiVarP v, wildP]
go _ =
Nothing
con n = conP (mkName n)
signed = conP (mkName "C.Signed") []
unsigned = conP (mkName "C.Unsigned") []
| 1,057 |
qqConstP = go
where
go (C.AntiInt v _) =
Just $ (con "C.IntConst") [wildP, signed, antiVarP v, wildP]
go (C.AntiUInt v _) =
Just $ (con "C.IntConst") [wildP, unsigned, antiVarP v, wildP]
go (C.AntiLInt v _) =
Just $ (con "C.LongIntConst") [wildP, signed, antiVarP v, wildP]
go (C.AntiULInt v _) =
Just $ (con "C.LongIntConst") [wildP, unsigned, antiVarP v, wildP]
go (C.AntiFloat v _) =
Just $ (con "C.FloatConst") [wildP, antiVarP v, wildP]
go (C.AntiDouble v _) =
Just $ (con "C.DoubleConst") [wildP, antiVarP v, wildP]
go (C.AntiLongDouble v _) =
Just $ (con "C.LongDoubleConst") [wildP, antiVarP v, wildP]
go (C.AntiChar v _) =
Just $ (con "C.CharConst") [wildP, antiVarP v, wildP]
go (C.AntiString v _) =
Just $ (con "C.StringConst") [wildP, antiVarP v, wildP]
go _ =
Nothing
con n = conP (mkName n)
signed = conP (mkName "C.Signed") []
unsigned = conP (mkName "C.Unsigned") []
| 1,020 | false | true | 0 | 8 | 291 | 489 | 250 | 239 | null | null |
frontrowed/stratosphere
|
library-gen/Stratosphere/ResourceProperties/AutoScalingScalingPolicyMetricDimension.hs
|
mit
|
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-metricdimension.html#cfn-autoscaling-scalingpolicy-metricdimension-value
asspmdValue :: Lens' AutoScalingScalingPolicyMetricDimension (Val Text)
asspmdValue = lens _autoScalingScalingPolicyMetricDimensionValue (\s a -> s { _autoScalingScalingPolicyMetricDimensionValue = a })
| 383 |
asspmdValue :: Lens' AutoScalingScalingPolicyMetricDimension (Val Text)
asspmdValue = lens _autoScalingScalingPolicyMetricDimensionValue (\s a -> s { _autoScalingScalingPolicyMetricDimensionValue = a })
| 202 |
asspmdValue = lens _autoScalingScalingPolicyMetricDimensionValue (\s a -> s { _autoScalingScalingPolicyMetricDimensionValue = a })
| 130 | true | true | 1 | 9 | 21 | 51 | 25 | 26 | null | null |
vincenthz/cryptonite
|
tests/Utils.hs
|
bsd-3-clause
|
katZero :: Int
katZero = 0
| 26 |
katZero :: Int
katZero = 0
| 26 |
katZero = 0
| 11 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
Heather/Idris-dev
|
src/Idris/Reflection.hs
|
bsd-3-clause
|
rFunArgToPArg (RFunArg n _ RImplicit e) = PImp 0 False (rArgOpts e) n Placeholder
| 81 |
rFunArgToPArg (RFunArg n _ RImplicit e) = PImp 0 False (rArgOpts e) n Placeholder
| 81 |
rFunArgToPArg (RFunArg n _ RImplicit e) = PImp 0 False (rArgOpts e) n Placeholder
| 81 | false | false | 0 | 7 | 13 | 38 | 18 | 20 | null | null |
rueshyna/gogol
|
gogol-admin-directory/gen/Network/Google/Resource/Directory/Customers/Patch.hs
|
mpl-2.0
|
-- | Id of the customer to be updated
cpCustomerKey :: Lens' CustomersPatch Text
cpCustomerKey
= lens _cpCustomerKey
(\ s a -> s{_cpCustomerKey = a})
| 157 |
cpCustomerKey :: Lens' CustomersPatch Text
cpCustomerKey
= lens _cpCustomerKey
(\ s a -> s{_cpCustomerKey = a})
| 119 |
cpCustomerKey
= lens _cpCustomerKey
(\ s a -> s{_cpCustomerKey = a})
| 76 | true | true | 0 | 9 | 32 | 42 | 22 | 20 | null | null |
ml9951/ghc
|
compiler/rename/RnBinds.hs
|
bsd-3-clause
|
-- General version used both from the top-level and for local things
-- Assumes the LHS vars are in scope
--
-- Does not bind the local fixity declarations
rnValBindsRHS :: HsSigCtxt
-> HsValBindsLR Name RdrName
-> RnM (HsValBinds Name, DefUses)
rnValBindsRHS ctxt (ValBindsIn mbinds sigs)
= do { (sigs', sig_fvs) <- renameSigs ctxt sigs
; binds_w_dus <- mapBagM (rnLBind (mkSigTvFn sigs')) mbinds
; case depAnalBinds binds_w_dus of
(anal_binds, anal_dus) -> return (valbind', valbind'_dus)
where
valbind' = ValBindsOut anal_binds sigs'
valbind'_dus = anal_dus `plusDU` usesOnly sig_fvs
-- Put the sig uses *after* the bindings
-- so that the binders are removed from
-- the uses in the sigs
}
| 895 |
rnValBindsRHS :: HsSigCtxt
-> HsValBindsLR Name RdrName
-> RnM (HsValBinds Name, DefUses)
rnValBindsRHS ctxt (ValBindsIn mbinds sigs)
= do { (sigs', sig_fvs) <- renameSigs ctxt sigs
; binds_w_dus <- mapBagM (rnLBind (mkSigTvFn sigs')) mbinds
; case depAnalBinds binds_w_dus of
(anal_binds, anal_dus) -> return (valbind', valbind'_dus)
where
valbind' = ValBindsOut anal_binds sigs'
valbind'_dus = anal_dus `plusDU` usesOnly sig_fvs
-- Put the sig uses *after* the bindings
-- so that the binders are removed from
-- the uses in the sigs
}
| 738 |
rnValBindsRHS ctxt (ValBindsIn mbinds sigs)
= do { (sigs', sig_fvs) <- renameSigs ctxt sigs
; binds_w_dus <- mapBagM (rnLBind (mkSigTvFn sigs')) mbinds
; case depAnalBinds binds_w_dus of
(anal_binds, anal_dus) -> return (valbind', valbind'_dus)
where
valbind' = ValBindsOut anal_binds sigs'
valbind'_dus = anal_dus `plusDU` usesOnly sig_fvs
-- Put the sig uses *after* the bindings
-- so that the binders are removed from
-- the uses in the sigs
}
| 620 | true | true | 0 | 13 | 310 | 159 | 85 | 74 | null | null |
keera-studios/hsQt
|
Qtc/Gui/QWidget.hs
|
bsd-2-clause
|
isFullScreen :: QWidget a -> (()) -> IO (Bool)
isFullScreen x0 ()
= withBoolResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QWidget_isFullScreen cobj_x0
| 158 |
isFullScreen :: QWidget a -> (()) -> IO (Bool)
isFullScreen x0 ()
= withBoolResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QWidget_isFullScreen cobj_x0
| 158 |
isFullScreen x0 ()
= withBoolResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QWidget_isFullScreen cobj_x0
| 111 | false | true | 0 | 9 | 31 | 63 | 30 | 33 | null | null |
nomicflux/threals
|
src/Threal/Comps.hs
|
gpl-2.0
|
compSig x y = [[compRedGreen x y, compGreenBlue x y, compBlueRed x y, compRedGreen y x, compGreenBlue y x, compBlueRed y x],
[fullCompRedGreen x y, fullCompGreenBlue x y, fullCompBlueRed x y, fullCompRedGreen y x, fullCompGreenBlue y x, fullCompBlueRed y x]]
| 273 |
compSig x y = [[compRedGreen x y, compGreenBlue x y, compBlueRed x y, compRedGreen y x, compGreenBlue y x, compBlueRed y x],
[fullCompRedGreen x y, fullCompGreenBlue x y, fullCompBlueRed x y, fullCompRedGreen y x, fullCompGreenBlue y x, fullCompBlueRed y x]]
| 273 |
compSig x y = [[compRedGreen x y, compGreenBlue x y, compBlueRed x y, compRedGreen y x, compGreenBlue y x, compBlueRed y x],
[fullCompRedGreen x y, fullCompGreenBlue x y, fullCompBlueRed x y, fullCompRedGreen y x, fullCompGreenBlue y x, fullCompBlueRed y x]]
| 273 | false | false | 0 | 7 | 54 | 113 | 57 | 56 | null | null |
patperry/permutation
|
lib/Data/Permute.hs
|
bsd-3-clause
|
-- | Get the inverse of a permutation.
inverse :: Permute -> Permute
inverse p = runST $
unsafeFreeze =<< getInverse =<< unsafeThaw p
| 138 |
inverse :: Permute -> Permute
inverse p = runST $
unsafeFreeze =<< getInverse =<< unsafeThaw p
| 99 |
inverse p = runST $
unsafeFreeze =<< getInverse =<< unsafeThaw p
| 69 | true | true | 0 | 7 | 28 | 34 | 17 | 17 | null | null |
Spheniscida/symmath
|
Symmath/Derivate.hs
|
mit
|
----------
deriv :: Var -> SymTerm -> SymTerm
deriv _ (Number _) = Number 0
| 78 |
deriv :: Var -> SymTerm -> SymTerm
deriv _ (Number _) = Number 0
| 66 |
deriv _ (Number _) = Number 0
| 31 | true | true | 0 | 7 | 17 | 34 | 17 | 17 | null | null |
rahulmutt/ghcvm
|
compiler/Eta/DeSugar/DsGRHSs.hs
|
bsd-3-clause
|
matchGuards (BodyStmt expr _ _ _ : stmts) ctx rhs rhs_ty = do
match_result <- matchGuards stmts ctx rhs rhs_ty
pred_expr <- dsLExpr expr
return (mkGuardedMatchResult pred_expr match_result)
| 201 |
matchGuards (BodyStmt expr _ _ _ : stmts) ctx rhs rhs_ty = do
match_result <- matchGuards stmts ctx rhs rhs_ty
pred_expr <- dsLExpr expr
return (mkGuardedMatchResult pred_expr match_result)
| 201 |
matchGuards (BodyStmt expr _ _ _ : stmts) ctx rhs rhs_ty = do
match_result <- matchGuards stmts ctx rhs rhs_ty
pred_expr <- dsLExpr expr
return (mkGuardedMatchResult pred_expr match_result)
| 201 | false | false | 0 | 9 | 39 | 71 | 32 | 39 | null | null |
arnizamani/aiw
|
Instances.hs
|
gpl-2.0
|
matchExpExp (Binary (OVar op1) p1 p2) (Binary op2 e1 e2) = matchExpExp p1 e1 && matchExpExp p2 e2
| 97 |
matchExpExp (Binary (OVar op1) p1 p2) (Binary op2 e1 e2) = matchExpExp p1 e1 && matchExpExp p2 e2
| 97 |
matchExpExp (Binary (OVar op1) p1 p2) (Binary op2 e1 e2) = matchExpExp p1 e1 && matchExpExp p2 e2
| 97 | false | false | 0 | 8 | 17 | 53 | 24 | 29 | null | null |
ekmett/ixset
|
src/Data/IxSet/Usage.hs
|
bsd-3-clause
|
s7 = union s6 s4
| 16 |
s7 = union s6 s4
| 16 |
s7 = union s6 s4
| 16 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
danr/hipspec
|
src/HipSpec/Heuristics/CallGraph.hs
|
gpl-3.0
|
-- | Calculate the call graph for the QuickSpec string marshallings
transitiveCallGraph :: ResolveMap -> Map Symbol [Symbol]
transitiveCallGraph (ResolveMap si _) = M.fromList
[ (s,mapMaybe (`M.lookup` ism) (varSetElems (transCalls Without i)))
| (i,s) <- is
]
where
is :: [(Id,Symbol)]
is = [ (i,s) | (s,i) <- M.toList si, not (isDataConId i) ]
ism :: Map Id Symbol
ism = M.fromList is
| 417 |
transitiveCallGraph :: ResolveMap -> Map Symbol [Symbol]
transitiveCallGraph (ResolveMap si _) = M.fromList
[ (s,mapMaybe (`M.lookup` ism) (varSetElems (transCalls Without i)))
| (i,s) <- is
]
where
is :: [(Id,Symbol)]
is = [ (i,s) | (s,i) <- M.toList si, not (isDataConId i) ]
ism :: Map Id Symbol
ism = M.fromList is
| 349 |
transitiveCallGraph (ResolveMap si _) = M.fromList
[ (s,mapMaybe (`M.lookup` ism) (varSetElems (transCalls Without i)))
| (i,s) <- is
]
where
is :: [(Id,Symbol)]
is = [ (i,s) | (s,i) <- M.toList si, not (isDataConId i) ]
ism :: Map Id Symbol
ism = M.fromList is
| 292 | true | true | 0 | 11 | 93 | 173 | 94 | 79 | null | null |
shepheb/go10c
|
Compiler.hs
|
bsd-3-clause
|
mapExpressions f (StmtExpr x : rest) = StmtExpr (f x) : mapExpressions f rest
| 77 |
mapExpressions f (StmtExpr x : rest) = StmtExpr (f x) : mapExpressions f rest
| 77 |
mapExpressions f (StmtExpr x : rest) = StmtExpr (f x) : mapExpressions f rest
| 77 | false | false | 0 | 8 | 13 | 39 | 18 | 21 | null | null |
rdnetto/persistent
|
persistent/Database/Persist/Quasi.hs
|
mit
|
empty [Spaces _] = True
| 23 |
empty [Spaces _] = True
| 23 |
empty [Spaces _] = True
| 23 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
emwap/feldspar-language
|
src/Feldspar/Range.hs
|
bsd-3-clause
|
-- | Accurate range propagation through 'xor' for unsigned types
rangeXorUnsignedAccurate :: BoundedInt a => Range a -> Range a -> Range a
rangeXorUnsignedAccurate (Range a b) (Range c d) =
range (minXorUnsigned a b c d) (maxXorUnsigned a b c d)
| 249 |
rangeXorUnsignedAccurate :: BoundedInt a => Range a -> Range a -> Range a
rangeXorUnsignedAccurate (Range a b) (Range c d) =
range (minXorUnsigned a b c d) (maxXorUnsigned a b c d)
| 184 |
rangeXorUnsignedAccurate (Range a b) (Range c d) =
range (minXorUnsigned a b c d) (maxXorUnsigned a b c d)
| 110 | true | true | 0 | 8 | 45 | 86 | 41 | 45 | null | null |
ekmett/ermine
|
src/Ermine/Interpreter.hs
|
bsd-2-clause
|
allocPrimOp :: (Functor m, PrimMonad m) => (MachineState m -> m ()) -> m (Address m)
allocPrimOp f = Address <$> newMutVar (PrimClosure f)
| 138 |
allocPrimOp :: (Functor m, PrimMonad m) => (MachineState m -> m ()) -> m (Address m)
allocPrimOp f = Address <$> newMutVar (PrimClosure f)
| 138 |
allocPrimOp f = Address <$> newMutVar (PrimClosure f)
| 53 | false | true | 0 | 11 | 23 | 74 | 35 | 39 | null | null |
ku-fpg/blank-canvas
|
wiki-suite/Bounce.hs
|
bsd-3-clause
|
epoch :: [Ball ()]
epoch = []
| 29 |
epoch :: [Ball ()]
epoch = []
| 29 |
epoch = []
| 10 | false | true | 0 | 7 | 6 | 21 | 11 | 10 | null | null |
elos/hs
|
app/SensorAgent.hs
|
bsd-3-clause
|
showSensorEvent :: SensorEvent -> String
showSensorEvent event = concat [ time event, ","
, show . light $ event, ","
, show . sound $ event, "\n"
]
| 241 |
showSensorEvent :: SensorEvent -> String
showSensorEvent event = concat [ time event, ","
, show . light $ event, ","
, show . sound $ event, "\n"
]
| 241 |
showSensorEvent event = concat [ time event, ","
, show . light $ event, ","
, show . sound $ event, "\n"
]
| 200 | false | true | 0 | 8 | 120 | 63 | 32 | 31 | null | null |
mitochon/hoosalind
|
src/problems/corr.hs
|
mit
|
-- | takes a reverse complement of a sequence
revCompl :: [Dna.Base] -> [Dna.Base]
revCompl = reverse . (map Dna.compl)
| 119 |
revCompl :: [Dna.Base] -> [Dna.Base]
revCompl = reverse . (map Dna.compl)
| 73 |
revCompl = reverse . (map Dna.compl)
| 36 | true | true | 0 | 8 | 19 | 38 | 21 | 17 | null | null |
google/cabal2bazel
|
bzl/tests/version_macros/VersionTest.hs
|
apache-2.0
|
main = do
guard versionBase
guard dependencyVersionMet
guard dependencyVersionTooLow
guard (VERSION_dependency == "1.2.3")
| 138 |
main = do
guard versionBase
guard dependencyVersionMet
guard dependencyVersionTooLow
guard (VERSION_dependency == "1.2.3")
| 138 |
main = do
guard versionBase
guard dependencyVersionMet
guard dependencyVersionTooLow
guard (VERSION_dependency == "1.2.3")
| 138 | false | false | 0 | 9 | 28 | 37 | 15 | 22 | null | null |
haskell-opengl/OpenGLRaw
|
src/Graphics/GL/ExtensionPredicates.hs
|
bsd-3-clause
|
-- | Is the <https://www.opengl.org/registry/specs/ARB/draw_instanced.txt ARB_draw_instanced> extension supported?
glGetARBDrawInstanced :: MonadIO m => m Bool
glGetARBDrawInstanced = getExtensions >>= (return . member "GL_ARB_draw_instanced")
| 243 |
glGetARBDrawInstanced :: MonadIO m => m Bool
glGetARBDrawInstanced = getExtensions >>= (return . member "GL_ARB_draw_instanced")
| 128 |
glGetARBDrawInstanced = getExtensions >>= (return . member "GL_ARB_draw_instanced")
| 83 | true | true | 0 | 8 | 22 | 36 | 18 | 18 | null | null |
lukexi/ghc
|
compiler/nativeGen/X86/Ppr.hs
|
bsd-3-clause
|
-- x86_64 only
pprInstr (MUL size op1 op2) = pprSizeOpOp (sLit "mul") size op1 op2
| 82 |
pprInstr (MUL size op1 op2) = pprSizeOpOp (sLit "mul") size op1 op2
| 67 |
pprInstr (MUL size op1 op2) = pprSizeOpOp (sLit "mul") size op1 op2
| 67 | true | false | 0 | 7 | 14 | 35 | 17 | 18 | null | null |
mcmaniac/ghc
|
compiler/nativeGen/RegAlloc/Liveness.hs
|
bsd-3-clause
|
livenessBack liveregs blockmap acc (instr : instrs)
= let (liveregs', instr') = liveness1 liveregs blockmap instr
in livenessBack liveregs' blockmap (instr' : acc) instrs
| 181 |
livenessBack liveregs blockmap acc (instr : instrs)
= let (liveregs', instr') = liveness1 liveregs blockmap instr
in livenessBack liveregs' blockmap (instr' : acc) instrs
| 181 |
livenessBack liveregs blockmap acc (instr : instrs)
= let (liveregs', instr') = liveness1 liveregs blockmap instr
in livenessBack liveregs' blockmap (instr' : acc) instrs
| 181 | false | false | 0 | 9 | 34 | 63 | 31 | 32 | null | null |
ComputationWithBoundedResources/ara-inference
|
doc/tpdb_trs/Haskell/basic_haskell/compare_6.hs
|
mit
|
primCmpInt (Neg x) (Neg y) = primCmpNat y x
| 43 |
primCmpInt (Neg x) (Neg y) = primCmpNat y x
| 43 |
primCmpInt (Neg x) (Neg y) = primCmpNat y x
| 43 | false | false | 0 | 7 | 8 | 28 | 13 | 15 | null | null |
brendanhay/gogol
|
gogol-containeranalysis/gen/Network/Google/Resource/ContainerAnalysis/Projects/Occurrences/GetNotes.hs
|
mpl-2.0
|
-- | Required. The name of the occurrence in the form of
-- \`projects\/[PROJECT_ID]\/occurrences\/[OCCURRENCE_ID]\`.
pognName :: Lens' ProjectsOccurrencesGetNotes Text
pognName = lens _pognName (\ s a -> s{_pognName = a})
| 222 |
pognName :: Lens' ProjectsOccurrencesGetNotes Text
pognName = lens _pognName (\ s a -> s{_pognName = a})
| 104 |
pognName = lens _pognName (\ s a -> s{_pognName = a})
| 53 | true | true | 1 | 9 | 29 | 46 | 23 | 23 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.