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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
flipstone/redcard | src/Data/Validation/XML.hs | mit | parseBool :: Text.Text -> Maybe Bool
parseBool text =
case reads (Text.unpack (Text.strip text)) of
(n, "") : _ -> Just n
_ -> Nothing | 154 | parseBool :: Text.Text -> Maybe Bool
parseBool text =
case reads (Text.unpack (Text.strip text)) of
(n, "") : _ -> Just n
_ -> Nothing | 154 | parseBool text =
case reads (Text.unpack (Text.strip text)) of
(n, "") : _ -> Just n
_ -> Nothing | 117 | false | true | 0 | 11 | 44 | 71 | 35 | 36 | null | null |
lostbean/sphermonics | src/Texture/SH/Harmonics.hs | gpl-3.0 | -- | Evaluate a given HSH base function at a given position. Uses 'calcZC'
evalSingleHSH' :: (N, L, MF) -> SO3 -> Double
evalSingleHSH' (n, l, mf) x@(SO3{..})
| mf > 0 = realPart $ (ip l) * kr * (s * func (n, l, mf) + (func (n, l, -mf)))
| mf < 0 = realPart $ (ip $ l-1) * kr * (s * func (n, l, -mf) - (func (n, l, mf)))
| otherwise = realPart $ (ip l) * func (n, l, mf)
where
ip = imaginaryPower . unL
kr = (1 / sqrt2) :+ 0
s = if even (unMF mf) then 1 else -1
k = generatePyramid calcHyperKFull (unN n)
p = genAssLegenFullPyramid (L (unN n)) (cos so3Theta)
c = genGegenbauerPyramid n (cos $ so3Omega / 2)
func pos = calcZC pos k p c x
-- =============================== Plotting Functions ====================================
-- | Calculates and plots SH given a list of positions and a function to convert from
-- Complex SH to Real SH. | 894 | evalSingleHSH' :: (N, L, MF) -> SO3 -> Double
evalSingleHSH' (n, l, mf) x@(SO3{..})
| mf > 0 = realPart $ (ip l) * kr * (s * func (n, l, mf) + (func (n, l, -mf)))
| mf < 0 = realPart $ (ip $ l-1) * kr * (s * func (n, l, -mf) - (func (n, l, mf)))
| otherwise = realPart $ (ip l) * func (n, l, mf)
where
ip = imaginaryPower . unL
kr = (1 / sqrt2) :+ 0
s = if even (unMF mf) then 1 else -1
k = generatePyramid calcHyperKFull (unN n)
p = genAssLegenFullPyramid (L (unN n)) (cos so3Theta)
c = genGegenbauerPyramid n (cos $ so3Omega / 2)
func pos = calcZC pos k p c x
-- =============================== Plotting Functions ====================================
-- | Calculates and plots SH given a list of positions and a function to convert from
-- Complex SH to Real SH. | 819 | evalSingleHSH' (n, l, mf) x@(SO3{..})
| mf > 0 = realPart $ (ip l) * kr * (s * func (n, l, mf) + (func (n, l, -mf)))
| mf < 0 = realPart $ (ip $ l-1) * kr * (s * func (n, l, -mf) - (func (n, l, mf)))
| otherwise = realPart $ (ip l) * func (n, l, mf)
where
ip = imaginaryPower . unL
kr = (1 / sqrt2) :+ 0
s = if even (unMF mf) then 1 else -1
k = generatePyramid calcHyperKFull (unN n)
p = genAssLegenFullPyramid (L (unN n)) (cos so3Theta)
c = genGegenbauerPyramid n (cos $ so3Omega / 2)
func pos = calcZC pos k p c x
-- =============================== Plotting Functions ====================================
-- | Calculates and plots SH given a list of positions and a function to convert from
-- Complex SH to Real SH. | 773 | true | true | 8 | 12 | 224 | 404 | 204 | 200 | null | null |
norm2782/uuagc | src-generated/PrintCode.hs | bsd-3-clause | ppMultiSeqH :: [PP_Doc] -> PP_Doc -> PP_Doc
ppMultiSeqH = ppMultiSeq' (>#<) | 75 | ppMultiSeqH :: [PP_Doc] -> PP_Doc -> PP_Doc
ppMultiSeqH = ppMultiSeq' (>#<) | 75 | ppMultiSeqH = ppMultiSeq' (>#<) | 31 | false | true | 0 | 6 | 10 | 27 | 15 | 12 | null | null |
jeffbr13/conway.hs | conway.hs | bsd-3-clause | -- Game logic & stuff:
-- -----------------------------------------------------------------------------
playGame :: Board -> IO ()
playGame bd = mapM_ printBoard (game bd) | 172 | playGame :: Board -> IO ()
playGame bd = mapM_ printBoard (game bd) | 67 | playGame bd = mapM_ printBoard (game bd) | 40 | true | true | 0 | 8 | 20 | 40 | 19 | 21 | null | null |
dysinger/amazonka | amazonka-directconnect/gen/Network/AWS/DirectConnect/AllocatePublicVirtualInterface.hs | mpl-2.0 | apvir1AuthKey :: Lens' AllocatePublicVirtualInterfaceResponse (Maybe Text)
apvir1AuthKey = lens _apvir1AuthKey (\s a -> s { _apvir1AuthKey = a }) | 145 | apvir1AuthKey :: Lens' AllocatePublicVirtualInterfaceResponse (Maybe Text)
apvir1AuthKey = lens _apvir1AuthKey (\s a -> s { _apvir1AuthKey = a }) | 145 | apvir1AuthKey = lens _apvir1AuthKey (\s a -> s { _apvir1AuthKey = a }) | 70 | false | true | 1 | 9 | 18 | 51 | 24 | 27 | null | null |
yliu120/K3 | src/Language/K3/Analysis/SEffects/Inference.hs | apache-2.0 | filkupc :: FIEnv -> Int -> Either Text [Identifier]
filkupc env i = flclkup (flcenv env) i | 90 | filkupc :: FIEnv -> Int -> Either Text [Identifier]
filkupc env i = flclkup (flcenv env) i | 90 | filkupc env i = flclkup (flcenv env) i | 38 | false | true | 0 | 9 | 16 | 47 | 22 | 25 | null | null |
vTurbine/ghc | compiler/rename/RnBinds.hs | bsd-3-clause | rnLocalValBindsLHS :: MiniFixityEnv
-> HsValBinds RdrName
-> RnM ([Name], HsValBindsLR Name RdrName)
rnLocalValBindsLHS fix_env binds
= do { binds' <- rnValBindsLHS (localRecNameMaker fix_env) binds
-- Check for duplicates and shadowing
-- Must do this *after* renaming the patterns
-- See Note [Collect binders only after renaming] in HsUtils
-- We need to check for dups here because we
-- don't don't bind all of the variables from the ValBinds at once
-- with bindLocatedLocals any more.
--
-- Note that we don't want to do this at the top level, since
-- sorting out duplicates and shadowing there happens elsewhere.
-- The behavior is even different. For example,
-- import A(f)
-- f = ...
-- should not produce a shadowing warning (but it will produce
-- an ambiguity warning if you use f), but
-- import A(f)
-- g = let f = ... in f
-- should.
; let bound_names = collectHsValBinders binds'
-- There should be only Ids, but if there are any bogus
-- pattern synonyms, we'll collect them anyway, so that
-- we don't generate subsequent out-of-scope messages
; envs <- getRdrEnvs
; checkDupAndShadowedNames envs bound_names
; return (bound_names, binds') } | 1,433 | rnLocalValBindsLHS :: MiniFixityEnv
-> HsValBinds RdrName
-> RnM ([Name], HsValBindsLR Name RdrName)
rnLocalValBindsLHS fix_env binds
= do { binds' <- rnValBindsLHS (localRecNameMaker fix_env) binds
-- Check for duplicates and shadowing
-- Must do this *after* renaming the patterns
-- See Note [Collect binders only after renaming] in HsUtils
-- We need to check for dups here because we
-- don't don't bind all of the variables from the ValBinds at once
-- with bindLocatedLocals any more.
--
-- Note that we don't want to do this at the top level, since
-- sorting out duplicates and shadowing there happens elsewhere.
-- The behavior is even different. For example,
-- import A(f)
-- f = ...
-- should not produce a shadowing warning (but it will produce
-- an ambiguity warning if you use f), but
-- import A(f)
-- g = let f = ... in f
-- should.
; let bound_names = collectHsValBinders binds'
-- There should be only Ids, but if there are any bogus
-- pattern synonyms, we'll collect them anyway, so that
-- we don't generate subsequent out-of-scope messages
; envs <- getRdrEnvs
; checkDupAndShadowedNames envs bound_names
; return (bound_names, binds') } | 1,433 | rnLocalValBindsLHS fix_env binds
= do { binds' <- rnValBindsLHS (localRecNameMaker fix_env) binds
-- Check for duplicates and shadowing
-- Must do this *after* renaming the patterns
-- See Note [Collect binders only after renaming] in HsUtils
-- We need to check for dups here because we
-- don't don't bind all of the variables from the ValBinds at once
-- with bindLocatedLocals any more.
--
-- Note that we don't want to do this at the top level, since
-- sorting out duplicates and shadowing there happens elsewhere.
-- The behavior is even different. For example,
-- import A(f)
-- f = ...
-- should not produce a shadowing warning (but it will produce
-- an ambiguity warning if you use f), but
-- import A(f)
-- g = let f = ... in f
-- should.
; let bound_names = collectHsValBinders binds'
-- There should be only Ids, but if there are any bogus
-- pattern synonyms, we'll collect them anyway, so that
-- we don't generate subsequent out-of-scope messages
; envs <- getRdrEnvs
; checkDupAndShadowedNames envs bound_names
; return (bound_names, binds') } | 1,294 | false | true | 0 | 10 | 466 | 127 | 73 | 54 | null | null |
djeik/goto | libgoto/Language/X86/HwTranslator.hs | mit | spillOperand :: Int -> HardwareOperand label
spillOperand i
= Register
$ Indirect
$ Offset (fromIntegral i)
$ SizedRegister Extended64
$ IntegerHwRegister Rbp | 178 | spillOperand :: Int -> HardwareOperand label
spillOperand i
= Register
$ Indirect
$ Offset (fromIntegral i)
$ SizedRegister Extended64
$ IntegerHwRegister Rbp | 178 | spillOperand i
= Register
$ Indirect
$ Offset (fromIntegral i)
$ SizedRegister Extended64
$ IntegerHwRegister Rbp | 133 | false | true | 6 | 7 | 41 | 52 | 24 | 28 | null | null |
steven777400/TwilioIVR | test/Network/Wai/Twilio/RequestValidatorMiddlewareSpec.hs | mit | -- https://mycompany.com/myapp.php?foo=1&bar=2
req1 = SRequest defaultRequest
{ requestMethod = "POST"
, rawPathInfo = "/myapp.php"
, rawQueryString = "?foo=1&bar=2"
, isSecure = True
, requestHeaderHost = Just "mycompany.com"
, requestHeaders = [("X-Twilio-Signature", "RSOYDt4T1cUTdK1PDd93/VVr8B8=")]
} "Digits=1234&To=%2B18005551212&From=%2B14158675309&Caller=%2B14158675309&CallSid=CA1234567890ABCDE" | 432 | req1 = SRequest defaultRequest
{ requestMethod = "POST"
, rawPathInfo = "/myapp.php"
, rawQueryString = "?foo=1&bar=2"
, isSecure = True
, requestHeaderHost = Just "mycompany.com"
, requestHeaders = [("X-Twilio-Signature", "RSOYDt4T1cUTdK1PDd93/VVr8B8=")]
} "Digits=1234&To=%2B18005551212&From=%2B14158675309&Caller=%2B14158675309&CallSid=CA1234567890ABCDE" | 385 | req1 = SRequest defaultRequest
{ requestMethod = "POST"
, rawPathInfo = "/myapp.php"
, rawQueryString = "?foo=1&bar=2"
, isSecure = True
, requestHeaderHost = Just "mycompany.com"
, requestHeaders = [("X-Twilio-Signature", "RSOYDt4T1cUTdK1PDd93/VVr8B8=")]
} "Digits=1234&To=%2B18005551212&From=%2B14158675309&Caller=%2B14158675309&CallSid=CA1234567890ABCDE" | 385 | true | false | 1 | 8 | 61 | 70 | 39 | 31 | null | null |
michaxm/haskell-hdfs-thrift-client | src-gen-thrift/ThriftHadoopFileSystem.hs | bsd-3-clause | decode_Mkdirs_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Mkdirs_args
decode_Mkdirs_args iprot bs = to_Mkdirs_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Mkdirs_args) bs | 197 | decode_Mkdirs_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Mkdirs_args
decode_Mkdirs_args iprot bs = to_Mkdirs_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Mkdirs_args) bs | 197 | decode_Mkdirs_args iprot bs = to_Mkdirs_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Mkdirs_args) bs | 105 | false | true | 0 | 9 | 23 | 69 | 34 | 35 | null | null |
martin-kolinek/some-board-game | src/Player/Building/Types.hs | mit | oppositeDirection :: Direction -> Direction
oppositeDirection DirectionDown = DirectionUp | 89 | oppositeDirection :: Direction -> Direction
oppositeDirection DirectionDown = DirectionUp | 89 | oppositeDirection DirectionDown = DirectionUp | 45 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
rueshyna/gogol | gogol-pagespeed/gen/Network/Google/PageSpeed/Types/Product.hs | mpl-2.0 | -- | The minor version number of PageSpeed used to generate these results.
rvMinor :: Lens' ResultVersion (Maybe Int32)
rvMinor
= lens _rvMinor (\ s a -> s{_rvMinor = a}) .
mapping _Coerce | 196 | rvMinor :: Lens' ResultVersion (Maybe Int32)
rvMinor
= lens _rvMinor (\ s a -> s{_rvMinor = a}) .
mapping _Coerce | 121 | rvMinor
= lens _rvMinor (\ s a -> s{_rvMinor = a}) .
mapping _Coerce | 76 | true | true | 0 | 10 | 40 | 55 | 28 | 27 | null | null |
ledyba/Jinzamomi | src/Jinzamomi/Driver/Util.hs | gpl-3.0 | --
enumAllFiles :: FilePath -> IO [FilePath]
enumAllFiles path = do
files <- enumAllFiles' path
return (fmap (makeRelative path) files)
where
enumAllFiles' path = do
let normpath = normalise path
allItems <- getDirectoryContents path
let items = (\f -> path ++ pathSeparator:f) <$> filter (\k -> k /= "." && k /= "..") allItems
files <- filterM doesFileExist items
justFolders <- filterM doesDirectoryExist items
leftFiles <- mapM enumAllFiles' justFolders
return (files ++ concat leftFiles) | 547 | enumAllFiles :: FilePath -> IO [FilePath]
enumAllFiles path = do
files <- enumAllFiles' path
return (fmap (makeRelative path) files)
where
enumAllFiles' path = do
let normpath = normalise path
allItems <- getDirectoryContents path
let items = (\f -> path ++ pathSeparator:f) <$> filter (\k -> k /= "." && k /= "..") allItems
files <- filterM doesFileExist items
justFolders <- filterM doesDirectoryExist items
leftFiles <- mapM enumAllFiles' justFolders
return (files ++ concat leftFiles) | 544 | enumAllFiles path = do
files <- enumAllFiles' path
return (fmap (makeRelative path) files)
where
enumAllFiles' path = do
let normpath = normalise path
allItems <- getDirectoryContents path
let items = (\f -> path ++ pathSeparator:f) <$> filter (\k -> k /= "." && k /= "..") allItems
files <- filterM doesFileExist items
justFolders <- filterM doesDirectoryExist items
leftFiles <- mapM enumAllFiles' justFolders
return (files ++ concat leftFiles) | 502 | true | true | 0 | 16 | 129 | 194 | 90 | 104 | null | null |
spechub/Hets | CASL/Overload.hs | gpl-2.0 | minExpFORMULAeq :: (FormExtension f, TermExtension f)
=> Min f e -> Sign f e -> (TERM f -> TERM f -> Range -> FORMULA f)
-> TERM f -> TERM f -> Range -> Result (FORMULA f)
minExpFORMULAeq mef sign eq term1 term2 pos = do
(ps, msg) <- minExpTermCond mef sign ( \ t1 t2 -> eq t1 t2 pos)
term1 term2 pos
isUnambiguous msg (globAnnos sign) (eq term1 term2 pos) ps pos
-- | check if there is at least one solution | 433 | minExpFORMULAeq :: (FormExtension f, TermExtension f)
=> Min f e -> Sign f e -> (TERM f -> TERM f -> Range -> FORMULA f)
-> TERM f -> TERM f -> Range -> Result (FORMULA f)
minExpFORMULAeq mef sign eq term1 term2 pos = do
(ps, msg) <- minExpTermCond mef sign ( \ t1 t2 -> eq t1 t2 pos)
term1 term2 pos
isUnambiguous msg (globAnnos sign) (eq term1 term2 pos) ps pos
-- | check if there is at least one solution | 433 | minExpFORMULAeq mef sign eq term1 term2 pos = do
(ps, msg) <- minExpTermCond mef sign ( \ t1 t2 -> eq t1 t2 pos)
term1 term2 pos
isUnambiguous msg (globAnnos sign) (eq term1 term2 pos) ps pos
-- | check if there is at least one solution | 255 | false | true | 0 | 15 | 108 | 191 | 91 | 100 | null | null |
icyfork/shellcheck | ShellCheck/Parser.hs | gpl-3.0 | prop_readDollarExpansion1= isOk readDollarExpansion "$(echo foo; ls\n)" | 71 | prop_readDollarExpansion1= isOk readDollarExpansion "$(echo foo; ls\n)" | 71 | prop_readDollarExpansion1= isOk readDollarExpansion "$(echo foo; ls\n)" | 71 | false | false | 1 | 5 | 5 | 16 | 5 | 11 | null | null |
pikajude/WordNet-ghc74 | NLP/WordNet.hs | bsd-3-clause | meetSearchPaths :: Bag b (Tree SearchResult)
=> b (Tree SearchResult)
-> Tree SearchResult
-> Tree SearchResult
-> Maybe ([SearchResult], SearchResult, [SearchResult])
meetSearchPaths emptyBg t1 t2 =
let srch b v1 v2 bag1 bag2
| isEmptyBag bag1 && isEmptyBag bag2 = Nothing
| isEmptyBag bag1 = srch (not b) v2 v1 bag2 bag1
| otherwise =
let (Node sr chl, bag1') = splitBag bag1
sl = srWords sr AllSenses
in if v2 `containsResult` sl
then Just $ if b
then (reverse v1, sr, drop 1 $ dropWhile ((/=sl) . flip srWords AllSenses) v2)
else (reverse $ drop 1 $ dropWhile ((/=sl) . flip srWords AllSenses) v2, sr, v1)
else srch (not b)
v2 (addResult v1 sr)
bag2 (addListToBag bag1' chl) -- flip the order :)
in srch True [] [] (addToBag emptyBg t1) (addToBag emptyBg t2)
where
containsResult v sl = sl `elem` map (`srWords` AllSenses) v
addResult v sr = sr:v | 1,173 | meetSearchPaths :: Bag b (Tree SearchResult)
=> b (Tree SearchResult)
-> Tree SearchResult
-> Tree SearchResult
-> Maybe ([SearchResult], SearchResult, [SearchResult])
meetSearchPaths emptyBg t1 t2 =
let srch b v1 v2 bag1 bag2
| isEmptyBag bag1 && isEmptyBag bag2 = Nothing
| isEmptyBag bag1 = srch (not b) v2 v1 bag2 bag1
| otherwise =
let (Node sr chl, bag1') = splitBag bag1
sl = srWords sr AllSenses
in if v2 `containsResult` sl
then Just $ if b
then (reverse v1, sr, drop 1 $ dropWhile ((/=sl) . flip srWords AllSenses) v2)
else (reverse $ drop 1 $ dropWhile ((/=sl) . flip srWords AllSenses) v2, sr, v1)
else srch (not b)
v2 (addResult v1 sr)
bag2 (addListToBag bag1' chl) -- flip the order :)
in srch True [] [] (addToBag emptyBg t1) (addToBag emptyBg t2)
where
containsResult v sl = sl `elem` map (`srWords` AllSenses) v
addResult v sr = sr:v | 1,173 | meetSearchPaths emptyBg t1 t2 =
let srch b v1 v2 bag1 bag2
| isEmptyBag bag1 && isEmptyBag bag2 = Nothing
| isEmptyBag bag1 = srch (not b) v2 v1 bag2 bag1
| otherwise =
let (Node sr chl, bag1') = splitBag bag1
sl = srWords sr AllSenses
in if v2 `containsResult` sl
then Just $ if b
then (reverse v1, sr, drop 1 $ dropWhile ((/=sl) . flip srWords AllSenses) v2)
else (reverse $ drop 1 $ dropWhile ((/=sl) . flip srWords AllSenses) v2, sr, v1)
else srch (not b)
v2 (addResult v1 sr)
bag2 (addListToBag bag1' chl) -- flip the order :)
in srch True [] [] (addToBag emptyBg t1) (addToBag emptyBg t2)
where
containsResult v sl = sl `elem` map (`srWords` AllSenses) v
addResult v sr = sr:v | 941 | false | true | 1 | 20 | 473 | 405 | 204 | 201 | null | null |
mlite/hLLVM | src/Llvm/AsmHirConversion/Specialization.hs | bsd-3-clause | unspecializePAttr :: PAttr -> ParamAttr
unspecializePAttr x = case x of
PInReg -> PaInReg
PInAlloca -> PaInAlloca
PNoAlias -> PaNoAlias
PNoCapture -> PaNoCapture
PNest -> PaNest
PReturned -> PaReturned
PNonNull -> PaNonNull
PDereferenceable n -> PaDereferenceable n
PReadOnly -> PaReadOnly
PReadNone -> PaReadNone | 333 | unspecializePAttr :: PAttr -> ParamAttr
unspecializePAttr x = case x of
PInReg -> PaInReg
PInAlloca -> PaInAlloca
PNoAlias -> PaNoAlias
PNoCapture -> PaNoCapture
PNest -> PaNest
PReturned -> PaReturned
PNonNull -> PaNonNull
PDereferenceable n -> PaDereferenceable n
PReadOnly -> PaReadOnly
PReadNone -> PaReadNone | 333 | unspecializePAttr x = case x of
PInReg -> PaInReg
PInAlloca -> PaInAlloca
PNoAlias -> PaNoAlias
PNoCapture -> PaNoCapture
PNest -> PaNest
PReturned -> PaReturned
PNonNull -> PaNonNull
PDereferenceable n -> PaDereferenceable n
PReadOnly -> PaReadOnly
PReadNone -> PaReadNone | 293 | false | true | 11 | 5 | 62 | 99 | 43 | 56 | null | null |
MichaelXavier/Bucketeer | Bucketeer/Testing/Main.hs | bsd-2-clause | main :: IO ()
main = do conn <- connect defaultConnectInfo
mspecs <- M.specs
runSpecs [HS.hspecB $ P.specs conn ++ U.specs ++ WU.specs ++ T.specs ++ mspecs]
WS.runSpecs conn
---- Helpers | 219 | main :: IO ()
main = do conn <- connect defaultConnectInfo
mspecs <- M.specs
runSpecs [HS.hspecB $ P.specs conn ++ U.specs ++ WU.specs ++ T.specs ++ mspecs]
WS.runSpecs conn
---- Helpers | 219 | main = do conn <- connect defaultConnectInfo
mspecs <- M.specs
runSpecs [HS.hspecB $ P.specs conn ++ U.specs ++ WU.specs ++ T.specs ++ mspecs]
WS.runSpecs conn
---- Helpers | 205 | false | true | 0 | 15 | 63 | 86 | 40 | 46 | null | null |
mettekou/ghc | compiler/types/Coercion.hs | bsd-3-clause | ppr_co p (KindCo co) = pprPrefixApp p (text "kind") [pprParendCo co] | 76 | ppr_co p (KindCo co) = pprPrefixApp p (text "kind") [pprParendCo co] | 76 | ppr_co p (KindCo co) = pprPrefixApp p (text "kind") [pprParendCo co] | 76 | false | false | 0 | 7 | 18 | 36 | 17 | 19 | null | null |
shepheb/go10c | Compiler.hs | bsd-3-clause | compile (StmtIf initializer condition ifbody elsebody) = do
-- the anatomy of an if-statement:
-- it begins with the initializer. then the condition is computed. a jump is compiled that if the condition is false jumps to the beginning of the else block or the end
-- at the end of the body a jump to the end is computed to skip over the else block.
-- or is it easier to go in reverse?
-- push the new scope before compiling the initializer, since any variables it defines are scoped in the if.
modify $ \s -> s { symbols = M.empty : symbols s }
initCode <- concat <$> mapM compile initializer
ct <- typeCheck condition
when (ct /= TypeBool) $ typeError $ "Condition of an if statement must have type bool, found " ++ show ct
prefix <- uniqueLabel
let jumpSuffix = if null elsebody then "_endif" else "_else"
condJumpCode <- compileCondition prefix jumpSuffix condition
ifCode <- concat <$> mapM compile ifbody
let ifJumpCode = if null elsebody then [] else [SET PC (Label (prefix ++ "_endif"))] -- add a jump to the end of the if body if there's an else to jump over.
elseCode <- case elsebody of
[] -> return []
_ -> do
elseCode <- concat <$> mapM compile elsebody
return $ [LabelDef (prefix ++ "_else")] ++ elseCode
-- TODO I think variables declared in any part of the if are spreading to the rest of it. Mostly harmless.
-- remove the scope
modify $ \s -> s { symbols = tail (symbols s) }
return $ initCode ++ condJumpCode ++ ifCode ++ ifJumpCode ++ elseCode ++ [LabelDef (prefix ++ "_endif")] | 1,624 | compile (StmtIf initializer condition ifbody elsebody) = do
-- the anatomy of an if-statement:
-- it begins with the initializer. then the condition is computed. a jump is compiled that if the condition is false jumps to the beginning of the else block or the end
-- at the end of the body a jump to the end is computed to skip over the else block.
-- or is it easier to go in reverse?
-- push the new scope before compiling the initializer, since any variables it defines are scoped in the if.
modify $ \s -> s { symbols = M.empty : symbols s }
initCode <- concat <$> mapM compile initializer
ct <- typeCheck condition
when (ct /= TypeBool) $ typeError $ "Condition of an if statement must have type bool, found " ++ show ct
prefix <- uniqueLabel
let jumpSuffix = if null elsebody then "_endif" else "_else"
condJumpCode <- compileCondition prefix jumpSuffix condition
ifCode <- concat <$> mapM compile ifbody
let ifJumpCode = if null elsebody then [] else [SET PC (Label (prefix ++ "_endif"))] -- add a jump to the end of the if body if there's an else to jump over.
elseCode <- case elsebody of
[] -> return []
_ -> do
elseCode <- concat <$> mapM compile elsebody
return $ [LabelDef (prefix ++ "_else")] ++ elseCode
-- TODO I think variables declared in any part of the if are spreading to the rest of it. Mostly harmless.
-- remove the scope
modify $ \s -> s { symbols = tail (symbols s) }
return $ initCode ++ condJumpCode ++ ifCode ++ ifJumpCode ++ elseCode ++ [LabelDef (prefix ++ "_endif")] | 1,624 | compile (StmtIf initializer condition ifbody elsebody) = do
-- the anatomy of an if-statement:
-- it begins with the initializer. then the condition is computed. a jump is compiled that if the condition is false jumps to the beginning of the else block or the end
-- at the end of the body a jump to the end is computed to skip over the else block.
-- or is it easier to go in reverse?
-- push the new scope before compiling the initializer, since any variables it defines are scoped in the if.
modify $ \s -> s { symbols = M.empty : symbols s }
initCode <- concat <$> mapM compile initializer
ct <- typeCheck condition
when (ct /= TypeBool) $ typeError $ "Condition of an if statement must have type bool, found " ++ show ct
prefix <- uniqueLabel
let jumpSuffix = if null elsebody then "_endif" else "_else"
condJumpCode <- compileCondition prefix jumpSuffix condition
ifCode <- concat <$> mapM compile ifbody
let ifJumpCode = if null elsebody then [] else [SET PC (Label (prefix ++ "_endif"))] -- add a jump to the end of the if body if there's an else to jump over.
elseCode <- case elsebody of
[] -> return []
_ -> do
elseCode <- concat <$> mapM compile elsebody
return $ [LabelDef (prefix ++ "_else")] ++ elseCode
-- TODO I think variables declared in any part of the if are spreading to the rest of it. Mostly harmless.
-- remove the scope
modify $ \s -> s { symbols = tail (symbols s) }
return $ initCode ++ condJumpCode ++ ifCode ++ ifJumpCode ++ elseCode ++ [LabelDef (prefix ++ "_endif")] | 1,624 | false | false | 0 | 18 | 403 | 351 | 173 | 178 | null | null |
ntc2/cryptol | src/Cryptol/TypeCheck/Unify.hs | bsd-3-clause | mgu t1 t2
| not (k1 == k2) = uniError $ UniKindMismatch k1 k2
| otherwise = uniError $ UniTypeMismatch t1 t2
where
k1 = kindOf t1
k2 = kindOf t2 | 161 | mgu t1 t2
| not (k1 == k2) = uniError $ UniKindMismatch k1 k2
| otherwise = uniError $ UniTypeMismatch t1 t2
where
k1 = kindOf t1
k2 = kindOf t2 | 161 | mgu t1 t2
| not (k1 == k2) = uniError $ UniKindMismatch k1 k2
| otherwise = uniError $ UniTypeMismatch t1 t2
where
k1 = kindOf t1
k2 = kindOf t2 | 161 | false | false | 2 | 10 | 47 | 77 | 34 | 43 | null | null |
shayan-najd/Haskell-Desugar-Generic | Examples/XMonad/SS_noListComp.hs | bsd-3-clause | view ::
(Eq s, Eq i) => i -> StackSet i l a s sd -> StackSet i l a s sd
view i s
| i == currentTag s = s
| Just x <- L.find ((i ==) . tag . workspace) (visible s) =
s{current = x,
visible = current s : L.deleteBy (equating screen) x (visible s)}
| Just x <- L.find ((i ==) . tag) (hidden s) =
s{current = (current s){workspace = x},
hidden =
workspace (current s) : L.deleteBy (equating tag) x (hidden s)}
| otherwise = s
where equating f = \ x y -> f x == f y | 505 | view ::
(Eq s, Eq i) => i -> StackSet i l a s sd -> StackSet i l a s sd
view i s
| i == currentTag s = s
| Just x <- L.find ((i ==) . tag . workspace) (visible s) =
s{current = x,
visible = current s : L.deleteBy (equating screen) x (visible s)}
| Just x <- L.find ((i ==) . tag) (hidden s) =
s{current = (current s){workspace = x},
hidden =
workspace (current s) : L.deleteBy (equating tag) x (hidden s)}
| otherwise = s
where equating f = \ x y -> f x == f y | 505 | view i s
| i == currentTag s = s
| Just x <- L.find ((i ==) . tag . workspace) (visible s) =
s{current = x,
visible = current s : L.deleteBy (equating screen) x (visible s)}
| Just x <- L.find ((i ==) . tag) (hidden s) =
s{current = (current s){workspace = x},
hidden =
workspace (current s) : L.deleteBy (equating tag) x (hidden s)}
| otherwise = s
where equating f = \ x y -> f x == f y | 426 | false | true | 1 | 13 | 151 | 300 | 151 | 149 | null | null |
olorin/amazonka | amazonka-iam/test/Test/AWS/Gen/IAM.hs | mpl-2.0 | testListRolePoliciesResponse :: ListRolePoliciesResponse -> TestTree
testListRolePoliciesResponse = res
"ListRolePoliciesResponse"
"fixture/ListRolePoliciesResponse.proto"
iAM
(Proxy :: Proxy ListRolePolicies) | 225 | testListRolePoliciesResponse :: ListRolePoliciesResponse -> TestTree
testListRolePoliciesResponse = res
"ListRolePoliciesResponse"
"fixture/ListRolePoliciesResponse.proto"
iAM
(Proxy :: Proxy ListRolePolicies) | 225 | testListRolePoliciesResponse = res
"ListRolePoliciesResponse"
"fixture/ListRolePoliciesResponse.proto"
iAM
(Proxy :: Proxy ListRolePolicies) | 156 | false | true | 0 | 6 | 30 | 36 | 17 | 19 | null | null |
fcostantini/PlEb | src/Xspf.hs | gpl-3.0 | normalizePath :: String -> String
normalizePath = map (\x -> if x == '/' then '\\' else x) | 90 | normalizePath :: String -> String
normalizePath = map (\x -> if x == '/' then '\\' else x) | 90 | normalizePath = map (\x -> if x == '/' then '\\' else x) | 56 | false | true | 0 | 9 | 17 | 38 | 21 | 17 | null | null |
ian-ross/c2hs-macos-test | c2hs-0.26.1/src/C2HS/Gen/Monad.hs | mit | -- | set the dynamic library and library prefix
--
setContext :: (Maybe String) -> (Maybe String) -> (Maybe String) -> GB ()
setContext lib' prefix' repprefix' =
transCT $ \state -> (state {lib = fromMaybe "" lib',
prefix = fromMaybe "" prefix',
repprefix = fromMaybe "" repprefix'},
()) | 381 | setContext :: (Maybe String) -> (Maybe String) -> (Maybe String) -> GB ()
setContext lib' prefix' repprefix' =
transCT $ \state -> (state {lib = fromMaybe "" lib',
prefix = fromMaybe "" prefix',
repprefix = fromMaybe "" repprefix'},
()) | 330 | setContext lib' prefix' repprefix' =
transCT $ \state -> (state {lib = fromMaybe "" lib',
prefix = fromMaybe "" prefix',
repprefix = fromMaybe "" repprefix'},
()) | 256 | true | true | 0 | 10 | 142 | 107 | 57 | 50 | null | null |
rimmington/pipes-cliff | genCabal.hs | bsd-3-clause | async :: Package
async = package "async" (gtEq [2,0]) | 53 | async :: Package
async = package "async" (gtEq [2,0]) | 53 | async = package "async" (gtEq [2,0]) | 36 | false | true | 0 | 8 | 8 | 28 | 15 | 13 | null | null |
mikeyhc/harkerbot | src/HarkerServer/Args.hs | bsd-3-clause | defserver = "segfault.net.nz" | 32 | defserver = "segfault.net.nz" | 32 | defserver = "segfault.net.nz" | 32 | false | false | 0 | 4 | 5 | 6 | 3 | 3 | null | null |
ethercrow/yi | yi-keymap-vim/src/Yi/Keymap/Vim.hs | gpl-2.0 | convertEvent InsertVisual _ e = e | 33 | convertEvent InsertVisual _ e = e | 33 | convertEvent InsertVisual _ e = e | 33 | false | false | 1 | 5 | 5 | 15 | 6 | 9 | null | null |
ben-schulz/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | mapPDeclFC f g (PInterface doc syn fc constrs n nfc params paramDocs det body ctor ctorDoc) =
PInterface doc syn (f fc)
(map (\(constrn, constr) -> (constrn, mapPTermFC f g constr)) constrs)
n (g nfc) (map (\(n, nfc, pty) -> (n, g nfc, mapPTermFC f g pty)) params)
paramDocs (map (\(dn, dnfc) -> (dn, g dnfc)) det)
(map (mapPDeclFC f g) body)
(fmap (\(n, nfc) -> (n, g nfc)) ctor)
ctorDoc | 458 | mapPDeclFC f g (PInterface doc syn fc constrs n nfc params paramDocs det body ctor ctorDoc) =
PInterface doc syn (f fc)
(map (\(constrn, constr) -> (constrn, mapPTermFC f g constr)) constrs)
n (g nfc) (map (\(n, nfc, pty) -> (n, g nfc, mapPTermFC f g pty)) params)
paramDocs (map (\(dn, dnfc) -> (dn, g dnfc)) det)
(map (mapPDeclFC f g) body)
(fmap (\(n, nfc) -> (n, g nfc)) ctor)
ctorDoc | 458 | mapPDeclFC f g (PInterface doc syn fc constrs n nfc params paramDocs det body ctor ctorDoc) =
PInterface doc syn (f fc)
(map (\(constrn, constr) -> (constrn, mapPTermFC f g constr)) constrs)
n (g nfc) (map (\(n, nfc, pty) -> (n, g nfc, mapPTermFC f g pty)) params)
paramDocs (map (\(dn, dnfc) -> (dn, g dnfc)) det)
(map (mapPDeclFC f g) body)
(fmap (\(n, nfc) -> (n, g nfc)) ctor)
ctorDoc | 458 | false | false | 0 | 11 | 140 | 249 | 127 | 122 | null | null |
msullivan/advent-of-code | 2017/A20.hs | mit | splitOn1 a b = fromJust $ stripInfix a b | 40 | splitOn1 a b = fromJust $ stripInfix a b | 40 | splitOn1 a b = fromJust $ stripInfix a b | 40 | false | false | 0 | 6 | 8 | 20 | 9 | 11 | null | null |
rvion/ride | jetpack/src/Data/ByteString/Lazy/Char8/AsC8.hs | bsd-3-clause | -- c8_foldl1 :: (Char -> Char -> Char) -> ByteString -> Char
c8_foldl1 = I.foldl1 | 81 | c8_foldl1 = I.foldl1 | 20 | c8_foldl1 = I.foldl1 | 20 | true | false | 1 | 6 | 14 | 13 | 5 | 8 | null | null |
jaalonso/I1M-Cod-Temas | src/Tema_13/Vida.hs | gpl-2.0 | irA :: Pos -> IO ()
irA (x,y) = putStr ("\ESC[" ++ show y ++ ";" ++ show x ++ "H") | 82 | irA :: Pos -> IO ()
irA (x,y) = putStr ("\ESC[" ++ show y ++ ";" ++ show x ++ "H") | 82 | irA (x,y) = putStr ("\ESC[" ++ show y ++ ";" ++ show x ++ "H") | 62 | false | true | 0 | 11 | 20 | 62 | 29 | 33 | null | null |
mrkkrp/stack | src/Path/Find.hs | bsd-3-clause | findPathUp :: (MonadIO m,MonadThrow m)
=> (([Path Abs Dir],[Path Abs File]) -> [Path Abs t])
-- ^ Choose path type from pair.
-> Path Abs Dir -- ^ Start here.
-> (Path Abs t -> Bool) -- ^ Predicate to match the path.
-> Maybe (Path Abs Dir) -- ^ Do not ascend above this directory.
-> m (Maybe (Path Abs t)) -- ^ Absolute path.
findPathUp pathType dir p upperBound =
do entries <- listDir dir
case find p (pathType entries) of
Just path -> return (Just path)
Nothing | Just dir == upperBound -> return Nothing
| parent dir == dir -> return Nothing
| otherwise -> findPathUp pathType (parent dir) p upperBound
-- | Find files matching predicate below a root directory.
--
-- NOTE: this skips symbolic directory links, to avoid loops. This may
-- not make sense for all uses of file finding.
--
-- TODO: write one of these that traverses symbolic links but
-- efficiently ignores loops. | 1,059 | findPathUp :: (MonadIO m,MonadThrow m)
=> (([Path Abs Dir],[Path Abs File]) -> [Path Abs t])
-- ^ Choose path type from pair.
-> Path Abs Dir -- ^ Start here.
-> (Path Abs t -> Bool) -- ^ Predicate to match the path.
-> Maybe (Path Abs Dir) -- ^ Do not ascend above this directory.
-> m (Maybe (Path Abs t))
findPathUp pathType dir p upperBound =
do entries <- listDir dir
case find p (pathType entries) of
Just path -> return (Just path)
Nothing | Just dir == upperBound -> return Nothing
| parent dir == dir -> return Nothing
| otherwise -> findPathUp pathType (parent dir) p upperBound
-- | Find files matching predicate below a root directory.
--
-- NOTE: this skips symbolic directory links, to avoid loops. This may
-- not make sense for all uses of file finding.
--
-- TODO: write one of these that traverses symbolic links but
-- efficiently ignores loops. | 1,029 | findPathUp pathType dir p upperBound =
do entries <- listDir dir
case find p (pathType entries) of
Just path -> return (Just path)
Nothing | Just dir == upperBound -> return Nothing
| parent dir == dir -> return Nothing
| otherwise -> findPathUp pathType (parent dir) p upperBound
-- | Find files matching predicate below a root directory.
--
-- NOTE: this skips symbolic directory links, to avoid loops. This may
-- not make sense for all uses of file finding.
--
-- TODO: write one of these that traverses symbolic links but
-- efficiently ignores loops. | 608 | true | true | 0 | 14 | 338 | 256 | 127 | 129 | null | null |
mettekou/ghc | compiler/basicTypes/Literal.hs | bsd-3-clause | litTag (MachStr _) = 2 | 30 | litTag (MachStr _) = 2 | 30 | litTag (MachStr _) = 2 | 30 | false | false | 0 | 7 | 12 | 15 | 7 | 8 | null | null |
spechub/Hets | CSMOF/Parser.hs | gpl-2.0 | createChildrenKeys :: Element -> (String, Integer, Map.Map String String) ->
(String, Integer, Map.Map String String)
createChildrenKeys eleme (keySup, pos, mapp) =
let key = keySup ++ show pos
in (keySup, pos + 1, Map.insert key (parseStringAttribute eleme objectNameK) mapp) | 302 | createChildrenKeys :: Element -> (String, Integer, Map.Map String String) ->
(String, Integer, Map.Map String String)
createChildrenKeys eleme (keySup, pos, mapp) =
let key = keySup ++ show pos
in (keySup, pos + 1, Map.insert key (parseStringAttribute eleme objectNameK) mapp) | 302 | createChildrenKeys eleme (keySup, pos, mapp) =
let key = keySup ++ show pos
in (keySup, pos + 1, Map.insert key (parseStringAttribute eleme objectNameK) mapp) | 162 | false | true | 0 | 11 | 64 | 118 | 61 | 57 | null | null |
adarqui/ghcjs-jquery | JavaScript/JQuery.hs | mit | slice :: Int -> JQuery -> IO JQuery
slice = jq_slice | 52 | slice :: Int -> JQuery -> IO JQuery
slice = jq_slice | 52 | slice = jq_slice | 16 | false | true | 0 | 8 | 10 | 28 | 12 | 16 | null | null |
tchagnon/cs636-raytracer | a4/Math.hs | apache-2.0 | -- Degrees to Radians
deg2rad :: RealT -> RealT
deg2rad d = d * pi / 180 | 72 | deg2rad :: RealT -> RealT
deg2rad d = d * pi / 180 | 50 | deg2rad d = d * pi / 180 | 24 | true | true | 0 | 6 | 16 | 27 | 14 | 13 | null | null |
fpco/strict-concurrency | Control/Concurrent/Chan/Strict.hs | bsd-3-clause | newChan :: NFData a => IO (Chan a)
newChan = do
hole <- newEmptyMVar
readm <- newMVar hole
write <- newMVar hole
return (Chan readm write)
-- To put an element on a channel, a new hole at the write end is created.
-- What was previously the empty @MVar@ at the back of the channel is then
-- filled in with a new stream element holding the entered value and the
-- new hole.
-- |Write a value to a 'Chan'. | 420 | newChan :: NFData a => IO (Chan a)
newChan = do
hole <- newEmptyMVar
readm <- newMVar hole
write <- newMVar hole
return (Chan readm write)
-- To put an element on a channel, a new hole at the write end is created.
-- What was previously the empty @MVar@ at the back of the channel is then
-- filled in with a new stream element holding the entered value and the
-- new hole.
-- |Write a value to a 'Chan'. | 420 | newChan = do
hole <- newEmptyMVar
readm <- newMVar hole
write <- newMVar hole
return (Chan readm write)
-- To put an element on a channel, a new hole at the write end is created.
-- What was previously the empty @MVar@ at the back of the channel is then
-- filled in with a new stream element holding the entered value and the
-- new hole.
-- |Write a value to a 'Chan'. | 385 | false | true | 0 | 9 | 96 | 73 | 35 | 38 | null | null |
DataStewardshipPortal/ds-form-engine | FormElement/FormElement.hs | apache-2.0 | setGroupInGroup :: Maybe ElemGroup -> ElemGroup -> ElemGroup
setGroupInGroup parentGr group = group { egElements = map (setGroupOfElem parentGr) (egElements group) } | 165 | setGroupInGroup :: Maybe ElemGroup -> ElemGroup -> ElemGroup
setGroupInGroup parentGr group = group { egElements = map (setGroupOfElem parentGr) (egElements group) } | 165 | setGroupInGroup parentGr group = group { egElements = map (setGroupOfElem parentGr) (egElements group) } | 104 | false | true | 0 | 9 | 21 | 52 | 26 | 26 | null | null |
Hodapp87/atom | Language/Atom/Code.hs | bsd-3-clause | codeRule :: UeMap -> Config -> Rule -> String
codeRule mp config rule@(Rule _ _ _ _ _ _ _) =
"/* " ++ show rule ++ " */\n" ++
"static void __r" ++ show (ruleId rule) ++ "() {\n" ++
concatMap (codeUE mp config ues " ") ues ++
" if (" ++ id' (ruleEnable rule) ++ ") {\n" ++
concatMap codeAction (ruleActions rule) ++
codeIf (cRuleCoverage config)
( " __coverage[" ++ covWord ++ "] = __coverage[" ++ covWord
++ "] | (1 << " ++ covBit ++ ");\n")
++ " }\n" ++ concatMap codeAssign (ruleAssigns rule) ++ "}\n\n"
where
ues = topo mp $ allUEs rule
id' ue' = fromJust $ lookup ue' ues
codeAction :: (([String] -> String), [Hash]) -> String
codeAction (f, args) = " " ++ f (map id' args) ++ ";\n"
covWord = show $ div (ruleId rule) 32
covBit = show $ mod (ruleId rule) 32
codeAssign :: (MUV, Hash) -> String
codeAssign (uv', ue') = concat [" ", lh, " = ", id' ue', ";\n"]
where
lh = case uv' of
MUV _ n _ -> concat [cStateName config, ".", n]
MUVArray (UA _ n _) index ->
concat [cStateName config, ".", n, "[", id' index, "]"]
MUVArray (UAExtern n _) index -> concat [n, "[", id' index, "]"]
MUVExtern n _ -> n | 1,246 | codeRule :: UeMap -> Config -> Rule -> String
codeRule mp config rule@(Rule _ _ _ _ _ _ _) =
"/* " ++ show rule ++ " */\n" ++
"static void __r" ++ show (ruleId rule) ++ "() {\n" ++
concatMap (codeUE mp config ues " ") ues ++
" if (" ++ id' (ruleEnable rule) ++ ") {\n" ++
concatMap codeAction (ruleActions rule) ++
codeIf (cRuleCoverage config)
( " __coverage[" ++ covWord ++ "] = __coverage[" ++ covWord
++ "] | (1 << " ++ covBit ++ ");\n")
++ " }\n" ++ concatMap codeAssign (ruleAssigns rule) ++ "}\n\n"
where
ues = topo mp $ allUEs rule
id' ue' = fromJust $ lookup ue' ues
codeAction :: (([String] -> String), [Hash]) -> String
codeAction (f, args) = " " ++ f (map id' args) ++ ";\n"
covWord = show $ div (ruleId rule) 32
covBit = show $ mod (ruleId rule) 32
codeAssign :: (MUV, Hash) -> String
codeAssign (uv', ue') = concat [" ", lh, " = ", id' ue', ";\n"]
where
lh = case uv' of
MUV _ n _ -> concat [cStateName config, ".", n]
MUVArray (UA _ n _) index ->
concat [cStateName config, ".", n, "[", id' index, "]"]
MUVArray (UAExtern n _) index -> concat [n, "[", id' index, "]"]
MUVExtern n _ -> n | 1,246 | codeRule mp config rule@(Rule _ _ _ _ _ _ _) =
"/* " ++ show rule ++ " */\n" ++
"static void __r" ++ show (ruleId rule) ++ "() {\n" ++
concatMap (codeUE mp config ues " ") ues ++
" if (" ++ id' (ruleEnable rule) ++ ") {\n" ++
concatMap codeAction (ruleActions rule) ++
codeIf (cRuleCoverage config)
( " __coverage[" ++ covWord ++ "] = __coverage[" ++ covWord
++ "] | (1 << " ++ covBit ++ ");\n")
++ " }\n" ++ concatMap codeAssign (ruleAssigns rule) ++ "}\n\n"
where
ues = topo mp $ allUEs rule
id' ue' = fromJust $ lookup ue' ues
codeAction :: (([String] -> String), [Hash]) -> String
codeAction (f, args) = " " ++ f (map id' args) ++ ";\n"
covWord = show $ div (ruleId rule) 32
covBit = show $ mod (ruleId rule) 32
codeAssign :: (MUV, Hash) -> String
codeAssign (uv', ue') = concat [" ", lh, " = ", id' ue', ";\n"]
where
lh = case uv' of
MUV _ n _ -> concat [cStateName config, ".", n]
MUVArray (UA _ n _) index ->
concat [cStateName config, ".", n, "[", id' index, "]"]
MUVArray (UAExtern n _) index -> concat [n, "[", id' index, "]"]
MUVExtern n _ -> n | 1,200 | false | true | 2 | 16 | 366 | 528 | 268 | 260 | null | null |
tjhance/logic-puzzles | src/Hashiwokakero.hs | mit | rules :: HashiwokakeroInst -> Symbolic SBool
rules inst = do
let width = length (head inst)
let height = length inst
let edges = getEdges inst
edgesWithVars <- forM edges $ \edge -> do
var <- symbolic (toVarName edge)
return (edge, var)
addConstraints $ do
forM_ edgesWithVars $ \(_, var) -> do
addConstraint $ var .>= 0 &&& var .<= 2
forM_ (filter (\((e1, _), (e2, _)) -> pairIntersects e1 e2) (allPairs edgesWithVars)) $ \((_, v1), (_, v2)) ->
addConstraint $ v1 .== 0 ||| v2 .== 0
forM_ [0..height-1] $ \r ->
forM_ [0..width-1] $ \c ->
case (inst !! r) !! c
of Nothing -> return ()
Just i -> addConstraint $ literal i .== sum (map snd $ filter (\((p1, p2), _) -> p1 == (r,c) || p2 == (r,c)) edgesWithVars) | 868 | rules :: HashiwokakeroInst -> Symbolic SBool
rules inst = do
let width = length (head inst)
let height = length inst
let edges = getEdges inst
edgesWithVars <- forM edges $ \edge -> do
var <- symbolic (toVarName edge)
return (edge, var)
addConstraints $ do
forM_ edgesWithVars $ \(_, var) -> do
addConstraint $ var .>= 0 &&& var .<= 2
forM_ (filter (\((e1, _), (e2, _)) -> pairIntersects e1 e2) (allPairs edgesWithVars)) $ \((_, v1), (_, v2)) ->
addConstraint $ v1 .== 0 ||| v2 .== 0
forM_ [0..height-1] $ \r ->
forM_ [0..width-1] $ \c ->
case (inst !! r) !! c
of Nothing -> return ()
Just i -> addConstraint $ literal i .== sum (map snd $ filter (\((p1, p2), _) -> p1 == (r,c) || p2 == (r,c)) edgesWithVars) | 868 | rules inst = do
let width = length (head inst)
let height = length inst
let edges = getEdges inst
edgesWithVars <- forM edges $ \edge -> do
var <- symbolic (toVarName edge)
return (edge, var)
addConstraints $ do
forM_ edgesWithVars $ \(_, var) -> do
addConstraint $ var .>= 0 &&& var .<= 2
forM_ (filter (\((e1, _), (e2, _)) -> pairIntersects e1 e2) (allPairs edgesWithVars)) $ \((_, v1), (_, v2)) ->
addConstraint $ v1 .== 0 ||| v2 .== 0
forM_ [0..height-1] $ \r ->
forM_ [0..width-1] $ \c ->
case (inst !! r) !! c
of Nothing -> return ()
Just i -> addConstraint $ literal i .== sum (map snd $ filter (\((p1, p2), _) -> p1 == (r,c) || p2 == (r,c)) edgesWithVars) | 823 | false | true | 0 | 31 | 293 | 409 | 207 | 202 | null | null |
diagrams/diagrams-contrib | src/Diagrams/TwoD/Path/LSystem.hs | bsd-3-clause | symbol '[' = Push | 17 | symbol '[' = Push | 17 | symbol '[' = Push | 17 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ChrisCoffey/haskell_sandbox | hackerRank/data_structures/arrays.hs | mit | main :: IO ()
main = do
n_temp <- getLine
let n = read n_temp :: Int
arr_temp <- getLine
let arr = reverse . words $ arr_temp
putStr $ unwords arr | 166 | main :: IO ()
main = do
n_temp <- getLine
let n = read n_temp :: Int
arr_temp <- getLine
let arr = reverse . words $ arr_temp
putStr $ unwords arr | 166 | main = do
n_temp <- getLine
let n = read n_temp :: Int
arr_temp <- getLine
let arr = reverse . words $ arr_temp
putStr $ unwords arr | 152 | false | true | 0 | 12 | 51 | 78 | 34 | 44 | null | null |
nicball/playground | visgo/src/Server.hs | mit | roomSize :: Int
roomSize = 2 | 28 | roomSize :: Int
roomSize = 2 | 28 | roomSize = 2 | 12 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
erochest/popvox-scrape | src/PopVox/Ranks.hs | apache-2.0 | readPositionScores :: FilePath -> Script [PositionScore]
readPositionScores input =
EitherT $ sequenceA . map parsePosition . T.lines
<$> TIO.readFile (encodeString input) | 189 | readPositionScores :: FilePath -> Script [PositionScore]
readPositionScores input =
EitherT $ sequenceA . map parsePosition . T.lines
<$> TIO.readFile (encodeString input) | 189 | readPositionScores input =
EitherT $ sequenceA . map parsePosition . T.lines
<$> TIO.readFile (encodeString input) | 132 | false | true | 0 | 8 | 38 | 56 | 27 | 29 | null | null |
rfranek/duckling | Duckling/Quantity/KO/Corpus.hs | bsd-3-clause | corpus :: Corpus
corpus = (testContext {lang = KO}, allExamples) | 64 | corpus :: Corpus
corpus = (testContext {lang = KO}, allExamples) | 64 | corpus = (testContext {lang = KO}, allExamples) | 47 | false | true | 0 | 8 | 9 | 32 | 16 | 16 | null | null |
gleachkr/Carnap | Carnap/src/Carnap/Core/ModelChecking/ModelFinder.hs | gpl-3.0 | sat2CNF (SNot (SNot x)) = sat2CNF x | 37 | sat2CNF (SNot (SNot x)) = sat2CNF x | 37 | sat2CNF (SNot (SNot x)) = sat2CNF x | 37 | false | false | 0 | 9 | 8 | 24 | 11 | 13 | null | null |
psibi/yesod | yesod-eventsource/Yesod/EventSource.hs | mit | ioToRepEventSource :: s
-> (EventSourcePolyfill -> s -> IO ([ES.ServerEvent], s))
-> HandlerFor site TypedContent
ioToRepEventSource initial act = pollingEventSource initial act'
where act' p s = liftIO (act p s)
-- | Which @EventSource@ polyfill was detected (if any). | 311 | ioToRepEventSource :: s
-> (EventSourcePolyfill -> s -> IO ([ES.ServerEvent], s))
-> HandlerFor site TypedContent
ioToRepEventSource initial act = pollingEventSource initial act'
where act' p s = liftIO (act p s)
-- | Which @EventSource@ polyfill was detected (if any). | 311 | ioToRepEventSource initial act = pollingEventSource initial act'
where act' p s = liftIO (act p s)
-- | Which @EventSource@ polyfill was detected (if any). | 159 | false | true | 0 | 13 | 81 | 84 | 42 | 42 | null | null |
vito/atomo-old | Atomo/Internals.hs | mit | getType (AConstruct _ [] d@(AData n ps)) = getType d | 52 | getType (AConstruct _ [] d@(AData n ps)) = getType d | 52 | getType (AConstruct _ [] d@(AData n ps)) = getType d | 52 | false | false | 0 | 9 | 9 | 36 | 17 | 19 | null | null |
opqdonut/riot | Riot/Style.hs | gpl-2.0 | sa_underline = \a -> Curses.setUnderline a True | 47 | sa_underline = \a -> Curses.setUnderline a True | 47 | sa_underline = \a -> Curses.setUnderline a True | 47 | false | false | 0 | 7 | 6 | 18 | 9 | 9 | null | null |
cjlarose/advent-2016 | src/BalanceBots.hs | bsd-3-clause | runFactory' :: Factory -> Factory
runFactory' factory@(rules, possessions) = (rules, newPossessions)
where
updatesForBot :: (Bot, [Int]) -> [(Destination, Int)]
updatesForBot (b, vs) = let (dl, dh) = rules Map.! b in [(dl, minimum vs), (dh, maximum vs)]
additions :: [(Destination, Int)]
additions = concatMap updatesForBot (readyBots factory)
possessionsWithAdditions = foldl' (\m (k, v) -> Map.insertWith (++) k [v] m) possessions additions
newPossessions = foldl' (flip Map.delete) possessionsWithAdditions (map (ToBot . fst) (readyBots factory)) | 578 | runFactory' :: Factory -> Factory
runFactory' factory@(rules, possessions) = (rules, newPossessions)
where
updatesForBot :: (Bot, [Int]) -> [(Destination, Int)]
updatesForBot (b, vs) = let (dl, dh) = rules Map.! b in [(dl, minimum vs), (dh, maximum vs)]
additions :: [(Destination, Int)]
additions = concatMap updatesForBot (readyBots factory)
possessionsWithAdditions = foldl' (\m (k, v) -> Map.insertWith (++) k [v] m) possessions additions
newPossessions = foldl' (flip Map.delete) possessionsWithAdditions (map (ToBot . fst) (readyBots factory)) | 578 | runFactory' factory@(rules, possessions) = (rules, newPossessions)
where
updatesForBot :: (Bot, [Int]) -> [(Destination, Int)]
updatesForBot (b, vs) = let (dl, dh) = rules Map.! b in [(dl, minimum vs), (dh, maximum vs)]
additions :: [(Destination, Int)]
additions = concatMap updatesForBot (readyBots factory)
possessionsWithAdditions = foldl' (\m (k, v) -> Map.insertWith (++) k [v] m) possessions additions
newPossessions = foldl' (flip Map.delete) possessionsWithAdditions (map (ToBot . fst) (readyBots factory)) | 544 | false | true | 0 | 9 | 101 | 240 | 134 | 106 | null | null |
GaloisInc/halvm-ghc | libraries/ghc-boot/GHC/PackageDb.hs | bsd-3-clause | getHeader :: Get (Word32, Word32)
getHeader = do
magic <- getByteString (BS.length headerMagic)
when (magic /= headerMagic) $
fail "not a ghc-pkg db file, wrong file magic number"
majorVersion <- get :: Get Word32
-- The major version is for incompatible changes
minorVersion <- get :: Get Word32
-- The minor version is for compatible extensions
when (majorVersion /= 1) $
fail "unsupported ghc-pkg db format version"
-- If we ever support multiple major versions then we'll have to change
-- this code
-- The header can be extended without incrementing the major version,
-- we ignore fields we don't know about (currently all).
headerExtraLen <- get :: Get Word32
skip (fromIntegral headerExtraLen)
return (majorVersion, minorVersion) | 810 | getHeader :: Get (Word32, Word32)
getHeader = do
magic <- getByteString (BS.length headerMagic)
when (magic /= headerMagic) $
fail "not a ghc-pkg db file, wrong file magic number"
majorVersion <- get :: Get Word32
-- The major version is for incompatible changes
minorVersion <- get :: Get Word32
-- The minor version is for compatible extensions
when (majorVersion /= 1) $
fail "unsupported ghc-pkg db format version"
-- If we ever support multiple major versions then we'll have to change
-- this code
-- The header can be extended without incrementing the major version,
-- we ignore fields we don't know about (currently all).
headerExtraLen <- get :: Get Word32
skip (fromIntegral headerExtraLen)
return (majorVersion, minorVersion) | 810 | getHeader = do
magic <- getByteString (BS.length headerMagic)
when (magic /= headerMagic) $
fail "not a ghc-pkg db file, wrong file magic number"
majorVersion <- get :: Get Word32
-- The major version is for incompatible changes
minorVersion <- get :: Get Word32
-- The minor version is for compatible extensions
when (majorVersion /= 1) $
fail "unsupported ghc-pkg db format version"
-- If we ever support multiple major versions then we'll have to change
-- this code
-- The header can be extended without incrementing the major version,
-- we ignore fields we don't know about (currently all).
headerExtraLen <- get :: Get Word32
skip (fromIntegral headerExtraLen)
return (majorVersion, minorVersion) | 776 | false | true | 0 | 12 | 188 | 153 | 73 | 80 | null | null |
mettekou/ghc | compiler/basicTypes/Id.hs | bsd-3-clause | {-
************************************************************************
* *
\subsection{Simple Id construction}
* *
************************************************************************
Absolutely all Ids are made by mkId. It is just like Var.mkId,
but in addition it pins free-tyvar-info onto the Id's type,
where it can easily be found.
Note [Free type variables]
~~~~~~~~~~~~~~~~~~~~~~~~~~
At one time we cached the free type variables of the type of an Id
at the root of the type in a TyNote. The idea was to avoid repeating
the free-type-variable calculation. But it turned out to slow down
the compiler overall. I don't quite know why; perhaps finding free
type variables of an Id isn't all that common whereas applying a
substitution (which changes the free type variables) is more common.
Anyway, we removed it in March 2008.
-}
-- | For an explanation of global vs. local 'Id's, see "Var#globalvslocal"
mkGlobalId :: IdDetails -> Name -> Type -> IdInfo -> Id
mkGlobalId = Var.mkGlobalVar | 1,147 | mkGlobalId :: IdDetails -> Name -> Type -> IdInfo -> Id
mkGlobalId = Var.mkGlobalVar | 84 | mkGlobalId = Var.mkGlobalVar | 28 | true | true | 0 | 8 | 293 | 31 | 17 | 14 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Vector.Unboxed.hs | bsd-3-clause | zip4 as bs cs ds = V_4 len (unsafeSlice 0 len as)
(unsafeSlice 0 len bs)
(unsafeSlice 0 len cs)
(unsafeSlice 0 len ds)
where
len = length as `delayed_min`
length bs `delayed_min`
length cs `delayed_min`
length ds
| 330 | zip4 as bs cs ds = V_4 len (unsafeSlice 0 len as)
(unsafeSlice 0 len bs)
(unsafeSlice 0 len cs)
(unsafeSlice 0 len ds)
where
len = length as `delayed_min`
length bs `delayed_min`
length cs `delayed_min`
length ds
| 330 | zip4 as bs cs ds = V_4 len (unsafeSlice 0 len as)
(unsafeSlice 0 len bs)
(unsafeSlice 0 len cs)
(unsafeSlice 0 len ds)
where
len = length as `delayed_min`
length bs `delayed_min`
length cs `delayed_min`
length ds
| 330 | false | false | 2 | 6 | 155 | 126 | 55 | 71 | null | null |
Copilot-Language/sbv-for-copilot | SBVUnitTest/Examples/Basics/BasicTests.hs | bsd-3-clause | f5 x _ = x + 1 | 14 | f5 x _ = x + 1 | 14 | f5 x _ = x + 1 | 14 | false | false | 0 | 5 | 6 | 15 | 7 | 8 | null | null |
haskoin/haskoin | src/Haskoin/Util/Arbitrary/Transaction.hs | unlicense | arbitraryAddrOnlyTxFull :: Network -> Gen Tx
arbitraryAddrOnlyTxFull net = do
ni <- choose (1, 5)
no <- choose (1, 5)
inps <- vectorOf ni (arbitraryAddrOnlyTxInFull net)
outs <- vectorOf no (arbitraryAddrOnlyTxOut net)
Tx <$> arbitrary <*> pure inps <*> pure outs <*> pure [] <*> arbitrary
-- | Arbitrary TxIn that can only be of type 'SpendPKHash' or 'SpendScriptHash'
-- (multisig). Only compressed public keys are used. | 443 | arbitraryAddrOnlyTxFull :: Network -> Gen Tx
arbitraryAddrOnlyTxFull net = do
ni <- choose (1, 5)
no <- choose (1, 5)
inps <- vectorOf ni (arbitraryAddrOnlyTxInFull net)
outs <- vectorOf no (arbitraryAddrOnlyTxOut net)
Tx <$> arbitrary <*> pure inps <*> pure outs <*> pure [] <*> arbitrary
-- | Arbitrary TxIn that can only be of type 'SpendPKHash' or 'SpendScriptHash'
-- (multisig). Only compressed public keys are used. | 443 | arbitraryAddrOnlyTxFull net = do
ni <- choose (1, 5)
no <- choose (1, 5)
inps <- vectorOf ni (arbitraryAddrOnlyTxInFull net)
outs <- vectorOf no (arbitraryAddrOnlyTxOut net)
Tx <$> arbitrary <*> pure inps <*> pure outs <*> pure [] <*> arbitrary
-- | Arbitrary TxIn that can only be of type 'SpendPKHash' or 'SpendScriptHash'
-- (multisig). Only compressed public keys are used. | 398 | false | true | 0 | 11 | 87 | 130 | 60 | 70 | null | null |
vycasas/jinsei.no.game | src/Grid.hs | mit | createCell :: Grid -> Int -> Int -> Grid
createCell g c r = setCellLife g c r True | 82 | createCell :: Grid -> Int -> Int -> Grid
createCell g c r = setCellLife g c r True | 82 | createCell g c r = setCellLife g c r True | 41 | false | true | 0 | 7 | 18 | 39 | 19 | 20 | null | null |
junnf/Functional-Programming | codes/canfail.hs | unlicense | safediv 0 y = Nothing | 21 | safediv 0 y = Nothing | 21 | safediv 0 y = Nothing | 21 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
lambda-11235/ttyped | src/Reduce.hs | gpl-3.0 | reduceObject (Prod name t o) = Prod name (reduceTerm t) (reduceObject o) | 72 | reduceObject (Prod name t o) = Prod name (reduceTerm t) (reduceObject o) | 72 | reduceObject (Prod name t o) = Prod name (reduceTerm t) (reduceObject o) | 72 | false | false | 0 | 7 | 11 | 39 | 18 | 21 | null | null |
brendanhay/gogol | gogol-fusiontables/gen/Network/Google/Resource/FusionTables/Table/Copy.hs | mpl-2.0 | -- | Whether to also copy tabs, styles, and templates. Default is false.
tcCopyPresentation :: Lens' TableCopy (Maybe Bool)
tcCopyPresentation
= lens _tcCopyPresentation
(\ s a -> s{_tcCopyPresentation = a}) | 215 | tcCopyPresentation :: Lens' TableCopy (Maybe Bool)
tcCopyPresentation
= lens _tcCopyPresentation
(\ s a -> s{_tcCopyPresentation = a}) | 142 | tcCopyPresentation
= lens _tcCopyPresentation
(\ s a -> s{_tcCopyPresentation = a}) | 91 | true | true | 1 | 9 | 37 | 51 | 25 | 26 | null | null |
valderman/selda | selda/src/Database/Selda/SQL/Print.hs | mit | ppCol (UnOp op a) = ppUnOp op a | 34 | ppCol (UnOp op a) = ppUnOp op a | 34 | ppCol (UnOp op a) = ppUnOp op a | 34 | false | false | 0 | 6 | 10 | 24 | 10 | 14 | null | null |
Teaspot-Studio/netwire | FRP/Netwire/Analyze.hs | bsd-3-clause | lGraphN int n =
let n1 = n - 1
f qt = realToFrac int * fromIntegral qt / fromIntegral n1
in lGraph (map f [0..n1]) | 132 | lGraphN int n =
let n1 = n - 1
f qt = realToFrac int * fromIntegral qt / fromIntegral n1
in lGraph (map f [0..n1]) | 132 | lGraphN int n =
let n1 = n - 1
f qt = realToFrac int * fromIntegral qt / fromIntegral n1
in lGraph (map f [0..n1]) | 132 | false | false | 0 | 11 | 43 | 68 | 31 | 37 | null | null |
paulbarbu/ePseudocode | src/EPseudocode/Evaluator.hs | bsd-3-clause | eval env (TypeDef name body) =
case lookup name env of
Just _ -> throwError $ "Cannot declare type " ++ name ++ " since it will shadow other names"
Nothing -> do
structEnv <- structToEnv env body
return ((name, Func [] [Ret $ Struct structEnv] env):env, Void) | 303 | eval env (TypeDef name body) =
case lookup name env of
Just _ -> throwError $ "Cannot declare type " ++ name ++ " since it will shadow other names"
Nothing -> do
structEnv <- structToEnv env body
return ((name, Func [] [Ret $ Struct structEnv] env):env, Void) | 303 | eval env (TypeDef name body) =
case lookup name env of
Just _ -> throwError $ "Cannot declare type " ++ name ++ " since it will shadow other names"
Nothing -> do
structEnv <- structToEnv env body
return ((name, Func [] [Ret $ Struct structEnv] env):env, Void) | 303 | false | false | 8 | 10 | 91 | 91 | 47 | 44 | null | null |
co-dan/NPNTool | startup/Main.hs | bsd-3-clause | testLive :: (Ord (m1 p), Ord p, Ord t, DynNet (Net p t n m1) p t m1) => Net p t n m1 -> MaybeT IO ()
testLive n = unless (isLive (reachabilityGraph n) n) $ do
lift (putStrLn "One of the nets is not live")
mzero | 214 | testLive :: (Ord (m1 p), Ord p, Ord t, DynNet (Net p t n m1) p t m1) => Net p t n m1 -> MaybeT IO ()
testLive n = unless (isLive (reachabilityGraph n) n) $ do
lift (putStrLn "One of the nets is not live")
mzero | 214 | testLive n = unless (isLive (reachabilityGraph n) n) $ do
lift (putStrLn "One of the nets is not live")
mzero | 113 | false | true | 0 | 10 | 51 | 121 | 58 | 63 | null | null |
fosskers/mapalgebra | lib/Geography/MapAlgebra.hs | bsd-3-clause | -- | An invisible pixel (alpha channel set to 0).
invisible :: Pixel RGBA Word8
invisible = PixelRGBA 0 0 0 0 | 109 | invisible :: Pixel RGBA Word8
invisible = PixelRGBA 0 0 0 0 | 59 | invisible = PixelRGBA 0 0 0 0 | 29 | true | true | 1 | 5 | 21 | 29 | 13 | 16 | null | null |
Vlix/telegram-bot-http | Network/Telegram/Bot/Requests.hs | mit | ---------------------------------
-- MULTIPART/FORMDATA VERSIONS --
---------------------------------
sendPhotoFileRequest :: (MonadIO m, MonadThrow m) => TelegramRequest TG.SendPhotoRequest m TG.Message
sendPhotoFileRequest = telegramPostFileRequest "sendPhoto" | 263 | sendPhotoFileRequest :: (MonadIO m, MonadThrow m) => TelegramRequest TG.SendPhotoRequest m TG.Message
sendPhotoFileRequest = telegramPostFileRequest "sendPhoto" | 160 | sendPhotoFileRequest = telegramPostFileRequest "sendPhoto" | 58 | true | true | 0 | 7 | 21 | 43 | 23 | 20 | null | null |
DaMSL/K3 | src/Language/K3/Parser/SQL.hs | apache-2.0 | memberE :: Bool -> ScopeId -> BindingMap -> K3 Expression -> K3 Expression -> SQLParseM (K3 Expression)
memberE asMem sid bm elemexpr colexpr = matchE sid bm elemexpr colexpr >>= emptyE (not asMem) | 197 | memberE :: Bool -> ScopeId -> BindingMap -> K3 Expression -> K3 Expression -> SQLParseM (K3 Expression)
memberE asMem sid bm elemexpr colexpr = matchE sid bm elemexpr colexpr >>= emptyE (not asMem) | 197 | memberE asMem sid bm elemexpr colexpr = matchE sid bm elemexpr colexpr >>= emptyE (not asMem) | 93 | false | true | 0 | 12 | 32 | 79 | 37 | 42 | null | null |
spechub/Hets | HasCASL/Morphism.hs | gpl-2.0 | showEnvDiff :: Env -> Env -> String
showEnvDiff e1 e2 =
"Signature 1:\n" ++ showDoc e1 "\nSignature 2:\n"
++ showDoc e2 "\nDifference\n" ++ showDoc
(diffEnv e1 e2) "" | 195 | showEnvDiff :: Env -> Env -> String
showEnvDiff e1 e2 =
"Signature 1:\n" ++ showDoc e1 "\nSignature 2:\n"
++ showDoc e2 "\nDifference\n" ++ showDoc
(diffEnv e1 e2) "" | 195 | showEnvDiff e1 e2 =
"Signature 1:\n" ++ showDoc e1 "\nSignature 2:\n"
++ showDoc e2 "\nDifference\n" ++ showDoc
(diffEnv e1 e2) "" | 159 | false | true | 0 | 8 | 56 | 59 | 28 | 31 | null | null |
spechub/Hets | Taxonomy/OntoParser.hs | gpl-2.0 | nameDefl :: GenParser Char st (String, String)
nameDefl = do
s1 <- braced idParser
s2 <- braced value
return (s1, s2) | 123 | nameDefl :: GenParser Char st (String, String)
nameDefl = do
s1 <- braced idParser
s2 <- braced value
return (s1, s2) | 123 | nameDefl = do
s1 <- braced idParser
s2 <- braced value
return (s1, s2) | 76 | false | true | 0 | 8 | 26 | 56 | 27 | 29 | null | null |
brendanhay/gogol | gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs | mpl-2.0 | -- | The source range to copy.
cprSource :: Lens' CopyPasteRequest (Maybe GridRange)
cprSource
= lens _cprSource (\ s a -> s{_cprSource = a}) | 143 | cprSource :: Lens' CopyPasteRequest (Maybe GridRange)
cprSource
= lens _cprSource (\ s a -> s{_cprSource = a}) | 112 | cprSource
= lens _cprSource (\ s a -> s{_cprSource = a}) | 58 | true | true | 1 | 9 | 25 | 52 | 25 | 27 | null | null |
jean-edouard/manager | xec/xec.hs | gpl-2.0 | listInterfaceProperties :: Interface -> IO ()
listInterfaceProperties i = mapM_ (putStrLn . TL.unpack . propName) (intfProperties i) | 132 | listInterfaceProperties :: Interface -> IO ()
listInterfaceProperties i = mapM_ (putStrLn . TL.unpack . propName) (intfProperties i) | 132 | listInterfaceProperties i = mapM_ (putStrLn . TL.unpack . propName) (intfProperties i) | 86 | false | true | 0 | 9 | 16 | 47 | 23 | 24 | null | null |
spetz911/progames | GLFW/InteractGLFW.hs | mit | turnViewRL ang w = w { angRL = ang'' }
where ang'' = if ang' > pi then 2 * pi - ang'
else if ang' < (-pi) then 2 * pi + ang'
else ang'
ang' = ang + angRL w | 197 | turnViewRL ang w = w { angRL = ang'' }
where ang'' = if ang' > pi then 2 * pi - ang'
else if ang' < (-pi) then 2 * pi + ang'
else ang'
ang' = ang + angRL w | 197 | turnViewRL ang w = w { angRL = ang'' }
where ang'' = if ang' > pi then 2 * pi - ang'
else if ang' < (-pi) then 2 * pi + ang'
else ang'
ang' = ang + angRL w | 197 | false | false | 1 | 9 | 83 | 86 | 45 | 41 | null | null |
telser/numerals | src/Text/Numeral/Language/FIN.hs | bsd-3-clause | bounds ∷ (Integral α) ⇒ (α, α)
bounds = let x = dec 15 - 1 in (negate x, x) | 75 | bounds ∷ (Integral α) ⇒ (α, α)
bounds = let x = dec 15 - 1 in (negate x, x) | 75 | bounds = let x = dec 15 - 1 in (negate x, x) | 44 | false | true | 0 | 10 | 19 | 60 | 29 | 31 | null | null |
xarts19/tpbhs | FSUtils.hs | mit | getTVShow :: FilePath -> IO (Maybe TVShow)
getTVShow filename = do
let show_name = takeBaseName filename
exists <- doesDirectoryExist filename
case exists of
False -> return Nothing
True -> do
files <- getDirectoryContents filename
absolute_path <- canonicalizePath filename
let ep = foldl1 (<|>) $ Nothing : (map lastEpisodeFile files)
let eps = catMaybes $ map parseEpisode $ filter (isTitleValid show_name) files
-- print some useful information
case ep of
Nothing -> return ()
Just e -> (putStrLn $ "Processing '" ++ filename ++ "'...") >>
(putStrLn $ "Latest watched episode: " ++ show e)
case eps of
[] -> return ()
xs -> putStrLn $ "Latest episode on disk: " ++ show (maximum xs)
-- if some episodes are present that are more recent then last episode file suggests
-- then use them
return $ fmap (\e -> TVShow show_name absolute_path e) $ fmap (\e -> maximum (e:eps)) ep | 1,141 | getTVShow :: FilePath -> IO (Maybe TVShow)
getTVShow filename = do
let show_name = takeBaseName filename
exists <- doesDirectoryExist filename
case exists of
False -> return Nothing
True -> do
files <- getDirectoryContents filename
absolute_path <- canonicalizePath filename
let ep = foldl1 (<|>) $ Nothing : (map lastEpisodeFile files)
let eps = catMaybes $ map parseEpisode $ filter (isTitleValid show_name) files
-- print some useful information
case ep of
Nothing -> return ()
Just e -> (putStrLn $ "Processing '" ++ filename ++ "'...") >>
(putStrLn $ "Latest watched episode: " ++ show e)
case eps of
[] -> return ()
xs -> putStrLn $ "Latest episode on disk: " ++ show (maximum xs)
-- if some episodes are present that are more recent then last episode file suggests
-- then use them
return $ fmap (\e -> TVShow show_name absolute_path e) $ fmap (\e -> maximum (e:eps)) ep | 1,141 | getTVShow filename = do
let show_name = takeBaseName filename
exists <- doesDirectoryExist filename
case exists of
False -> return Nothing
True -> do
files <- getDirectoryContents filename
absolute_path <- canonicalizePath filename
let ep = foldl1 (<|>) $ Nothing : (map lastEpisodeFile files)
let eps = catMaybes $ map parseEpisode $ filter (isTitleValid show_name) files
-- print some useful information
case ep of
Nothing -> return ()
Just e -> (putStrLn $ "Processing '" ++ filename ++ "'...") >>
(putStrLn $ "Latest watched episode: " ++ show e)
case eps of
[] -> return ()
xs -> putStrLn $ "Latest episode on disk: " ++ show (maximum xs)
-- if some episodes are present that are more recent then last episode file suggests
-- then use them
return $ fmap (\e -> TVShow show_name absolute_path e) $ fmap (\e -> maximum (e:eps)) ep | 1,098 | false | true | 0 | 21 | 412 | 316 | 148 | 168 | null | null |
heatherleaf/FraCaS-treebank | ToHTML.hs | gpl-3.0 | endtag t = tag ('/':t) | 22 | endtag t = tag ('/':t) | 22 | endtag t = tag ('/':t) | 22 | false | false | 0 | 7 | 4 | 19 | 9 | 10 | null | null |
blender/Rome | tests/Tests.hs | mit | prop_split_string :: String -> Property
prop_split_string ls = not (null ls) ==> splitWithSeparator '/' (T.pack ls) == T.split (== '/') (T.pack ls) | 147 | prop_split_string :: String -> Property
prop_split_string ls = not (null ls) ==> splitWithSeparator '/' (T.pack ls) == T.split (== '/') (T.pack ls) | 147 | prop_split_string ls = not (null ls) ==> splitWithSeparator '/' (T.pack ls) == T.split (== '/') (T.pack ls) | 107 | false | true | 0 | 10 | 21 | 67 | 33 | 34 | null | null |
brendanhay/gogol | gogol-monitoring/gen/Network/Google/Monitoring/Types/Product.hs | mpl-2.0 | -- | The returned Uptime check configurations.
luccrUptimeCheckConfigs :: Lens' ListUptimeCheckConfigsResponse [UptimeCheckConfig]
luccrUptimeCheckConfigs
= lens _luccrUptimeCheckConfigs
(\ s a -> s{_luccrUptimeCheckConfigs = a})
. _Default
. _Coerce | 270 | luccrUptimeCheckConfigs :: Lens' ListUptimeCheckConfigsResponse [UptimeCheckConfig]
luccrUptimeCheckConfigs
= lens _luccrUptimeCheckConfigs
(\ s a -> s{_luccrUptimeCheckConfigs = a})
. _Default
. _Coerce | 223 | luccrUptimeCheckConfigs
= lens _luccrUptimeCheckConfigs
(\ s a -> s{_luccrUptimeCheckConfigs = a})
. _Default
. _Coerce | 139 | true | true | 2 | 8 | 46 | 57 | 28 | 29 | null | null |
erochest/wa-tor | src/WaTor/Utils.hs | apache-2.0 | entityKey Shark{} = "shark" | 27 | entityKey Shark{} = "shark" | 27 | entityKey Shark{} = "shark" | 27 | false | false | 0 | 6 | 3 | 13 | 6 | 7 | null | null |
svenssonjoel/ObsidianGFX | Obsidian/Names.hs | bsd-3-clause | mapNamesM_ :: Monad m => (Name -> m ()) -> Names a -> m ()
mapNamesM_ f (Single nom) = f nom | 93 | mapNamesM_ :: Monad m => (Name -> m ()) -> Names a -> m ()
mapNamesM_ f (Single nom) = f nom | 93 | mapNamesM_ f (Single nom) = f nom | 34 | false | true | 0 | 10 | 22 | 60 | 28 | 32 | null | null |
GU-CLASP/TypedFlow | TypedFlow/Broadcast.hs | lgpl-3.0 | unopInputShape (Num1Op _) = Unit | 32 | unopInputShape (Num1Op _) = Unit | 32 | unopInputShape (Num1Op _) = Unit | 32 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
siddhanathan/yi | yi-core/src/Yi/Config/Simple.hs | gpl-2.0 | autoHideScrollBar :: Field Bool
autoHideScrollBar = configUIA . configAutoHideScrollBarA | 88 | autoHideScrollBar :: Field Bool
autoHideScrollBar = configUIA . configAutoHideScrollBarA | 88 | autoHideScrollBar = configUIA . configAutoHideScrollBarA | 56 | false | true | 1 | 6 | 8 | 22 | 9 | 13 | null | null |
tdeekens/tda452-code | Lab-4/Parser.hs | mit | -- Parses a string into a field
parseField :: String -> Field
parseField s = Field (map parseRow (lines s)) | 107 | parseField :: String -> Field
parseField s = Field (map parseRow (lines s)) | 75 | parseField s = Field (map parseRow (lines s)) | 45 | true | true | 0 | 9 | 19 | 42 | 19 | 23 | null | null |
alexbaluta/courseography | dependencies/HaXml-1.25.3/src/Text/XML/HaXml/Html/ParseLazy.hs | gpl-3.0 | attvalue :: HParser AttValue
attvalue =
( do avs <- bracket (tok TokQuote) (commit $ tok TokQuote)
(many (either freetext reference))
return (AttValue avs) ) `onFail`
( do v <- nmtoken
s <- (tok TokPercent >> return "%") `onFail` return ""
return (AttValue [Left (v++s)]) ) `onFail`
( do s <- oneOf [ tok TokPlus >> return "+"
, tok TokHash >> return "#"
]
v <- nmtoken
return (AttValue [Left (s++v)]) ) `onFail`
failP "Badly formatted attribute value" | 553 | attvalue :: HParser AttValue
attvalue =
( do avs <- bracket (tok TokQuote) (commit $ tok TokQuote)
(many (either freetext reference))
return (AttValue avs) ) `onFail`
( do v <- nmtoken
s <- (tok TokPercent >> return "%") `onFail` return ""
return (AttValue [Left (v++s)]) ) `onFail`
( do s <- oneOf [ tok TokPlus >> return "+"
, tok TokHash >> return "#"
]
v <- nmtoken
return (AttValue [Left (s++v)]) ) `onFail`
failP "Badly formatted attribute value" | 553 | attvalue =
( do avs <- bracket (tok TokQuote) (commit $ tok TokQuote)
(many (either freetext reference))
return (AttValue avs) ) `onFail`
( do v <- nmtoken
s <- (tok TokPercent >> return "%") `onFail` return ""
return (AttValue [Left (v++s)]) ) `onFail`
( do s <- oneOf [ tok TokPlus >> return "+"
, tok TokHash >> return "#"
]
v <- nmtoken
return (AttValue [Left (s++v)]) ) `onFail`
failP "Badly formatted attribute value" | 524 | false | true | 0 | 17 | 179 | 229 | 112 | 117 | null | null |
advancedtelematic/quickcheck-state-machine-model | test/ShrinkingProps.hs | bsd-3-clause | equalCmd _ _ = False | 20 | equalCmd _ _ = False | 20 | equalCmd _ _ = False | 20 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
garetxe/cabal | cabal-install/Distribution/Client/Setup.hs | bsd-3-clause | defaultInfoFlags :: InfoFlags
defaultInfoFlags = InfoFlags {
infoVerbosity = toFlag normal,
infoPackageDBs = []
} | 124 | defaultInfoFlags :: InfoFlags
defaultInfoFlags = InfoFlags {
infoVerbosity = toFlag normal,
infoPackageDBs = []
} | 124 | defaultInfoFlags = InfoFlags {
infoVerbosity = toFlag normal,
infoPackageDBs = []
} | 94 | false | true | 0 | 8 | 25 | 37 | 18 | 19 | null | null |
ArchiveTeam/glowing-computing-machine | src/Propellor/PrivData/Paths.hs | bsd-2-clause | privDataLocal :: FilePath
privDataLocal = privDataDir </> "local" | 65 | privDataLocal :: FilePath
privDataLocal = privDataDir </> "local" | 65 | privDataLocal = privDataDir </> "local" | 39 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
iu-parfunc/AutoObsidian | interface_brainstorming/06_ExtensibleEffects/newVer/Eff1.hs | bsd-3-clause | -- The handler of Reader requests. The return type shows that
-- all Reader requests are fully handled.
runReader' :: Eff (Reader e ': r) w -> e -> Eff r w
runReader' m e = loop m where
loop (Val x) = return x
loop (E u q) = case decomp u of
Right Reader -> loop $ qApp e q
Left u -> E u (tsingleton (qComp q loop))
-- A different way of writing the above | 400 | runReader' :: Eff (Reader e ': r) w -> e -> Eff r w
runReader' m e = loop m where
loop (Val x) = return x
loop (E u q) = case decomp u of
Right Reader -> loop $ qApp e q
Left u -> E u (tsingleton (qComp q loop))
-- A different way of writing the above | 296 | runReader' m e = loop m where
loop (Val x) = return x
loop (E u q) = case decomp u of
Right Reader -> loop $ qApp e q
Left u -> E u (tsingleton (qComp q loop))
-- A different way of writing the above | 244 | true | true | 0 | 14 | 123 | 140 | 67 | 73 | null | null |
tpsinnem/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | defined (PMutual _ ds) = concatMap defined ds | 72 | defined (PMutual _ ds) = concatMap defined ds | 72 | defined (PMutual _ ds) = concatMap defined ds | 72 | false | false | 0 | 7 | 34 | 22 | 10 | 12 | null | null |
heathweiss/Tricad | src/Examples/ShoeLift/SnowBoardBoot.hs | gpl-2.0 | writeForwardRoundedToeTread = writeStlToFile $ newStlShape "tread forward" treadForwardTriangles | 96 | writeForwardRoundedToeTread = writeStlToFile $ newStlShape "tread forward" treadForwardTriangles | 96 | writeForwardRoundedToeTread = writeStlToFile $ newStlShape "tread forward" treadForwardTriangles | 96 | false | false | 0 | 6 | 7 | 15 | 7 | 8 | null | null |
ancientlanguage/haskell-analysis | prepare/src/Prepare/Decompose.hs | mit | decomposeChar '\x0B5D' = "\x0B22\x0B3C" | 39 | decomposeChar '\x0B5D' = "\x0B22\x0B3C" | 39 | decomposeChar '\x0B5D' = "\x0B22\x0B3C" | 39 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
smaximov/lordown | src/Text/Pandoc/Writers/Lorcode.hs | bsd-3-clause | prettyInline (Code _ code) = tag Nothing "inline" $ text code | 61 | prettyInline (Code _ code) = tag Nothing "inline" $ text code | 61 | prettyInline (Code _ code) = tag Nothing "inline" $ text code | 61 | false | false | 0 | 7 | 10 | 29 | 13 | 16 | null | null |
noughtmare/yi | yi-keymap-vim/src/Yi/Keymap/Vim/Ex/Commands/Quit.hs | gpl-2.0 | quitWindowE :: YiM ()
quitWindowE = do
nw <- gets currentBuffer >>= Common.needsSaving
ws <- withEditor $ use currentWindowA >>= windowsOnBufferE . bufkey
if length ws == 1 && nw
then errorEditor "No write since last change (add ! to override)"
else do
winCount <- withEditor $ uses windowsA PL.length
tabCount <- withEditor $ uses tabsA PL.length
if winCount == 1 && tabCount == 1
-- if its the last window, quitting will quit the editor
then quitAllE
else closeWindow | 558 | quitWindowE :: YiM ()
quitWindowE = do
nw <- gets currentBuffer >>= Common.needsSaving
ws <- withEditor $ use currentWindowA >>= windowsOnBufferE . bufkey
if length ws == 1 && nw
then errorEditor "No write since last change (add ! to override)"
else do
winCount <- withEditor $ uses windowsA PL.length
tabCount <- withEditor $ uses tabsA PL.length
if winCount == 1 && tabCount == 1
-- if its the last window, quitting will quit the editor
then quitAllE
else closeWindow | 558 | quitWindowE = do
nw <- gets currentBuffer >>= Common.needsSaving
ws <- withEditor $ use currentWindowA >>= windowsOnBufferE . bufkey
if length ws == 1 && nw
then errorEditor "No write since last change (add ! to override)"
else do
winCount <- withEditor $ uses windowsA PL.length
tabCount <- withEditor $ uses tabsA PL.length
if winCount == 1 && tabCount == 1
-- if its the last window, quitting will quit the editor
then quitAllE
else closeWindow | 536 | false | true | 1 | 13 | 168 | 143 | 66 | 77 | null | null |
rvion/stack | src/Stack/Types/Package.hs | bsd-3-clause | isCBench :: NamedComponent -> Bool
isCBench CBench{} = True | 59 | isCBench :: NamedComponent -> Bool
isCBench CBench{} = True | 59 | isCBench CBench{} = True | 24 | false | true | 0 | 6 | 8 | 22 | 11 | 11 | null | null |
ml9951/ghc | compiler/backpack/ShPackageKey.hs | bsd-3-clause | newPackageKey' dflags
shpk@(ShPackageKey pn vh insts fhs) = do
ASSERTM( fmap (==fhs) (calcInstsFreeHoles dflags insts) )
let pk = mkPackageKey pn vh insts
pkt_var = pkgKeyCache dflags
pk_cache <- readIORef pkt_var
let consistent pk_cache = maybe True (==shpk) (lookupUFM pk_cache pk)
MASSERT( consistent pk_cache )
when (not (elemUFM pk pk_cache)) $
atomicModifyIORef' pkt_var (\pk_cache ->
-- Could race, but it's guaranteed to be the same
ASSERT( consistent pk_cache ) (addToUFM pk_cache pk shpk, ()))
return pk
-- | Given a 'PackageKey', reverse lookup the 'ShPackageKey' associated
-- with it. This only gives useful information for keys which are
-- created using 'newPackageKey' or the associated functions, or that are
-- already in the installed package database, since we generally cannot reverse
-- MD5 hashes. | 905 | newPackageKey' dflags
shpk@(ShPackageKey pn vh insts fhs) = do
ASSERTM( fmap (==fhs) (calcInstsFreeHoles dflags insts) )
let pk = mkPackageKey pn vh insts
pkt_var = pkgKeyCache dflags
pk_cache <- readIORef pkt_var
let consistent pk_cache = maybe True (==shpk) (lookupUFM pk_cache pk)
MASSERT( consistent pk_cache )
when (not (elemUFM pk pk_cache)) $
atomicModifyIORef' pkt_var (\pk_cache ->
-- Could race, but it's guaranteed to be the same
ASSERT( consistent pk_cache ) (addToUFM pk_cache pk shpk, ()))
return pk
-- | Given a 'PackageKey', reverse lookup the 'ShPackageKey' associated
-- with it. This only gives useful information for keys which are
-- created using 'newPackageKey' or the associated functions, or that are
-- already in the installed package database, since we generally cannot reverse
-- MD5 hashes. | 905 | newPackageKey' dflags
shpk@(ShPackageKey pn vh insts fhs) = do
ASSERTM( fmap (==fhs) (calcInstsFreeHoles dflags insts) )
let pk = mkPackageKey pn vh insts
pkt_var = pkgKeyCache dflags
pk_cache <- readIORef pkt_var
let consistent pk_cache = maybe True (==shpk) (lookupUFM pk_cache pk)
MASSERT( consistent pk_cache )
when (not (elemUFM pk pk_cache)) $
atomicModifyIORef' pkt_var (\pk_cache ->
-- Could race, but it's guaranteed to be the same
ASSERT( consistent pk_cache ) (addToUFM pk_cache pk shpk, ()))
return pk
-- | Given a 'PackageKey', reverse lookup the 'ShPackageKey' associated
-- with it. This only gives useful information for keys which are
-- created using 'newPackageKey' or the associated functions, or that are
-- already in the installed package database, since we generally cannot reverse
-- MD5 hashes. | 905 | false | false | 0 | 13 | 208 | 204 | 100 | 104 | null | null |
xruzzz/axt-base-app-console-haskell | app/Main.hs | gpl-2.0 | toAlg (x,y) = [chr (x + 96), chr (y + 48)] | 42 | toAlg (x,y) = [chr (x + 96), chr (y + 48)] | 42 | toAlg (x,y) = [chr (x + 96), chr (y + 48)] | 42 | false | false | 0 | 8 | 10 | 42 | 22 | 20 | null | null |
gcampax/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | orphNamesOfCoAxBranches :: BranchList CoAxBranch br -> NameSet
orphNamesOfCoAxBranches = brListFoldr (unionNameSet . orphNamesOfCoAxBranch) emptyNameSet | 152 | orphNamesOfCoAxBranches :: BranchList CoAxBranch br -> NameSet
orphNamesOfCoAxBranches = brListFoldr (unionNameSet . orphNamesOfCoAxBranch) emptyNameSet | 152 | orphNamesOfCoAxBranches = brListFoldr (unionNameSet . orphNamesOfCoAxBranch) emptyNameSet | 89 | false | true | 0 | 7 | 13 | 38 | 17 | 21 | null | null |
bgamari/shaking-up-ghc | src/GHC/Packages.hs | bsd-3-clause | -- | These are all GHC packages we know about. Build rules will be generated for
-- all of them. However, not all of these packages will be built. For example,
-- package 'win32' is built only on Windows. 'defaultPackages' defines default
-- conditions for building each package. Users can add their own packages and
-- modify build default build conditions in "UserSettings".
ghcPackages :: [Package]
ghcPackages =
[ array, base, binary, bytestring, cabal, checkPpr, compareSizes, compiler
, containers, deepseq, deriveConstants, directory, filepath, genapply
, genprimopcode, ghc, ghcBoot, ghcBootTh, ghcCompact, ghcHeap, ghci, ghcPkg
, ghcPrim, ghcTags, haddock, haskeline, hsc2hs, hp2ps, hpc, hpcBin, integerGmp
, integerSimple, iserv, libffi, libiserv, mtl, parsec, parallel, pretty
, process, rts, runGhc, stm, templateHaskell, terminfo, text, time, touchy
, transformers, unlit, unix, win32, xhtml ] | 934 | ghcPackages :: [Package]
ghcPackages =
[ array, base, binary, bytestring, cabal, checkPpr, compareSizes, compiler
, containers, deepseq, deriveConstants, directory, filepath, genapply
, genprimopcode, ghc, ghcBoot, ghcBootTh, ghcCompact, ghcHeap, ghci, ghcPkg
, ghcPrim, ghcTags, haddock, haskeline, hsc2hs, hp2ps, hpc, hpcBin, integerGmp
, integerSimple, iserv, libffi, libiserv, mtl, parsec, parallel, pretty
, process, rts, runGhc, stm, templateHaskell, terminfo, text, time, touchy
, transformers, unlit, unix, win32, xhtml ] | 557 | ghcPackages =
[ array, base, binary, bytestring, cabal, checkPpr, compareSizes, compiler
, containers, deepseq, deriveConstants, directory, filepath, genapply
, genprimopcode, ghc, ghcBoot, ghcBootTh, ghcCompact, ghcHeap, ghci, ghcPkg
, ghcPrim, ghcTags, haddock, haskeline, hsc2hs, hp2ps, hpc, hpcBin, integerGmp
, integerSimple, iserv, libffi, libiserv, mtl, parsec, parallel, pretty
, process, rts, runGhc, stm, templateHaskell, terminfo, text, time, touchy
, transformers, unlit, unix, win32, xhtml ] | 532 | true | true | 0 | 7 | 156 | 185 | 120 | 65 | null | null |
diku-dk/futhark | src/Futhark/CodeGen/ImpCode.hs | isc | declaredIn (If _ t f) = declaredIn t <> declaredIn f | 52 | declaredIn (If _ t f) = declaredIn t <> declaredIn f | 52 | declaredIn (If _ t f) = declaredIn t <> declaredIn f | 52 | false | false | 0 | 7 | 10 | 29 | 13 | 16 | null | null |
tychon/phrases | test.hs | mit | -- TODO more exhaustive testing,
-- use testing framework?
main = do
let passphrase = "testpassphrase"
-- encrypt
putStrLn "Encrypting empty container ..."
storage <- initStdStorage passphrase
innersalt <- genRandomness (innersalt_length $ fromJust $ props storage)
let encrypted = encrypt storage innersalt
putStrLn $ "Size (bytes): "++(show $ BS.length encrypted)
-- decrypt
putStrLn "Decrypting empty container ..."
let (Just props, fcontent') = readProps encrypted
let Just (lockhash, newhash, serialized)
= assert (checkStorageProps props)
(decrypt props (BS8.pack passphrase) fcontent')
putStrLn $ "Hash: "++(printHex newhash) | 694 | main = do
let passphrase = "testpassphrase"
-- encrypt
putStrLn "Encrypting empty container ..."
storage <- initStdStorage passphrase
innersalt <- genRandomness (innersalt_length $ fromJust $ props storage)
let encrypted = encrypt storage innersalt
putStrLn $ "Size (bytes): "++(show $ BS.length encrypted)
-- decrypt
putStrLn "Decrypting empty container ..."
let (Just props, fcontent') = readProps encrypted
let Just (lockhash, newhash, serialized)
= assert (checkStorageProps props)
(decrypt props (BS8.pack passphrase) fcontent')
putStrLn $ "Hash: "++(printHex newhash) | 634 | main = do
let passphrase = "testpassphrase"
-- encrypt
putStrLn "Encrypting empty container ..."
storage <- initStdStorage passphrase
innersalt <- genRandomness (innersalt_length $ fromJust $ props storage)
let encrypted = encrypt storage innersalt
putStrLn $ "Size (bytes): "++(show $ BS.length encrypted)
-- decrypt
putStrLn "Decrypting empty container ..."
let (Just props, fcontent') = readProps encrypted
let Just (lockhash, newhash, serialized)
= assert (checkStorageProps props)
(decrypt props (BS8.pack passphrase) fcontent')
putStrLn $ "Hash: "++(printHex newhash) | 634 | true | false | 1 | 15 | 144 | 196 | 90 | 106 | null | null |
gcross/LogicGrowsOnTrees | LogicGrowsOnTrees/examples/readme-full.hs | bsd-2-clause | nqueensCount board_size =
-- Start with...
go board_size -- ...n queens left...
0 -- ... at row zero...
-- ... with all columns available ...
(IntSet.fromDistinctAscList [0..fromIntegral board_size-1])
IntSet.empty -- ... with no occupied negative diagonals...
IntSet.empty -- ... with no occupied positive diagonals.
where
-- We have placed the last queen, so this is a solution!
go 0 _ _ _ _ = return (WordSum 1)
-- We are still placing queens.
go n
row
available_columns
occupied_negative_diagonals
occupied_positive_diagonals
= do
-- Pick one of the available columns.
column <- allFrom $ IntSet.toList available_columns
-- See if this spot conflicts with another queen on the negative diagonal.
let negative_diagonal = row + column
guard $ IntSet.notMember negative_diagonal occupied_negative_diagonals
-- See if this spot conflicts with another queen on the positive diagonal.
let positive_diagonal = row - column
guard $ IntSet.notMember positive_diagonal occupied_positive_diagonals
-- This spot is good! Place a queen here and move on to the next row.
go (n-1)
(row+1)
(IntSet.delete column available_columns)
(IntSet.insert negative_diagonal occupied_negative_diagonals)
(IntSet.insert positive_diagonal occupied_positive_diagonals) | 1,465 | nqueensCount board_size =
-- Start with...
go board_size -- ...n queens left...
0 -- ... at row zero...
-- ... with all columns available ...
(IntSet.fromDistinctAscList [0..fromIntegral board_size-1])
IntSet.empty -- ... with no occupied negative diagonals...
IntSet.empty -- ... with no occupied positive diagonals.
where
-- We have placed the last queen, so this is a solution!
go 0 _ _ _ _ = return (WordSum 1)
-- We are still placing queens.
go n
row
available_columns
occupied_negative_diagonals
occupied_positive_diagonals
= do
-- Pick one of the available columns.
column <- allFrom $ IntSet.toList available_columns
-- See if this spot conflicts with another queen on the negative diagonal.
let negative_diagonal = row + column
guard $ IntSet.notMember negative_diagonal occupied_negative_diagonals
-- See if this spot conflicts with another queen on the positive diagonal.
let positive_diagonal = row - column
guard $ IntSet.notMember positive_diagonal occupied_positive_diagonals
-- This spot is good! Place a queen here and move on to the next row.
go (n-1)
(row+1)
(IntSet.delete column available_columns)
(IntSet.insert negative_diagonal occupied_negative_diagonals)
(IntSet.insert positive_diagonal occupied_positive_diagonals) | 1,465 | nqueensCount board_size =
-- Start with...
go board_size -- ...n queens left...
0 -- ... at row zero...
-- ... with all columns available ...
(IntSet.fromDistinctAscList [0..fromIntegral board_size-1])
IntSet.empty -- ... with no occupied negative diagonals...
IntSet.empty -- ... with no occupied positive diagonals.
where
-- We have placed the last queen, so this is a solution!
go 0 _ _ _ _ = return (WordSum 1)
-- We are still placing queens.
go n
row
available_columns
occupied_negative_diagonals
occupied_positive_diagonals
= do
-- Pick one of the available columns.
column <- allFrom $ IntSet.toList available_columns
-- See if this spot conflicts with another queen on the negative diagonal.
let negative_diagonal = row + column
guard $ IntSet.notMember negative_diagonal occupied_negative_diagonals
-- See if this spot conflicts with another queen on the positive diagonal.
let positive_diagonal = row - column
guard $ IntSet.notMember positive_diagonal occupied_positive_diagonals
-- This spot is good! Place a queen here and move on to the next row.
go (n-1)
(row+1)
(IntSet.delete column available_columns)
(IntSet.insert negative_diagonal occupied_negative_diagonals)
(IntSet.insert positive_diagonal occupied_positive_diagonals) | 1,465 | false | false | 0 | 10 | 392 | 228 | 114 | 114 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.