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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
kazu-yamamoto/word8
|
Data/Word8.hs
|
bsd-3-clause
|
_comma = 0x2c
| 19 |
_comma = 0x2c
| 19 |
_comma = 0x2c
| 19 | false | false | 1 | 5 | 8 | 10 | 3 | 7 | null | null |
haskell-opengl/OpenGLRaw
|
src/Graphics/GL/Functions/F28.hs
|
bsd-3-clause
|
-- glUniform2iv ----------------------------------------------------------------
-- | Manual pages for <https://www.opengl.org/sdk/docs/man2/xhtml/glUniform.xml OpenGL 2.x> or <https://www.opengl.org/sdk/docs/man3/xhtml/glUniform.xml OpenGL 3.x> or <https://www.opengl.org/sdk/docs/man4/html/glUniform.xhtml OpenGL 4.x>.
glUniform2iv
:: MonadIO m
=> GLint -- ^ @location@.
-> GLsizei -- ^ @count@.
-> Ptr GLint -- ^ @value@ pointing to @count*2@ elements of type @GLint@.
-> m ()
glUniform2iv v1 v2 v3 = liftIO $ dyn841 ptr_glUniform2iv v1 v2 v3
| 556 |
glUniform2iv
:: MonadIO m
=> GLint -- ^ @location@.
-> GLsizei -- ^ @count@.
-> Ptr GLint -- ^ @value@ pointing to @count*2@ elements of type @GLint@.
-> m ()
glUniform2iv v1 v2 v3 = liftIO $ dyn841 ptr_glUniform2iv v1 v2 v3
| 234 |
glUniform2iv v1 v2 v3 = liftIO $ dyn841 ptr_glUniform2iv v1 v2 v3
| 65 | true | true | 0 | 11 | 71 | 67 | 33 | 34 | null | null |
hvr/jhc
|
src/E/PrimDecode.hs
|
mit
|
stot :: Show a => a -> Int -> ExtType -> Ty
stot op n s = stringToOpTy' (show op ++ show n) s
| 93 |
stot :: Show a => a -> Int -> ExtType -> Ty
stot op n s = stringToOpTy' (show op ++ show n) s
| 93 |
stot op n s = stringToOpTy' (show op ++ show n) s
| 49 | false | true | 0 | 8 | 23 | 55 | 26 | 29 | null | null |
Megaleo/Minehack
|
src/Tile/TileType.hs
|
bsd-3-clause
|
name (TBlock B.Wood) = "Block of Wood"
| 57 |
name (TBlock B.Wood) = "Block of Wood"
| 57 |
name (TBlock B.Wood) = "Block of Wood"
| 57 | false | false | 0 | 8 | 25 | 17 | 8 | 9 | null | null |
gitfoxi/vcd-haskell
|
app/make-burst.hs
|
agpl-3.0
|
main :: IO ()
main = do
Opts burst portPinList <- execParser opts
putStrLn "hp93000,vector,0.1"
putStr $ makePortBurst burst portPinList
| 149 |
main :: IO ()
main = do
Opts burst portPinList <- execParser opts
putStrLn "hp93000,vector,0.1"
putStr $ makePortBurst burst portPinList
| 149 |
main = do
Opts burst portPinList <- execParser opts
putStrLn "hp93000,vector,0.1"
putStr $ makePortBurst burst portPinList
| 135 | false | true | 0 | 8 | 32 | 49 | 21 | 28 | null | null |
diku-dk/futhark
|
src/Futhark/CodeGen/ImpGen/Multicore/SegRed.hs
|
isc
|
nonsegmentedReduction ::
Pat LetDecMem ->
SegSpace ->
[SegBinOp MCMem] ->
TV Int32 ->
DoSegBody ->
MulticoreGen Imp.MCCode
nonsegmentedReduction pat space reds nsubtasks kbody = collect $ do
thread_res_arrs <- groupResultArrays "reduce_stage_1_tid_res_arr" (tvSize nsubtasks) reds
let slugs1 = zipWith SegBinOpSlug reds thread_res_arrs
nsubtasks' = tvExp nsubtasks
reductionStage1 space slugs1 kbody
reds2 <- renameSegBinOp reds
let slugs2 = zipWith SegBinOpSlug reds2 thread_res_arrs
reductionStage2 pat space nsubtasks' slugs2
| 559 |
nonsegmentedReduction ::
Pat LetDecMem ->
SegSpace ->
[SegBinOp MCMem] ->
TV Int32 ->
DoSegBody ->
MulticoreGen Imp.MCCode
nonsegmentedReduction pat space reds nsubtasks kbody = collect $ do
thread_res_arrs <- groupResultArrays "reduce_stage_1_tid_res_arr" (tvSize nsubtasks) reds
let slugs1 = zipWith SegBinOpSlug reds thread_res_arrs
nsubtasks' = tvExp nsubtasks
reductionStage1 space slugs1 kbody
reds2 <- renameSegBinOp reds
let slugs2 = zipWith SegBinOpSlug reds2 thread_res_arrs
reductionStage2 pat space nsubtasks' slugs2
| 559 |
nonsegmentedReduction pat space reds nsubtasks kbody = collect $ do
thread_res_arrs <- groupResultArrays "reduce_stage_1_tid_res_arr" (tvSize nsubtasks) reds
let slugs1 = zipWith SegBinOpSlug reds thread_res_arrs
nsubtasks' = tvExp nsubtasks
reductionStage1 space slugs1 kbody
reds2 <- renameSegBinOp reds
let slugs2 = zipWith SegBinOpSlug reds2 thread_res_arrs
reductionStage2 pat space nsubtasks' slugs2
| 424 | false | true | 0 | 11 | 95 | 155 | 70 | 85 | null | null |
jsnajder/multext-east-msd
|
src/Data/MultextEastMsd.hs
|
bsd-3-clause
|
encode (OwnerNumber v) = enc OwnerNumber v
| 43 |
encode (OwnerNumber v) = enc OwnerNumber v
| 43 |
encode (OwnerNumber v) = enc OwnerNumber v
| 43 | false | false | 0 | 6 | 7 | 21 | 9 | 12 | null | null |
bmillwood/pointfree
|
Plugin/Pl/Common.hs
|
mit
|
mapTopLevel :: (Expr -> Expr) -> TopLevel -> TopLevel
mapTopLevel f tl = case getExpr tl of (e, c) -> c $ f e
| 109 |
mapTopLevel :: (Expr -> Expr) -> TopLevel -> TopLevel
mapTopLevel f tl = case getExpr tl of (e, c) -> c $ f e
| 109 |
mapTopLevel f tl = case getExpr tl of (e, c) -> c $ f e
| 55 | false | true | 0 | 9 | 23 | 62 | 30 | 32 | null | null |
aaronvargo/htut
|
src/Tut/Misc.hs
|
bsd-3-clause
|
maybeError
:: MonadError e m
=> e -> Maybe a -> m a
maybeError e = maybe (throwError e) return
| 98 |
maybeError
:: MonadError e m
=> e -> Maybe a -> m a
maybeError e = maybe (throwError e) return
| 98 |
maybeError e = maybe (throwError e) return
| 42 | false | true | 0 | 8 | 23 | 51 | 23 | 28 | null | null |
kojiromike/Idris-dev
|
src/Idris/Elab/AsPat.hs
|
bsd-3-clause
|
-- | Replace _-patterns under @-patterns with fresh names that can be
-- used on the RHS
replaceUnderscore :: PTerm -> PTerm
replaceUnderscore tm = evalState (transformM (underAs replaceUnderscore') tm) 0
where
underAs :: (PTerm -> State Int PTerm) -> PTerm -> State Int PTerm
underAs f (PAs fc n tm) = PAs fc n <$> transformM f tm
underAs f x = return x
fresh :: State Int Name
fresh = modify (+1) >> flip sMN "underscorePatVar" <$> get
replaceUnderscore' :: PTerm -> State Int PTerm
replaceUnderscore' Placeholder = PRef emptyFC [] <$> fresh
replaceUnderscore' tm = return tm
| 623 |
replaceUnderscore :: PTerm -> PTerm
replaceUnderscore tm = evalState (transformM (underAs replaceUnderscore') tm) 0
where
underAs :: (PTerm -> State Int PTerm) -> PTerm -> State Int PTerm
underAs f (PAs fc n tm) = PAs fc n <$> transformM f tm
underAs f x = return x
fresh :: State Int Name
fresh = modify (+1) >> flip sMN "underscorePatVar" <$> get
replaceUnderscore' :: PTerm -> State Int PTerm
replaceUnderscore' Placeholder = PRef emptyFC [] <$> fresh
replaceUnderscore' tm = return tm
| 534 |
replaceUnderscore tm = evalState (transformM (underAs replaceUnderscore') tm) 0
where
underAs :: (PTerm -> State Int PTerm) -> PTerm -> State Int PTerm
underAs f (PAs fc n tm) = PAs fc n <$> transformM f tm
underAs f x = return x
fresh :: State Int Name
fresh = modify (+1) >> flip sMN "underscorePatVar" <$> get
replaceUnderscore' :: PTerm -> State Int PTerm
replaceUnderscore' Placeholder = PRef emptyFC [] <$> fresh
replaceUnderscore' tm = return tm
| 498 | true | true | 17 | 9 | 145 | 193 | 97 | 96 | null | null |
Persi/shellcheck
|
ShellCheck/AST.hs
|
gpl-3.0
|
doTransform i = runIdentity . analyze blank blank i
| 51 |
doTransform i = runIdentity . analyze blank blank i
| 51 |
doTransform i = runIdentity . analyze blank blank i
| 51 | false | false | 0 | 6 | 8 | 20 | 9 | 11 | null | null |
facebookincubator/duckling
|
Duckling/Quantity/KO/Corpus.hs
|
bsd-3-clause
|
allExamples :: [Example]
allExamples = concat
[ examples (simple (Custom "근") 2 (Just "삼겹살"))
[ "삼겹살 두근"
]
, examples (simple (Custom "근") 1 Nothing)
[ "한근"
]
, examples (simple Gram 600 Nothing)
[ "육백그람"
]
, examples (simple Cup 3 (Just "콜라"))
[ "콜라 세컵"
]
]
| 372 |
allExamples :: [Example]
allExamples = concat
[ examples (simple (Custom "근") 2 (Just "삼겹살"))
[ "삼겹살 두근"
]
, examples (simple (Custom "근") 1 Nothing)
[ "한근"
]
, examples (simple Gram 600 Nothing)
[ "육백그람"
]
, examples (simple Cup 3 (Just "콜라"))
[ "콜라 세컵"
]
]
| 372 |
allExamples = concat
[ examples (simple (Custom "근") 2 (Just "삼겹살"))
[ "삼겹살 두근"
]
, examples (simple (Custom "근") 1 Nothing)
[ "한근"
]
, examples (simple Gram 600 Nothing)
[ "육백그람"
]
, examples (simple Cup 3 (Just "콜라"))
[ "콜라 세컵"
]
]
| 347 | false | true | 0 | 10 | 162 | 125 | 65 | 60 | null | null |
tolysz/prepare-ghcjs
|
spec-lts8/cabal/Cabal/Language/Haskell/Extension.hs
|
bsd-3-clause
|
classifyLanguage :: String -> Language
classifyLanguage = \str -> case lookup str langTable of
Just lang -> lang
Nothing -> UnknownLanguage str
where
langTable = [ (show lang, lang)
| lang <- knownLanguages ]
-- ------------------------------------------------------------
-- * Extension
-- ------------------------------------------------------------
-- Note: if you add a new 'KnownExtension':
--
-- * also add it to the Distribution.Simple.X.languageExtensions lists
-- (where X is each compiler: GHC, JHC, LHC, UHC, HaskellSuite)
--
-- | This represents language extensions beyond a base 'Language' definition
-- (such as 'Haskell98') that are supported by some implementations, usually
-- in some special mode.
--
-- Where applicable, references are given to an implementation's
-- official documentation.
| 846 |
classifyLanguage :: String -> Language
classifyLanguage = \str -> case lookup str langTable of
Just lang -> lang
Nothing -> UnknownLanguage str
where
langTable = [ (show lang, lang)
| lang <- knownLanguages ]
-- ------------------------------------------------------------
-- * Extension
-- ------------------------------------------------------------
-- Note: if you add a new 'KnownExtension':
--
-- * also add it to the Distribution.Simple.X.languageExtensions lists
-- (where X is each compiler: GHC, JHC, LHC, UHC, HaskellSuite)
--
-- | This represents language extensions beyond a base 'Language' definition
-- (such as 'Haskell98') that are supported by some implementations, usually
-- in some special mode.
--
-- Where applicable, references are given to an implementation's
-- official documentation.
| 846 |
classifyLanguage = \str -> case lookup str langTable of
Just lang -> lang
Nothing -> UnknownLanguage str
where
langTable = [ (show lang, lang)
| lang <- knownLanguages ]
-- ------------------------------------------------------------
-- * Extension
-- ------------------------------------------------------------
-- Note: if you add a new 'KnownExtension':
--
-- * also add it to the Distribution.Simple.X.languageExtensions lists
-- (where X is each compiler: GHC, JHC, LHC, UHC, HaskellSuite)
--
-- | This represents language extensions beyond a base 'Language' definition
-- (such as 'Haskell98') that are supported by some implementations, usually
-- in some special mode.
--
-- Where applicable, references are given to an implementation's
-- official documentation.
| 807 | false | true | 0 | 9 | 146 | 89 | 52 | 37 | null | null |
robdockins/edison
|
edison-core/src/Data/Edison/Seq/BraunSeq.hs
|
mit
|
rhead E = error "BraunSeq.rhead: empty sequence"
| 48 |
rhead E = error "BraunSeq.rhead: empty sequence"
| 48 |
rhead E = error "BraunSeq.rhead: empty sequence"
| 48 | false | false | 0 | 5 | 6 | 12 | 5 | 7 | null | null |
mapinguari/SC_HS_Proxy
|
src/Proxy/PathFinding/HinzAStar.hs
|
mit
|
takeUntilReachedAll :: (Ord a) => (b -> a) -> [a] -> [b] -> [b]
takeUntilReachedAll f gs ls = tur (S.fromList gs) ls
where tur _ [] = []
tur s (l:ls)
| S.null s = []
| f l `S.member` s = l : tur (S.delete (f l) s) ls
| otherwise = l : tur s ls
| 286 |
takeUntilReachedAll :: (Ord a) => (b -> a) -> [a] -> [b] -> [b]
takeUntilReachedAll f gs ls = tur (S.fromList gs) ls
where tur _ [] = []
tur s (l:ls)
| S.null s = []
| f l `S.member` s = l : tur (S.delete (f l) s) ls
| otherwise = l : tur s ls
| 286 |
takeUntilReachedAll f gs ls = tur (S.fromList gs) ls
where tur _ [] = []
tur s (l:ls)
| S.null s = []
| f l `S.member` s = l : tur (S.delete (f l) s) ls
| otherwise = l : tur s ls
| 222 | false | true | 4 | 11 | 101 | 197 | 92 | 105 | null | null |
chwthewke/hackup
|
src/Hackup/Config/Fields.hs
|
mit
|
sectionKeepField :: ConfigField
sectionKeepField = ConfigField "keep"
| 69 |
sectionKeepField :: ConfigField
sectionKeepField = ConfigField "keep"
| 69 |
sectionKeepField = ConfigField "keep"
| 37 | false | true | 0 | 6 | 6 | 21 | 8 | 13 | null | null |
GaloisInc/sk-dev-platform
|
libs/SCD/src/SCD/GenShrimp/FromCoreLob.hs
|
bsd-3-clause
|
ppDomainDeclFC :: Bool -> ClassName -> VarName -> [Expr] -> Doc
ppDomainDeclFC isTop c v es = hcat
[ text $ "DomainFC" ++ c ++ "("
, sepWith (\d1 d2 -> d1 <> text ", " <> d2) (localPrefix isTop v : map ppExpr es)
, text ")"
]
| 233 |
ppDomainDeclFC :: Bool -> ClassName -> VarName -> [Expr] -> Doc
ppDomainDeclFC isTop c v es = hcat
[ text $ "DomainFC" ++ c ++ "("
, sepWith (\d1 d2 -> d1 <> text ", " <> d2) (localPrefix isTop v : map ppExpr es)
, text ")"
]
| 233 |
ppDomainDeclFC isTop c v es = hcat
[ text $ "DomainFC" ++ c ++ "("
, sepWith (\d1 d2 -> d1 <> text ", " <> d2) (localPrefix isTop v : map ppExpr es)
, text ")"
]
| 169 | false | true | 0 | 11 | 56 | 109 | 55 | 54 | null | null |
brendanhay/gogol
|
gogol-bigtableadmin/gen/Network/Google/BigtableAdmin/Types/Product.hs
|
mpl-2.0
|
-- | Output only. Name of the backup.
biBackup :: Lens' BackupInfo (Maybe Text)
biBackup = lens _biBackup (\ s a -> s{_biBackup = a})
| 133 |
biBackup :: Lens' BackupInfo (Maybe Text)
biBackup = lens _biBackup (\ s a -> s{_biBackup = a})
| 95 |
biBackup = lens _biBackup (\ s a -> s{_biBackup = a})
| 53 | true | true | 0 | 9 | 24 | 46 | 25 | 21 | null | null |
afroisalreadyinu/LogAnalyzer
|
daemon/Generation.hs
|
gpl-2.0
|
isRighteous :: CoverageStatus -> Bool
isRighteous (Covered a) = True
| 68 |
isRighteous :: CoverageStatus -> Bool
isRighteous (Covered a) = True
| 68 |
isRighteous (Covered a) = True
| 30 | false | true | 0 | 7 | 9 | 24 | 12 | 12 | null | null |
Atsky/haskell-idea-plugin
|
data/indentTests/Braces.hs
|
apache-2.0
|
main = do { a; b }
| 18 |
main = do { a; b }
| 18 |
main = do { a; b }
| 18 | false | false | 0 | 6 | 6 | 15 | 8 | 7 | null | null |
spechub/Hets
|
CSL/Keywords.hs
|
gpl-2.0
|
numberpS :: String
numberpS = "numperp"
| 39 |
numberpS :: String
numberpS = "numperp"
| 39 |
numberpS = "numperp"
| 20 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
keera-studios/hsQt
|
Qtc/Gui/QTextFrame.hs
|
bsd-2-clause
|
parentFrame :: QTextFrame a -> (()) -> IO (QTextFrame ())
parentFrame x0 ()
= withQTextFrameResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTextFrame_parentFrame cobj_x0
| 176 |
parentFrame :: QTextFrame a -> (()) -> IO (QTextFrame ())
parentFrame x0 ()
= withQTextFrameResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTextFrame_parentFrame cobj_x0
| 176 |
parentFrame x0 ()
= withQTextFrameResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTextFrame_parentFrame cobj_x0
| 118 | false | true | 0 | 10 | 32 | 64 | 31 | 33 | null | null |
athanclark/tries
|
src/Data/Trie/HashMap.hs
|
bsd-3-clause
|
-- lookupNearest ~ match
match :: ( Hashable p
, Eq p
) => NonEmpty p -> HashMapTrie p a -> Maybe (NonEmpty p, a, [p])
match (p:|ps) (HashMapTrie (HashMapStep xs)) = do
(HashMapChildren mx mxs) <- HM.lookup p xs
let mFoundHere = (p:|[],,ps) <$> mx
if F.null ps
then mFoundHere
else getFirst $ First (do (pre,y,suff) <- match (NE.fromList ps) =<< mxs
pure (NE.cons p pre, y, suff))
<> First mFoundHere
| 473 |
match :: ( Hashable p
, Eq p
) => NonEmpty p -> HashMapTrie p a -> Maybe (NonEmpty p, a, [p])
match (p:|ps) (HashMapTrie (HashMapStep xs)) = do
(HashMapChildren mx mxs) <- HM.lookup p xs
let mFoundHere = (p:|[],,ps) <$> mx
if F.null ps
then mFoundHere
else getFirst $ First (do (pre,y,suff) <- match (NE.fromList ps) =<< mxs
pure (NE.cons p pre, y, suff))
<> First mFoundHere
| 448 |
match (p:|ps) (HashMapTrie (HashMapStep xs)) = do
(HashMapChildren mx mxs) <- HM.lookup p xs
let mFoundHere = (p:|[],,ps) <$> mx
if F.null ps
then mFoundHere
else getFirst $ First (do (pre,y,suff) <- match (NE.fromList ps) =<< mxs
pure (NE.cons p pre, y, suff))
<> First mFoundHere
| 336 | true | true | 0 | 19 | 144 | 223 | 112 | 111 | null | null |
ford-prefect/haskell-gi
|
test/testGtk.hs
|
lgpl-2.1
|
testOutArgs :: IO ()
testOutArgs = do
performGC
putStrLn "*** Out args test"
iconThemeGetDefault >>= iconThemeGetSearchPath >>= print
performGC
putStrLn "+++ Out args test done"
| 187 |
testOutArgs :: IO ()
testOutArgs = do
performGC
putStrLn "*** Out args test"
iconThemeGetDefault >>= iconThemeGetSearchPath >>= print
performGC
putStrLn "+++ Out args test done"
| 187 |
testOutArgs = do
performGC
putStrLn "*** Out args test"
iconThemeGetDefault >>= iconThemeGetSearchPath >>= print
performGC
putStrLn "+++ Out args test done"
| 166 | false | true | 0 | 8 | 34 | 45 | 19 | 26 | null | null |
prowdsponsor/country-codes
|
src/Data/CountryCodes/ISO31661.hs
|
bsd-3-clause
|
toName GH = "Ghana"
| 19 |
toName GH = "Ghana"
| 19 |
toName GH = "Ghana"
| 19 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
ggreif/thebook-haskell
|
Setup.hs
|
mit
|
-- | Attempts to parse 'FieldType' from attributes.
parseType :: Map XML.Name Text -> Text -> Maybe FieldType
parseType _ "UInt8" = Just UInt8
| 146 |
parseType :: Map XML.Name Text -> Text -> Maybe FieldType
parseType _ "UInt8" = Just UInt8
| 94 |
parseType _ "UInt8" = Just UInt8
| 36 | true | true | 3 | 6 | 27 | 40 | 18 | 22 | null | null |
avh4/elm-compiler
|
src/Generate/JavaScript.hs
|
bsd-3-clause
|
_Utils :: String -> Expression ()
_Utils x =
obj ["_U", x]
| 62 |
_Utils :: String -> Expression ()
_Utils x =
obj ["_U", x]
| 62 |
_Utils x =
obj ["_U", x]
| 28 | false | true | 0 | 7 | 15 | 32 | 16 | 16 | null | null |
lynnard/cocos2d-hs
|
src/Graphics/UI/Cocos2d/Sprite.hs
|
bsd-3-clause
|
castSpriteFrameToConst :: SpriteFrame -> SpriteFrameConst
castSpriteFrameToConst (SpriteFrame ptr') = SpriteFrameConst $ HoppyF.castPtr ptr'
| 140 |
castSpriteFrameToConst :: SpriteFrame -> SpriteFrameConst
castSpriteFrameToConst (SpriteFrame ptr') = SpriteFrameConst $ HoppyF.castPtr ptr'
| 140 |
castSpriteFrameToConst (SpriteFrame ptr') = SpriteFrameConst $ HoppyF.castPtr ptr'
| 82 | false | true | 0 | 7 | 12 | 37 | 17 | 20 | null | null |
alphalambda/hsmath
|
src/Learn/Geometry/euclid1_2.hs
|
gpl-2.0
|
myPicture points =
drawSegment (b,c) & drawPointsLabels [a,b,c] ["A","B","C"] &
drawSegment (a,b) & drawPointLabel o "O" &
drawSegment (o,a) & drawSegment (o,d) &
drawPointLabel d "D" &
drawArc (a,b,o) & drawArc (b,a,o) &
drawArc (c,b,d) & drawArc (d,o,e) &
drawPointLabel e "E" & drawSegment (a,e) &
message $ "Euclid 1_2 "
++ " AE=" ++ shownum (dist a e)
++ ", BC=" ++ shownum (dist b c)
where [a,b,c] = take 3 points
Just o = find (across c (a,b)) $ circle_circle (a,b) (b,a)
Just d = find (beyond (o,b)) $ line_circle (o,b) (b,c)
Just e = find (beyond (o,a)) $ line_circle (o,a) (o,d)
| 690 |
myPicture points =
drawSegment (b,c) & drawPointsLabels [a,b,c] ["A","B","C"] &
drawSegment (a,b) & drawPointLabel o "O" &
drawSegment (o,a) & drawSegment (o,d) &
drawPointLabel d "D" &
drawArc (a,b,o) & drawArc (b,a,o) &
drawArc (c,b,d) & drawArc (d,o,e) &
drawPointLabel e "E" & drawSegment (a,e) &
message $ "Euclid 1_2 "
++ " AE=" ++ shownum (dist a e)
++ ", BC=" ++ shownum (dist b c)
where [a,b,c] = take 3 points
Just o = find (across c (a,b)) $ circle_circle (a,b) (b,a)
Just d = find (beyond (o,b)) $ line_circle (o,b) (b,c)
Just e = find (beyond (o,a)) $ line_circle (o,a) (o,d)
| 690 |
myPicture points =
drawSegment (b,c) & drawPointsLabels [a,b,c] ["A","B","C"] &
drawSegment (a,b) & drawPointLabel o "O" &
drawSegment (o,a) & drawSegment (o,d) &
drawPointLabel d "D" &
drawArc (a,b,o) & drawArc (b,a,o) &
drawArc (c,b,d) & drawArc (d,o,e) &
drawPointLabel e "E" & drawSegment (a,e) &
message $ "Euclid 1_2 "
++ " AE=" ++ shownum (dist a e)
++ ", BC=" ++ shownum (dist b c)
where [a,b,c] = take 3 points
Just o = find (across c (a,b)) $ circle_circle (a,b) (b,a)
Just d = find (beyond (o,b)) $ line_circle (o,b) (b,c)
Just e = find (beyond (o,a)) $ line_circle (o,a) (o,d)
| 690 | false | false | 27 | 12 | 205 | 348 | 203 | 145 | null | null |
gridaphobe/ghc
|
compiler/simplCore/SimplEnv.hs
|
bsd-3-clause
|
simplNonRecBndr :: SimplEnv -> InBndr -> SimplM (SimplEnv, OutBndr)
-- A non-recursive let binder
simplNonRecBndr env id
= do { let (env1, id1) = substIdBndr env id
; seqId id1 `seq` return (env1, id1) }
| 214 |
simplNonRecBndr :: SimplEnv -> InBndr -> SimplM (SimplEnv, OutBndr)
simplNonRecBndr env id
= do { let (env1, id1) = substIdBndr env id
; seqId id1 `seq` return (env1, id1) }
| 184 |
simplNonRecBndr env id
= do { let (env1, id1) = substIdBndr env id
; seqId id1 `seq` return (env1, id1) }
| 116 | true | true | 0 | 10 | 45 | 79 | 42 | 37 | null | null |
frozencemetery/haskey
|
src/Storage.hs
|
gpl-3.0
|
get db _ (Just serv) (Just user) =
case filter (\(s, u, _) -> s == serv && u == user) db of
[] -> return Nothing
[ent] -> return $ Just ent
_ -> error "Fatal error: duplicate (service, user) pair found in DB."
-- the Bool represents sharing
-- by which I mean whether it overwrote
| 295 |
get db _ (Just serv) (Just user) =
case filter (\(s, u, _) -> s == serv && u == user) db of
[] -> return Nothing
[ent] -> return $ Just ent
_ -> error "Fatal error: duplicate (service, user) pair found in DB."
-- the Bool represents sharing
-- by which I mean whether it overwrote
| 295 |
get db _ (Just serv) (Just user) =
case filter (\(s, u, _) -> s == serv && u == user) db of
[] -> return Nothing
[ent] -> return $ Just ent
_ -> error "Fatal error: duplicate (service, user) pair found in DB."
-- the Bool represents sharing
-- by which I mean whether it overwrote
| 295 | false | false | 0 | 11 | 72 | 104 | 53 | 51 | null | null |
agrafix/Spock
|
Spock-core/src/Web/Spock/Internal/CoreAction.hs
|
bsd-3-clause
|
-- | Send json as response. Content-Type will be "application/json"
json :: (A.ToJSON a, MonadIO m) => a -> ActionCtxT ctx m b
json val =
do
setHeaderUnsafe "Content-Type" "application/json; charset=utf-8"
lazyBytes $ A.encode val
| 241 |
json :: (A.ToJSON a, MonadIO m) => a -> ActionCtxT ctx m b
json val =
do
setHeaderUnsafe "Content-Type" "application/json; charset=utf-8"
lazyBytes $ A.encode val
| 173 |
json val =
do
setHeaderUnsafe "Content-Type" "application/json; charset=utf-8"
lazyBytes $ A.encode val
| 114 | true | true | 0 | 9 | 45 | 63 | 30 | 33 | null | null |
feliposz/learning-stuff
|
haskell/Shape.hs
|
mit
|
baseRectangle :: Float -> Float -> Shape
baseRectangle w h = Rectangle (Point 0 0) (Point w h)
| 94 |
baseRectangle :: Float -> Float -> Shape
baseRectangle w h = Rectangle (Point 0 0) (Point w h)
| 94 |
baseRectangle w h = Rectangle (Point 0 0) (Point w h)
| 53 | false | true | 0 | 7 | 17 | 45 | 22 | 23 | null | null |
ahihi/babylonlib
|
PersonID.hs
|
cc0-1.0
|
dateOfBirth :: Parser Day
dateOfBirth = do
day <- intOfLength 2
month <- intOfLength 2
year <- (+) <$> intOfLength 2 <*> century
case fromGregorianValid year month day of
Just date -> return date
Nothing -> fail "invalid date"
| 260 |
dateOfBirth :: Parser Day
dateOfBirth = do
day <- intOfLength 2
month <- intOfLength 2
year <- (+) <$> intOfLength 2 <*> century
case fromGregorianValid year month day of
Just date -> return date
Nothing -> fail "invalid date"
| 260 |
dateOfBirth = do
day <- intOfLength 2
month <- intOfLength 2
year <- (+) <$> intOfLength 2 <*> century
case fromGregorianValid year month day of
Just date -> return date
Nothing -> fail "invalid date"
| 234 | false | true | 1 | 11 | 72 | 93 | 40 | 53 | null | null |
spechub/Hets
|
OMDoc/XmlInterface.hs
|
gpl-2.0
|
at_style = toQN "style"
| 23 |
at_style = toQN "style"
| 23 |
at_style = toQN "style"
| 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
merijn/lambda-except
|
Lexer.hs
|
bsd-3-clause
|
lineComment :: Parser ()
lineComment = highlight Comment $
reserve varOp "--" >> void (manyTill anyChar newline)
| 116 |
lineComment :: Parser ()
lineComment = highlight Comment $
reserve varOp "--" >> void (manyTill anyChar newline)
| 116 |
lineComment = highlight Comment $
reserve varOp "--" >> void (manyTill anyChar newline)
| 91 | false | true | 0 | 8 | 20 | 43 | 20 | 23 | null | null |
edsko/cabal
|
Cabal/src/Distribution/Simple/GHC.hs
|
bsd-3-clause
|
componentGhcOptions :: Verbosity -> LocalBuildInfo
-> BuildInfo -> ComponentLocalBuildInfo -> FilePath
-> GhcOptions
componentGhcOptions = Internal.componentGhcOptions
| 207 |
componentGhcOptions :: Verbosity -> LocalBuildInfo
-> BuildInfo -> ComponentLocalBuildInfo -> FilePath
-> GhcOptions
componentGhcOptions = Internal.componentGhcOptions
| 207 |
componentGhcOptions = Internal.componentGhcOptions
| 50 | false | true | 0 | 9 | 55 | 33 | 17 | 16 | null | null |
brendanhay/gogol
|
gogol-tpu/gen/Network/Google/Resource/TPU/Projects/Locations/List.hs
|
mpl-2.0
|
-- | Creates a value of 'ProjectsLocationsList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pllXgafv'
--
-- * 'pllUploadProtocol'
--
-- * 'pllAccessToken'
--
-- * 'pllUploadType'
--
-- * 'pllName'
--
-- * 'pllFilter'
--
-- * 'pllPageToken'
--
-- * 'pllPageSize'
--
-- * 'pllCallback'
projectsLocationsList
:: Text -- ^ 'pllName'
-> ProjectsLocationsList
projectsLocationsList pPllName_ =
ProjectsLocationsList'
{ _pllXgafv = Nothing
, _pllUploadProtocol = Nothing
, _pllAccessToken = Nothing
, _pllUploadType = Nothing
, _pllName = pPllName_
, _pllFilter = Nothing
, _pllPageToken = Nothing
, _pllPageSize = Nothing
, _pllCallback = Nothing
}
| 782 |
projectsLocationsList
:: Text -- ^ 'pllName'
-> ProjectsLocationsList
projectsLocationsList pPllName_ =
ProjectsLocationsList'
{ _pllXgafv = Nothing
, _pllUploadProtocol = Nothing
, _pllAccessToken = Nothing
, _pllUploadType = Nothing
, _pllName = pPllName_
, _pllFilter = Nothing
, _pllPageToken = Nothing
, _pllPageSize = Nothing
, _pllCallback = Nothing
}
| 408 |
projectsLocationsList pPllName_ =
ProjectsLocationsList'
{ _pllXgafv = Nothing
, _pllUploadProtocol = Nothing
, _pllAccessToken = Nothing
, _pllUploadType = Nothing
, _pllName = pPllName_
, _pllFilter = Nothing
, _pllPageToken = Nothing
, _pllPageSize = Nothing
, _pllCallback = Nothing
}
| 330 | true | true | 0 | 7 | 164 | 105 | 70 | 35 | null | null |
vu3rdd/functorrent
|
src/FuncTorrent/Utils.hs
|
gpl-3.0
|
createDummyFile :: FilePath -> Int -> IO (Either IOException ())
createDummyFile path size = do
dfe <- doesFileExist path
if not dfe
then
try $ writeFile path (BC.replicate size '\0')
else
return $ Right ()
-- write into a file at a specific offet
| 268 |
createDummyFile :: FilePath -> Int -> IO (Either IOException ())
createDummyFile path size = do
dfe <- doesFileExist path
if not dfe
then
try $ writeFile path (BC.replicate size '\0')
else
return $ Right ()
-- write into a file at a specific offet
| 268 |
createDummyFile path size = do
dfe <- doesFileExist path
if not dfe
then
try $ writeFile path (BC.replicate size '\0')
else
return $ Right ()
-- write into a file at a specific offet
| 203 | false | true | 0 | 13 | 64 | 95 | 44 | 51 | null | null |
seckcoder/lang-learn
|
haskell/minimal.hs
|
unlicense
|
Point x1 y1 == Point x2 y2 = (x1 == x2) && (y1 == y2)
| 53 |
Point x1 y1 == Point x2 y2 = (x1 == x2) && (y1 == y2)
| 53 |
Point x1 y1 == Point x2 y2 = (x1 == x2) && (y1 == y2)
| 53 | false | false | 0 | 8 | 14 | 45 | 20 | 25 | null | null |
brendanhay/gogol
|
gogol-firestore/gen/Network/Google/FireStore/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'GoogleFirestoreAdminV1ExportDocumentsMetadata' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gfavedmProgressBytes'
--
-- * 'gfavedmStartTime'
--
-- * 'gfavedmCollectionIds'
--
-- * 'gfavedmProgressDocuments'
--
-- * 'gfavedmEndTime'
--
-- * 'gfavedmOperationState'
--
-- * 'gfavedmOutputURIPrefix'
googleFirestoreAdminV1ExportDocumentsMetadata
:: GoogleFirestoreAdminV1ExportDocumentsMetadata
googleFirestoreAdminV1ExportDocumentsMetadata =
GoogleFirestoreAdminV1ExportDocumentsMetadata'
{ _gfavedmProgressBytes = Nothing
, _gfavedmStartTime = Nothing
, _gfavedmCollectionIds = Nothing
, _gfavedmProgressDocuments = Nothing
, _gfavedmEndTime = Nothing
, _gfavedmOperationState = Nothing
, _gfavedmOutputURIPrefix = Nothing
}
| 875 |
googleFirestoreAdminV1ExportDocumentsMetadata
:: GoogleFirestoreAdminV1ExportDocumentsMetadata
googleFirestoreAdminV1ExportDocumentsMetadata =
GoogleFirestoreAdminV1ExportDocumentsMetadata'
{ _gfavedmProgressBytes = Nothing
, _gfavedmStartTime = Nothing
, _gfavedmCollectionIds = Nothing
, _gfavedmProgressDocuments = Nothing
, _gfavedmEndTime = Nothing
, _gfavedmOperationState = Nothing
, _gfavedmOutputURIPrefix = Nothing
}
| 464 |
googleFirestoreAdminV1ExportDocumentsMetadata =
GoogleFirestoreAdminV1ExportDocumentsMetadata'
{ _gfavedmProgressBytes = Nothing
, _gfavedmStartTime = Nothing
, _gfavedmCollectionIds = Nothing
, _gfavedmProgressDocuments = Nothing
, _gfavedmEndTime = Nothing
, _gfavedmOperationState = Nothing
, _gfavedmOutputURIPrefix = Nothing
}
| 365 | true | true | 1 | 7 | 130 | 79 | 53 | 26 | null | null |
sinelaw/lamdu
|
Lamdu/Data/Expression/Utils.hs
|
gpl-3.0
|
matchExpressionG ::
(Eq def, Applicative f) =>
(Guid -> Guid -> f ()) -> -- ^ Left expr guid overrides right expr guid
(a -> b -> f c) ->
(Expression def a -> Expression def b -> f (Expression def c)) ->
Expression def a -> Expression def b -> f (Expression def c)
matchExpressionG overrideGuids onMatch onMismatch =
go Map.empty
where
go scope e0@(Expression body0 pl0) e1@(Expression body1 pl1) =
case matchBody matchLamResult matchOther matchGetPar body0 body1 of
Nothing ->
onMismatch e0 $
(ExprLens.exprLeaves . ExprLens.parameterRef %~ lookupGuid) e1
Just bodyMatched -> Expression <$> sequenceA bodyMatched <*> onMatch pl0 pl1
where
matchGetPar p0 p1 = p0 == lookupGuid p1
matchLamResult p0 p1 r0 r1 = overrideGuids p0 p1 *> go (Map.insert p1 p0 scope) r0 r1
matchOther = go scope
lookupGuid guid = fromMaybe guid $ Map.lookup guid scope
| 934 |
matchExpressionG ::
(Eq def, Applicative f) =>
(Guid -> Guid -> f ()) -> -- ^ Left expr guid overrides right expr guid
(a -> b -> f c) ->
(Expression def a -> Expression def b -> f (Expression def c)) ->
Expression def a -> Expression def b -> f (Expression def c)
matchExpressionG overrideGuids onMatch onMismatch =
go Map.empty
where
go scope e0@(Expression body0 pl0) e1@(Expression body1 pl1) =
case matchBody matchLamResult matchOther matchGetPar body0 body1 of
Nothing ->
onMismatch e0 $
(ExprLens.exprLeaves . ExprLens.parameterRef %~ lookupGuid) e1
Just bodyMatched -> Expression <$> sequenceA bodyMatched <*> onMatch pl0 pl1
where
matchGetPar p0 p1 = p0 == lookupGuid p1
matchLamResult p0 p1 r0 r1 = overrideGuids p0 p1 *> go (Map.insert p1 p0 scope) r0 r1
matchOther = go scope
lookupGuid guid = fromMaybe guid $ Map.lookup guid scope
| 934 |
matchExpressionG overrideGuids onMatch onMismatch =
go Map.empty
where
go scope e0@(Expression body0 pl0) e1@(Expression body1 pl1) =
case matchBody matchLamResult matchOther matchGetPar body0 body1 of
Nothing ->
onMismatch e0 $
(ExprLens.exprLeaves . ExprLens.parameterRef %~ lookupGuid) e1
Just bodyMatched -> Expression <$> sequenceA bodyMatched <*> onMatch pl0 pl1
where
matchGetPar p0 p1 = p0 == lookupGuid p1
matchLamResult p0 p1 r0 r1 = overrideGuids p0 p1 *> go (Map.insert p1 p0 scope) r0 r1
matchOther = go scope
lookupGuid guid = fromMaybe guid $ Map.lookup guid scope
| 659 | false | true | 0 | 14 | 230 | 340 | 164 | 176 | null | null |
dongy7/raytracer
|
src/Render/Setup.hs
|
mit
|
reshape :: ReshapeCallback
reshape size@(Size w h) = do
viewport $= (Position 0 0, size)
matrixMode $= Projection
loadIdentity
ortho2D 0 (fromIntegral w) 0 (fromIntegral h)
matrixMode $= Modelview 0
loadIdentity
| 229 |
reshape :: ReshapeCallback
reshape size@(Size w h) = do
viewport $= (Position 0 0, size)
matrixMode $= Projection
loadIdentity
ortho2D 0 (fromIntegral w) 0 (fromIntegral h)
matrixMode $= Modelview 0
loadIdentity
| 229 |
reshape size@(Size w h) = do
viewport $= (Position 0 0, size)
matrixMode $= Projection
loadIdentity
ortho2D 0 (fromIntegral w) 0 (fromIntegral h)
matrixMode $= Modelview 0
loadIdentity
| 202 | false | true | 2 | 9 | 48 | 99 | 42 | 57 | null | null |
ryantrinkle/ghcjs
|
test/nofib/spectral/puzzle/Main.hs
|
mit
|
totalTime :: History -> Int
totalTime ((time, _) : _) = time
| 60 |
totalTime :: History -> Int
totalTime ((time, _) : _) = time
| 60 |
totalTime ((time, _) : _) = time
| 32 | false | true | 0 | 10 | 11 | 37 | 18 | 19 | null | null |
knuton/lox
|
Text/Lox/Writers/HTML.hs
|
gpl-3.0
|
asHTML (And f1 f2) = parens (asHTML f1 ++ " ∧ " ++ asHTML f2)
| 65 |
asHTML (And f1 f2) = parens (asHTML f1 ++ " ∧ " ++ asHTML f2)
| 65 |
asHTML (And f1 f2) = parens (asHTML f1 ++ " ∧ " ++ asHTML f2)
| 65 | false | false | 0 | 9 | 14 | 37 | 17 | 20 | null | null |
m-alvarez/jhc
|
lib/jhc/Foreign/Marshal/Array.hs
|
mit
|
-- |Like 'withArrayLen', but a terminator indicates where the array ends
--
withArrayLen0 :: Storable a => a -> [a] -> (Int -> Ptr a -> IO b) -> IO b
withArrayLen0 marker vals f = etaIO $
len `seq` allocaArray0 len $ \ptr -> do
pokeArray0 marker ptr vals
res <- f len ptr
return res
where
len = length vals
-- copying (argument order: destination, source)
-- -------
-- |Copy the given number of elements from the second array (source) into the
-- first array (destination); the copied areas may /not/ overlap
--
| 541 |
withArrayLen0 :: Storable a => a -> [a] -> (Int -> Ptr a -> IO b) -> IO b
withArrayLen0 marker vals f = etaIO $
len `seq` allocaArray0 len $ \ptr -> do
pokeArray0 marker ptr vals
res <- f len ptr
return res
where
len = length vals
-- copying (argument order: destination, source)
-- -------
-- |Copy the given number of elements from the second array (source) into the
-- first array (destination); the copied areas may /not/ overlap
--
| 465 |
withArrayLen0 marker vals f = etaIO $
len `seq` allocaArray0 len $ \ptr -> do
pokeArray0 marker ptr vals
res <- f len ptr
return res
where
len = length vals
-- copying (argument order: destination, source)
-- -------
-- |Copy the given number of elements from the second array (source) into the
-- first array (destination); the copied areas may /not/ overlap
--
| 391 | true | true | 1 | 12 | 123 | 134 | 65 | 69 | null | null |
trygvis/hledger
|
hledger-lib/Hledger/Data/Dates.hs
|
gpl-3.0
|
-- | Split a DateSpan into one or more consecutive spans at the specified interval.
splitSpan :: Interval -> DateSpan -> [DateSpan]
splitSpan _ (DateSpan Nothing Nothing) = [DateSpan Nothing Nothing]
| 199 |
splitSpan :: Interval -> DateSpan -> [DateSpan]
splitSpan _ (DateSpan Nothing Nothing) = [DateSpan Nothing Nothing]
| 115 |
splitSpan _ (DateSpan Nothing Nothing) = [DateSpan Nothing Nothing]
| 67 | true | true | 0 | 10 | 30 | 50 | 24 | 26 | null | null |
yesodweb/persistent
|
persistent/Database/Persist/Quasi/Internal.hs
|
mit
|
mkUnboundForeignFieldList
:: [Text]
-> [Text]
-> Either String UnboundForeignFieldList
mkUnboundForeignFieldList (fmap FieldNameHS -> source) (fmap FieldNameHS -> target) =
case NEL.nonEmpty source of
Nothing ->
Left "No fields on foreign reference."
Just sources ->
case NEL.nonEmpty target of
Nothing ->
Right $ FieldListImpliedId sources
Just targets ->
if length targets /= length sources
then
Left "Target and source length differe on foreign reference."
else
Right
$ FieldListHasReferences
$ NEL.zipWith ForeignFieldReference sources targets
| 811 |
mkUnboundForeignFieldList
:: [Text]
-> [Text]
-> Either String UnboundForeignFieldList
mkUnboundForeignFieldList (fmap FieldNameHS -> source) (fmap FieldNameHS -> target) =
case NEL.nonEmpty source of
Nothing ->
Left "No fields on foreign reference."
Just sources ->
case NEL.nonEmpty target of
Nothing ->
Right $ FieldListImpliedId sources
Just targets ->
if length targets /= length sources
then
Left "Target and source length differe on foreign reference."
else
Right
$ FieldListHasReferences
$ NEL.zipWith ForeignFieldReference sources targets
| 811 |
mkUnboundForeignFieldList (fmap FieldNameHS -> source) (fmap FieldNameHS -> target) =
case NEL.nonEmpty source of
Nothing ->
Left "No fields on foreign reference."
Just sources ->
case NEL.nonEmpty target of
Nothing ->
Right $ FieldListImpliedId sources
Just targets ->
if length targets /= length sources
then
Left "Target and source length differe on foreign reference."
else
Right
$ FieldListHasReferences
$ NEL.zipWith ForeignFieldReference sources targets
| 712 | false | true | 2 | 11 | 335 | 156 | 73 | 83 | null | null |
alexvong1995/pandoc
|
src/Text/Pandoc/Templates.hs
|
gpl-2.0
|
cond :: Variable -> Template -> Template -> Template
cond var' (Template ifyes) (Template ifno) = Template $ \val ->
case resolveVar var' val of
"" -> ifno val
_ -> ifyes val
| 191 |
cond :: Variable -> Template -> Template -> Template
cond var' (Template ifyes) (Template ifno) = Template $ \val ->
case resolveVar var' val of
"" -> ifno val
_ -> ifyes val
| 191 |
cond var' (Template ifyes) (Template ifno) = Template $ \val ->
case resolveVar var' val of
"" -> ifno val
_ -> ifyes val
| 138 | false | true | 2 | 8 | 49 | 83 | 39 | 44 | null | null |
pminten/xhaskell
|
house/example.hs
|
mit
|
rhyme :: String
rhyme = unlines $ map ("This is " ++) $ scanl1 f pieces
where f tail' piece = piece ++ ' ' : tail'
| 116 |
rhyme :: String
rhyme = unlines $ map ("This is " ++) $ scanl1 f pieces
where f tail' piece = piece ++ ' ' : tail'
| 116 |
rhyme = unlines $ map ("This is " ++) $ scanl1 f pieces
where f tail' piece = piece ++ ' ' : tail'
| 100 | false | true | 0 | 8 | 28 | 51 | 26 | 25 | null | null |
spechub/Hets
|
PGIP/GraphQL/Resolver/OMS.hs
|
gpl-2.0
|
resolveSentences :: MonadIO m
=> LocIdBaseId -> DBMonad m [GraphQLResultSentence.Sentence]
resolveSentences omsKey = do
sentenceL <-
select $ from $ \(sentencesSql `InnerJoin` loc_id_bases
`LeftOuterJoin` file_ranges
`LeftOuterJoin` conjectures) -> do
on (coerceId (conjectures ?. ConjectureId) ==. loc_id_bases ^. LocIdBaseId)
on (file_ranges ?. FileRangeId ==. sentencesSql ^. SentenceFileRangeId)
on (loc_id_bases ^. LocIdBaseId ==. coerceId (sentencesSql ^. SentenceId))
where_ (sentencesSql ^. SentenceOmsId ==. val omsKey)
return (sentencesSql, loc_id_bases, file_ranges, conjectures)
mapM (\ (sentenceEntity, locIdBaseEntity, fileRangeM, conjectureM) -> do
symbolResults <- resolveSymbols $ entityKey sentenceEntity
case conjectureM of
Nothing -> return $
axiomToResult sentenceEntity locIdBaseEntity fileRangeM symbolResults
Just conjectureEntity -> resolveConjecture sentenceEntity
locIdBaseEntity fileRangeM conjectureEntity symbolResults
) sentenceL
| 1,164 |
resolveSentences :: MonadIO m
=> LocIdBaseId -> DBMonad m [GraphQLResultSentence.Sentence]
resolveSentences omsKey = do
sentenceL <-
select $ from $ \(sentencesSql `InnerJoin` loc_id_bases
`LeftOuterJoin` file_ranges
`LeftOuterJoin` conjectures) -> do
on (coerceId (conjectures ?. ConjectureId) ==. loc_id_bases ^. LocIdBaseId)
on (file_ranges ?. FileRangeId ==. sentencesSql ^. SentenceFileRangeId)
on (loc_id_bases ^. LocIdBaseId ==. coerceId (sentencesSql ^. SentenceId))
where_ (sentencesSql ^. SentenceOmsId ==. val omsKey)
return (sentencesSql, loc_id_bases, file_ranges, conjectures)
mapM (\ (sentenceEntity, locIdBaseEntity, fileRangeM, conjectureM) -> do
symbolResults <- resolveSymbols $ entityKey sentenceEntity
case conjectureM of
Nothing -> return $
axiomToResult sentenceEntity locIdBaseEntity fileRangeM symbolResults
Just conjectureEntity -> resolveConjecture sentenceEntity
locIdBaseEntity fileRangeM conjectureEntity symbolResults
) sentenceL
| 1,164 |
resolveSentences omsKey = do
sentenceL <-
select $ from $ \(sentencesSql `InnerJoin` loc_id_bases
`LeftOuterJoin` file_ranges
`LeftOuterJoin` conjectures) -> do
on (coerceId (conjectures ?. ConjectureId) ==. loc_id_bases ^. LocIdBaseId)
on (file_ranges ?. FileRangeId ==. sentencesSql ^. SentenceFileRangeId)
on (loc_id_bases ^. LocIdBaseId ==. coerceId (sentencesSql ^. SentenceId))
where_ (sentencesSql ^. SentenceOmsId ==. val omsKey)
return (sentencesSql, loc_id_bases, file_ranges, conjectures)
mapM (\ (sentenceEntity, locIdBaseEntity, fileRangeM, conjectureM) -> do
symbolResults <- resolveSymbols $ entityKey sentenceEntity
case conjectureM of
Nothing -> return $
axiomToResult sentenceEntity locIdBaseEntity fileRangeM symbolResults
Just conjectureEntity -> resolveConjecture sentenceEntity
locIdBaseEntity fileRangeM conjectureEntity symbolResults
) sentenceL
| 1,056 | false | true | 0 | 18 | 307 | 277 | 139 | 138 | null | null |
atsukotakahashi/wi
|
src/library/Yi/Keymap/Vim/EventUtils.hs
|
gpl-2.0
|
specList :: [(EventString, Key)]
specList =
[ (Ev "Esc", KEsc)
, (Ev "CR", KEnter)
, (Ev "BS", KBS)
, (Ev "Tab", KTab)
, (Ev "Down", KDown)
, (Ev "Up", KUp)
, (Ev "Left", KLeft)
, (Ev "Right", KRight)
, (Ev "PageUp", KPageUp)
, (Ev "PageDown", KPageDown)
, (Ev "Home", KHome)
, (Ev "End", KEnd)
, (Ev "Ins", KIns)
, (Ev "Del", KDel)
]
| 394 |
specList :: [(EventString, Key)]
specList =
[ (Ev "Esc", KEsc)
, (Ev "CR", KEnter)
, (Ev "BS", KBS)
, (Ev "Tab", KTab)
, (Ev "Down", KDown)
, (Ev "Up", KUp)
, (Ev "Left", KLeft)
, (Ev "Right", KRight)
, (Ev "PageUp", KPageUp)
, (Ev "PageDown", KPageDown)
, (Ev "Home", KHome)
, (Ev "End", KEnd)
, (Ev "Ins", KIns)
, (Ev "Del", KDel)
]
| 394 |
specList =
[ (Ev "Esc", KEsc)
, (Ev "CR", KEnter)
, (Ev "BS", KBS)
, (Ev "Tab", KTab)
, (Ev "Down", KDown)
, (Ev "Up", KUp)
, (Ev "Left", KLeft)
, (Ev "Right", KRight)
, (Ev "PageUp", KPageUp)
, (Ev "PageDown", KPageDown)
, (Ev "Home", KHome)
, (Ev "End", KEnd)
, (Ev "Ins", KIns)
, (Ev "Del", KDel)
]
| 361 | false | true | 0 | 7 | 122 | 188 | 110 | 78 | null | null |
dysinger/amazonka
|
amazonka-cognito-identity/gen/Network/AWS/CognitoIdentity/UpdateIdentityPool.hs
|
mpl-2.0
|
-- | Optional key:value pairs mapping provider names to provider app IDs.
uiprSupportedLoginProviders :: Lens' UpdateIdentityPoolResponse (HashMap Text Text)
uiprSupportedLoginProviders =
lens _uiprSupportedLoginProviders
(\s a -> s { _uiprSupportedLoginProviders = a })
. _Map
| 301 |
uiprSupportedLoginProviders :: Lens' UpdateIdentityPoolResponse (HashMap Text Text)
uiprSupportedLoginProviders =
lens _uiprSupportedLoginProviders
(\s a -> s { _uiprSupportedLoginProviders = a })
. _Map
| 227 |
uiprSupportedLoginProviders =
lens _uiprSupportedLoginProviders
(\s a -> s { _uiprSupportedLoginProviders = a })
. _Map
| 143 | true | true | 0 | 10 | 57 | 52 | 28 | 24 | null | null |
urbanslug/ghc
|
libraries/base/codepages/MakeTable.hs
|
bsd-3-clause
|
readCharHex :: String -> Char
readCharHex s = if c > fromEnum (maxBound :: Word16)
then error "Can't handle non-BMP character."
else toEnum c
where c = readHex' s
-------------------------------------------
-- Writing out the main data values.
| 289 |
readCharHex :: String -> Char
readCharHex s = if c > fromEnum (maxBound :: Word16)
then error "Can't handle non-BMP character."
else toEnum c
where c = readHex' s
-------------------------------------------
-- Writing out the main data values.
| 289 |
readCharHex s = if c > fromEnum (maxBound :: Word16)
then error "Can't handle non-BMP character."
else toEnum c
where c = readHex' s
-------------------------------------------
-- Writing out the main data values.
| 259 | false | true | 0 | 8 | 82 | 57 | 30 | 27 | null | null |
hvr/cassava
|
src/Data/Csv/Conversion/Internal.hs
|
bsd-3-clause
|
zero :: Word8
zero = 48
| 23 |
zero :: Word8
zero = 48
| 23 |
zero = 48
| 9 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
jutaro/rdf4h
|
testsuite/tests/Text/RDF/RDF4H/XmlParser_Test.hs
|
bsd-3-clause
|
test_parseXmlRDF_example15 :: Assertion
test_parseXmlRDF_example15 = testParse
"<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\
\ xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\
\ xmlns:ex=\"http://example.org/stuff/1.0/\">\
\<ex:Document rdf:about=\"http://example.org/thing\">\
\<dc:title>A marvelous thing</dc:title>\
\</ex:Document>\
\</rdf:RDF>"
( mkRdf [ Triple (unode "http://example.org/thing")
(unode "rdf:type")
(unode "ex:Document")
, Triple (unode "http://example.org/thing")
(unode "dc:title")
(mkTextNode "A marvelous thing")
]
Nothing
( PrefixMappings (Map.fromList [ ("dc", "http://purl.org/dc/elements/1.1/")
, ("ex", "http://example.org/stuff/1.0/")
, ("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ]) )
)
| 1,028 |
test_parseXmlRDF_example15 :: Assertion
test_parseXmlRDF_example15 = testParse
"<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\
\ xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\
\ xmlns:ex=\"http://example.org/stuff/1.0/\">\
\<ex:Document rdf:about=\"http://example.org/thing\">\
\<dc:title>A marvelous thing</dc:title>\
\</ex:Document>\
\</rdf:RDF>"
( mkRdf [ Triple (unode "http://example.org/thing")
(unode "rdf:type")
(unode "ex:Document")
, Triple (unode "http://example.org/thing")
(unode "dc:title")
(mkTextNode "A marvelous thing")
]
Nothing
( PrefixMappings (Map.fromList [ ("dc", "http://purl.org/dc/elements/1.1/")
, ("ex", "http://example.org/stuff/1.0/")
, ("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ]) )
)
| 1,028 |
test_parseXmlRDF_example15 = testParse
"<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\
\ xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\
\ xmlns:ex=\"http://example.org/stuff/1.0/\">\
\<ex:Document rdf:about=\"http://example.org/thing\">\
\<dc:title>A marvelous thing</dc:title>\
\</ex:Document>\
\</rdf:RDF>"
( mkRdf [ Triple (unode "http://example.org/thing")
(unode "rdf:type")
(unode "ex:Document")
, Triple (unode "http://example.org/thing")
(unode "dc:title")
(mkTextNode "A marvelous thing")
]
Nothing
( PrefixMappings (Map.fromList [ ("dc", "http://purl.org/dc/elements/1.1/")
, ("ex", "http://example.org/stuff/1.0/")
, ("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ]) )
)
| 988 | false | true | 0 | 13 | 333 | 131 | 67 | 64 | null | null |
Lykos/Sara
|
src/lib/Sara/Semantic/PureChecker.hs
|
gpl-3.0
|
preservesPureness S.Boolean{} = True
| 58 |
preservesPureness S.Boolean{} = True
| 58 |
preservesPureness S.Boolean{} = True
| 58 | false | false | 0 | 7 | 25 | 15 | 7 | 8 | null | null |
zmthy/http-media
|
src/Network/HTTP/Media.hs
|
mit
|
matchQuality
:: Accept a
=> [a] -- ^ The server-side options
-> [Quality a] -- ^ The pre-parsed client-side header value
-> Maybe a
matchQuality options acceptq = do
guard $ not (null options)
Quality m q <- maximumBy (compare `on` fmap qualityOrder) optionsq
guard $ q /= 0
return m
where
optionsq = reverse $ map addQuality options
addQuality opt = withQValue opt <$> foldl' (mfold opt) Nothing acceptq
withQValue opt qv = qv { qualityData = opt }
mfold opt cur acq@(Quality acd _)
| opt `matches` acd = mostSpecific acq <$> cur <|> Just acq
| otherwise = cur
------------------------------------------------------------------------------
-- | The equivalent of 'matchQuality' above, except the resulting choice is
-- mapped to another value. Convenient for specifying how to translate the
-- resource into each of its available formats.
--
-- > parseQuality header >>= maybe render406Error renderResource . mapQuality
-- > [ ("text" // "html", asHtml)
-- > , ("application" // "json", asJson)
-- > ]
| 1,107 |
matchQuality
:: Accept a
=> [a] -- ^ The server-side options
-> [Quality a] -- ^ The pre-parsed client-side header value
-> Maybe a
matchQuality options acceptq = do
guard $ not (null options)
Quality m q <- maximumBy (compare `on` fmap qualityOrder) optionsq
guard $ q /= 0
return m
where
optionsq = reverse $ map addQuality options
addQuality opt = withQValue opt <$> foldl' (mfold opt) Nothing acceptq
withQValue opt qv = qv { qualityData = opt }
mfold opt cur acq@(Quality acd _)
| opt `matches` acd = mostSpecific acq <$> cur <|> Just acq
| otherwise = cur
------------------------------------------------------------------------------
-- | The equivalent of 'matchQuality' above, except the resulting choice is
-- mapped to another value. Convenient for specifying how to translate the
-- resource into each of its available formats.
--
-- > parseQuality header >>= maybe render406Error renderResource . mapQuality
-- > [ ("text" // "html", asHtml)
-- > , ("application" // "json", asJson)
-- > ]
| 1,107 |
matchQuality options acceptq = do
guard $ not (null options)
Quality m q <- maximumBy (compare `on` fmap qualityOrder) optionsq
guard $ q /= 0
return m
where
optionsq = reverse $ map addQuality options
addQuality opt = withQValue opt <$> foldl' (mfold opt) Nothing acceptq
withQValue opt qv = qv { qualityData = opt }
mfold opt cur acq@(Quality acd _)
| opt `matches` acd = mostSpecific acq <$> cur <|> Just acq
| otherwise = cur
------------------------------------------------------------------------------
-- | The equivalent of 'matchQuality' above, except the resulting choice is
-- mapped to another value. Convenient for specifying how to translate the
-- resource into each of its available formats.
--
-- > parseQuality header >>= maybe render406Error renderResource . mapQuality
-- > [ ("text" // "html", asHtml)
-- > , ("application" // "json", asJson)
-- > ]
| 949 | false | true | 0 | 11 | 267 | 242 | 120 | 122 | null | null |
nightscape/platform
|
node/src/Unison/Codebase/LeveldbStore.hs
|
mit
|
-- | Create a 'Store' rooted at the given path.
make :: (MonadIO m, MonadMask m, Ord v, ToJSON v, FromJSON v) => FilePath -> m (Store m v)
make root =
let
dbOptions = DB.defaultOptions { DB.createIfMissing = True }
hashesIn :: (MonadIO m, MonadMask m) =>
(ByteString -> Reference) -> DB.DB -> Noted m (Set Reference)
hashesIn f db =
let keyToReference it = fmap (fmap f) (DB.iterKey it)
referenceList l it = keyToReference it >>=
maybe (pure l) (\i -> referenceList (i:l) it)
referenceSet it = Set.fromList <$> referenceList [] it
runSet = IT.withIter db DB.defaultReadOptions referenceSet
in Note.lift runSet
n :: Either String a -> Either Note a
n (Left e) = Left (Note.note e)
n (Right a) = Right a
maybeToEither b Nothing = Left b
maybeToEither _ (Just a) = Right a
read :: (MonadIO m, FromJSON a) => (h -> ByteString) -> DB.DB -> h -> Noted m a
read f db h = Note.noted $
(n . (>>= Aeson.eitherDecodeStrict) . maybeToEither "knf")
<$> DB.get db DB.defaultReadOptions (f h)
write :: (MonadIO m, ToJSON a) => (h -> ByteString) -> DB.DB -> h -> a -> Noted m ()
write f db h v = Note.lift $
DB.put db DB.defaultWriteOptions (f h) (LazyByteString.toStrict (Aeson.encode v))
read' :: (MonadIO m, FromJSON a) => DB.DB -> Hash -> Noted m a
read' = read Hash.toBytes
write' :: (MonadIO m, ToJSON a) => DB.DB -> Hash -> a -> Noted m ()
write' = write Hash.toBytes
hashes :: (MonadIO m, MonadMask m) =>
DB.DB -> DB.DB -> Maybe (Set Reference) -> Noted m (Set Reference)
hashes termsDB builtinMetadataDB limit =
let limitf = maybe id Set.intersection limit
in liftA2 Set.union
(limitf <$> hashesIn (Reference.Derived . Hash.fromBytes) termsDB)
(limitf <$> hashesIn (Reference.Builtin . decodeUtf8) builtinMetadataDB)
in do
termsDB <- DB.open (root </> "terms") dbOptions
metadataDB <- DB.open (root </> "metadata") dbOptions
builtinTypesDB <- DB.open (root </> "builtinTypes") dbOptions
builtinMetadataDB <- DB.open (root </> "builtinMetadata") dbOptions
pure $ Store
(hashes termsDB builtinMetadataDB) -- hashes
(read' termsDB) -- readTerm
(write' termsDB) -- writeTerm
(\r -> case r of -- typeOfTerm
Reference.Derived h -> read' termsDB h
Reference.Builtin b -> read encodeUtf8 builtinTypesDB b)
(\r -> case r of -- annotateTerm
Reference.Derived h -> write' termsDB h
Reference.Builtin b -> write encodeUtf8 builtinTypesDB b)
(\r -> case r of -- readMetadata
Reference.Derived h -> read' metadataDB h
Reference.Builtin b -> read encodeUtf8 builtinMetadataDB b)
(\r -> case r of -- writeMetadata
Reference.Derived h -> write' metadataDB h
Reference.Builtin b -> write encodeUtf8 builtinMetadataDB b)
| 3,063 |
make :: (MonadIO m, MonadMask m, Ord v, ToJSON v, FromJSON v) => FilePath -> m (Store m v)
make root =
let
dbOptions = DB.defaultOptions { DB.createIfMissing = True }
hashesIn :: (MonadIO m, MonadMask m) =>
(ByteString -> Reference) -> DB.DB -> Noted m (Set Reference)
hashesIn f db =
let keyToReference it = fmap (fmap f) (DB.iterKey it)
referenceList l it = keyToReference it >>=
maybe (pure l) (\i -> referenceList (i:l) it)
referenceSet it = Set.fromList <$> referenceList [] it
runSet = IT.withIter db DB.defaultReadOptions referenceSet
in Note.lift runSet
n :: Either String a -> Either Note a
n (Left e) = Left (Note.note e)
n (Right a) = Right a
maybeToEither b Nothing = Left b
maybeToEither _ (Just a) = Right a
read :: (MonadIO m, FromJSON a) => (h -> ByteString) -> DB.DB -> h -> Noted m a
read f db h = Note.noted $
(n . (>>= Aeson.eitherDecodeStrict) . maybeToEither "knf")
<$> DB.get db DB.defaultReadOptions (f h)
write :: (MonadIO m, ToJSON a) => (h -> ByteString) -> DB.DB -> h -> a -> Noted m ()
write f db h v = Note.lift $
DB.put db DB.defaultWriteOptions (f h) (LazyByteString.toStrict (Aeson.encode v))
read' :: (MonadIO m, FromJSON a) => DB.DB -> Hash -> Noted m a
read' = read Hash.toBytes
write' :: (MonadIO m, ToJSON a) => DB.DB -> Hash -> a -> Noted m ()
write' = write Hash.toBytes
hashes :: (MonadIO m, MonadMask m) =>
DB.DB -> DB.DB -> Maybe (Set Reference) -> Noted m (Set Reference)
hashes termsDB builtinMetadataDB limit =
let limitf = maybe id Set.intersection limit
in liftA2 Set.union
(limitf <$> hashesIn (Reference.Derived . Hash.fromBytes) termsDB)
(limitf <$> hashesIn (Reference.Builtin . decodeUtf8) builtinMetadataDB)
in do
termsDB <- DB.open (root </> "terms") dbOptions
metadataDB <- DB.open (root </> "metadata") dbOptions
builtinTypesDB <- DB.open (root </> "builtinTypes") dbOptions
builtinMetadataDB <- DB.open (root </> "builtinMetadata") dbOptions
pure $ Store
(hashes termsDB builtinMetadataDB) -- hashes
(read' termsDB) -- readTerm
(write' termsDB) -- writeTerm
(\r -> case r of -- typeOfTerm
Reference.Derived h -> read' termsDB h
Reference.Builtin b -> read encodeUtf8 builtinTypesDB b)
(\r -> case r of -- annotateTerm
Reference.Derived h -> write' termsDB h
Reference.Builtin b -> write encodeUtf8 builtinTypesDB b)
(\r -> case r of -- readMetadata
Reference.Derived h -> read' metadataDB h
Reference.Builtin b -> read encodeUtf8 builtinMetadataDB b)
(\r -> case r of -- writeMetadata
Reference.Derived h -> write' metadataDB h
Reference.Builtin b -> write encodeUtf8 builtinMetadataDB b)
| 3,015 |
make root =
let
dbOptions = DB.defaultOptions { DB.createIfMissing = True }
hashesIn :: (MonadIO m, MonadMask m) =>
(ByteString -> Reference) -> DB.DB -> Noted m (Set Reference)
hashesIn f db =
let keyToReference it = fmap (fmap f) (DB.iterKey it)
referenceList l it = keyToReference it >>=
maybe (pure l) (\i -> referenceList (i:l) it)
referenceSet it = Set.fromList <$> referenceList [] it
runSet = IT.withIter db DB.defaultReadOptions referenceSet
in Note.lift runSet
n :: Either String a -> Either Note a
n (Left e) = Left (Note.note e)
n (Right a) = Right a
maybeToEither b Nothing = Left b
maybeToEither _ (Just a) = Right a
read :: (MonadIO m, FromJSON a) => (h -> ByteString) -> DB.DB -> h -> Noted m a
read f db h = Note.noted $
(n . (>>= Aeson.eitherDecodeStrict) . maybeToEither "knf")
<$> DB.get db DB.defaultReadOptions (f h)
write :: (MonadIO m, ToJSON a) => (h -> ByteString) -> DB.DB -> h -> a -> Noted m ()
write f db h v = Note.lift $
DB.put db DB.defaultWriteOptions (f h) (LazyByteString.toStrict (Aeson.encode v))
read' :: (MonadIO m, FromJSON a) => DB.DB -> Hash -> Noted m a
read' = read Hash.toBytes
write' :: (MonadIO m, ToJSON a) => DB.DB -> Hash -> a -> Noted m ()
write' = write Hash.toBytes
hashes :: (MonadIO m, MonadMask m) =>
DB.DB -> DB.DB -> Maybe (Set Reference) -> Noted m (Set Reference)
hashes termsDB builtinMetadataDB limit =
let limitf = maybe id Set.intersection limit
in liftA2 Set.union
(limitf <$> hashesIn (Reference.Derived . Hash.fromBytes) termsDB)
(limitf <$> hashesIn (Reference.Builtin . decodeUtf8) builtinMetadataDB)
in do
termsDB <- DB.open (root </> "terms") dbOptions
metadataDB <- DB.open (root </> "metadata") dbOptions
builtinTypesDB <- DB.open (root </> "builtinTypes") dbOptions
builtinMetadataDB <- DB.open (root </> "builtinMetadata") dbOptions
pure $ Store
(hashes termsDB builtinMetadataDB) -- hashes
(read' termsDB) -- readTerm
(write' termsDB) -- writeTerm
(\r -> case r of -- typeOfTerm
Reference.Derived h -> read' termsDB h
Reference.Builtin b -> read encodeUtf8 builtinTypesDB b)
(\r -> case r of -- annotateTerm
Reference.Derived h -> write' termsDB h
Reference.Builtin b -> write encodeUtf8 builtinTypesDB b)
(\r -> case r of -- readMetadata
Reference.Derived h -> read' metadataDB h
Reference.Builtin b -> read encodeUtf8 builtinMetadataDB b)
(\r -> case r of -- writeMetadata
Reference.Derived h -> write' metadataDB h
Reference.Builtin b -> write encodeUtf8 builtinMetadataDB b)
| 2,924 | true | true | 0 | 19 | 892 | 1,131 | 560 | 571 | null | null |
LambdaHack/LambdaHack
|
definition-src/Game/LambdaHack/Definition/Color.hs
|
bsd-3-clause
|
legalFgCol = darkCol ++ [White, BrBlack] ++ brightCol ++ [BrWhite]
| 66 |
legalFgCol = darkCol ++ [White, BrBlack] ++ brightCol ++ [BrWhite]
| 66 |
legalFgCol = darkCol ++ [White, BrBlack] ++ brightCol ++ [BrWhite]
| 66 | false | false | 0 | 8 | 9 | 27 | 15 | 12 | null | null |
puffnfresh/game-of-comonads
|
GameOfComonads/Board.hs
|
unlicense
|
rules :: Pointer Bool -> Bool
rules p | c && (n < 2 || n > 3) = False
| (c && n == 2) || n == 3 = True
| otherwise = c
where c = extract p
n = liveNeighbours p
| 193 |
rules :: Pointer Bool -> Bool
rules p | c && (n < 2 || n > 3) = False
| (c && n == 2) || n == 3 = True
| otherwise = c
where c = extract p
n = liveNeighbours p
| 193 |
rules p | c && (n < 2 || n > 3) = False
| (c && n == 2) || n == 3 = True
| otherwise = c
where c = extract p
n = liveNeighbours p
| 163 | false | true | 0 | 12 | 78 | 101 | 49 | 52 | null | null |
meiersi/blaze-builder
|
Blaze/ByteString/Builder/Internal/Types.hs
|
bsd-3-clause
|
putBuildStepCont :: (forall r. (a -> BufRange -> IO (BuildSignal r)) ->
( BufRange -> IO (BuildSignal r))
) -> Put a
putBuildStepCont step = Put step'
where
step' k = BuildStep $ step (\x -> runBuildStep (k x))
| 271 |
putBuildStepCont :: (forall r. (a -> BufRange -> IO (BuildSignal r)) ->
( BufRange -> IO (BuildSignal r))
) -> Put a
putBuildStepCont step = Put step'
where
step' k = BuildStep $ step (\x -> runBuildStep (k x))
| 271 |
putBuildStepCont step = Put step'
where
step' k = BuildStep $ step (\x -> runBuildStep (k x))
| 99 | false | true | 1 | 14 | 99 | 110 | 53 | 57 | null | null |
anup-2s/project-euler
|
src/Problem13.hs
|
bsd-3-clause
|
carryForward [x]
| x >= 10 = carryForward [x, 0]
| otherwise = [x]
| 70 |
carryForward [x]
| x >= 10 = carryForward [x, 0]
| otherwise = [x]
| 70 |
carryForward [x]
| x >= 10 = carryForward [x, 0]
| otherwise = [x]
| 70 | false | false | 1 | 8 | 17 | 42 | 21 | 21 | null | null |
keizo042/quic-prototype
|
Network/QUIC/Error.hs
|
bsd-3-clause
|
err2int IpAddressChanged = 0x50
| 53 |
err2int IpAddressChanged = 0x50
| 53 |
err2int IpAddressChanged = 0x50
| 53 | false | false | 0 | 5 | 25 | 9 | 4 | 5 | null | null |
spechub/Hets
|
Propositional/ProveWithTruthTable.hs
|
gpl-2.0
|
eval m (Equivalence phi1 phi2 _) = eval m phi1 == eval m phi2
| 61 |
eval m (Equivalence phi1 phi2 _) = eval m phi1 == eval m phi2
| 61 |
eval m (Equivalence phi1 phi2 _) = eval m phi1 == eval m phi2
| 61 | false | false | 0 | 6 | 13 | 37 | 16 | 21 | null | null |
HJvT/hdirect
|
src/Parser.hs
|
bsd-3-clause
|
happyReduction_8 (HappyAbsSyn16 happy_var_3)
_
(HappyAbsSyn8 happy_var_1)
= HappyAbsSyn7
((happy_var_1, False, happy_var_3)
)
| 178 |
happyReduction_8 (HappyAbsSyn16 happy_var_3)
_
(HappyAbsSyn8 happy_var_1)
= HappyAbsSyn7
((happy_var_1, False, happy_var_3)
)
| 178 |
happyReduction_8 (HappyAbsSyn16 happy_var_3)
_
(HappyAbsSyn8 happy_var_1)
= HappyAbsSyn7
((happy_var_1, False, happy_var_3)
)
| 178 | false | false | 0 | 7 | 64 | 40 | 21 | 19 | null | null |
chameco/reliquary
|
src/Reliquary/Core/AST.hs
|
gpl-3.0
|
matchTerm _ _ = False
| 21 |
matchTerm _ _ = False
| 21 |
matchTerm _ _ = False
| 21 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
Mokosha/Lambency
|
examples/Pong.hs
|
mit
|
screenWidth :: Int
screenWidth = 640
| 36 |
screenWidth :: Int
screenWidth = 640
| 36 |
screenWidth = 640
| 17 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
bergmannf/gitit
|
src/Network/Gitit/ContentTransformer.hs
|
gpl-2.0
|
getPreCommitTransforms :: ContentTransformer [String -> PluginM String]
getPreCommitTransforms = liftM (mapMaybe preCommitTransform) $
queryGititState plugins
where preCommitTransform (PreCommitTransform x) = Just x
preCommitTransform _ = Nothing
-- | @applyTransform a t@ applies the transform @t@ to input @a@.
| 370 |
getPreCommitTransforms :: ContentTransformer [String -> PluginM String]
getPreCommitTransforms = liftM (mapMaybe preCommitTransform) $
queryGititState plugins
where preCommitTransform (PreCommitTransform x) = Just x
preCommitTransform _ = Nothing
-- | @applyTransform a t@ applies the transform @t@ to input @a@.
| 370 |
getPreCommitTransforms = liftM (mapMaybe preCommitTransform) $
queryGititState plugins
where preCommitTransform (PreCommitTransform x) = Just x
preCommitTransform _ = Nothing
-- | @applyTransform a t@ applies the transform @t@ to input @a@.
| 298 | false | true | 1 | 8 | 95 | 68 | 33 | 35 | null | null |
olsner/ghc
|
compiler/ghci/ByteCodeGen.hs
|
bsd-3-clause
|
typeArgRep :: Type -> ArgRep
typeArgRep = toArgRep . typePrimRep
| 64 |
typeArgRep :: Type -> ArgRep
typeArgRep = toArgRep . typePrimRep
| 64 |
typeArgRep = toArgRep . typePrimRep
| 35 | false | true | 0 | 5 | 9 | 19 | 10 | 9 | null | null |
mrmonday/Idris-dev
|
src/IRTS/Lang.hs
|
bsd-3-clause
|
lift env (LCase up e alts) = do alts' <- mapM liftA alts
e' <- lift env e
return (LCase up e' alts')
where
liftA (LConCase i n args e) = do e' <- lift (env ++ args) e
return (LConCase i n args e')
liftA (LConstCase c e) = do e' <- lift env e
return (LConstCase c e')
liftA (LDefaultCase e) = do e' <- lift env e
return (LDefaultCase e')
| 515 |
lift env (LCase up e alts) = do alts' <- mapM liftA alts
e' <- lift env e
return (LCase up e' alts')
where
liftA (LConCase i n args e) = do e' <- lift (env ++ args) e
return (LConCase i n args e')
liftA (LConstCase c e) = do e' <- lift env e
return (LConstCase c e')
liftA (LDefaultCase e) = do e' <- lift env e
return (LDefaultCase e')
| 515 |
lift env (LCase up e alts) = do alts' <- mapM liftA alts
e' <- lift env e
return (LCase up e' alts')
where
liftA (LConCase i n args e) = do e' <- lift (env ++ args) e
return (LConCase i n args e')
liftA (LConstCase c e) = do e' <- lift env e
return (LConstCase c e')
liftA (LDefaultCase e) = do e' <- lift env e
return (LDefaultCase e')
| 515 | false | false | 0 | 10 | 251 | 206 | 91 | 115 | null | null |
aleator/bindings-dc1394
|
Examples/HelloWorld.hs
|
bsd-3-clause
|
fromResult INVALID_FEATURE = c'DC1394_INVALID_FEATURE
| 64 |
fromResult INVALID_FEATURE = c'DC1394_INVALID_FEATURE
| 64 |
fromResult INVALID_FEATURE = c'DC1394_INVALID_FEATURE
| 64 | false | false | 0 | 5 | 14 | 9 | 4 | 5 | null | null |
WraithM/network-bitcoin
|
src/Network/Bitcoin/Wallet.hs
|
bsd-3-clause
|
-- | Gets all transactions in blocks since the given block, or all
-- transactions if ommited.
listSinceBlock' :: Client
-> Maybe BlockHash
-- ^ The hash of the first block to list.
-> Maybe Int
-- ^ The minimum number of confirmations before a
-- transaction can be returned as 'sbLastBlockHash'. This does
-- not in any way affect which transactions are returned
-- (see https://github.com/bitcoin/bitcoin/pull/199#issuecomment-1514952)
-> IO (SinceBlock)
listSinceBlock' client mblockHash mminConf =
callApi client "listsinceblock" $ tja mblockHash ++ tja mminConf
| 707 |
listSinceBlock' :: Client
-> Maybe BlockHash
-- ^ The hash of the first block to list.
-> Maybe Int
-- ^ The minimum number of confirmations before a
-- transaction can be returned as 'sbLastBlockHash'. This does
-- not in any way affect which transactions are returned
-- (see https://github.com/bitcoin/bitcoin/pull/199#issuecomment-1514952)
-> IO (SinceBlock)
listSinceBlock' client mblockHash mminConf =
callApi client "listsinceblock" $ tja mblockHash ++ tja mminConf
| 610 |
listSinceBlock' client mblockHash mminConf =
callApi client "listsinceblock" $ tja mblockHash ++ tja mminConf
| 113 | true | true | 0 | 10 | 223 | 73 | 36 | 37 | null | null |
ktvoelker/cookie-jar
|
test/Expires.hs
|
gpl-3.0
|
-- 5.1.1.
timeParseTest valid n xs = sessionTest ("Time parsing: " ++ xs) $ do
recv (time $ n - 1) e $ cs ++ "; Expires=" ++ xs
send (time $ n - 1) e cs
if valid
then noSend (time n) e
-- An invalid date doesn't invalidate the whole-cookie, so it becomes
-- a non-persistent cookie with no particular expiration.
else send (time n) e cs >> send (time $ n + year) e cs
where
cs = "x=y"
e = ep host1 path1 True True
| 445 |
timeParseTest valid n xs = sessionTest ("Time parsing: " ++ xs) $ do
recv (time $ n - 1) e $ cs ++ "; Expires=" ++ xs
send (time $ n - 1) e cs
if valid
then noSend (time n) e
-- An invalid date doesn't invalidate the whole-cookie, so it becomes
-- a non-persistent cookie with no particular expiration.
else send (time n) e cs >> send (time $ n + year) e cs
where
cs = "x=y"
e = ep host1 path1 True True
| 435 |
timeParseTest valid n xs = sessionTest ("Time parsing: " ++ xs) $ do
recv (time $ n - 1) e $ cs ++ "; Expires=" ++ xs
send (time $ n - 1) e cs
if valid
then noSend (time n) e
-- An invalid date doesn't invalidate the whole-cookie, so it becomes
-- a non-persistent cookie with no particular expiration.
else send (time n) e cs >> send (time $ n + year) e cs
where
cs = "x=y"
e = ep host1 path1 True True
| 435 | true | false | 1 | 14 | 120 | 162 | 80 | 82 | null | null |
fmapfmapfmap/amazonka
|
core/src/Network/AWS/Data/Headers.hs
|
mpl-2.0
|
hAMZNErrorType :: HeaderName
hAMZNErrorType = "X-Amzn-ErrorType"
| 64 |
hAMZNErrorType :: HeaderName
hAMZNErrorType = "X-Amzn-ErrorType"
| 64 |
hAMZNErrorType = "X-Amzn-ErrorType"
| 35 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
lally/libmet
|
src/Ppt/Frame/Parser.hs
|
bsd-3-clause
|
exact1 _ name = Left ("Exactly 1 " ++ name ++ " required")
| 58 |
exact1 _ name = Left ("Exactly 1 " ++ name ++ " required")
| 58 |
exact1 _ name = Left ("Exactly 1 " ++ name ++ " required")
| 58 | false | false | 1 | 8 | 12 | 26 | 12 | 14 | null | null |
josefs/autosar
|
oldARSim/ARComp.hs
|
bsd-3-clause
|
rte_exit :: EX c -> RunM (StdRet ())
rte_exit ex = liftVoid (Exit ex)
| 76 |
rte_exit :: EX c -> RunM (StdRet ())
rte_exit ex = liftVoid (Exit ex)
| 76 |
rte_exit ex = liftVoid (Exit ex)
| 32 | false | true | 0 | 10 | 20 | 45 | 20 | 25 | null | null |
Catchouli/Hasteroids
|
app/Main.hs
|
bsd-3-clause
|
height = 600
| 12 |
height = 600
| 12 |
height = 600
| 12 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
Tener/deeplearning-thesis
|
src/gg-exp7.hs
|
bsd-3-clause
|
localSearch = 0.003
| 19 |
localSearch = 0.003
| 19 |
localSearch = 0.003
| 19 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
fmapfmapfmap/amazonka
|
amazonka-support/gen/Network/AWS/Support/ResolveCase.hs
|
mpl-2.0
|
-- | The response status code.
rcrsResponseStatus :: Lens' ResolveCaseResponse Int
rcrsResponseStatus = lens _rcrsResponseStatus (\ s a -> s{_rcrsResponseStatus = a})
| 166 |
rcrsResponseStatus :: Lens' ResolveCaseResponse Int
rcrsResponseStatus = lens _rcrsResponseStatus (\ s a -> s{_rcrsResponseStatus = a})
| 135 |
rcrsResponseStatus = lens _rcrsResponseStatus (\ s a -> s{_rcrsResponseStatus = a})
| 83 | true | true | 0 | 9 | 21 | 40 | 22 | 18 | null | null |
brendanhay/gogol
|
gogol-videointelligence/gen/Network/Google/VideoIntelligence/Types/Product.hs
|
mpl-2.0
|
-- | Video file location in [Cloud
-- Storage](https:\/\/cloud.google.com\/storage\/).
ggInputURI :: Lens' GoogleCloudVideointelligenceV1beta2_VideoAnnotationProgress (Maybe Text)
ggInputURI
= lens _ggInputURI (\ s a -> s{_ggInputURI = a})
| 241 |
ggInputURI :: Lens' GoogleCloudVideointelligenceV1beta2_VideoAnnotationProgress (Maybe Text)
ggInputURI
= lens _ggInputURI (\ s a -> s{_ggInputURI = a})
| 154 |
ggInputURI
= lens _ggInputURI (\ s a -> s{_ggInputURI = a})
| 61 | true | true | 0 | 9 | 27 | 49 | 26 | 23 | null | null |
emmanueltouzery/cigale-timesheet
|
tests/StrSpec.hs
|
mit
|
testStrMultiT :: Spec
testStrMultiT = it "works on two line Text" $ do
let converted = [strT|
test string
second line|]
let expected = "test string\n second line"
assertEqual "doesn't match" expected converted
| 274 |
testStrMultiT :: Spec
testStrMultiT = it "works on two line Text" $ do
let converted = [strT|
test string
second line|]
let expected = "test string\n second line"
assertEqual "doesn't match" expected converted
| 274 |
testStrMultiT = it "works on two line Text" $ do
let converted = [strT|
test string
second line|]
let expected = "test string\n second line"
assertEqual "doesn't match" expected converted
| 252 | false | true | 0 | 10 | 97 | 50 | 25 | 25 | null | null |
haskell-opengl/OpenGLRaw
|
src/Graphics/GL/Functions/F19.hs
|
bsd-3-clause
|
-- glPauseTransformFeedbackNV --------------------------------------------------
-- | This command is an alias for 'glPauseTransformFeedback'.
glPauseTransformFeedbackNV
:: MonadIO m
=> m ()
glPauseTransformFeedbackNV = liftIO $ dyn11 ptr_glPauseTransformFeedbackNV
| 270 |
glPauseTransformFeedbackNV
:: MonadIO m
=> m ()
glPauseTransformFeedbackNV = liftIO $ dyn11 ptr_glPauseTransformFeedbackNV
| 126 |
glPauseTransformFeedbackNV = liftIO $ dyn11 ptr_glPauseTransformFeedbackNV
| 74 | true | true | 0 | 8 | 29 | 37 | 17 | 20 | null | null |
spell-music/temporal-music-notation-demo
|
src/Temporal/Music/Demo/GeneralMidi.hs
|
bsd-3-clause
|
koto = instr 107
| 16 |
koto = instr 107
| 16 |
koto = instr 107
| 16 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
vscharf/Mach7
|
media/papers/OpenPatternMatching/artifact/code/exp.hs
|
bsd-3-clause
|
toString (Plus a b) = "(" ++ toString a ++ "+" ++ toString b ++ ")"
| 68 |
toString (Plus a b) = "(" ++ toString a ++ "+" ++ toString b ++ ")"
| 68 |
toString (Plus a b) = "(" ++ toString a ++ "+" ++ toString b ++ ")"
| 68 | false | false | 0 | 9 | 16 | 40 | 18 | 22 | null | null |
ulricha/algebra-sql
|
src/Database/Algebra/Table/Typing.hs
|
bsd-3-clause
|
opTyErr :: (MonadError String m, Show o) => o -> [S.Set TypedAttr] -> m a
opTyErr o rows = throwError $ printf "%s\n%s" (show o) (concat $ intersperse "\n" (map show rows))
| 172 |
opTyErr :: (MonadError String m, Show o) => o -> [S.Set TypedAttr] -> m a
opTyErr o rows = throwError $ printf "%s\n%s" (show o) (concat $ intersperse "\n" (map show rows))
| 172 |
opTyErr o rows = throwError $ printf "%s\n%s" (show o) (concat $ intersperse "\n" (map show rows))
| 98 | false | true | 0 | 11 | 31 | 89 | 44 | 45 | null | null |
kig/tomtegebra
|
Tomtegebra/Main.hs
|
gpl-3.0
|
-- | Maps an IORef through a function.
mapRef :: (a -> a) -> IORef a -> IO ()
mapRef f a = modifyIORef a f
| 106 |
mapRef :: (a -> a) -> IORef a -> IO ()
mapRef f a = modifyIORef a f
| 67 |
mapRef f a = modifyIORef a f
| 28 | true | true | 0 | 8 | 25 | 45 | 22 | 23 | null | null |
da-x/ghc
|
libraries/base/GHC/Enum.hs
|
bsd-3-clause
|
eftCharFB :: (Char -> a -> a) -> a -> Int# -> Int# -> a
eftCharFB c n x0 y = go x0
where
go x | isTrue# (x ># y) = n
| otherwise = C# (chr# x) `c` go (x +# 1#)
| 230 |
eftCharFB :: (Char -> a -> a) -> a -> Int# -> Int# -> a
eftCharFB c n x0 y = go x0
where
go x | isTrue# (x ># y) = n
| otherwise = C# (chr# x) `c` go (x +# 1#)
| 230 |
eftCharFB c n x0 y = go x0
where
go x | isTrue# (x ># y) = n
| otherwise = C# (chr# x) `c` go (x +# 1#)
| 174 | false | true | 0 | 12 | 114 | 110 | 54 | 56 | null | null |
Jinxit/firestone
|
src/Firestone/Database.hs
|
mit
|
lookupMinion :: IdGenerator -> String -> (Minion, IdGenerator)
lookupMinion gen name@"Oasis Snapjaw" = (minion, newGen)
where
(mId, mTime, newGen) = create gen name
minion = makeMinion mId name 2 7 None [] True mTime []
| 230 |
lookupMinion :: IdGenerator -> String -> (Minion, IdGenerator)
lookupMinion gen name@"Oasis Snapjaw" = (minion, newGen)
where
(mId, mTime, newGen) = create gen name
minion = makeMinion mId name 2 7 None [] True mTime []
| 229 |
lookupMinion gen name@"Oasis Snapjaw" = (minion, newGen)
where
(mId, mTime, newGen) = create gen name
minion = makeMinion mId name 2 7 None [] True mTime []
| 166 | false | true | 0 | 7 | 45 | 90 | 48 | 42 | null | null |
alexander-at-github/eta
|
libraries/base/GHC/Enum.hs
|
bsd-3-clause
|
boundedEnumFromThen :: (Enum a, Bounded a) => a -> a -> [a]
boundedEnumFromThen n1 n2
| i_n2 >= i_n1 = map toEnum [i_n1, i_n2 .. fromEnum (maxBound `asTypeOf` n1)]
| otherwise = map toEnum [i_n1, i_n2 .. fromEnum (minBound `asTypeOf` n1)]
where
i_n1 = fromEnum n1
i_n2 = fromEnum n2
------------------------------------------------------------------------
-- Helper functions
------------------------------------------------------------------------
| 470 |
boundedEnumFromThen :: (Enum a, Bounded a) => a -> a -> [a]
boundedEnumFromThen n1 n2
| i_n2 >= i_n1 = map toEnum [i_n1, i_n2 .. fromEnum (maxBound `asTypeOf` n1)]
| otherwise = map toEnum [i_n1, i_n2 .. fromEnum (minBound `asTypeOf` n1)]
where
i_n1 = fromEnum n1
i_n2 = fromEnum n2
------------------------------------------------------------------------
-- Helper functions
------------------------------------------------------------------------
| 470 |
boundedEnumFromThen n1 n2
| i_n2 >= i_n1 = map toEnum [i_n1, i_n2 .. fromEnum (maxBound `asTypeOf` n1)]
| otherwise = map toEnum [i_n1, i_n2 .. fromEnum (minBound `asTypeOf` n1)]
where
i_n1 = fromEnum n1
i_n2 = fromEnum n2
------------------------------------------------------------------------
-- Helper functions
------------------------------------------------------------------------
| 410 | false | true | 1 | 10 | 76 | 133 | 72 | 61 | null | null |
holzensp/ghc
|
libraries/base/Data/List.hs
|
bsd-3-clause
|
insert :: Ord a => a -> [a] -> [a]
insert e ls = insertBy (compare) e ls
| 72 |
insert :: Ord a => a -> [a] -> [a]
insert e ls = insertBy (compare) e ls
| 72 |
insert e ls = insertBy (compare) e ls
| 37 | false | true | 0 | 10 | 17 | 52 | 25 | 27 | null | null |
johanneshilden/principle
|
Trombone/Server.hs
|
bsd-3-clause
|
runWithConf :: ServerConf -> IO ()
runWithConf ServerConf
{ serverPoolSize = pconns
, serverPort = port
, serverDbConf = dbconf
, serverMiddleware = midware
, serverRoutes = routes
, serverHmacConf = hconf
, serverPipelines = pipes
, serverVerbose = loud
, serverLogger = logger
} =
withPostgresqlPool (buildConnectionString dbconf) pconns $ \pool -> do
putStrLn $ "Trombone listening on port " ++ show port ++ "."
run port $ foldr ($) `flip` midware $ \request app -> do
let context = Context pool request routes hconf pipes loud logger
flip runReaderT context $ runRoutes
>>= lift . app . sendJsonResponse . responseOr404
| 753 |
runWithConf :: ServerConf -> IO ()
runWithConf ServerConf
{ serverPoolSize = pconns
, serverPort = port
, serverDbConf = dbconf
, serverMiddleware = midware
, serverRoutes = routes
, serverHmacConf = hconf
, serverPipelines = pipes
, serverVerbose = loud
, serverLogger = logger
} =
withPostgresqlPool (buildConnectionString dbconf) pconns $ \pool -> do
putStrLn $ "Trombone listening on port " ++ show port ++ "."
run port $ foldr ($) `flip` midware $ \request app -> do
let context = Context pool request routes hconf pipes loud logger
flip runReaderT context $ runRoutes
>>= lift . app . sendJsonResponse . responseOr404
| 753 |
runWithConf ServerConf
{ serverPoolSize = pconns
, serverPort = port
, serverDbConf = dbconf
, serverMiddleware = midware
, serverRoutes = routes
, serverHmacConf = hconf
, serverPipelines = pipes
, serverVerbose = loud
, serverLogger = logger
} =
withPostgresqlPool (buildConnectionString dbconf) pconns $ \pool -> do
putStrLn $ "Trombone listening on port " ++ show port ++ "."
run port $ foldr ($) `flip` midware $ \request app -> do
let context = Context pool request routes hconf pipes loud logger
flip runReaderT context $ runRoutes
>>= lift . app . sendJsonResponse . responseOr404
| 718 | false | true | 27 | 19 | 231 | 224 | 108 | 116 | null | null |
glguy/simple-spreadsheet-tools
|
lib/Spreadsheet/Parser.hs
|
bsd-3-clause
|
-- | 'dataCell' parses an individual data cell in a data row
dataCell :: Maybe CellType -> Parsec String () CellValue
dataCell Nothing = return EmptyV
| 150 |
dataCell :: Maybe CellType -> Parsec String () CellValue
dataCell Nothing = return EmptyV
| 89 |
dataCell Nothing = return EmptyV
| 32 | true | true | 0 | 8 | 25 | 38 | 17 | 21 | null | null |
karshan/language-java
|
Language/Java/Parser.hs
|
bsd-3-clause
|
condExp :: P Exp
condExp = do
ie <- infixExp
ces <- list condExpSuffix
return $ foldl (\a s -> s a) ie ces
| 118 |
condExp :: P Exp
condExp = do
ie <- infixExp
ces <- list condExpSuffix
return $ foldl (\a s -> s a) ie ces
| 118 |
condExp = do
ie <- infixExp
ces <- list condExpSuffix
return $ foldl (\a s -> s a) ie ces
| 101 | false | true | 0 | 11 | 35 | 58 | 27 | 31 | null | null |
vollmerm/monad-tune
|
test/Control/Monad/TuneSpec.hs
|
bsd-2-clause
|
spec :: Spec
spec = do
describe "choiceMaps" $ do
it "creates an environment with one root choice" $
(M.size $ addChoiceRoot M.empty "a" [1]) `shouldBe` 1
it "creates an environment with two root choices" $
(M.size $ addChoiceRoot (addChoiceRoot M.empty "b" [1,2]) "a" [1]) `shouldBe` 2
it "creates an environment with one root choice and one dependent choice" $
let b = TunerChoice "b" [1, 2] Nothing
bmap = M.singleton "b" b
in (M.size $ addChoiceDepends bmap "a" [1] b) `shouldBe` 2
describe "tunerStates" $ do
it "creates a tuner state with a singleton environment" $ do
r <- getStdGen
let m = M.singleton "a" $ TunerChoice "a" [1,2] Nothing
(M.size $ env $ makeTunerState m r) `shouldBe` 1
| 770 |
spec :: Spec
spec = do
describe "choiceMaps" $ do
it "creates an environment with one root choice" $
(M.size $ addChoiceRoot M.empty "a" [1]) `shouldBe` 1
it "creates an environment with two root choices" $
(M.size $ addChoiceRoot (addChoiceRoot M.empty "b" [1,2]) "a" [1]) `shouldBe` 2
it "creates an environment with one root choice and one dependent choice" $
let b = TunerChoice "b" [1, 2] Nothing
bmap = M.singleton "b" b
in (M.size $ addChoiceDepends bmap "a" [1] b) `shouldBe` 2
describe "tunerStates" $ do
it "creates a tuner state with a singleton environment" $ do
r <- getStdGen
let m = M.singleton "a" $ TunerChoice "a" [1,2] Nothing
(M.size $ env $ makeTunerState m r) `shouldBe` 1
| 770 |
spec = do
describe "choiceMaps" $ do
it "creates an environment with one root choice" $
(M.size $ addChoiceRoot M.empty "a" [1]) `shouldBe` 1
it "creates an environment with two root choices" $
(M.size $ addChoiceRoot (addChoiceRoot M.empty "b" [1,2]) "a" [1]) `shouldBe` 2
it "creates an environment with one root choice and one dependent choice" $
let b = TunerChoice "b" [1, 2] Nothing
bmap = M.singleton "b" b
in (M.size $ addChoiceDepends bmap "a" [1] b) `shouldBe` 2
describe "tunerStates" $ do
it "creates a tuner state with a singleton environment" $ do
r <- getStdGen
let m = M.singleton "a" $ TunerChoice "a" [1,2] Nothing
(M.size $ env $ makeTunerState m r) `shouldBe` 1
| 757 | false | true | 0 | 18 | 195 | 276 | 135 | 141 | null | null |
antitypical/Surface
|
src/Data/Term.hs
|
mit
|
replace :: Ord a => a -> a -> Set.Set a -> Set.Set a
replace old new set = if Set.member old set then Set.insert new $ Set.delete old set else set
| 146 |
replace :: Ord a => a -> a -> Set.Set a -> Set.Set a
replace old new set = if Set.member old set then Set.insert new $ Set.delete old set else set
| 146 |
replace old new set = if Set.member old set then Set.insert new $ Set.delete old set else set
| 93 | false | true | 0 | 11 | 31 | 83 | 38 | 45 | null | null |
adept/hledger
|
hledger-lib/Hledger/Data/Journal.hs
|
gpl-3.0
|
filterJournalTransactions :: Query -> Journal -> Journal
filterJournalTransactions q j@Journal{jtxns} = j{jtxns=filter (matchesTransactionExtra (journalAccountType j) q) jtxns}
| 176 |
filterJournalTransactions :: Query -> Journal -> Journal
filterJournalTransactions q j@Journal{jtxns} = j{jtxns=filter (matchesTransactionExtra (journalAccountType j) q) jtxns}
| 176 |
filterJournalTransactions q j@Journal{jtxns} = j{jtxns=filter (matchesTransactionExtra (journalAccountType j) q) jtxns}
| 119 | false | true | 0 | 11 | 16 | 60 | 31 | 29 | null | null |
hce/yanas
|
src/Aeroplane.hs
|
gpl-2.0
|
handleAirspace :: YanasState -> (YanasState, [(Frequency, String)])
handleAirspace s = (s { stAirspace=airspace'' }, concat responses)
where
airspace = stAirspace s
airspace' = map (handleAP s) airspace
(airspace'', responses) = unzip $ map handleAPResponses airspace'
| 314 |
handleAirspace :: YanasState -> (YanasState, [(Frequency, String)])
handleAirspace s = (s { stAirspace=airspace'' }, concat responses)
where
airspace = stAirspace s
airspace' = map (handleAP s) airspace
(airspace'', responses) = unzip $ map handleAPResponses airspace'
| 314 |
handleAirspace s = (s { stAirspace=airspace'' }, concat responses)
where
airspace = stAirspace s
airspace' = map (handleAP s) airspace
(airspace'', responses) = unzip $ map handleAPResponses airspace'
| 246 | false | true | 1 | 10 | 80 | 105 | 54 | 51 | null | null |
bhamrick/fuzzygrep
|
Main.hs
|
mit
|
openSource (File fname) = openFile fname ReadMode
| 49 |
openSource (File fname) = openFile fname ReadMode
| 49 |
openSource (File fname) = openFile fname ReadMode
| 49 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
phischu/fragnix
|
tests/packages/scotty/Data.HashMap.Base.hs
|
bsd-3-clause
|
-- | /O(n+m)/ Intersection of two maps. If a key occurs in both maps
-- the provided function is used to combine the values from the two
-- maps.
intersectionWithKey :: (Eq k, Hashable k) => (k -> v1 -> v2 -> v3)
-> HashMap k v1 -> HashMap k v2 -> HashMap k v3
intersectionWithKey f a b = foldlWithKey' go empty a
where
go m k v = case lookup k b of
Just w -> insert k (f k v w) m
_ -> m
| 453 |
intersectionWithKey :: (Eq k, Hashable k) => (k -> v1 -> v2 -> v3)
-> HashMap k v1 -> HashMap k v2 -> HashMap k v3
intersectionWithKey f a b = foldlWithKey' go empty a
where
go m k v = case lookup k b of
Just w -> insert k (f k v w) m
_ -> m
| 307 |
intersectionWithKey f a b = foldlWithKey' go empty a
where
go m k v = case lookup k b of
Just w -> insert k (f k v w) m
_ -> m
| 172 | true | true | 0 | 10 | 153 | 141 | 69 | 72 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.