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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bennofs/cabal2nix | src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs | bsd-3-clause | libNixName "gio-2.0" = return "glib" | 63 | libNixName "gio-2.0" = return "glib" | 63 | libNixName "gio-2.0" = return "glib" | 63 | false | false | 0 | 5 | 31 | 13 | 5 | 8 | null | null |
li-zhirui/JSAnalyzer | JSEntity.hs | mit | showParamters :: [String] -> String
showParamters = surroundCalate id "," "(" ")" | 81 | showParamters :: [String] -> String
showParamters = surroundCalate id "," "(" ")" | 81 | showParamters = surroundCalate id "," "(" ")" | 45 | false | true | 0 | 7 | 11 | 36 | 15 | 21 | null | null |
DougBurke/swish | src/Swish/RDF/Formatter/N3.hs | lgpl-2.1 | emptyN3FS :: NamespaceMap -> NodeGenState -> N3FormatterState
emptyN3FS pmap ngs = N3FS
{ indent = "\n"
, lineBreak = False
, graph = emptyRDFGraph
, subjs = []
, props = []
, objs = []
, formAvail = emptyFormulaMap
, formQueue = []
, prefixes = pmap
, nodeGenSt = ngs
, bNodesCheck = []
, traceBuf = []
} | 381 | emptyN3FS :: NamespaceMap -> NodeGenState -> N3FormatterState
emptyN3FS pmap ngs = N3FS
{ indent = "\n"
, lineBreak = False
, graph = emptyRDFGraph
, subjs = []
, props = []
, objs = []
, formAvail = emptyFormulaMap
, formQueue = []
, prefixes = pmap
, nodeGenSt = ngs
, bNodesCheck = []
, traceBuf = []
} | 381 | emptyN3FS pmap ngs = N3FS
{ indent = "\n"
, lineBreak = False
, graph = emptyRDFGraph
, subjs = []
, props = []
, objs = []
, formAvail = emptyFormulaMap
, formQueue = []
, prefixes = pmap
, nodeGenSt = ngs
, bNodesCheck = []
, traceBuf = []
} | 319 | false | true | 0 | 8 | 136 | 114 | 68 | 46 | null | null |
isomorphism/webgl | src/Graphics/Rendering/WebGL/Constants.hs | mit | gl_SAMPLER_CUBE_SHADOW :: GLenum
gl_SAMPLER_CUBE_SHADOW = 0x8DC5 | 64 | gl_SAMPLER_CUBE_SHADOW :: GLenum
gl_SAMPLER_CUBE_SHADOW = 0x8DC5 | 64 | gl_SAMPLER_CUBE_SHADOW = 0x8DC5 | 31 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
cordawyn/rdf4h | testsuite/tests/W3C/Manifest.hs | bsd-3-clause | mkTestXMLEval :: Triples -> TestEntry
mkTestXMLEval ts = TestXMLEval {
name = lnodeText $ objectByPredicate mfName ts,
comment = lnodeText $ objectByPredicate rdfsComment ts,
-- FIXME: incorrect namespace "rdfs:approval" in rdf-mt/manifest.ttl
-- approval = objectByPredicate rdftApproval ts,
approval = objectByPredicate rdfsApproval ts,
action = objectByPredicate mfAction ts,
result = objectByPredicate mfResult ts
} | 585 | mkTestXMLEval :: Triples -> TestEntry
mkTestXMLEval ts = TestXMLEval {
name = lnodeText $ objectByPredicate mfName ts,
comment = lnodeText $ objectByPredicate rdfsComment ts,
-- FIXME: incorrect namespace "rdfs:approval" in rdf-mt/manifest.ttl
-- approval = objectByPredicate rdftApproval ts,
approval = objectByPredicate rdfsApproval ts,
action = objectByPredicate mfAction ts,
result = objectByPredicate mfResult ts
} | 585 | mkTestXMLEval ts = TestXMLEval {
name = lnodeText $ objectByPredicate mfName ts,
comment = lnodeText $ objectByPredicate rdfsComment ts,
-- FIXME: incorrect namespace "rdfs:approval" in rdf-mt/manifest.ttl
-- approval = objectByPredicate rdftApproval ts,
approval = objectByPredicate rdfsApproval ts,
action = objectByPredicate mfAction ts,
result = objectByPredicate mfResult ts
} | 547 | false | true | 0 | 9 | 218 | 89 | 47 | 42 | null | null |
ivarnymoen/nanomsg-haskell | benchmarks/Zmq.hs | mit | nThr :: Int -> Int -> String -> String -> IO ()
nThr size count bindString connString = do
s1 <- N.socket N.Pair
_ <- N.bind s1 bindString
s2 <- N.socket N.Pair
_ <- N.connect s2 connString
let msg = C.pack $ replicate size 'a'
replicateM_ count (replicateM_ 100 (N.send s1 msg) >> replicateM_ 100 (N.recv s2))
N.close s1
N.close s2
return () | 378 | nThr :: Int -> Int -> String -> String -> IO ()
nThr size count bindString connString = do
s1 <- N.socket N.Pair
_ <- N.bind s1 bindString
s2 <- N.socket N.Pair
_ <- N.connect s2 connString
let msg = C.pack $ replicate size 'a'
replicateM_ count (replicateM_ 100 (N.send s1 msg) >> replicateM_ 100 (N.recv s2))
N.close s1
N.close s2
return () | 378 | nThr size count bindString connString = do
s1 <- N.socket N.Pair
_ <- N.bind s1 bindString
s2 <- N.socket N.Pair
_ <- N.connect s2 connString
let msg = C.pack $ replicate size 'a'
replicateM_ count (replicateM_ 100 (N.send s1 msg) >> replicateM_ 100 (N.recv s2))
N.close s1
N.close s2
return () | 330 | false | true | 0 | 13 | 98 | 184 | 82 | 102 | null | null |
aweinstock314/neural-networks | VisualizeFunction.hs | apache-2.0 | scaleFromTo (a, b) (a', b') x = ((x-a)/(b-a))*(b'-a')+a' | 56 | scaleFromTo (a, b) (a', b') x = ((x-a)/(b-a))*(b'-a')+a' | 56 | scaleFromTo (a, b) (a', b') x = ((x-a)/(b-a))*(b'-a')+a' | 56 | false | false | 0 | 10 | 7 | 61 | 34 | 27 | null | null |
hw-hello-world/okta-signin-widget | haskell-scotty/app/Main.hs | mit | app :: Config -> IO ()
app c = scotty 12234 $ do
middleware logStdoutDev
middleware $ staticPolicy (noDots >-> addBase "public")
get "/" $ do
cookies <- getCookies'
liftIO $ print cookies
html . renderHtml $ homePage (findUserFromCookies cookies)
get "/login-okta" $ html . renderHtml $ loginOktaPage c
get "/logout" $ text "FIXME: logout by clean up session."
get "/callback" $ do
-- FIXME: code may not exists when the request error and it will contain
-- error=access_denied&error_description=User+is+not+assigned+to+the+client+application
-- turns out it is an issue at local server !!???
code <- param "code"
state <- param "state"
r' <- liftIO (fetchToken c code state)
case r' of
Right authResult -> do
setCookie "okta-user" (BS.toStrict $ BS.pack $ email $ claims authResult)
redirect "/"
Left e -> html . renderHtml $ H.toHtml e
-- html . renderHtml $ callbackPage code state | 982 | app :: Config -> IO ()
app c = scotty 12234 $ do
middleware logStdoutDev
middleware $ staticPolicy (noDots >-> addBase "public")
get "/" $ do
cookies <- getCookies'
liftIO $ print cookies
html . renderHtml $ homePage (findUserFromCookies cookies)
get "/login-okta" $ html . renderHtml $ loginOktaPage c
get "/logout" $ text "FIXME: logout by clean up session."
get "/callback" $ do
-- FIXME: code may not exists when the request error and it will contain
-- error=access_denied&error_description=User+is+not+assigned+to+the+client+application
-- turns out it is an issue at local server !!???
code <- param "code"
state <- param "state"
r' <- liftIO (fetchToken c code state)
case r' of
Right authResult -> do
setCookie "okta-user" (BS.toStrict $ BS.pack $ email $ claims authResult)
redirect "/"
Left e -> html . renderHtml $ H.toHtml e
-- html . renderHtml $ callbackPage code state | 982 | app c = scotty 12234 $ do
middleware logStdoutDev
middleware $ staticPolicy (noDots >-> addBase "public")
get "/" $ do
cookies <- getCookies'
liftIO $ print cookies
html . renderHtml $ homePage (findUserFromCookies cookies)
get "/login-okta" $ html . renderHtml $ loginOktaPage c
get "/logout" $ text "FIXME: logout by clean up session."
get "/callback" $ do
-- FIXME: code may not exists when the request error and it will contain
-- error=access_denied&error_description=User+is+not+assigned+to+the+client+application
-- turns out it is an issue at local server !!???
code <- param "code"
state <- param "state"
r' <- liftIO (fetchToken c code state)
case r' of
Right authResult -> do
setCookie "okta-user" (BS.toStrict $ BS.pack $ email $ claims authResult)
redirect "/"
Left e -> html . renderHtml $ H.toHtml e
-- html . renderHtml $ callbackPage code state | 959 | false | true | 2 | 21 | 238 | 271 | 118 | 153 | null | null |
epsilonhalbe/accelerate-typelits | src/Data/Array/Accelerate/TypeLits/Internal.hs | isc | mkVector :: forall n a. (KnownNat n, Elt a) => [a] -> Maybe (AccVector n a)
-- | a smart constructor to generate Vectors - returning Nothing
-- if the input list is not as long as the dimension of the Vector
mkVector as = if length as == n'
then Just $ unsafeMkVector as
else Nothing
where n' = fromIntegral $ natVal (Proxy :: Proxy n) | 371 | mkVector :: forall n a. (KnownNat n, Elt a) => [a] -> Maybe (AccVector n a)
mkVector as = if length as == n'
then Just $ unsafeMkVector as
else Nothing
where n' = fromIntegral $ natVal (Proxy :: Proxy n) | 239 | mkVector as = if length as == n'
then Just $ unsafeMkVector as
else Nothing
where n' = fromIntegral $ natVal (Proxy :: Proxy n) | 163 | true | true | 3 | 11 | 102 | 109 | 54 | 55 | null | null |
tek/proteome | packages/test/test/Proteome/Test/ResolveTest.hs | mit | targetProject :: Project
targetProject =
Project (DirProject fn root (Just tp)) [ti, ta] (Just l) [li, la] | 108 | targetProject :: Project
targetProject =
Project (DirProject fn root (Just tp)) [ti, ta] (Just l) [li, la] | 108 | targetProject =
Project (DirProject fn root (Just tp)) [ti, ta] (Just l) [li, la] | 83 | false | true | 0 | 9 | 18 | 54 | 29 | 25 | null | null |
vTurbine/ghc | compiler/typecheck/TcEvidence.hs | bsd-3-clause | isTcReflCo :: TcCoercion -> Bool
mkTcReflCo = mkReflCo | 79 | isTcReflCo :: TcCoercion -> Bool
mkTcReflCo = mkReflCo | 78 | mkTcReflCo = mkReflCo | 33 | false | true | 0 | 5 | 32 | 15 | 8 | 7 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/course/2013-11-coursera-fp-odersky-but-in-haskell/FP06ForComp.hs | unlicense | readDictionary :: IO [Word]
readDictionary = do
x <- readFile "FP06ForCompTestWords.txt"
return $ splitLines x
-- http://stackoverflow.com/questions/15412027/haskell-equivalent-to-scalas-groupby | 203 | readDictionary :: IO [Word]
readDictionary = do
x <- readFile "FP06ForCompTestWords.txt"
return $ splitLines x
-- http://stackoverflow.com/questions/15412027/haskell-equivalent-to-scalas-groupby | 203 | readDictionary = do
x <- readFile "FP06ForCompTestWords.txt"
return $ splitLines x
-- http://stackoverflow.com/questions/15412027/haskell-equivalent-to-scalas-groupby | 175 | false | true | 0 | 8 | 25 | 38 | 18 | 20 | null | null |
rudymatela/leancheck | test/Test.hs | bsd-3-clause | thn :: (a->a->Ordering) -> (a->a->Ordering) -> a -> a -> Ordering
thn cmp1 cmp2 x y = (x `cmp1` y) `ifNotEq` (x `cmp2` y) | 121 | thn :: (a->a->Ordering) -> (a->a->Ordering) -> a -> a -> Ordering
thn cmp1 cmp2 x y = (x `cmp1` y) `ifNotEq` (x `cmp2` y) | 121 | thn cmp1 cmp2 x y = (x `cmp1` y) `ifNotEq` (x `cmp2` y) | 55 | false | true | 0 | 9 | 23 | 82 | 46 | 36 | null | null |
databrary/databrary | src/Model/Authorize.hs | agpl-3.0 | -- | Attempt to find an authorization request or grant from the child party to the granting parent party.
-- If authorize filter is ForPartyViewer, filter out expired authorizations.
lookupAuthorize :: MonadDB c m => AuthorizeFilter -> Party -> Party -> m (Maybe Authorize)
lookupAuthorize aFilter child parent =
dbQuery1 $
(\mkAuthorize' -> mkAuthorize' child parent)
<$> case aFilter of
ActiveAuthorizations ->
$(selectQuery
authorizeRow
"$WHERE authorize.child = ${partyId $ partyRow child} AND authorize.parent = ${partyId $ partyRow parent} AND (expires IS NULL OR expires > CURRENT_TIMESTAMP)")
AllAuthorizations ->
$(selectQuery
authorizeRow
"$WHERE authorize.child = ${partyId $ partyRow child} AND authorize.parent = ${partyId $ partyRow parent}")
-- | Find an active authorization request or approval from child to parent. | 1,043 | lookupAuthorize :: MonadDB c m => AuthorizeFilter -> Party -> Party -> m (Maybe Authorize)
lookupAuthorize aFilter child parent =
dbQuery1 $
(\mkAuthorize' -> mkAuthorize' child parent)
<$> case aFilter of
ActiveAuthorizations ->
$(selectQuery
authorizeRow
"$WHERE authorize.child = ${partyId $ partyRow child} AND authorize.parent = ${partyId $ partyRow parent} AND (expires IS NULL OR expires > CURRENT_TIMESTAMP)")
AllAuthorizations ->
$(selectQuery
authorizeRow
"$WHERE authorize.child = ${partyId $ partyRow child} AND authorize.parent = ${partyId $ partyRow parent}")
-- | Find an active authorization request or approval from child to parent. | 860 | lookupAuthorize aFilter child parent =
dbQuery1 $
(\mkAuthorize' -> mkAuthorize' child parent)
<$> case aFilter of
ActiveAuthorizations ->
$(selectQuery
authorizeRow
"$WHERE authorize.child = ${partyId $ partyRow child} AND authorize.parent = ${partyId $ partyRow parent} AND (expires IS NULL OR expires > CURRENT_TIMESTAMP)")
AllAuthorizations ->
$(selectQuery
authorizeRow
"$WHERE authorize.child = ${partyId $ partyRow child} AND authorize.parent = ${partyId $ partyRow parent}")
-- | Find an active authorization request or approval from child to parent. | 769 | true | true | 4 | 11 | 327 | 109 | 53 | 56 | null | null |
ryantrinkle/reflex-dom | reflex-dom-core/src/Reflex/Dom/Main.hs | bsd-3-clause | runDomHost :: DomHost a -> IO a
runDomHost = runSpiderHost
#ifdef PROFILE_REFLEX
. runProfiledM | 97 | runDomHost :: DomHost a -> IO a
runDomHost = runSpiderHost
#ifdef PROFILE_REFLEX
. runProfiledM | 97 | runDomHost = runSpiderHost
#ifdef PROFILE_REFLEX
. runProfiledM | 65 | false | true | 1 | 6 | 15 | 28 | 13 | 15 | null | null |
ciderpunx/57-exercises-for-programmers | src/P51FirebaseNotes.hs | gpl-3.0 | baseUrl :: BaseUrl
baseUrl = BaseUrl Https "notes-b1434.firebaseio.com" 443 "" | 78 | baseUrl :: BaseUrl
baseUrl = BaseUrl Https "notes-b1434.firebaseio.com" 443 "" | 78 | baseUrl = BaseUrl Https "notes-b1434.firebaseio.com" 443 "" | 59 | false | true | 0 | 5 | 9 | 20 | 10 | 10 | null | null |
wavewave/hoodle-core | src/Hoodle/ModelAction/Eraser.hs | gpl-3.0 | eraseHitted (n :-Empty) = return (unNotHitted n) | 48 | eraseHitted (n :-Empty) = return (unNotHitted n) | 48 | eraseHitted (n :-Empty) = return (unNotHitted n) | 48 | false | false | 0 | 6 | 6 | 26 | 12 | 14 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/DAXSubnetGroup.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html#cfn-dax-subnetgroup-subnetgroupname
daxsgSubnetGroupName :: Lens' DAXSubnetGroup (Maybe (Val Text))
daxsgSubnetGroupName = lens _dAXSubnetGroupSubnetGroupName (\s a -> s { _dAXSubnetGroupSubnetGroupName = a }) | 310 | daxsgSubnetGroupName :: Lens' DAXSubnetGroup (Maybe (Val Text))
daxsgSubnetGroupName = lens _dAXSubnetGroupSubnetGroupName (\s a -> s { _dAXSubnetGroupSubnetGroupName = a }) | 173 | daxsgSubnetGroupName = lens _dAXSubnetGroupSubnetGroupName (\s a -> s { _dAXSubnetGroupSubnetGroupName = a }) | 109 | true | true | 0 | 9 | 22 | 52 | 28 | 24 | null | null |
bredelings/BAli-Phy | haskell/Probability/Distribution/Discrete.hs | gpl-2.0 | extendDiscreteDistribution d p x = mix [p, 1.0-p] [certainly x, d] | 66 | extendDiscreteDistribution d p x = mix [p, 1.0-p] [certainly x, d] | 66 | extendDiscreteDistribution d p x = mix [p, 1.0-p] [certainly x, d] | 66 | false | false | 0 | 7 | 10 | 37 | 19 | 18 | null | null |
dmjio/aeson | tests/DataFamilies/Encoders.hs | bsd-3-clause | gSomeTypeToEncodingTaggedObject :: SomeType c () Int -> Encoding
gSomeTypeToEncodingTaggedObject = genericToEncoding optsTaggedObject | 133 | gSomeTypeToEncodingTaggedObject :: SomeType c () Int -> Encoding
gSomeTypeToEncodingTaggedObject = genericToEncoding optsTaggedObject | 133 | gSomeTypeToEncodingTaggedObject = genericToEncoding optsTaggedObject | 68 | false | true | 0 | 7 | 11 | 27 | 13 | 14 | null | null |
hackern/halfs | Halfs/Inode.hs | bsd-3-clause | -- | Decompose the given absolute byte offset into an inode's data stream into
-- Ext index (i.e., 0-based index into the ext chain), a block offset within
-- that Ext, and a byte offset within that block.
decomp :: (Serialize t, Timed t m, Monad m, Show t) =>
Word64 -- ^ Block size, in bytes
-> Word64 -- ^ Offset into the data stream
-> HalfsM b r l m StreamIdx
decomp blkSz streamOff = do
-- Note that the first Ext in a Ext chain always gets embedded in an Inode,
-- and thus has differing capacity than the rest of the Exts, which are of
-- uniform size.
(stExtBytes, extBytes, _, _) <- hasks hsSizes
let (extIdx, extByteIdx) =
if streamOff >= stExtBytes
then fmapFst (+1) $ (streamOff - stExtBytes) `divMod` extBytes
else (0, streamOff)
(blkOff, byteOff) = extByteIdx `divMod` blkSz
return (extIdx, blkOff, byteOff) | 893 | decomp :: (Serialize t, Timed t m, Monad m, Show t) =>
Word64 -- ^ Block size, in bytes
-> Word64 -- ^ Offset into the data stream
-> HalfsM b r l m StreamIdx
decomp blkSz streamOff = do
-- Note that the first Ext in a Ext chain always gets embedded in an Inode,
-- and thus has differing capacity than the rest of the Exts, which are of
-- uniform size.
(stExtBytes, extBytes, _, _) <- hasks hsSizes
let (extIdx, extByteIdx) =
if streamOff >= stExtBytes
then fmapFst (+1) $ (streamOff - stExtBytes) `divMod` extBytes
else (0, streamOff)
(blkOff, byteOff) = extByteIdx `divMod` blkSz
return (extIdx, blkOff, byteOff) | 687 | decomp blkSz streamOff = do
-- Note that the first Ext in a Ext chain always gets embedded in an Inode,
-- and thus has differing capacity than the rest of the Exts, which are of
-- uniform size.
(stExtBytes, extBytes, _, _) <- hasks hsSizes
let (extIdx, extByteIdx) =
if streamOff >= stExtBytes
then fmapFst (+1) $ (streamOff - stExtBytes) `divMod` extBytes
else (0, streamOff)
(blkOff, byteOff) = extByteIdx `divMod` blkSz
return (extIdx, blkOff, byteOff) | 504 | true | true | 0 | 15 | 219 | 190 | 105 | 85 | null | null |
firefrorefiddle/songmaker | src/SongMaker/Read/Header.hs | gpl-2.0 | isHeaderLine = isJust . tryReadHeaderLine | 41 | isHeaderLine = isJust . tryReadHeaderLine | 41 | isHeaderLine = isJust . tryReadHeaderLine | 41 | false | false | 0 | 5 | 4 | 10 | 5 | 5 | null | null |
danstiner/clod | src/Command/LsFiles.hs | mit | parser :: Parser Options
parser = Options
<$> switch
( long "cached"
<> short 'c'
<> help "Show cached files in the output (default)." ) | 154 | parser :: Parser Options
parser = Options
<$> switch
( long "cached"
<> short 'c'
<> help "Show cached files in the output (default)." ) | 154 | parser = Options
<$> switch
( long "cached"
<> short 'c'
<> help "Show cached files in the output (default)." ) | 129 | false | true | 2 | 9 | 42 | 48 | 20 | 28 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/CodeDeployDeploymentConfigMinimumHealthyHosts.hs | mit | codeDeployDeploymentConfigMinimumHealthyHosts
:: Val Text -- ^ 'cddcmhhType'
-> Val Integer -- ^ 'cddcmhhValue'
-> CodeDeployDeploymentConfigMinimumHealthyHosts
codeDeployDeploymentConfigMinimumHealthyHosts typearg valuearg =
CodeDeployDeploymentConfigMinimumHealthyHosts
{ _codeDeployDeploymentConfigMinimumHealthyHostsType = typearg
, _codeDeployDeploymentConfigMinimumHealthyHostsValue = valuearg
} | 415 | codeDeployDeploymentConfigMinimumHealthyHosts
:: Val Text -- ^ 'cddcmhhType'
-> Val Integer -- ^ 'cddcmhhValue'
-> CodeDeployDeploymentConfigMinimumHealthyHosts
codeDeployDeploymentConfigMinimumHealthyHosts typearg valuearg =
CodeDeployDeploymentConfigMinimumHealthyHosts
{ _codeDeployDeploymentConfigMinimumHealthyHostsType = typearg
, _codeDeployDeploymentConfigMinimumHealthyHostsValue = valuearg
} | 415 | codeDeployDeploymentConfigMinimumHealthyHosts typearg valuearg =
CodeDeployDeploymentConfigMinimumHealthyHosts
{ _codeDeployDeploymentConfigMinimumHealthyHostsType = typearg
, _codeDeployDeploymentConfigMinimumHealthyHostsValue = valuearg
} | 248 | false | true | 0 | 8 | 42 | 55 | 27 | 28 | null | null |
m4rw3r/warframe-dmg-hs | src/armor.hs | mit | modifierForDamageOnArmor Damage.Toxic Flesh = 0.5 | 64 | modifierForDamageOnArmor Damage.Toxic Flesh = 0.5 | 64 | modifierForDamageOnArmor Damage.Toxic Flesh = 0.5 | 64 | false | false | 0 | 6 | 19 | 15 | 6 | 9 | null | null |
hjwylde/werewolf | src/Game/Werewolf/Role.hs | bsd-3-clause | -- | /Originally rejected by the townsfolk, the Oracle's prophetic divinations has earned trust/
-- /within the village. With constant precognition - and concern for the future - the Oracle/
-- /knows the village will only live if they work together./
--
-- Each night the Oracle chooses a player to divine. They are then informed of the player's role
-- the following morning. This wisdom is for the Oracle to use to ensure the future of Fougères.
oracleRole :: Role
oracleRole = Role
{ _tag = "oracle"
, _name = T.strip [iFile|variant/standard/role/oracle/name.txt|]
, _allegiance = Villagers
, _balance = 4
, _activity = Nocturnal
, _description = T.strip [iFile|variant/standard/role/oracle/description.txt|]
, _rules = T.strip [iFile|variant/standard/role/oracle/rules.txt|]
} | 857 | oracleRole :: Role
oracleRole = Role
{ _tag = "oracle"
, _name = T.strip [iFile|variant/standard/role/oracle/name.txt|]
, _allegiance = Villagers
, _balance = 4
, _activity = Nocturnal
, _description = T.strip [iFile|variant/standard/role/oracle/description.txt|]
, _rules = T.strip [iFile|variant/standard/role/oracle/rules.txt|]
} | 400 | oracleRole = Role
{ _tag = "oracle"
, _name = T.strip [iFile|variant/standard/role/oracle/name.txt|]
, _allegiance = Villagers
, _balance = 4
, _activity = Nocturnal
, _description = T.strip [iFile|variant/standard/role/oracle/description.txt|]
, _rules = T.strip [iFile|variant/standard/role/oracle/rules.txt|]
} | 381 | true | true | 0 | 8 | 191 | 88 | 59 | 29 | null | null |
ihc/futhark | src/Futhark/Optimise/Simplifier/Rule.hs | isc | -- | @simplifyStm uses bnd@ performs simplification of the binding
-- @bnd@. If simplification is possible, a replacement list of
-- bindings is returned, that bind at least the same names as the
-- original binding (and possibly more, for intermediate results).
-- The first argument is the set of names used after this binding.
bottomUpSimplifyStm :: MonadBinder m =>
RuleBook m
-> (ST.SymbolTable (Lore m), UT.UsageTable)
-> Stm (Lore m)
-> m (Maybe [Stm (Lore m)])
bottomUpSimplifyStm = applyRules . bookBottomUpRules | 605 | bottomUpSimplifyStm :: MonadBinder m =>
RuleBook m
-> (ST.SymbolTable (Lore m), UT.UsageTable)
-> Stm (Lore m)
-> m (Maybe [Stm (Lore m)])
bottomUpSimplifyStm = applyRules . bookBottomUpRules | 274 | bottomUpSimplifyStm = applyRules . bookBottomUpRules | 52 | true | true | 0 | 15 | 165 | 91 | 47 | 44 | null | null |
LambdaHack/LambdaHack | engine-src/Game/LambdaHack/Client/HandleAtomicM.hs | bsd-3-clause | cmdAtomicSemCli oldState cmd = case cmd of
UpdRegisterItems ais -> mapM_ (addItemToDiscoBenefit . fst) ais
UpdCreateActor aid b ais -> createActor aid b ais
UpdDestroyActor aid b _ -> destroyActor aid b True
UpdCreateItem _ iid _ _ (CActor aid store) -> do
wipeBfsIfItemAffectsSkills store aid
addItemToDiscoBenefit iid
updateInMeleeDueToItem aid store
UpdCreateItem _ iid _ _ _ -> addItemToDiscoBenefit iid
UpdDestroyItem _ _ _ _ (CActor aid store) -> do
wipeBfsIfItemAffectsSkills store aid
updateInMeleeDueToItem aid store
UpdDestroyItem{} -> return ()
UpdSpotActor aid b -> do
ais <- getsState $ getCarriedAssocsAndTrunk b
createActor aid b ais
UpdLoseActor aid b -> destroyActor aid b False
UpdSpotItem _ iid _ (CActor aid store) -> do
wipeBfsIfItemAffectsSkills store aid
addItemToDiscoBenefit iid
updateInMeleeDueToItem aid store
UpdSpotItem _ iid _ _ -> addItemToDiscoBenefit iid
UpdLoseItem _ _ _ (CActor aid store) -> do
wipeBfsIfItemAffectsSkills store aid
updateInMeleeDueToItem aid store
UpdLoseItem{} -> return ()
UpdSpotItemBag _ (CActor aid store) bag -> do
wipeBfsIfItemAffectsSkills store aid
mapM_ addItemToDiscoBenefit $ EM.keys bag
updateInMeleeDueToItem aid store
UpdSpotItemBag _ _ bag ->
mapM_ addItemToDiscoBenefit $ EM.keys bag
UpdLoseItemBag _ (CActor aid store) _ -> do
wipeBfsIfItemAffectsSkills store aid
updateInMeleeDueToItem aid store
UpdLoseItemBag{} -> return ()
UpdMoveActor aid _ _ -> do
invalidateBfsAid aid
-- other BFSes not invalidated, because distant actors may still move out
-- of the way and close actors are considered when attempting to move
-- and then BFS is invalidated, if needed.
b <- getsState $ getActorBody aid
updateInMeleeDueToActor b
UpdWaitActor aid _fromW toW -> do
-- So that we can later ignore such actors when updating targets
-- and not risk they being pushed/displaced and targets getting illegal.
when (toW == WSleep) $
modifyClient $ updateTarget aid (const Nothing)
b <- getsState $ getActorBody aid
updateInMeleeDueToActor b -- @bwatch@ checked in several places
UpdDisplaceActor source target -> do
invalidateBfsAid source
invalidateBfsAid target
-- other BFSes not invalidated, because distant actors may still move out
-- of the way and close actors are considered when attempting to move
-- and then BFS is invalidated, if needed.
sb <- getsState $ getActorBody source
-- At least one of these is not a projectile and both move, so update.
insertInMeleeM (blid sb)
UpdMoveItem _ _ aid s1 s2 -> do
wipeBfsIfItemAffectsSkills s1 aid
wipeBfsIfItemAffectsSkills s2 aid
updateInMeleeDueToItem aid s1
updateInMeleeDueToItem aid s2
UpdRefillHP _ 0 -> return ()
UpdRefillHP aid delta -> do
b <- getsState $ getActorBody aid
unless (bproj b
|| signum (bhp b) -- new HP
== signum (bhp b - delta)) $ -- old HP
insertInMeleeM (blid b) -- @bhp@ checked in several places
UpdRefillCalm{} -> return ()
UpdTrajectory{} -> return ()
UpdQuitFaction{} -> return ()
UpdSpotStashFaction{} -> return ()
UpdLoseStashFaction{} -> return ()
UpdLeadFaction fid source target -> do
side <- getsClient sside
when (side == fid) $ do
mleader <- getsClient sleader
let !_A = assert (mleader == source
-- somebody changed the leader for us
|| mleader == target
-- we changed the leader ourselves
`blame` "unexpected leader"
`swith` (cmd, mleader)) ()
modifyClient $ \cli -> cli {_sleader = target}
UpdDiplFaction{} ->
-- Depends on who is a foe as opposed to a neutral actor.
updateInMeleeInDungeon
UpdAutoFaction{} -> do
-- Regaining control of faction cancels some --stopAfter*.
-- This is really a UI client issue, but is in general client state
-- to make it simpler to set this via commandline.
modifyClient $ \cli ->
cli {soptions = (soptions cli) { sstopAfterSeconds = Nothing
, sstopAfterFrames = Nothing }}
-- @condBFS@ depends on the setting we change here (e.g., smarkSuspect).
invalidateBfsAll
UpdRecordKill{} -> return ()
UpdDoctrineFaction{} -> do
-- Clear all targets except the leader's.
mleader <- getsClient sleader
mtgt <- case mleader of
Nothing -> return Nothing
Just leader -> getsClient $ EM.lookup leader . stargetD
modifyClient $ \cli ->
let stargetD | Just tgt <- mtgt
, Just leader <- mleader
= EM.singleton leader tgt
| otherwise = EM.empty
in cli {stargetD}
UpdAlterTile lid p fromTile toTile -> do
updateSalter lid [(p, toTile)]
cops <- getsState scops
let lvl = (EM.! lid) . sdungeon $ oldState
t = lvl `at` p
let !_A = assert (t == fromTile) ()
when (tileChangeAffectsBfs cops fromTile toTile) $
invalidateBfsLid lid
UpdAlterExplorable{} -> return ()
UpdAlterGold{} -> return ()
UpdSearchTile aid p toTile -> do
COps{cotile} <- getsState scops
b <- getsState $ getActorBody aid
let lid = blid b
updateSalter lid [(p, toTile)]
cops <- getsState scops
let lvl = (EM.! lid) . sdungeon $ oldState
t = lvl `at` p
let !_A = assert (Just t == Tile.hideAs cotile toTile) ()
-- The following check is needed even if we verity in content
-- that searching doesn't change clarity and light of tiles,
-- because it modifies skill needed to alter the tile and even
-- walkability and changeability.
when (tileChangeAffectsBfs cops t toTile) $
invalidateBfsLid lid
UpdHideTile{} -> return ()
UpdSpotTile lid ts -> do
updateSalter lid ts
cops <- getsState scops
let lvl = (EM.! lid) . sdungeon $ oldState
affects (p, toTile) =
let fromTile = lvl `at` p
in tileChangeAffectsBfs cops fromTile toTile
bs = map affects ts
when (or bs) $ invalidateBfsLid lid
UpdLoseTile lid ts -> do
updateSalter lid ts
invalidateBfsLid lid -- from known to unknown tiles
UpdSpotEntry{} -> return ()
UpdLoseEntry{} -> return ()
UpdAlterSmell{} -> return ()
UpdSpotSmell{} -> return ()
UpdLoseSmell{} -> return ()
UpdTimeItem{} -> return ()
UpdAgeGame{} -> return ()
UpdUnAgeGame{} -> return ()
UpdDiscover _ iid _ _ -> do
item <- getsState $ getItemBody iid
case jkind item of
IdentityObvious _ik -> discoverAspect iid
IdentityCovered ix _ik ->
if ix `EM.notMember` sdiscoKind oldState
then discoverKindAndAspect ix
else discoverAspect iid
UpdCover _ iid _ _ -> do
item <- getsState $ getItemBody iid
newState <- getState
case jkind item of
IdentityObvious _ik -> coverAspect iid
IdentityCovered ix _ik ->
if ix `EM.member` sdiscoKind newState
then coverAspectAndKind ix
else coverAspect iid
UpdDiscoverKind _c ix _ik -> discoverKind ix
UpdCoverKind _c ix _ik -> coverKind ix
UpdDiscoverAspect _c iid _arItem -> discoverAspect iid
UpdCoverAspect _c iid _arItem -> coverAspect iid
UpdDiscoverServer{} -> error "server command leaked to client"
UpdCoverServer{} -> error "server command leaked to client"
UpdPerception lid outPer inPer -> perception lid outPer inPer
UpdRestart side sfper _ scurChal soptionsNew srandom -> do
COps{cocave} <- getsState scops
fact <- getsState $ (EM.! side) . sfactionD
snxtChal <- getsClient snxtChal
smarkSuspect <- getsClient smarkSuspect
stabs <- getsClient stabs
soptionsOld <- getsClient soptions
let h lvl = CK.clabyrinth (okind cocave $ lkind lvl)
&& not (fhasGender $ gkind fact)
-- Not to burrow through a labyrinth instead of leaving it for
-- the human player and to prevent AI losing time there instead
-- of congregating at exits.
sexplored <- getsState $ EM.keysSet . EM.filter h . sdungeon
let cli = emptyStateClient side
putClient cli { sexplored
-- , sundo = [UpdAtomic cmd]
, sfper
, srandom
, scurChal
, snxtChal
, smarkSuspect
, soptions =
soptionsNew {snoAnim = -- persist @snoAnim@ between games
snoAnim soptionsOld `mplus` snoAnim soptionsNew}
, stabs }
salter <- getsState createSalter
modifyClient $ \cli1 -> cli1 {salter}
updateInMeleeInDungeon
UpdRestartServer{} -> return ()
UpdResume _side sfperNew -> do
#ifdef WITH_EXPENSIVE_ASSERTIONS
sfperOld <- getsClient sfper
let !_A = assert (sfperNew == sfperOld
`blame` (_side, sfperNew, sfperOld)) ()
#endif
modifyClient $ \cli -> cli {sfper = sfperNew} -- just in case
salter <- getsState createSalter -- because space saved by not storing it
modifyClient $ \cli -> cli {salter}
UpdResumeServer{} -> return ()
UpdKillExit _fid -> killExit
UpdWriteSave -> saveClient
UpdHearFid{} -> return ()
UpdMuteMessages{} -> return () | 9,316 | cmdAtomicSemCli oldState cmd = case cmd of
UpdRegisterItems ais -> mapM_ (addItemToDiscoBenefit . fst) ais
UpdCreateActor aid b ais -> createActor aid b ais
UpdDestroyActor aid b _ -> destroyActor aid b True
UpdCreateItem _ iid _ _ (CActor aid store) -> do
wipeBfsIfItemAffectsSkills store aid
addItemToDiscoBenefit iid
updateInMeleeDueToItem aid store
UpdCreateItem _ iid _ _ _ -> addItemToDiscoBenefit iid
UpdDestroyItem _ _ _ _ (CActor aid store) -> do
wipeBfsIfItemAffectsSkills store aid
updateInMeleeDueToItem aid store
UpdDestroyItem{} -> return ()
UpdSpotActor aid b -> do
ais <- getsState $ getCarriedAssocsAndTrunk b
createActor aid b ais
UpdLoseActor aid b -> destroyActor aid b False
UpdSpotItem _ iid _ (CActor aid store) -> do
wipeBfsIfItemAffectsSkills store aid
addItemToDiscoBenefit iid
updateInMeleeDueToItem aid store
UpdSpotItem _ iid _ _ -> addItemToDiscoBenefit iid
UpdLoseItem _ _ _ (CActor aid store) -> do
wipeBfsIfItemAffectsSkills store aid
updateInMeleeDueToItem aid store
UpdLoseItem{} -> return ()
UpdSpotItemBag _ (CActor aid store) bag -> do
wipeBfsIfItemAffectsSkills store aid
mapM_ addItemToDiscoBenefit $ EM.keys bag
updateInMeleeDueToItem aid store
UpdSpotItemBag _ _ bag ->
mapM_ addItemToDiscoBenefit $ EM.keys bag
UpdLoseItemBag _ (CActor aid store) _ -> do
wipeBfsIfItemAffectsSkills store aid
updateInMeleeDueToItem aid store
UpdLoseItemBag{} -> return ()
UpdMoveActor aid _ _ -> do
invalidateBfsAid aid
-- other BFSes not invalidated, because distant actors may still move out
-- of the way and close actors are considered when attempting to move
-- and then BFS is invalidated, if needed.
b <- getsState $ getActorBody aid
updateInMeleeDueToActor b
UpdWaitActor aid _fromW toW -> do
-- So that we can later ignore such actors when updating targets
-- and not risk they being pushed/displaced and targets getting illegal.
when (toW == WSleep) $
modifyClient $ updateTarget aid (const Nothing)
b <- getsState $ getActorBody aid
updateInMeleeDueToActor b -- @bwatch@ checked in several places
UpdDisplaceActor source target -> do
invalidateBfsAid source
invalidateBfsAid target
-- other BFSes not invalidated, because distant actors may still move out
-- of the way and close actors are considered when attempting to move
-- and then BFS is invalidated, if needed.
sb <- getsState $ getActorBody source
-- At least one of these is not a projectile and both move, so update.
insertInMeleeM (blid sb)
UpdMoveItem _ _ aid s1 s2 -> do
wipeBfsIfItemAffectsSkills s1 aid
wipeBfsIfItemAffectsSkills s2 aid
updateInMeleeDueToItem aid s1
updateInMeleeDueToItem aid s2
UpdRefillHP _ 0 -> return ()
UpdRefillHP aid delta -> do
b <- getsState $ getActorBody aid
unless (bproj b
|| signum (bhp b) -- new HP
== signum (bhp b - delta)) $ -- old HP
insertInMeleeM (blid b) -- @bhp@ checked in several places
UpdRefillCalm{} -> return ()
UpdTrajectory{} -> return ()
UpdQuitFaction{} -> return ()
UpdSpotStashFaction{} -> return ()
UpdLoseStashFaction{} -> return ()
UpdLeadFaction fid source target -> do
side <- getsClient sside
when (side == fid) $ do
mleader <- getsClient sleader
let !_A = assert (mleader == source
-- somebody changed the leader for us
|| mleader == target
-- we changed the leader ourselves
`blame` "unexpected leader"
`swith` (cmd, mleader)) ()
modifyClient $ \cli -> cli {_sleader = target}
UpdDiplFaction{} ->
-- Depends on who is a foe as opposed to a neutral actor.
updateInMeleeInDungeon
UpdAutoFaction{} -> do
-- Regaining control of faction cancels some --stopAfter*.
-- This is really a UI client issue, but is in general client state
-- to make it simpler to set this via commandline.
modifyClient $ \cli ->
cli {soptions = (soptions cli) { sstopAfterSeconds = Nothing
, sstopAfterFrames = Nothing }}
-- @condBFS@ depends on the setting we change here (e.g., smarkSuspect).
invalidateBfsAll
UpdRecordKill{} -> return ()
UpdDoctrineFaction{} -> do
-- Clear all targets except the leader's.
mleader <- getsClient sleader
mtgt <- case mleader of
Nothing -> return Nothing
Just leader -> getsClient $ EM.lookup leader . stargetD
modifyClient $ \cli ->
let stargetD | Just tgt <- mtgt
, Just leader <- mleader
= EM.singleton leader tgt
| otherwise = EM.empty
in cli {stargetD}
UpdAlterTile lid p fromTile toTile -> do
updateSalter lid [(p, toTile)]
cops <- getsState scops
let lvl = (EM.! lid) . sdungeon $ oldState
t = lvl `at` p
let !_A = assert (t == fromTile) ()
when (tileChangeAffectsBfs cops fromTile toTile) $
invalidateBfsLid lid
UpdAlterExplorable{} -> return ()
UpdAlterGold{} -> return ()
UpdSearchTile aid p toTile -> do
COps{cotile} <- getsState scops
b <- getsState $ getActorBody aid
let lid = blid b
updateSalter lid [(p, toTile)]
cops <- getsState scops
let lvl = (EM.! lid) . sdungeon $ oldState
t = lvl `at` p
let !_A = assert (Just t == Tile.hideAs cotile toTile) ()
-- The following check is needed even if we verity in content
-- that searching doesn't change clarity and light of tiles,
-- because it modifies skill needed to alter the tile and even
-- walkability and changeability.
when (tileChangeAffectsBfs cops t toTile) $
invalidateBfsLid lid
UpdHideTile{} -> return ()
UpdSpotTile lid ts -> do
updateSalter lid ts
cops <- getsState scops
let lvl = (EM.! lid) . sdungeon $ oldState
affects (p, toTile) =
let fromTile = lvl `at` p
in tileChangeAffectsBfs cops fromTile toTile
bs = map affects ts
when (or bs) $ invalidateBfsLid lid
UpdLoseTile lid ts -> do
updateSalter lid ts
invalidateBfsLid lid -- from known to unknown tiles
UpdSpotEntry{} -> return ()
UpdLoseEntry{} -> return ()
UpdAlterSmell{} -> return ()
UpdSpotSmell{} -> return ()
UpdLoseSmell{} -> return ()
UpdTimeItem{} -> return ()
UpdAgeGame{} -> return ()
UpdUnAgeGame{} -> return ()
UpdDiscover _ iid _ _ -> do
item <- getsState $ getItemBody iid
case jkind item of
IdentityObvious _ik -> discoverAspect iid
IdentityCovered ix _ik ->
if ix `EM.notMember` sdiscoKind oldState
then discoverKindAndAspect ix
else discoverAspect iid
UpdCover _ iid _ _ -> do
item <- getsState $ getItemBody iid
newState <- getState
case jkind item of
IdentityObvious _ik -> coverAspect iid
IdentityCovered ix _ik ->
if ix `EM.member` sdiscoKind newState
then coverAspectAndKind ix
else coverAspect iid
UpdDiscoverKind _c ix _ik -> discoverKind ix
UpdCoverKind _c ix _ik -> coverKind ix
UpdDiscoverAspect _c iid _arItem -> discoverAspect iid
UpdCoverAspect _c iid _arItem -> coverAspect iid
UpdDiscoverServer{} -> error "server command leaked to client"
UpdCoverServer{} -> error "server command leaked to client"
UpdPerception lid outPer inPer -> perception lid outPer inPer
UpdRestart side sfper _ scurChal soptionsNew srandom -> do
COps{cocave} <- getsState scops
fact <- getsState $ (EM.! side) . sfactionD
snxtChal <- getsClient snxtChal
smarkSuspect <- getsClient smarkSuspect
stabs <- getsClient stabs
soptionsOld <- getsClient soptions
let h lvl = CK.clabyrinth (okind cocave $ lkind lvl)
&& not (fhasGender $ gkind fact)
-- Not to burrow through a labyrinth instead of leaving it for
-- the human player and to prevent AI losing time there instead
-- of congregating at exits.
sexplored <- getsState $ EM.keysSet . EM.filter h . sdungeon
let cli = emptyStateClient side
putClient cli { sexplored
-- , sundo = [UpdAtomic cmd]
, sfper
, srandom
, scurChal
, snxtChal
, smarkSuspect
, soptions =
soptionsNew {snoAnim = -- persist @snoAnim@ between games
snoAnim soptionsOld `mplus` snoAnim soptionsNew}
, stabs }
salter <- getsState createSalter
modifyClient $ \cli1 -> cli1 {salter}
updateInMeleeInDungeon
UpdRestartServer{} -> return ()
UpdResume _side sfperNew -> do
#ifdef WITH_EXPENSIVE_ASSERTIONS
sfperOld <- getsClient sfper
let !_A = assert (sfperNew == sfperOld
`blame` (_side, sfperNew, sfperOld)) ()
#endif
modifyClient $ \cli -> cli {sfper = sfperNew} -- just in case
salter <- getsState createSalter -- because space saved by not storing it
modifyClient $ \cli -> cli {salter}
UpdResumeServer{} -> return ()
UpdKillExit _fid -> killExit
UpdWriteSave -> saveClient
UpdHearFid{} -> return ()
UpdMuteMessages{} -> return () | 9,316 | cmdAtomicSemCli oldState cmd = case cmd of
UpdRegisterItems ais -> mapM_ (addItemToDiscoBenefit . fst) ais
UpdCreateActor aid b ais -> createActor aid b ais
UpdDestroyActor aid b _ -> destroyActor aid b True
UpdCreateItem _ iid _ _ (CActor aid store) -> do
wipeBfsIfItemAffectsSkills store aid
addItemToDiscoBenefit iid
updateInMeleeDueToItem aid store
UpdCreateItem _ iid _ _ _ -> addItemToDiscoBenefit iid
UpdDestroyItem _ _ _ _ (CActor aid store) -> do
wipeBfsIfItemAffectsSkills store aid
updateInMeleeDueToItem aid store
UpdDestroyItem{} -> return ()
UpdSpotActor aid b -> do
ais <- getsState $ getCarriedAssocsAndTrunk b
createActor aid b ais
UpdLoseActor aid b -> destroyActor aid b False
UpdSpotItem _ iid _ (CActor aid store) -> do
wipeBfsIfItemAffectsSkills store aid
addItemToDiscoBenefit iid
updateInMeleeDueToItem aid store
UpdSpotItem _ iid _ _ -> addItemToDiscoBenefit iid
UpdLoseItem _ _ _ (CActor aid store) -> do
wipeBfsIfItemAffectsSkills store aid
updateInMeleeDueToItem aid store
UpdLoseItem{} -> return ()
UpdSpotItemBag _ (CActor aid store) bag -> do
wipeBfsIfItemAffectsSkills store aid
mapM_ addItemToDiscoBenefit $ EM.keys bag
updateInMeleeDueToItem aid store
UpdSpotItemBag _ _ bag ->
mapM_ addItemToDiscoBenefit $ EM.keys bag
UpdLoseItemBag _ (CActor aid store) _ -> do
wipeBfsIfItemAffectsSkills store aid
updateInMeleeDueToItem aid store
UpdLoseItemBag{} -> return ()
UpdMoveActor aid _ _ -> do
invalidateBfsAid aid
-- other BFSes not invalidated, because distant actors may still move out
-- of the way and close actors are considered when attempting to move
-- and then BFS is invalidated, if needed.
b <- getsState $ getActorBody aid
updateInMeleeDueToActor b
UpdWaitActor aid _fromW toW -> do
-- So that we can later ignore such actors when updating targets
-- and not risk they being pushed/displaced and targets getting illegal.
when (toW == WSleep) $
modifyClient $ updateTarget aid (const Nothing)
b <- getsState $ getActorBody aid
updateInMeleeDueToActor b -- @bwatch@ checked in several places
UpdDisplaceActor source target -> do
invalidateBfsAid source
invalidateBfsAid target
-- other BFSes not invalidated, because distant actors may still move out
-- of the way and close actors are considered when attempting to move
-- and then BFS is invalidated, if needed.
sb <- getsState $ getActorBody source
-- At least one of these is not a projectile and both move, so update.
insertInMeleeM (blid sb)
UpdMoveItem _ _ aid s1 s2 -> do
wipeBfsIfItemAffectsSkills s1 aid
wipeBfsIfItemAffectsSkills s2 aid
updateInMeleeDueToItem aid s1
updateInMeleeDueToItem aid s2
UpdRefillHP _ 0 -> return ()
UpdRefillHP aid delta -> do
b <- getsState $ getActorBody aid
unless (bproj b
|| signum (bhp b) -- new HP
== signum (bhp b - delta)) $ -- old HP
insertInMeleeM (blid b) -- @bhp@ checked in several places
UpdRefillCalm{} -> return ()
UpdTrajectory{} -> return ()
UpdQuitFaction{} -> return ()
UpdSpotStashFaction{} -> return ()
UpdLoseStashFaction{} -> return ()
UpdLeadFaction fid source target -> do
side <- getsClient sside
when (side == fid) $ do
mleader <- getsClient sleader
let !_A = assert (mleader == source
-- somebody changed the leader for us
|| mleader == target
-- we changed the leader ourselves
`blame` "unexpected leader"
`swith` (cmd, mleader)) ()
modifyClient $ \cli -> cli {_sleader = target}
UpdDiplFaction{} ->
-- Depends on who is a foe as opposed to a neutral actor.
updateInMeleeInDungeon
UpdAutoFaction{} -> do
-- Regaining control of faction cancels some --stopAfter*.
-- This is really a UI client issue, but is in general client state
-- to make it simpler to set this via commandline.
modifyClient $ \cli ->
cli {soptions = (soptions cli) { sstopAfterSeconds = Nothing
, sstopAfterFrames = Nothing }}
-- @condBFS@ depends on the setting we change here (e.g., smarkSuspect).
invalidateBfsAll
UpdRecordKill{} -> return ()
UpdDoctrineFaction{} -> do
-- Clear all targets except the leader's.
mleader <- getsClient sleader
mtgt <- case mleader of
Nothing -> return Nothing
Just leader -> getsClient $ EM.lookup leader . stargetD
modifyClient $ \cli ->
let stargetD | Just tgt <- mtgt
, Just leader <- mleader
= EM.singleton leader tgt
| otherwise = EM.empty
in cli {stargetD}
UpdAlterTile lid p fromTile toTile -> do
updateSalter lid [(p, toTile)]
cops <- getsState scops
let lvl = (EM.! lid) . sdungeon $ oldState
t = lvl `at` p
let !_A = assert (t == fromTile) ()
when (tileChangeAffectsBfs cops fromTile toTile) $
invalidateBfsLid lid
UpdAlterExplorable{} -> return ()
UpdAlterGold{} -> return ()
UpdSearchTile aid p toTile -> do
COps{cotile} <- getsState scops
b <- getsState $ getActorBody aid
let lid = blid b
updateSalter lid [(p, toTile)]
cops <- getsState scops
let lvl = (EM.! lid) . sdungeon $ oldState
t = lvl `at` p
let !_A = assert (Just t == Tile.hideAs cotile toTile) ()
-- The following check is needed even if we verity in content
-- that searching doesn't change clarity and light of tiles,
-- because it modifies skill needed to alter the tile and even
-- walkability and changeability.
when (tileChangeAffectsBfs cops t toTile) $
invalidateBfsLid lid
UpdHideTile{} -> return ()
UpdSpotTile lid ts -> do
updateSalter lid ts
cops <- getsState scops
let lvl = (EM.! lid) . sdungeon $ oldState
affects (p, toTile) =
let fromTile = lvl `at` p
in tileChangeAffectsBfs cops fromTile toTile
bs = map affects ts
when (or bs) $ invalidateBfsLid lid
UpdLoseTile lid ts -> do
updateSalter lid ts
invalidateBfsLid lid -- from known to unknown tiles
UpdSpotEntry{} -> return ()
UpdLoseEntry{} -> return ()
UpdAlterSmell{} -> return ()
UpdSpotSmell{} -> return ()
UpdLoseSmell{} -> return ()
UpdTimeItem{} -> return ()
UpdAgeGame{} -> return ()
UpdUnAgeGame{} -> return ()
UpdDiscover _ iid _ _ -> do
item <- getsState $ getItemBody iid
case jkind item of
IdentityObvious _ik -> discoverAspect iid
IdentityCovered ix _ik ->
if ix `EM.notMember` sdiscoKind oldState
then discoverKindAndAspect ix
else discoverAspect iid
UpdCover _ iid _ _ -> do
item <- getsState $ getItemBody iid
newState <- getState
case jkind item of
IdentityObvious _ik -> coverAspect iid
IdentityCovered ix _ik ->
if ix `EM.member` sdiscoKind newState
then coverAspectAndKind ix
else coverAspect iid
UpdDiscoverKind _c ix _ik -> discoverKind ix
UpdCoverKind _c ix _ik -> coverKind ix
UpdDiscoverAspect _c iid _arItem -> discoverAspect iid
UpdCoverAspect _c iid _arItem -> coverAspect iid
UpdDiscoverServer{} -> error "server command leaked to client"
UpdCoverServer{} -> error "server command leaked to client"
UpdPerception lid outPer inPer -> perception lid outPer inPer
UpdRestart side sfper _ scurChal soptionsNew srandom -> do
COps{cocave} <- getsState scops
fact <- getsState $ (EM.! side) . sfactionD
snxtChal <- getsClient snxtChal
smarkSuspect <- getsClient smarkSuspect
stabs <- getsClient stabs
soptionsOld <- getsClient soptions
let h lvl = CK.clabyrinth (okind cocave $ lkind lvl)
&& not (fhasGender $ gkind fact)
-- Not to burrow through a labyrinth instead of leaving it for
-- the human player and to prevent AI losing time there instead
-- of congregating at exits.
sexplored <- getsState $ EM.keysSet . EM.filter h . sdungeon
let cli = emptyStateClient side
putClient cli { sexplored
-- , sundo = [UpdAtomic cmd]
, sfper
, srandom
, scurChal
, snxtChal
, smarkSuspect
, soptions =
soptionsNew {snoAnim = -- persist @snoAnim@ between games
snoAnim soptionsOld `mplus` snoAnim soptionsNew}
, stabs }
salter <- getsState createSalter
modifyClient $ \cli1 -> cli1 {salter}
updateInMeleeInDungeon
UpdRestartServer{} -> return ()
UpdResume _side sfperNew -> do
#ifdef WITH_EXPENSIVE_ASSERTIONS
sfperOld <- getsClient sfper
let !_A = assert (sfperNew == sfperOld
`blame` (_side, sfperNew, sfperOld)) ()
#endif
modifyClient $ \cli -> cli {sfper = sfperNew} -- just in case
salter <- getsState createSalter -- because space saved by not storing it
modifyClient $ \cli -> cli {salter}
UpdResumeServer{} -> return ()
UpdKillExit _fid -> killExit
UpdWriteSave -> saveClient
UpdHearFid{} -> return ()
UpdMuteMessages{} -> return () | 9,316 | false | false | 43 | 22 | 2,506 | 2,453 | 1,184 | 1,269 | null | null |
garetxe/cabal | Cabal/Distribution/Simple/Setup.hs | bsd-3-clause | isAllowNewer :: AllowNewer -> Bool
isAllowNewer AllowNewerNone = False | 74 | isAllowNewer :: AllowNewer -> Bool
isAllowNewer AllowNewerNone = False | 74 | isAllowNewer AllowNewerNone = False | 39 | false | true | 0 | 5 | 12 | 18 | 9 | 9 | null | null |
MaxGabriel/mysql | Database/MySQL/Base.hs | bsd-3-clause | ping :: Connection -> IO ()
ping conn = withConn conn $ \ptr -> mysql_ping ptr >>= check "ping" conn | 100 | ping :: Connection -> IO ()
ping conn = withConn conn $ \ptr -> mysql_ping ptr >>= check "ping" conn | 100 | ping conn = withConn conn $ \ptr -> mysql_ping ptr >>= check "ping" conn | 72 | false | true | 0 | 8 | 19 | 47 | 22 | 25 | null | null |
stevechy/HaskQuery | HaskQuery.hs | bsd-3-clause | selectWithIndex :: (c -> indexValue -> Control.Monad.Trans.Cont.Cont (b -> b) Int) -> Relation a c -> indexValue -> Control.Monad.Trans.Cont.Cont (b -> b) a
selectWithIndex indexAccessor relation indexValue = do
rowId <- indexAccessor (readAuto $ _indices relation) indexValue
return $ (_relation relation) Data.IntMap.Lazy.! rowId | 339 | selectWithIndex :: (c -> indexValue -> Control.Monad.Trans.Cont.Cont (b -> b) Int) -> Relation a c -> indexValue -> Control.Monad.Trans.Cont.Cont (b -> b) a
selectWithIndex indexAccessor relation indexValue = do
rowId <- indexAccessor (readAuto $ _indices relation) indexValue
return $ (_relation relation) Data.IntMap.Lazy.! rowId | 339 | selectWithIndex indexAccessor relation indexValue = do
rowId <- indexAccessor (readAuto $ _indices relation) indexValue
return $ (_relation relation) Data.IntMap.Lazy.! rowId | 182 | false | true | 0 | 11 | 50 | 123 | 64 | 59 | null | null |
abresas/ai | tests/spambase/spambase.hs | mit | percentCorrect :: [ [ Double ] ] -> [ [ Double ] ] -> Double
percentCorrect targets predictions = let
numCorrect = length $ filter ( \(target,prediction) -> (round (head target)) == (round (head prediction)) ) $ zip targets predictions
in (fromIntegral (100 * numCorrect)) / (genericLength targets) | 306 | percentCorrect :: [ [ Double ] ] -> [ [ Double ] ] -> Double
percentCorrect targets predictions = let
numCorrect = length $ filter ( \(target,prediction) -> (round (head target)) == (round (head prediction)) ) $ zip targets predictions
in (fromIntegral (100 * numCorrect)) / (genericLength targets) | 306 | percentCorrect targets predictions = let
numCorrect = length $ filter ( \(target,prediction) -> (round (head target)) == (round (head prediction)) ) $ zip targets predictions
in (fromIntegral (100 * numCorrect)) / (genericLength targets) | 245 | false | true | 0 | 18 | 55 | 133 | 68 | 65 | null | null |
ndmitchell/cmdargs | System/Console/CmdArgs/Implicit/Global.hs | bsd-3-clause | changeBuiltin :: Maybe Builtin_ -> Flag a -> [Flag a]
changeBuiltin Nothing _ = [] | 82 | changeBuiltin :: Maybe Builtin_ -> Flag a -> [Flag a]
changeBuiltin Nothing _ = [] | 82 | changeBuiltin Nothing _ = [] | 28 | false | true | 0 | 8 | 14 | 38 | 18 | 20 | null | null |
mitar/etage | lib/Control/Etage/Internals.hs | lgpl-3.0 | waitForException :: IO a
waitForException = newEmptyMVar >>= takeMVar | 69 | waitForException :: IO a
waitForException = newEmptyMVar >>= takeMVar | 69 | waitForException = newEmptyMVar >>= takeMVar | 44 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
xmonad/xmonad-contrib | tests/RotateSome.hs | bsd-3-clause | -- Total number of elements does not change.
prop_rotate_some_length (Divisor d) (stk :: Stack Int) =
length (integrate stk) == length (integrate $ rotateSome (`isMultOf` d) stk) | 180 | prop_rotate_some_length (Divisor d) (stk :: Stack Int) =
length (integrate stk) == length (integrate $ rotateSome (`isMultOf` d) stk) | 135 | prop_rotate_some_length (Divisor d) (stk :: Stack Int) =
length (integrate stk) == length (integrate $ rotateSome (`isMultOf` d) stk) | 135 | true | false | 0 | 10 | 28 | 62 | 32 | 30 | null | null |
glowe/alphabeta | AlphaBeta.hs | bsd-3-clause | maxValue' (s:xs) v alpha beta
| v' >= beta = v' -- Prune
| otherwise = maxValue' xs v' (max alpha v') beta
where v' = max v $ minValue s alpha beta | 159 | maxValue' (s:xs) v alpha beta
| v' >= beta = v' -- Prune
| otherwise = maxValue' xs v' (max alpha v') beta
where v' = max v $ minValue s alpha beta | 159 | maxValue' (s:xs) v alpha beta
| v' >= beta = v' -- Prune
| otherwise = maxValue' xs v' (max alpha v') beta
where v' = max v $ minValue s alpha beta | 159 | false | false | 1 | 8 | 44 | 79 | 38 | 41 | null | null |
rumaak/room-model | .stack-work/dist/5f9bc736/build/autogen/Paths_my_project.hs | bsd-3-clause | version :: Version
version = Version [0,1,0,0] [] | 49 | version :: Version
version = Version [0,1,0,0] [] | 49 | version = Version [0,1,0,0] [] | 30 | false | true | 0 | 6 | 7 | 38 | 18 | 20 | null | null |
monsanto/hie | Hie/Language/Haskell/Exts/Annotated/ExactPrint.hs | gpl-3.0 | printWarndeprs ps ((ns,str):nsts) = printWd ps ns str nsts
where printWd :: [Pos] -> [Name SrcSpanInfo] -> String -> [([Name SrcSpanInfo], String)] -> EP ()
printWd (p:ps) [] str nsts = printStringAt p (show str) >> printWarndeprs ps nsts
printWd ps [n] str nsts = exactPC n >> printWd ps [] str nsts
printWd (p:ps) (n:ns) str nsts = exactPC n >> printStringAt p "," >> printWd ps ns str nsts | 427 | printWarndeprs ps ((ns,str):nsts) = printWd ps ns str nsts
where printWd :: [Pos] -> [Name SrcSpanInfo] -> String -> [([Name SrcSpanInfo], String)] -> EP ()
printWd (p:ps) [] str nsts = printStringAt p (show str) >> printWarndeprs ps nsts
printWd ps [n] str nsts = exactPC n >> printWd ps [] str nsts
printWd (p:ps) (n:ns) str nsts = exactPC n >> printStringAt p "," >> printWd ps ns str nsts | 427 | printWarndeprs ps ((ns,str):nsts) = printWd ps ns str nsts
where printWd :: [Pos] -> [Name SrcSpanInfo] -> String -> [([Name SrcSpanInfo], String)] -> EP ()
printWd (p:ps) [] str nsts = printStringAt p (show str) >> printWarndeprs ps nsts
printWd ps [n] str nsts = exactPC n >> printWd ps [] str nsts
printWd (p:ps) (n:ns) str nsts = exactPC n >> printStringAt p "," >> printWd ps ns str nsts | 427 | false | false | 1 | 13 | 105 | 226 | 110 | 116 | null | null |
gafiatulin/codewars | src/1 kyu/MicroLens.hs | mit | -- | A prism which focuses on the right branch of an Either
_Right :: Prism (Either x a) (Either x b) a b
_Right = rmap (either (pure . Left) (fmap Right)) . right' | 164 | _Right :: Prism (Either x a) (Either x b) a b
_Right = rmap (either (pure . Left) (fmap Right)) . right' | 104 | _Right = rmap (either (pure . Left) (fmap Right)) . right' | 58 | true | true | 0 | 9 | 34 | 71 | 34 | 37 | null | null |
Tener/deeplearning-thesis | src/gg-exp5.hs | bsd-3-clause | dbnMatlabOpts = Just (def {dbnSizes = [750], numEpochs = 15, implementation = Matlab}) | 86 | dbnMatlabOpts = Just (def {dbnSizes = [750], numEpochs = 15, implementation = Matlab}) | 86 | dbnMatlabOpts = Just (def {dbnSizes = [750], numEpochs = 15, implementation = Matlab}) | 86 | false | false | 1 | 9 | 12 | 39 | 21 | 18 | null | null |
pparkkin/eta | compiler/ETA/Specialise/Rules.hs | bsd-3-clause | -------------
match_co :: RuleMatchEnv
-> RuleSubst
-> Coercion
-> Coercion
-> Maybe RuleSubst
match_co renv subst (CoVarCo cv) co
= match_var renv subst cv (Coercion co) | 208 | match_co :: RuleMatchEnv
-> RuleSubst
-> Coercion
-> Coercion
-> Maybe RuleSubst
match_co renv subst (CoVarCo cv) co
= match_var renv subst cv (Coercion co) | 194 | match_co renv subst (CoVarCo cv) co
= match_var renv subst cv (Coercion co) | 77 | true | true | 0 | 9 | 63 | 61 | 30 | 31 | null | null |
tolysz/prepare-ghcjs | spec-lts8/cabal/cabal-install/Distribution/Client/Setup.hs | bsd-3-clause | fetchCommand :: CommandUI FetchFlags
fetchCommand = CommandUI {
commandName = "fetch",
commandSynopsis = "Downloads packages for later installation.",
commandUsage = usageAlternatives "fetch" [ "[FLAGS] PACKAGES"
],
commandDescription = Just $ \_ ->
"Note that it currently is not possible to fetch the dependencies for a\n"
++ "package in the current directory.\n",
commandNotes = Nothing,
commandDefaultFlags = defaultFetchFlags,
commandOptions = \ showOrParseArgs -> [
optionVerbosity fetchVerbosity (\v flags -> flags { fetchVerbosity = v })
-- , option "o" ["output"]
-- "Put the package(s) somewhere specific rather than the usual cache."
-- fetchOutput (\v flags -> flags { fetchOutput = v })
-- (reqArgFlag "PATH")
, option [] ["dependencies", "deps"]
"Resolve and fetch dependencies (default)"
fetchDeps (\v flags -> flags { fetchDeps = v })
trueArg
, option [] ["no-dependencies", "no-deps"]
"Ignore dependencies"
fetchDeps (\v flags -> flags { fetchDeps = v })
falseArg
, option [] ["dry-run"]
"Do not install anything, only print what would be installed."
fetchDryRun (\v flags -> flags { fetchDryRun = v })
trueArg
] ++
optionSolver fetchSolver (\v flags -> flags { fetchSolver = v }) :
optionSolverFlags showOrParseArgs
fetchMaxBackjumps (\v flags -> flags { fetchMaxBackjumps = v })
fetchReorderGoals (\v flags -> flags { fetchReorderGoals = v })
fetchIndependentGoals (\v flags -> flags { fetchIndependentGoals = v })
fetchShadowPkgs (\v flags -> flags { fetchShadowPkgs = v })
fetchStrongFlags (\v flags -> flags { fetchStrongFlags = v })
} | 2,061 | fetchCommand :: CommandUI FetchFlags
fetchCommand = CommandUI {
commandName = "fetch",
commandSynopsis = "Downloads packages for later installation.",
commandUsage = usageAlternatives "fetch" [ "[FLAGS] PACKAGES"
],
commandDescription = Just $ \_ ->
"Note that it currently is not possible to fetch the dependencies for a\n"
++ "package in the current directory.\n",
commandNotes = Nothing,
commandDefaultFlags = defaultFetchFlags,
commandOptions = \ showOrParseArgs -> [
optionVerbosity fetchVerbosity (\v flags -> flags { fetchVerbosity = v })
-- , option "o" ["output"]
-- "Put the package(s) somewhere specific rather than the usual cache."
-- fetchOutput (\v flags -> flags { fetchOutput = v })
-- (reqArgFlag "PATH")
, option [] ["dependencies", "deps"]
"Resolve and fetch dependencies (default)"
fetchDeps (\v flags -> flags { fetchDeps = v })
trueArg
, option [] ["no-dependencies", "no-deps"]
"Ignore dependencies"
fetchDeps (\v flags -> flags { fetchDeps = v })
falseArg
, option [] ["dry-run"]
"Do not install anything, only print what would be installed."
fetchDryRun (\v flags -> flags { fetchDryRun = v })
trueArg
] ++
optionSolver fetchSolver (\v flags -> flags { fetchSolver = v }) :
optionSolverFlags showOrParseArgs
fetchMaxBackjumps (\v flags -> flags { fetchMaxBackjumps = v })
fetchReorderGoals (\v flags -> flags { fetchReorderGoals = v })
fetchIndependentGoals (\v flags -> flags { fetchIndependentGoals = v })
fetchShadowPkgs (\v flags -> flags { fetchShadowPkgs = v })
fetchStrongFlags (\v flags -> flags { fetchStrongFlags = v })
} | 2,061 | fetchCommand = CommandUI {
commandName = "fetch",
commandSynopsis = "Downloads packages for later installation.",
commandUsage = usageAlternatives "fetch" [ "[FLAGS] PACKAGES"
],
commandDescription = Just $ \_ ->
"Note that it currently is not possible to fetch the dependencies for a\n"
++ "package in the current directory.\n",
commandNotes = Nothing,
commandDefaultFlags = defaultFetchFlags,
commandOptions = \ showOrParseArgs -> [
optionVerbosity fetchVerbosity (\v flags -> flags { fetchVerbosity = v })
-- , option "o" ["output"]
-- "Put the package(s) somewhere specific rather than the usual cache."
-- fetchOutput (\v flags -> flags { fetchOutput = v })
-- (reqArgFlag "PATH")
, option [] ["dependencies", "deps"]
"Resolve and fetch dependencies (default)"
fetchDeps (\v flags -> flags { fetchDeps = v })
trueArg
, option [] ["no-dependencies", "no-deps"]
"Ignore dependencies"
fetchDeps (\v flags -> flags { fetchDeps = v })
falseArg
, option [] ["dry-run"]
"Do not install anything, only print what would be installed."
fetchDryRun (\v flags -> flags { fetchDryRun = v })
trueArg
] ++
optionSolver fetchSolver (\v flags -> flags { fetchSolver = v }) :
optionSolverFlags showOrParseArgs
fetchMaxBackjumps (\v flags -> flags { fetchMaxBackjumps = v })
fetchReorderGoals (\v flags -> flags { fetchReorderGoals = v })
fetchIndependentGoals (\v flags -> flags { fetchIndependentGoals = v })
fetchShadowPkgs (\v flags -> flags { fetchShadowPkgs = v })
fetchStrongFlags (\v flags -> flags { fetchStrongFlags = v })
} | 2,024 | false | true | 0 | 16 | 738 | 390 | 224 | 166 | null | null |
rsasse/tamarin-prover | lib/utils/src/Logic/FOL.hs | gpl-3.0 | pdnf :: Formula a s v -> Disj (Conj (Formula a s v))
pdnf (Con Or p q) = mappend (pdnf p) (pdnf q) | 108 | pdnf :: Formula a s v -> Disj (Conj (Formula a s v))
pdnf (Con Or p q) = mappend (pdnf p) (pdnf q) | 108 | pdnf (Con Or p q) = mappend (pdnf p) (pdnf q) | 55 | false | true | 0 | 10 | 33 | 71 | 34 | 37 | null | null |
bergmark/purescript | psci/Main.hs | mit | options :: P.Options
options = P.Options False True False True Nothing True Nothing [] [] False | 95 | options :: P.Options
options = P.Options False True False True Nothing True Nothing [] [] False | 95 | options = P.Options False True False True Nothing True Nothing [] [] False | 74 | false | true | 0 | 7 | 15 | 46 | 21 | 25 | null | null |
ribag/ganeti-experiments | src/Ganeti/HTools/Node.hs | gpl-2.0 | -- | Changes the alias.
--
-- This is used only during the building of the data structures.
setAlias :: Node -> String -> Node
setAlias t s = t { alias = s } | 157 | setAlias :: Node -> String -> Node
setAlias t s = t { alias = s } | 65 | setAlias t s = t { alias = s } | 30 | true | true | 0 | 8 | 34 | 44 | 22 | 22 | null | null |
gsnewmark/cis194 | src/Cis194/Week2/Lecture.hs | apache-2.0 | checkFav :: Person -> String
checkFav (Person n _ SealingWax) = n ++ ", you're my kind of person!" | 98 | checkFav :: Person -> String
checkFav (Person n _ SealingWax) = n ++ ", you're my kind of person!" | 98 | checkFav (Person n _ SealingWax) = n ++ ", you're my kind of person!" | 69 | false | true | 0 | 7 | 18 | 32 | 16 | 16 | null | null |
wizzup/advent_of_code | 2019/haskell/exe/Day11.hs | mit | nextPoint (x,y) West LeftT = ((x,y-1), South) | 47 | nextPoint (x,y) West LeftT = ((x,y-1), South) | 47 | nextPoint (x,y) West LeftT = ((x,y-1), South) | 47 | false | false | 0 | 7 | 8 | 35 | 20 | 15 | null | null |
robdockins/canonical-lf | Extrinsic.hs | bsd-3-clause | tt :: LiftClosed γ => M (LF γ TERM)
tt = tmConst "tt" | 53 | tt :: LiftClosed γ => M (LF γ TERM)
tt = tmConst "tt" | 53 | tt = tmConst "tt" | 17 | false | true | 0 | 9 | 12 | 37 | 16 | 21 | null | null |
richardfontana/postmaster | Postmaster/FSM/DataHandler.hs | gpl-3.0 | getDataHandler :: Smtpd DataHandler
getDataHandler = dataHandler getVar_ >>= \(DH f) -> return f | 96 | getDataHandler :: Smtpd DataHandler
getDataHandler = dataHandler getVar_ >>= \(DH f) -> return f | 96 | getDataHandler = dataHandler getVar_ >>= \(DH f) -> return f | 60 | false | true | 0 | 8 | 13 | 35 | 17 | 18 | null | null |
brendanhay/gogol | gogol-appengine/gen/Network/Google/AppEngine/Types/Product.hs | mpl-2.0 | -- | MIME type used to serve all files served by this handler.Defaults to
-- file-specific MIME types, which are derived from each file\'s filename
-- extension.
sfhMimeType :: Lens' StaticFilesHandler (Maybe Text)
sfhMimeType
= lens _sfhMimeType (\ s a -> s{_sfhMimeType = a}) | 279 | sfhMimeType :: Lens' StaticFilesHandler (Maybe Text)
sfhMimeType
= lens _sfhMimeType (\ s a -> s{_sfhMimeType = a}) | 117 | sfhMimeType
= lens _sfhMimeType (\ s a -> s{_sfhMimeType = a}) | 64 | true | true | 1 | 9 | 45 | 54 | 27 | 27 | null | null |
Mic92/eidolon | Helper.hs | agpl-3.0 | reverseLookup :: Eq b => b -> [(a, b)] -> Maybe a
reverseLookup s ((x, y):zs)
| s == y = Just x
| s /= y = reverseLookup s zs
| otherwise = Nothing | 159 | reverseLookup :: Eq b => b -> [(a, b)] -> Maybe a
reverseLookup s ((x, y):zs)
| s == y = Just x
| s /= y = reverseLookup s zs
| otherwise = Nothing | 159 | reverseLookup s ((x, y):zs)
| s == y = Just x
| s /= y = reverseLookup s zs
| otherwise = Nothing | 109 | false | true | 2 | 9 | 46 | 95 | 47 | 48 | null | null |
CulpaBS/wbBach | src/Futhark/Representation/Primitive.hs | bsd-3-clause | -- | Left-shift.
doShl :: IntValue -> IntValue -> IntValue
doShl v1 v2 = intValue (intValueType v1) $ intToInt64 v1 `shiftL` intToInt v2 | 136 | doShl :: IntValue -> IntValue -> IntValue
doShl v1 v2 = intValue (intValueType v1) $ intToInt64 v1 `shiftL` intToInt v2 | 119 | doShl v1 v2 = intValue (intValueType v1) $ intToInt64 v1 `shiftL` intToInt v2 | 77 | true | true | 0 | 9 | 22 | 55 | 26 | 29 | null | null |
rvion/ride | twitch-cast/src/Types.hs | bsd-3-clause | jsToS :: ToJSON a => a -> LbsByteString
jsToS = js_encode . toJSON | 66 | jsToS :: ToJSON a => a -> LbsByteString
jsToS = js_encode . toJSON | 66 | jsToS = js_encode . toJSON | 26 | false | true | 0 | 6 | 12 | 26 | 13 | 13 | null | null |
michalkonecny/polypaver | src/Numeric/ER/Misc.hs | bsd-3-clause | allPairsCombinationsEvenOdd ::
[(k,(v,v))] {-^ the first value is even, the second odd -} ->
([[(k,v)]], [[(k,v)]])
allPairsCombinationsEvenOdd [] = ([[]], []) | 168 | allPairsCombinationsEvenOdd ::
[(k,(v,v))] {-^ the first value is even, the second odd -} ->
([[(k,v)]], [[(k,v)]])
allPairsCombinationsEvenOdd [] = ([[]], []) | 168 | allPairsCombinationsEvenOdd [] = ([[]], []) | 43 | false | true | 0 | 9 | 29 | 79 | 49 | 30 | null | null |
caasi/spj-book-student-1992 | src/Language.hs | bsd-3-clause | nonRecursive = False | 20 | nonRecursive = False | 20 | nonRecursive = False | 20 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
carliros/Simple-San-Simon-Functional-Web-Browser | src/Parser/ParserHTML.hs | bsd-3-clause | -- parser para atributos
pValor :: Parser String
pValor = pDeLimitarCon (pSym '"') (pTextoRestringido "\"") | 107 | pValor :: Parser String
pValor = pDeLimitarCon (pSym '"') (pTextoRestringido "\"") | 82 | pValor = pDeLimitarCon (pSym '"') (pTextoRestringido "\"") | 58 | true | true | 0 | 7 | 14 | 32 | 16 | 16 | null | null |
ocharles/hackage-server | Distribution/Server/Features/Core/Backup.hs | bsd-3-clause | updatePackages :: PartialIndex -> RestoreBackup PackagesState
updatePackages accum@(PartialIndex packageMap updatelog) = RestoreBackup {
restoreEntry = \entry -> do
accum' <- doPackageImport accum entry
return (updatePackages accum')
, restoreFinalize = do
results <- mapM partialToFullPkg (Map.toList packageMap)
return $ PackagesState (PackageIndex.fromList results) updatelog
} | 412 | updatePackages :: PartialIndex -> RestoreBackup PackagesState
updatePackages accum@(PartialIndex packageMap updatelog) = RestoreBackup {
restoreEntry = \entry -> do
accum' <- doPackageImport accum entry
return (updatePackages accum')
, restoreFinalize = do
results <- mapM partialToFullPkg (Map.toList packageMap)
return $ PackagesState (PackageIndex.fromList results) updatelog
} | 412 | updatePackages accum@(PartialIndex packageMap updatelog) = RestoreBackup {
restoreEntry = \entry -> do
accum' <- doPackageImport accum entry
return (updatePackages accum')
, restoreFinalize = do
results <- mapM partialToFullPkg (Map.toList packageMap)
return $ PackagesState (PackageIndex.fromList results) updatelog
} | 350 | false | true | 0 | 13 | 74 | 115 | 56 | 59 | null | null |
codemac/yi-editor | src/Yi/Config/Default.hs | gpl-2.0 | defaultCuaConfig = toCuaStyleConfig defaultConfig | 49 | defaultCuaConfig = toCuaStyleConfig defaultConfig | 49 | defaultCuaConfig = toCuaStyleConfig defaultConfig | 49 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
solidsnack/taskl | System/TaskL/Compiler.hs | bsd-3-clause | ann :: Bash.Statement () -> Bash.Annotated ()
ann stmt = Bash.Annotated () stmt | 85 | ann :: Bash.Statement () -> Bash.Annotated ()
ann stmt = Bash.Annotated () stmt | 85 | ann stmt = Bash.Annotated () stmt | 39 | false | true | 0 | 7 | 18 | 41 | 19 | 22 | null | null |
rueshyna/gogol | gogol-shopping-content/gen/Network/Google/Resource/Content/Accountstatuses/List.hs | mpl-2.0 | -- | The maximum number of account statuses to return in the response, used
-- for paging.
acc3MaxResults :: Lens' AccountstatusesList (Maybe Word32)
acc3MaxResults
= lens _acc3MaxResults
(\ s a -> s{_acc3MaxResults = a})
. mapping _Coerce | 253 | acc3MaxResults :: Lens' AccountstatusesList (Maybe Word32)
acc3MaxResults
= lens _acc3MaxResults
(\ s a -> s{_acc3MaxResults = a})
. mapping _Coerce | 162 | acc3MaxResults
= lens _acc3MaxResults
(\ s a -> s{_acc3MaxResults = a})
. mapping _Coerce | 103 | true | true | 0 | 10 | 50 | 56 | 29 | 27 | null | null |
brendanhay/gogol | gogol-healthcare/gen/Network/Google/Resource/Healthcare/Projects/Locations/DataSets/Hl7V2Stores/Messages/List.hs | mpl-2.0 | -- | Restricts messages returned to those matching a filter. The following
-- syntax is available: * A string field value can be written as text
-- inside quotation marks, for example \`\"query text\"\`. The only valid
-- relational operation for text fields is equality (\`=\`), where text is
-- searched within the field, rather than having the field be equal to the
-- text. For example, \`\"Comment = great\"\` returns messages with
-- \`great\` in the comment field. * A number field value can be written as
-- an integer, a decimal, or an exponential. The valid relational operators
-- for number fields are the equality operator (\`=\`), along with the less
-- than\/greater than operators (\`\<\`, \`\<=\`, \`>\`, \`>=\`). Note that
-- there is no inequality (\`!=\`) operator. You can prepend the \`NOT\`
-- operator to an expression to negate it. * A date field value must be
-- written in \`yyyy-mm-dd\` form. Fields with date and time use the
-- RFC3339 time format. Leading zeros are required for one-digit months and
-- days. The valid relational operators for date fields are the equality
-- operator (\`=\`) , along with the less than\/greater than operators
-- (\`\<\`, \`\<=\`, \`>\`, \`>=\`). Note that there is no inequality
-- (\`!=\`) operator. You can prepend the \`NOT\` operator to an expression
-- to negate it. * Multiple field query expressions can be combined in one
-- query by adding \`AND\` or \`OR\` operators between the expressions. If
-- a boolean operator appears within a quoted string, it is not treated as
-- special, it\'s just another part of the character string to be matched.
-- You can prepend the \`NOT\` operator to an expression to negate it.
-- Fields\/functions available for filtering are: * \`message_type\`, from
-- the MSH-9.1 field. For example, \`NOT message_type = \"ADT\"\`. *
-- \`send_date\` or \`sendDate\`, the YYYY-MM-DD date the message was sent
-- in the dataset\'s time_zone, from the MSH-7 segment. For example,
-- \`send_date \< \"2017-01-02\"\`. * \`send_time\`, the timestamp when the
-- message was sent, using the RFC3339 time format for comparisons, from
-- the MSH-7 segment. For example, \`send_time \<
-- \"2017-01-02T00:00:00-05:00\"\`. * \`create_time\`, the timestamp when
-- the message was created in the HL7v2 store. Use the RFC3339 time format
-- for comparisons. For example, \`create_time \<
-- \"2017-01-02T00:00:00-05:00\"\`. * \`send_facility\`, the care center
-- that the message came from, from the MSH-4 segment. For example,
-- \`send_facility = \"ABC\"\`. * \`PatientId(value, type)\`, which matches
-- if the message lists a patient having an ID of the given value and type
-- in the PID-2, PID-3, or PID-4 segments. For example,
-- \`PatientId(\"123456\", \"MRN\")\`. * \`labels.x\`, a string value of
-- the label with key \`x\` as set using the Message.labels map. For
-- example, \`labels.\"priority\"=\"high\"\`. The operator \`:*\` can be
-- used to assert the existence of a label. For example,
-- \`labels.\"priority\":*\`.
pldshvsmlFilter :: Lens' ProjectsLocationsDataSetsHl7V2StoresMessagesList (Maybe Text)
pldshvsmlFilter
= lens _pldshvsmlFilter
(\ s a -> s{_pldshvsmlFilter = a}) | 3,197 | pldshvsmlFilter :: Lens' ProjectsLocationsDataSetsHl7V2StoresMessagesList (Maybe Text)
pldshvsmlFilter
= lens _pldshvsmlFilter
(\ s a -> s{_pldshvsmlFilter = a}) | 169 | pldshvsmlFilter
= lens _pldshvsmlFilter
(\ s a -> s{_pldshvsmlFilter = a}) | 82 | true | true | 0 | 9 | 507 | 90 | 67 | 23 | null | null |
othercriteria/blaze | Bonawitz_3_19a.hs | mit | main :: IO ()
main = do
s <- readFile "cluster.dat"
let paramLocs = [ ([],"mu"), ([],"sigma") ]
run (buildMachine s) 2000 [ trace paramLocs, burnin 500 $ dump paramLocs ] | 177 | main :: IO ()
main = do
s <- readFile "cluster.dat"
let paramLocs = [ ([],"mu"), ([],"sigma") ]
run (buildMachine s) 2000 [ trace paramLocs, burnin 500 $ dump paramLocs ] | 177 | main = do
s <- readFile "cluster.dat"
let paramLocs = [ ([],"mu"), ([],"sigma") ]
run (buildMachine s) 2000 [ trace paramLocs, burnin 500 $ dump paramLocs ] | 163 | false | true | 0 | 13 | 37 | 98 | 47 | 51 | null | null |
ku-fpg/sunroof-compiler | Language/Sunroof/JavaScript.hs | bsd-3-clause | showIdx :: Expr -> Expr -> String
showIdx a (Lit x) | Just n <- isGoodSelectName x
= showExpr True a ++ "." ++ n | 130 | showIdx :: Expr -> Expr -> String
showIdx a (Lit x) | Just n <- isGoodSelectName x
= showExpr True a ++ "." ++ n | 130 | showIdx a (Lit x) | Just n <- isGoodSelectName x
= showExpr True a ++ "." ++ n | 96 | false | true | 0 | 9 | 42 | 59 | 27 | 32 | null | null |
IreneKnapp/direct-opengl | Graphics/Rendering/OpenGL/GL/Fog.hs | bsd-3-clause | marshalFogParameter :: FogParameter -> GLenum
marshalFogParameter x = case x of
FogIndex -> gl_FOG_INDEX
FogDensity -> gl_FOG_DENSITY
FogStart -> gl_FOG_START
FogEnd -> gl_FOG_END
FogMode -> gl_FOG_MODE
FogColor -> gl_FOG_COLOR
FogCoordSrc -> gl_FOG_COORD_SRC
-- TODO: Use FOG_DISTANCE_MODE_NV from NV_fog_distance extension
FogDistanceMode -> 0x855a
-------------------------------------------------------------------------------- | 459 | marshalFogParameter :: FogParameter -> GLenum
marshalFogParameter x = case x of
FogIndex -> gl_FOG_INDEX
FogDensity -> gl_FOG_DENSITY
FogStart -> gl_FOG_START
FogEnd -> gl_FOG_END
FogMode -> gl_FOG_MODE
FogColor -> gl_FOG_COLOR
FogCoordSrc -> gl_FOG_COORD_SRC
-- TODO: Use FOG_DISTANCE_MODE_NV from NV_fog_distance extension
FogDistanceMode -> 0x855a
-------------------------------------------------------------------------------- | 459 | marshalFogParameter x = case x of
FogIndex -> gl_FOG_INDEX
FogDensity -> gl_FOG_DENSITY
FogStart -> gl_FOG_START
FogEnd -> gl_FOG_END
FogMode -> gl_FOG_MODE
FogColor -> gl_FOG_COLOR
FogCoordSrc -> gl_FOG_COORD_SRC
-- TODO: Use FOG_DISTANCE_MODE_NV from NV_fog_distance extension
FogDistanceMode -> 0x855a
-------------------------------------------------------------------------------- | 413 | false | true | 0 | 7 | 70 | 72 | 37 | 35 | null | null |
headprogrammingczar/cabal | cabal-install/Distribution/Solver/Modular/Preference.hs | bsd-3-clause | -- | Enforce ghc's single instance restriction
--
-- From the solver's perspective, this means that for any package instance
-- (that is, package name + package version) there can be at most one qualified
-- goal resolving to that instance (there may be other goals _linking_ to that
-- instance however).
enforceSingleInstanceRestriction :: Tree QGoalReason -> Tree QGoalReason
enforceSingleInstanceRestriction = (`runReader` M.empty) . cata go
where
go :: TreeF QGoalReason (EnforceSIR (Tree QGoalReason)) -> EnforceSIR (Tree QGoalReason)
-- We just verify package choices.
go (PChoiceF qpn gr cs) =
PChoice qpn gr <$> sequence (P.mapWithKey (goP qpn) cs)
go _otherwise =
innM _otherwise
-- The check proper
goP :: QPN -> POption -> EnforceSIR (Tree QGoalReason) -> EnforceSIR (Tree QGoalReason)
goP qpn@(Q _ pn) (POption i linkedTo) r = do
let inst = PI pn i
env <- ask
case (linkedTo, M.lookup inst env) of
(Just _, _) ->
-- For linked nodes we don't check anything
r
(Nothing, Nothing) ->
-- Not linked, not already used
local (M.insert inst qpn) r
(Nothing, Just qpn') -> do
-- Not linked, already used. This is an error
return $ Fail (CS.union (varToConflictSet (P qpn)) (varToConflictSet (P qpn'))) MultipleInstances | 1,370 | enforceSingleInstanceRestriction :: Tree QGoalReason -> Tree QGoalReason
enforceSingleInstanceRestriction = (`runReader` M.empty) . cata go
where
go :: TreeF QGoalReason (EnforceSIR (Tree QGoalReason)) -> EnforceSIR (Tree QGoalReason)
-- We just verify package choices.
go (PChoiceF qpn gr cs) =
PChoice qpn gr <$> sequence (P.mapWithKey (goP qpn) cs)
go _otherwise =
innM _otherwise
-- The check proper
goP :: QPN -> POption -> EnforceSIR (Tree QGoalReason) -> EnforceSIR (Tree QGoalReason)
goP qpn@(Q _ pn) (POption i linkedTo) r = do
let inst = PI pn i
env <- ask
case (linkedTo, M.lookup inst env) of
(Just _, _) ->
-- For linked nodes we don't check anything
r
(Nothing, Nothing) ->
-- Not linked, not already used
local (M.insert inst qpn) r
(Nothing, Just qpn') -> do
-- Not linked, already used. This is an error
return $ Fail (CS.union (varToConflictSet (P qpn)) (varToConflictSet (P qpn'))) MultipleInstances | 1,064 | enforceSingleInstanceRestriction = (`runReader` M.empty) . cata go
where
go :: TreeF QGoalReason (EnforceSIR (Tree QGoalReason)) -> EnforceSIR (Tree QGoalReason)
-- We just verify package choices.
go (PChoiceF qpn gr cs) =
PChoice qpn gr <$> sequence (P.mapWithKey (goP qpn) cs)
go _otherwise =
innM _otherwise
-- The check proper
goP :: QPN -> POption -> EnforceSIR (Tree QGoalReason) -> EnforceSIR (Tree QGoalReason)
goP qpn@(Q _ pn) (POption i linkedTo) r = do
let inst = PI pn i
env <- ask
case (linkedTo, M.lookup inst env) of
(Just _, _) ->
-- For linked nodes we don't check anything
r
(Nothing, Nothing) ->
-- Not linked, not already used
local (M.insert inst qpn) r
(Nothing, Just qpn') -> do
-- Not linked, already used. This is an error
return $ Fail (CS.union (varToConflictSet (P qpn)) (varToConflictSet (P qpn'))) MultipleInstances | 991 | true | true | 13 | 12 | 343 | 363 | 193 | 170 | null | null |
BakerSmithA/Turing | src/Syntax/Parser.hs | bsd-3-clause | varDecl :: ParserM Stm
varDecl = do
_ <- lTok "let"
name <- newVarId
_ <- lTok "="
v <- anyValExpr
putM name (PVar (typeOf v))
return (VarDecl name v) | 176 | varDecl :: ParserM Stm
varDecl = do
_ <- lTok "let"
name <- newVarId
_ <- lTok "="
v <- anyValExpr
putM name (PVar (typeOf v))
return (VarDecl name v) | 176 | varDecl = do
_ <- lTok "let"
name <- newVarId
_ <- lTok "="
v <- anyValExpr
putM name (PVar (typeOf v))
return (VarDecl name v) | 153 | false | true | 0 | 11 | 55 | 82 | 36 | 46 | null | null |
oskimura/Lambda | src/Parser.hs | mit | beta var (Apply (Abs v1 m1) m2) n =
beta var m1' n
where
m1' = beta v1 m1 m2
---------------------------------------------------------
-- Parser | 162 | beta var (Apply (Abs v1 m1) m2) n =
beta var m1' n
where
m1' = beta v1 m1 m2
---------------------------------------------------------
-- Parser | 162 | beta var (Apply (Abs v1 m1) m2) n =
beta var m1' n
where
m1' = beta v1 m1 m2
---------------------------------------------------------
-- Parser | 162 | false | false | 2 | 9 | 40 | 65 | 26 | 39 | null | null |
bitemyapp/Haskell-Turtle-Library | src/Turtle/Prelude.hs | bsd-3-clause | -- | Read in a stream's contents strictly
strict :: MonadIO io => Shell Text -> io Text
strict s = liftM Text.unlines (fold s list) | 131 | strict :: MonadIO io => Shell Text -> io Text
strict s = liftM Text.unlines (fold s list) | 89 | strict s = liftM Text.unlines (fold s list) | 43 | true | true | 0 | 7 | 25 | 50 | 23 | 27 | null | null |
mettekou/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | typeSymbolKindCon = pcTyCon False typeSymbolKindConName Nothing [] [] | 69 | typeSymbolKindCon = pcTyCon False typeSymbolKindConName Nothing [] [] | 69 | typeSymbolKindCon = pcTyCon False typeSymbolKindConName Nothing [] [] | 69 | false | false | 0 | 6 | 7 | 21 | 10 | 11 | null | null |
pbl64k/CodeSprints | CodeSprint-2012-01-06-(2)/CountStrings/cs.hs | bsd-2-clause | r = a <|> b <|> sq <|> opt <|> rpt | 34 | r = a <|> b <|> sq <|> opt <|> rpt | 34 | r = a <|> b <|> sq <|> opt <|> rpt | 34 | false | false | 1 | 8 | 10 | 26 | 11 | 15 | null | null |
vdweegen/UvA-Software_Testing | Lab2/Final/Exercises.hs | gpl-3.0 | -- Stronger property => validate content of lists, filtering by this property yields a list
prop_derangement_validate_content :: Positive Integer -> Bool
prop_derangement_validate_content (Positive n) = not $ isDerangement [1..n] [2*n..3*n] | 240 | prop_derangement_validate_content :: Positive Integer -> Bool
prop_derangement_validate_content (Positive n) = not $ isDerangement [1..n] [2*n..3*n] | 148 | prop_derangement_validate_content (Positive n) = not $ isDerangement [1..n] [2*n..3*n] | 86 | true | true | 0 | 8 | 29 | 55 | 28 | 27 | null | null |
jstolarek/ghc | compiler/llvmGen/Llvm/PpLlvm.hs | bsd-3-clause | ppAlloca :: LlvmType -> Int -> SDoc
ppAlloca tp amount =
let amount' = LMLitVar $ LMIntLit (toInteger amount) i32
in text "alloca" <+> ppr tp <> comma <+> ppr amount' | 170 | ppAlloca :: LlvmType -> Int -> SDoc
ppAlloca tp amount =
let amount' = LMLitVar $ LMIntLit (toInteger amount) i32
in text "alloca" <+> ppr tp <> comma <+> ppr amount' | 170 | ppAlloca tp amount =
let amount' = LMLitVar $ LMIntLit (toInteger amount) i32
in text "alloca" <+> ppr tp <> comma <+> ppr amount' | 134 | false | true | 6 | 12 | 34 | 80 | 34 | 46 | null | null |
bsl/GLFW-b | Test.hs | bsd-2-clause | test_getJoystickButtons :: IO ()
test_getJoystickButtons =
mapM_ GLFW.getJoystickButtons joysticks | 102 | test_getJoystickButtons :: IO ()
test_getJoystickButtons =
mapM_ GLFW.getJoystickButtons joysticks | 102 | test_getJoystickButtons =
mapM_ GLFW.getJoystickButtons joysticks | 69 | false | true | 0 | 6 | 12 | 23 | 11 | 12 | null | null |
rfranek/duckling | Duckling/Ordinal/Types.hs | bsd-3-clause | isBetween :: Ord a => a -> a -> a -> Bool
isBetween x low high = low <= x && x <= high | 86 | isBetween :: Ord a => a -> a -> a -> Bool
isBetween x low high = low <= x && x <= high | 86 | isBetween x low high = low <= x && x <= high | 44 | false | true | 0 | 8 | 23 | 49 | 24 | 25 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_GEOMETRY_SHADER_INVOCATIONS_OES :: GLenum
gl_GEOMETRY_SHADER_INVOCATIONS_OES = 0x887F | 88 | gl_GEOMETRY_SHADER_INVOCATIONS_OES :: GLenum
gl_GEOMETRY_SHADER_INVOCATIONS_OES = 0x887F | 88 | gl_GEOMETRY_SHADER_INVOCATIONS_OES = 0x887F | 43 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
silky/super-reference | Application.hs | mit | warpSettings :: App -> Settings
warpSettings foundation =
setPort (appPort $ appSettings foundation)
$ setHost (appHost $ appSettings foundation)
$ setOnException (\_req e ->
when (defaultShouldDisplayException e) $ messageLoggerSource
foundation
(appLogger foundation)
$(qLocation >>= liftLoc)
"yesod"
LevelError
(toLogStr $ "Exception from Warp: " ++ show e))
defaultSettings | 477 | warpSettings :: App -> Settings
warpSettings foundation =
setPort (appPort $ appSettings foundation)
$ setHost (appHost $ appSettings foundation)
$ setOnException (\_req e ->
when (defaultShouldDisplayException e) $ messageLoggerSource
foundation
(appLogger foundation)
$(qLocation >>= liftLoc)
"yesod"
LevelError
(toLogStr $ "Exception from Warp: " ++ show e))
defaultSettings | 477 | warpSettings foundation =
setPort (appPort $ appSettings foundation)
$ setHost (appHost $ appSettings foundation)
$ setOnException (\_req e ->
when (defaultShouldDisplayException e) $ messageLoggerSource
foundation
(appLogger foundation)
$(qLocation >>= liftLoc)
"yesod"
LevelError
(toLogStr $ "Exception from Warp: " ++ show e))
defaultSettings | 445 | false | true | 4 | 11 | 146 | 130 | 60 | 70 | null | null |
feliposz/learning-stuff | haskell/learn_chapter8.hs | mit | (.++) :: List a -> List a -> List a
Empty .++ ys = ys | 53 | (.++) :: List a -> List a -> List a
Empty .++ ys = ys | 53 | Empty .++ ys = ys | 17 | false | true | 0 | 7 | 14 | 36 | 17 | 19 | null | null |
meiersi/blaze-builder | benchmarks/LazyByteString.hs | bsd-3-clause | cmpWriteToLib :: [Word8] -> (L.ByteString, L.ByteString)
cmpWriteToLib bs =
-- ( toLazyByteString $ fromWriteList write24bitsBase64 $ chunks3 bs
( toLazyByteString $ encodeBase64 $ S.pack bs
, (`L.Chunk` L.empty) $ encode $ S.pack bs ) | 248 | cmpWriteToLib :: [Word8] -> (L.ByteString, L.ByteString)
cmpWriteToLib bs =
-- ( toLazyByteString $ fromWriteList write24bitsBase64 $ chunks3 bs
( toLazyByteString $ encodeBase64 $ S.pack bs
, (`L.Chunk` L.empty) $ encode $ S.pack bs ) | 248 | cmpWriteToLib bs =
-- ( toLazyByteString $ fromWriteList write24bitsBase64 $ chunks3 bs
( toLazyByteString $ encodeBase64 $ S.pack bs
, (`L.Chunk` L.empty) $ encode $ S.pack bs ) | 191 | false | true | 0 | 9 | 46 | 74 | 41 | 33 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/show_2.hs | mit | primModNatS (Succ x) (Succ (Succ y)) = primModNatS0 x y (primGEqNatS x (Succ y)) | 80 | primModNatS (Succ x) (Succ (Succ y)) = primModNatS0 x y (primGEqNatS x (Succ y)) | 80 | primModNatS (Succ x) (Succ (Succ y)) = primModNatS0 x y (primGEqNatS x (Succ y)) | 80 | false | false | 0 | 9 | 13 | 52 | 24 | 28 | null | null |
marshall-lee/the_iron_searcher | Main.hs | mit | matchLine :: MatchFunc -> Line -> Maybe MatchedLine
matchLine finder (n, line) = (,) n <$> finder line | 102 | matchLine :: MatchFunc -> Line -> Maybe MatchedLine
matchLine finder (n, line) = (,) n <$> finder line | 102 | matchLine finder (n, line) = (,) n <$> finder line | 50 | false | true | 0 | 7 | 17 | 46 | 23 | 23 | null | null |
thelostt/climbu | src/Parser.hs | mit | tokenize ('\'':x:'\'':rest) = CHAR x : tokenize rest | 52 | tokenize ('\'':x:'\'':rest) = CHAR x : tokenize rest | 52 | tokenize ('\'':x:'\'':rest) = CHAR x : tokenize rest | 52 | false | false | 0 | 6 | 7 | 27 | 12 | 15 | null | null |
eddiemonroe/atomspace | opencog/haskell/OpenCog/AtomSpace/Internal.hs | agpl-3.0 | fromRaw :: AtomRaw -> Atom a -> Maybe (Atom a)
fromRaw raw orig = case (raw,orig) of
(Node "ConceptNode" n tv , ConceptNode _ _ ) -> Just $ ConceptNode n
$ fromTVRaw <$> tv
(Node "PredicateNode" n _ , PredicateNode _ ) -> Just $ PredicateNode n
(Link "AndLink" [ar,br] tv , AndLink ao bo _ ) -> do
a <- fromRaw ar ao
b <- fromRaw br bo
Just $ AndLink a b $ fromTVRaw <$> tv
(Link "ListLink" lraw _ , ListLink lorig ) -> do
lnew <- if length lraw == length lorig
then sequence $ zipWith (\raw orig ->
appAtomGen
((<$>) AtomGen . fromRaw raw) orig)
lraw lorig
else Nothing
Just $ ListLink lnew
_ -> Nothing -- undefined
-- Constant with the maximum number of parameters in any type of TV. | 1,002 | fromRaw :: AtomRaw -> Atom a -> Maybe (Atom a)
fromRaw raw orig = case (raw,orig) of
(Node "ConceptNode" n tv , ConceptNode _ _ ) -> Just $ ConceptNode n
$ fromTVRaw <$> tv
(Node "PredicateNode" n _ , PredicateNode _ ) -> Just $ PredicateNode n
(Link "AndLink" [ar,br] tv , AndLink ao bo _ ) -> do
a <- fromRaw ar ao
b <- fromRaw br bo
Just $ AndLink a b $ fromTVRaw <$> tv
(Link "ListLink" lraw _ , ListLink lorig ) -> do
lnew <- if length lraw == length lorig
then sequence $ zipWith (\raw orig ->
appAtomGen
((<$>) AtomGen . fromRaw raw) orig)
lraw lorig
else Nothing
Just $ ListLink lnew
_ -> Nothing -- undefined
-- Constant with the maximum number of parameters in any type of TV. | 1,002 | fromRaw raw orig = case (raw,orig) of
(Node "ConceptNode" n tv , ConceptNode _ _ ) -> Just $ ConceptNode n
$ fromTVRaw <$> tv
(Node "PredicateNode" n _ , PredicateNode _ ) -> Just $ PredicateNode n
(Link "AndLink" [ar,br] tv , AndLink ao bo _ ) -> do
a <- fromRaw ar ao
b <- fromRaw br bo
Just $ AndLink a b $ fromTVRaw <$> tv
(Link "ListLink" lraw _ , ListLink lorig ) -> do
lnew <- if length lraw == length lorig
then sequence $ zipWith (\raw orig ->
appAtomGen
((<$>) AtomGen . fromRaw raw) orig)
lraw lorig
else Nothing
Just $ ListLink lnew
_ -> Nothing -- undefined
-- Constant with the maximum number of parameters in any type of TV. | 955 | false | true | 0 | 19 | 452 | 301 | 146 | 155 | null | null |
jfischoff/hs-mitsuba | tests/Tests/Mitsuba/Types.hs | bsd-3-clause | case_conductor_0_toXML
= actualConductor `assertElement` [xmlQQ|
<bsdf type="conductor">
<string name="material" value="Au"/>
<string name="extEta" value="bk7"/>
<spectrum name="specularReflectance" value="1.0" />
</bsdf>
|] | 256 | case_conductor_0_toXML
= actualConductor `assertElement` [xmlQQ|
<bsdf type="conductor">
<string name="material" value="Au"/>
<string name="extEta" value="bk7"/>
<spectrum name="specularReflectance" value="1.0" />
</bsdf>
|] | 256 | case_conductor_0_toXML
= actualConductor `assertElement` [xmlQQ|
<bsdf type="conductor">
<string name="material" value="Au"/>
<string name="extEta" value="bk7"/>
<spectrum name="specularReflectance" value="1.0" />
</bsdf>
|] | 256 | false | false | 1 | 5 | 50 | 19 | 11 | 8 | null | null |
termite2/tsl | Frontend/Grammar.hs | bsd-3-clause | elabel = EAtLab nopos <$> (reservedOp "@" *> ident) | 56 | elabel = EAtLab nopos <$> (reservedOp "@" *> ident) | 56 | elabel = EAtLab nopos <$> (reservedOp "@" *> ident) | 56 | false | false | 0 | 8 | 13 | 23 | 11 | 12 | null | null |
frantisekfarka/ghc-dsi | compiler/main/DriverPipeline.hs | bsd-3-clause | mkExtraObj :: DynFlags -> Suffix -> String -> IO FilePath
mkExtraObj dflags extn xs
= do cFile <- newTempName dflags extn
oFile <- newTempName dflags "o"
writeFile cFile xs
let rtsDetails = getPackageDetails (pkgState dflags) rtsPackageId
SysTools.runCc dflags
([Option "-c",
FileOption "" cFile,
Option "-o",
FileOption "" oFile]
++ map (FileOption "-I") (includeDirs rtsDetails))
return oFile
-- When linking a binary, we need to create a C main() function that
-- starts everything off. This used to be compiled statically as part
-- of the RTS, but that made it hard to change the -rtsopts setting,
-- so now we generate and compile a main() stub as part of every
-- binary and pass the -rtsopts setting directly to the RTS (#5373)
-- | 897 | mkExtraObj :: DynFlags -> Suffix -> String -> IO FilePath
mkExtraObj dflags extn xs
= do cFile <- newTempName dflags extn
oFile <- newTempName dflags "o"
writeFile cFile xs
let rtsDetails = getPackageDetails (pkgState dflags) rtsPackageId
SysTools.runCc dflags
([Option "-c",
FileOption "" cFile,
Option "-o",
FileOption "" oFile]
++ map (FileOption "-I") (includeDirs rtsDetails))
return oFile
-- When linking a binary, we need to create a C main() function that
-- starts everything off. This used to be compiled statically as part
-- of the RTS, but that made it hard to change the -rtsopts setting,
-- so now we generate and compile a main() stub as part of every
-- binary and pass the -rtsopts setting directly to the RTS (#5373)
-- | 897 | mkExtraObj dflags extn xs
= do cFile <- newTempName dflags extn
oFile <- newTempName dflags "o"
writeFile cFile xs
let rtsDetails = getPackageDetails (pkgState dflags) rtsPackageId
SysTools.runCc dflags
([Option "-c",
FileOption "" cFile,
Option "-o",
FileOption "" oFile]
++ map (FileOption "-I") (includeDirs rtsDetails))
return oFile
-- When linking a binary, we need to create a C main() function that
-- starts everything off. This used to be compiled statically as part
-- of the RTS, but that made it hard to change the -rtsopts setting,
-- so now we generate and compile a main() stub as part of every
-- binary and pass the -rtsopts setting directly to the RTS (#5373)
-- | 839 | false | true | 0 | 12 | 281 | 159 | 76 | 83 | null | null |
spechub/Hets | CSL/Sign.hs | gpl-2.0 | lookupSym :: Sign -> Id -> Bool
lookupSym sig item = Map.member (idToSimpleId item) $ items sig | 95 | lookupSym :: Sign -> Id -> Bool
lookupSym sig item = Map.member (idToSimpleId item) $ items sig | 95 | lookupSym sig item = Map.member (idToSimpleId item) $ items sig | 63 | false | true | 0 | 8 | 16 | 42 | 20 | 22 | null | null |
nilthehuman/cis194 | Homework8.hs | unlicense | -- Wait, no, they want one that goes level-by-level (see next Exercise).
treeFold' :: (a -> [b] -> b) -> [b] -> Tree a -> b
treeFold' f zs (Node x ts) = f x $ map (treeFold' f zs) ts | 182 | treeFold' :: (a -> [b] -> b) -> [b] -> Tree a -> b
treeFold' f zs (Node x ts) = f x $ map (treeFold' f zs) ts | 109 | treeFold' f zs (Node x ts) = f x $ map (treeFold' f zs) ts | 58 | true | true | 0 | 9 | 40 | 85 | 41 | 44 | null | null |
chemist/highlighter | src/Text/Highlighter/Lexers/Haxe.hs | bsd-3-clause | codekeywords' :: TokenMatcher
codekeywords' =
[ tok "\\b(if|else|while|do|for|in|break|continue|return|switch|case|try|catch|throw|null|trace|new|this|super|untyped|cast|callback|here)\\b" (Arbitrary "Keyword" :. Arbitrary "Reserved")
] | 244 | codekeywords' :: TokenMatcher
codekeywords' =
[ tok "\\b(if|else|while|do|for|in|break|continue|return|switch|case|try|catch|throw|null|trace|new|this|super|untyped|cast|callback|here)\\b" (Arbitrary "Keyword" :. Arbitrary "Reserved")
] | 244 | codekeywords' =
[ tok "\\b(if|else|while|do|for|in|break|continue|return|switch|case|try|catch|throw|null|trace|new|this|super|untyped|cast|callback|here)\\b" (Arbitrary "Keyword" :. Arbitrary "Reserved")
] | 214 | false | true | 0 | 10 | 21 | 39 | 17 | 22 | null | null |
IanConnolly/aws-sdk-fork | AWS/EC2/Instance.hs | bsd-3-clause | iar InstanceAttributeRequestUserData = "userData" | 62 | iar InstanceAttributeRequestUserData = "userData" | 62 | iar InstanceAttributeRequestUserData = "userData" | 62 | false | false | 0 | 4 | 16 | 10 | 4 | 6 | null | null |
phischu/fragnix | tests/packages/scotty/Control.Concurrent.Chan.Lifted.hs | bsd-3-clause | -- | Generalized version of 'Chan.readChan'.
readChan :: MonadBase IO m => Chan a -> m a
readChan = liftBase . Chan.readChan | 124 | readChan :: MonadBase IO m => Chan a -> m a
readChan = liftBase . Chan.readChan | 79 | readChan = liftBase . Chan.readChan | 35 | true | true | 1 | 8 | 21 | 44 | 19 | 25 | null | null |
michalkonecny/aern2 | aern2-fun-univariate/src/AERN2/RealFun/UnaryBallFun/Type.hs | bsd-3-clause | lift2withX :: (CN MPBall -> CN MPBall -> CN MPBall -> CN MPBall) -> UnaryBallFun -> UnaryBallFun -> UnaryBallFun
lift2withX op (UnaryBallFun dom1 f1) (UnaryBallFun _dom2 f2) =
UnaryBallFun dom1 (\ x -> op x (f1 x) (f2 x)) | 223 | lift2withX :: (CN MPBall -> CN MPBall -> CN MPBall -> CN MPBall) -> UnaryBallFun -> UnaryBallFun -> UnaryBallFun
lift2withX op (UnaryBallFun dom1 f1) (UnaryBallFun _dom2 f2) =
UnaryBallFun dom1 (\ x -> op x (f1 x) (f2 x)) | 223 | lift2withX op (UnaryBallFun dom1 f1) (UnaryBallFun _dom2 f2) =
UnaryBallFun dom1 (\ x -> op x (f1 x) (f2 x)) | 110 | false | true | 0 | 10 | 40 | 105 | 51 | 54 | null | null |
RossOgilvie/MathPrelude | MathPrelude/Constructions/Complex.hs | gpl-3.0 | -- | Take the conjugate of a complex number, ie negate the imaginary part
conjugate :: Abelian a => Complex a -> Complex a
conjugate (x :+ y) = x :+ negate y | 157 | conjugate :: Abelian a => Complex a -> Complex a
conjugate (x :+ y) = x :+ negate y | 83 | conjugate (x :+ y) = x :+ negate y | 34 | true | true | 0 | 7 | 32 | 46 | 22 | 24 | null | null |
kishoredbn/barrelfish | tools/skate/SkateTypes.hs | mit | builtin_fmt_wr (UInt32) = "PRIu32" | 35 | builtin_fmt_wr (UInt32) = "PRIu32" | 35 | builtin_fmt_wr (UInt32) = "PRIu32" | 35 | false | false | 0 | 6 | 4 | 12 | 6 | 6 | null | null |
DavidEGrayson/update-nix-fetchgit | src/Update/Nix/FetchGit/Utils.hs | bsd-3-clause | deltaToSourcePos :: Delta -> SourcePos
deltaToSourcePos delta = SourcePos line column
where (Directed _ line column _ _) = delta
-- | Extract a named attribute from an attrset. | 194 | deltaToSourcePos :: Delta -> SourcePos
deltaToSourcePos delta = SourcePos line column
where (Directed _ line column _ _) = delta
-- | Extract a named attribute from an attrset. | 194 | deltaToSourcePos delta = SourcePos line column
where (Directed _ line column _ _) = delta
-- | Extract a named attribute from an attrset. | 155 | false | true | 0 | 8 | 46 | 46 | 23 | 23 | null | null |
thedward/haskell-ogdl | Text/OGDL/Parsec.hs | bsd-3-clause | indentSpaceChar = indentSpace <|> indentTab | 43 | indentSpaceChar = indentSpace <|> indentTab | 43 | indentSpaceChar = indentSpace <|> indentTab | 43 | false | false | 0 | 5 | 4 | 10 | 5 | 5 | null | null |
gcampax/ghc | compiler/types/TyCon.hs | bsd-3-clause | primElemRepSizeB Word16ElemRep = 2 | 34 | primElemRepSizeB Word16ElemRep = 2 | 34 | primElemRepSizeB Word16ElemRep = 2 | 34 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
haskell-distributed/distributed-process-client-server | src/Control/Distributed/Process/ManagedProcess/Server.hs | bsd-3-clause | -- | Sends a reply to a 'SendPort' (for use in 'handleRpcChan' et al).
--
-- > replyChan = sendChan
--
replyChan :: (Serializable m) => SendPort m -> m -> Process ()
replyChan = sendChan | 186 | replyChan :: (Serializable m) => SendPort m -> m -> Process ()
replyChan = sendChan | 83 | replyChan = sendChan | 20 | true | true | 0 | 10 | 35 | 46 | 23 | 23 | null | null |
ssaavedra/liquidhaskell | benchmarks/unordered-containers-0.2.1.0/Data/HashMap/Base.hs | bsd-3-clause | updateOrSnocWith :: Eq k => (v -> v -> v) -> k -> v -> A.Array (Leaf k v)
-> A.Array (Leaf k v)
updateOrSnocWith f k0 v0 ary0 = go k0 v0 ary0 0 (A.length ary0)
where
go !k v !ary !i !n
| i >= n = A.run $ do
-- Not found, append to the end.
mary <- A.new_ (n + 1)
A.copy ary 0 mary 0 n
A.write mary n (L k v)
return mary
| otherwise = case A.index ary i of
(L kx y) | k == kx -> A.update ary i (L k (f v y))
| otherwise -> go k v ary (i+1) n
#if __GLASGOW_HASKELL__ >= 700
| 606 | updateOrSnocWith :: Eq k => (v -> v -> v) -> k -> v -> A.Array (Leaf k v)
-> A.Array (Leaf k v)
updateOrSnocWith f k0 v0 ary0 = go k0 v0 ary0 0 (A.length ary0)
where
go !k v !ary !i !n
| i >= n = A.run $ do
-- Not found, append to the end.
mary <- A.new_ (n + 1)
A.copy ary 0 mary 0 n
A.write mary n (L k v)
return mary
| otherwise = case A.index ary i of
(L kx y) | k == kx -> A.update ary i (L k (f v y))
| otherwise -> go k v ary (i+1) n
#if __GLASGOW_HASKELL__ >= 700
| 606 | updateOrSnocWith f k0 v0 ary0 = go k0 v0 ary0 0 (A.length ary0)
where
go !k v !ary !i !n
| i >= n = A.run $ do
-- Not found, append to the end.
mary <- A.new_ (n + 1)
A.copy ary 0 mary 0 n
A.write mary n (L k v)
return mary
| otherwise = case A.index ary i of
(L kx y) | k == kx -> A.update ary i (L k (f v y))
| otherwise -> go k v ary (i+1) n
#if __GLASGOW_HASKELL__ >= 700
| 493 | false | true | 0 | 14 | 250 | 297 | 138 | 159 | null | null |
brendanhay/gogol | gogol-bigtableadmin/gen/Network/Google/Resource/BigtableAdmin/Projects/Instances/PartialUpdateInstance.hs | mpl-2.0 | -- | The unique name of the instance. Values are of the form
-- \`projects\/{project}\/instances\/a-z+[a-z0-9]\`.
pipuiName :: Lens' ProjectsInstancesPartialUpdateInstance Text
pipuiName
= lens _pipuiName (\ s a -> s{_pipuiName = a}) | 235 | pipuiName :: Lens' ProjectsInstancesPartialUpdateInstance Text
pipuiName
= lens _pipuiName (\ s a -> s{_pipuiName = a}) | 121 | pipuiName
= lens _pipuiName (\ s a -> s{_pipuiName = a}) | 58 | true | true | 0 | 9 | 32 | 43 | 23 | 20 | null | null |
eigengrau/hlint | src/Hint/Import.hs | bsd-3-clause | importHint :: ModuHint
importHint _ x = concatMap (wrap . snd) (groupSort
[((fromNamed $ importModule i,importPkg i),i) | i <- universeBi x, not $ importSrc i]) ++
concatMap (\x -> hierarchy x ++ reduce1 x) (universeBi x) ++
multiExport x | 289 | importHint :: ModuHint
importHint _ x = concatMap (wrap . snd) (groupSort
[((fromNamed $ importModule i,importPkg i),i) | i <- universeBi x, not $ importSrc i]) ++
concatMap (\x -> hierarchy x ++ reduce1 x) (universeBi x) ++
multiExport x | 289 | importHint _ x = concatMap (wrap . snd) (groupSort
[((fromNamed $ importModule i,importPkg i),i) | i <- universeBi x, not $ importSrc i]) ++
concatMap (\x -> hierarchy x ++ reduce1 x) (universeBi x) ++
multiExport x | 266 | false | true | 0 | 14 | 90 | 121 | 60 | 61 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.