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
bartavelle/stateWriter
tests/rwscompare.hs
bsd-3-clause
evaluateActions (Free (Modify f next)) = modify (evaluateSM f) >> evaluateActions next
86
evaluateActions (Free (Modify f next)) = modify (evaluateSM f) >> evaluateActions next
86
evaluateActions (Free (Modify f next)) = modify (evaluateSM f) >> evaluateActions next
86
false
false
0
9
11
39
18
21
null
null
sitewisely/zellige
src/Data/Geometry/Clip/Internal/LineNichollLeeNicholl.hs
apache-2.0
clipBottom :: TypesGeography.BoundingBox -> TypesGeography.GeoStorableLine -> Geospatial.PointXY -> Double -> Geospatial.PointXY clipBottom (TypesGeography.BoundingBox _ _ _ bottom) (TypesGeography.GeoStorableLine (Geospatial.PointXY p1x _) _) (Geospatial.PointXY _ dy) bottomP = Geospatial.PointXY (p1x + bottomP / dy) bottom
330
clipBottom :: TypesGeography.BoundingBox -> TypesGeography.GeoStorableLine -> Geospatial.PointXY -> Double -> Geospatial.PointXY clipBottom (TypesGeography.BoundingBox _ _ _ bottom) (TypesGeography.GeoStorableLine (Geospatial.PointXY p1x _) _) (Geospatial.PointXY _ dy) bottomP = Geospatial.PointXY (p1x + bottomP / dy) bottom
330
clipBottom (TypesGeography.BoundingBox _ _ _ bottom) (TypesGeography.GeoStorableLine (Geospatial.PointXY p1x _) _) (Geospatial.PointXY _ dy) bottomP = Geospatial.PointXY (p1x + bottomP / dy) bottom
201
false
true
0
15
37
113
54
59
null
null
dan-t/hsimport
lib/HsImport/ImportChange.hs
bsd-3-clause
-- | Remove a symbol from the import declaration. -- May remove the whole spec list if the list is empty after removal. removeSymbol :: ImportDecl -> SymbolImport -> Either ErrorMessage ImportDecl removeSymbol id@HS.ImportDecl {HS.importSpecs = specs} symbolImport = case specs & _Just %~ removeSpecList symbolImport of Nothing -> Right id {HS.importSpecs = Nothing } Just xs -> xs >>= \newSpecList -> Right id {HS.importSpecs = newSpecList}
458
removeSymbol :: ImportDecl -> SymbolImport -> Either ErrorMessage ImportDecl removeSymbol id@HS.ImportDecl {HS.importSpecs = specs} symbolImport = case specs & _Just %~ removeSpecList symbolImport of Nothing -> Right id {HS.importSpecs = Nothing } Just xs -> xs >>= \newSpecList -> Right id {HS.importSpecs = newSpecList}
336
removeSymbol id@HS.ImportDecl {HS.importSpecs = specs} symbolImport = case specs & _Just %~ removeSpecList symbolImport of Nothing -> Right id {HS.importSpecs = Nothing } Just xs -> xs >>= \newSpecList -> Right id {HS.importSpecs = newSpecList}
259
true
true
3
9
83
114
58
56
null
null
elopez/QuickFuzz
src/Test/QuickFuzz/Derive/Fixable.hs
gpl-3.0
-- |Creates a Fixable instance for a type, needs information to know which constructors represent -- the identifiers, variables and assignments mkFix :: Name -> [Name] -> [Name] -> Name -> Q [Dec] mkFix i v a t = do ti <- reify t case ti of TyConI (DataD _ _ params TH211MBKIND tcons _) -> do let cstuff = map getStuff tcons let names = map fst cstuff let matches = map (mkMatch v a) cstuff let np = length params let tvars = map (varT . getParName) params ii <- reify i case ii of TyConI (DataD _ _ ip TH211MBKIND _ _) -> do let ivars = map (varT . getParName) ip let nip = max np (length ip) plist <- replicateM nip (newName "x") let pvars = map varT plist if null tvars then if null ivars then [d| instance Fixable $(conT i) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(conT i) $(conT t) gg = $(mkFixBody matches) |] else [d| instance Fixable $(foldl appT (conT i) pvars) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(foldl appT (conT i) pvars) $(conT t) gg = $(mkFixBody matches) |] else if null ivars then [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars) ++(map (appT (conT ''Show)) pvars))) => Fixable $(conT i) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(conT i) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] else [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] TyConI (NewtypeD _ _ ip TH211MBKIND _ _) -> do let ivars = map (varT . getParName) ip let nip = max np (length ip) plist <- replicateM nip (newName "x") let pvars = map varT plist if null tvars then if null ivars then [d| instance Fixable $(conT i) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(conT i) $(conT t) gg = $(mkFixBody matches) |] else [d| instance Fixable $(foldl appT (conT i) pvars) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(foldl appT (conT i) pvars) $(conT t) gg = $(mkFixBody matches) |] else if null ivars then [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(conT i) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(conT i) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] else [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] TyConI (TySynD _ ip _) -> do let ivars = map (varT . getParName) ip let nip = max np (length ip) plist <- replicateM nip (newName "x") let pvars = map varT plist if null tvars then if null ivars then [d| instance Fixable $(conT i) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(conT i) $(conT t) gg = $(mkFixBody matches) |] else [d| instance Fixable $(foldl appT (conT i) pvars) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(foldl appT (conT i) pvars) $(conT t) gg = $(mkFixBody matches) |] else if null ivars then [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(conT i) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(conT i) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] else [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] --newtype case? _ -> return []
8,024
mkFix :: Name -> [Name] -> [Name] -> Name -> Q [Dec] mkFix i v a t = do ti <- reify t case ti of TyConI (DataD _ _ params TH211MBKIND tcons _) -> do let cstuff = map getStuff tcons let names = map fst cstuff let matches = map (mkMatch v a) cstuff let np = length params let tvars = map (varT . getParName) params ii <- reify i case ii of TyConI (DataD _ _ ip TH211MBKIND _ _) -> do let ivars = map (varT . getParName) ip let nip = max np (length ip) plist <- replicateM nip (newName "x") let pvars = map varT plist if null tvars then if null ivars then [d| instance Fixable $(conT i) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(conT i) $(conT t) gg = $(mkFixBody matches) |] else [d| instance Fixable $(foldl appT (conT i) pvars) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(foldl appT (conT i) pvars) $(conT t) gg = $(mkFixBody matches) |] else if null ivars then [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars) ++(map (appT (conT ''Show)) pvars))) => Fixable $(conT i) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(conT i) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] else [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] TyConI (NewtypeD _ _ ip TH211MBKIND _ _) -> do let ivars = map (varT . getParName) ip let nip = max np (length ip) plist <- replicateM nip (newName "x") let pvars = map varT plist if null tvars then if null ivars then [d| instance Fixable $(conT i) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(conT i) $(conT t) gg = $(mkFixBody matches) |] else [d| instance Fixable $(foldl appT (conT i) pvars) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(foldl appT (conT i) pvars) $(conT t) gg = $(mkFixBody matches) |] else if null ivars then [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(conT i) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(conT i) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] else [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] TyConI (TySynD _ ip _) -> do let ivars = map (varT . getParName) ip let nip = max np (length ip) plist <- replicateM nip (newName "x") let pvars = map varT plist if null tvars then if null ivars then [d| instance Fixable $(conT i) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(conT i) $(conT t) gg = $(mkFixBody matches) |] else [d| instance Fixable $(foldl appT (conT i) pvars) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(foldl appT (conT i) pvars) $(conT t) gg = $(mkFixBody matches) |] else if null ivars then [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(conT i) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(conT i) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] else [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] --newtype case? _ -> return []
7,879
mkFix i v a t = do ti <- reify t case ti of TyConI (DataD _ _ params TH211MBKIND tcons _) -> do let cstuff = map getStuff tcons let names = map fst cstuff let matches = map (mkMatch v a) cstuff let np = length params let tvars = map (varT . getParName) params ii <- reify i case ii of TyConI (DataD _ _ ip TH211MBKIND _ _) -> do let ivars = map (varT . getParName) ip let nip = max np (length ip) plist <- replicateM nip (newName "x") let pvars = map varT plist if null tvars then if null ivars then [d| instance Fixable $(conT i) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(conT i) $(conT t) gg = $(mkFixBody matches) |] else [d| instance Fixable $(foldl appT (conT i) pvars) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(foldl appT (conT i) pvars) $(conT t) gg = $(mkFixBody matches) |] else if null ivars then [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars) ++(map (appT (conT ''Show)) pvars))) => Fixable $(conT i) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(conT i) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] else [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] TyConI (NewtypeD _ _ ip TH211MBKIND _ _) -> do let ivars = map (varT . getParName) ip let nip = max np (length ip) plist <- replicateM nip (newName "x") let pvars = map varT plist if null tvars then if null ivars then [d| instance Fixable $(conT i) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(conT i) $(conT t) gg = $(mkFixBody matches) |] else [d| instance Fixable $(foldl appT (conT i) pvars) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(foldl appT (conT i) pvars) $(conT t) gg = $(mkFixBody matches) |] else if null ivars then [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(conT i) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(conT i) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] else [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] TyConI (TySynD _ ip _) -> do let ivars = map (varT . getParName) ip let nip = max np (length ip) plist <- replicateM nip (newName "x") let pvars = map varT plist if null tvars then if null ivars then [d| instance Fixable $(conT i) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(conT i) $(conT t) gg = $(mkFixBody matches) |] else [d| instance Fixable $(foldl appT (conT i) pvars) $(conT t) where fix = gg where gg :: $(conT t) -> VState $(foldl appT (conT i) pvars) $(conT t) gg = $(mkFixBody matches) |] else if null ivars then [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(conT i) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(conT i) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] else [d| instance $(foldl appT (tupleT (3*nip)) ((map (appT (conT ''Arbitrary)) pvars)++(map (appT (conT ''Eq)) pvars)++(map (appT (conT ''Show)) pvars))) => Fixable $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) where fix = gg where gg :: $(foldl appT (conT t) pvars) -> VState $(foldl appT (conT i) pvars) $(foldl appT (conT t) pvars) gg = $(mkFixBody matches) |] --newtype case? _ -> return []
7,826
true
true
0
23
4,500
653
334
319
null
null
mzero/PlainChanges2
src/Tests.hs
bsd-3-clause
strum :: Dur -> Music Pitch strum = phrase [Art $ Legato 3.5 ] . line . openStrings
83
strum :: Dur -> Music Pitch strum = phrase [Art $ Legato 3.5 ] . line . openStrings
83
strum = phrase [Art $ Legato 3.5 ] . line . openStrings
55
false
true
0
10
17
39
19
20
null
null
jwiegley/hnix
src/Nix/Render.hs
bsd-3-clause
posAndMsg :: SourcePos -> Doc a -> ParseError s Void posAndMsg (SourcePos _ lineNo _) msg = FancyError (unPos lineNo) (Set.fromList [ErrorFail (show msg) :: ErrorFancy Void])
178
posAndMsg :: SourcePos -> Doc a -> ParseError s Void posAndMsg (SourcePos _ lineNo _) msg = FancyError (unPos lineNo) (Set.fromList [ErrorFail (show msg) :: ErrorFancy Void])
178
posAndMsg (SourcePos _ lineNo _) msg = FancyError (unPos lineNo) (Set.fromList [ErrorFail (show msg) :: ErrorFancy Void])
125
false
true
0
10
30
80
38
42
null
null
Tener/HaNS
src/Network/TCP/Aux/SockMonad.hs
bsd-3-clause
----------------------------------------------------- -- has_sock_ :: SocketID -> SMonad t Bool -- has_sock_ sid = do -- h <- get_host_ -- return $ Map.member sid (sock_map h) -- -- lookup_sock_ sid = do -- h <- get_host_ -- res <- Map.lookup sid (sock_map h) -- return res -- -- {-# INLINE has_sock_ #-} -- {-# INLINE lookup_sock_ #-} -- ------------------ runSMonad :: SocketID -> (SMonad t a) -> HMonad t a runSMonad sid (SMonad m) = do h <- get_host sock <- lookup_sock sid let initstate = HState h sock let (res, finalstate) = m initstate put_host $ hs_host finalstate update_sock sid $ \_ -> hs_sock finalstate return res
657
runSMonad :: SocketID -> (SMonad t a) -> HMonad t a runSMonad sid (SMonad m) = do h <- get_host sock <- lookup_sock sid let initstate = HState h sock let (res, finalstate) = m initstate put_host $ hs_host finalstate update_sock sid $ \_ -> hs_sock finalstate return res
284
runSMonad sid (SMonad m) = do h <- get_host sock <- lookup_sock sid let initstate = HState h sock let (res, finalstate) = m initstate put_host $ hs_host finalstate update_sock sid $ \_ -> hs_sock finalstate return res
232
true
true
0
10
136
142
72
70
null
null
svenssonjoel/EmbArBB
Intel/ArBB/TypeCheck.hs
bsd-3-clause
emptyTCState = TCState Map.empty Map.empty Map.empty
52
emptyTCState = TCState Map.empty Map.empty Map.empty
52
emptyTCState = TCState Map.empty Map.empty Map.empty
52
false
false
1
6
5
22
9
13
null
null
Axure/elm-compiler
src/Type/Unify.hs
bsd-3-clause
gatherFields :: Variable -> IO ExpandedRecord gatherFields var = do desc <- UF.descriptor var case structure desc of (Just (Record1 fields ext)) -> do (ExpandedRecord deeperFields rootExt) <- gatherFields ext return (ExpandedRecord (Map.unionWith (++) fields deeperFields) rootExt) (Just EmptyRecord1) -> return (ExpandedRecord Map.empty (Empty var)) _ -> return (ExpandedRecord Map.empty (Extension var)) -- assumes that one of the dicts has stuff in it
536
gatherFields :: Variable -> IO ExpandedRecord gatherFields var = do desc <- UF.descriptor var case structure desc of (Just (Record1 fields ext)) -> do (ExpandedRecord deeperFields rootExt) <- gatherFields ext return (ExpandedRecord (Map.unionWith (++) fields deeperFields) rootExt) (Just EmptyRecord1) -> return (ExpandedRecord Map.empty (Empty var)) _ -> return (ExpandedRecord Map.empty (Extension var)) -- assumes that one of the dicts has stuff in it
536
gatherFields var = do desc <- UF.descriptor var case structure desc of (Just (Record1 fields ext)) -> do (ExpandedRecord deeperFields rootExt) <- gatherFields ext return (ExpandedRecord (Map.unionWith (++) fields deeperFields) rootExt) (Just EmptyRecord1) -> return (ExpandedRecord Map.empty (Empty var)) _ -> return (ExpandedRecord Map.empty (Extension var)) -- assumes that one of the dicts has stuff in it
490
false
true
0
18
144
171
80
91
null
null
cbrghostrider/Hacking
Euler/prob11.hs
mit
--creates a chain of Coords chain :: String -> Coord -> [Coord] chain "l" co@(cx, cy) = co : chain "l" (cx - 1, cy)
116
chain :: String -> Coord -> [Coord] chain "l" co@(cx, cy) = co : chain "l" (cx - 1, cy)
88
chain "l" co@(cx, cy) = co : chain "l" (cx - 1, cy)
52
true
true
0
8
25
56
31
25
null
null
bkoropoff/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LSRem (ATInt ITBig)) [l, r] = v ++ "idris_bigMod(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
97
doOp v (LSRem (ATInt ITBig)) [l, r] = v ++ "idris_bigMod(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
97
doOp v (LSRem (ATInt ITBig)) [l, r] = v ++ "idris_bigMod(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
97
false
false
1
14
22
62
28
34
null
null
ejconlon/analyze
test/Fixtures.hs
bsd-3-clause
fullUpdate :: RFrameUpdate Text Value fullUpdate = RFrameUpdate names values where names = V.fromList ["id", "name", "score"] values = V.fromList [ V.fromList [ValueInteger 42, ValueText "foo", ValueDouble 5.0] , V.fromList [ValueInteger 43, ValueText "bar", ValueDouble 3.0] ]
305
fullUpdate :: RFrameUpdate Text Value fullUpdate = RFrameUpdate names values where names = V.fromList ["id", "name", "score"] values = V.fromList [ V.fromList [ValueInteger 42, ValueText "foo", ValueDouble 5.0] , V.fromList [ValueInteger 43, ValueText "bar", ValueDouble 3.0] ]
305
fullUpdate = RFrameUpdate names values where names = V.fromList ["id", "name", "score"] values = V.fromList [ V.fromList [ValueInteger 42, ValueText "foo", ValueDouble 5.0] , V.fromList [ValueInteger 43, ValueText "bar", ValueDouble 3.0] ]
267
false
true
0
8
64
105
53
52
null
null
tjakway/blackjack-simulator
src/Jakway/Blackjack/Game.hs
mit
-- ^ since we prepend results to the list of hands we need to -- reverse it so it's in the same order as the [AIProc] that -- was passed in -- |monadic version of play play' :: AI -> Hand -> [Hand] -> Blackjack Hand play' ai hand otherHands = do deck <- get let (resultingHand, resDeck) = play ai hand otherHands deck put resDeck return resultingHand -- |first result in the tuple = result for the first Hand -- |second result in the tuple = result for the second Hand -- this function is very repetitive--rewrite it to pass a tuple of Hands -- instead of each players hand as a separate variable -- so it'll be: -- whoWon :: (Hand, Hand) -> (Result, Result)
701
play' :: AI -> Hand -> [Hand] -> Blackjack Hand play' ai hand otherHands = do deck <- get let (resultingHand, resDeck) = play ai hand otherHands deck put resDeck return resultingHand -- |first result in the tuple = result for the first Hand -- |second result in the tuple = result for the second Hand -- this function is very repetitive--rewrite it to pass a tuple of Hands -- instead of each players hand as a separate variable -- so it'll be: -- whoWon :: (Hand, Hand) -> (Result, Result)
500
play' ai hand otherHands = do deck <- get let (resultingHand, resDeck) = play ai hand otherHands deck put resDeck return resultingHand -- |first result in the tuple = result for the first Hand -- |second result in the tuple = result for the second Hand -- this function is very repetitive--rewrite it to pass a tuple of Hands -- instead of each players hand as a separate variable -- so it'll be: -- whoWon :: (Hand, Hand) -> (Result, Result)
452
true
true
0
10
169
90
47
43
null
null
sinelaw/lamdu
Lamdu/Data/Expression/Infer.hs
gpl-3.0
executeRules :: (Eq def, MonadA m) => InferT def m () executeRules = do curLayer <- liftState $ Lens.use sBfsNextLayer liftState $ sBfsCurLayer .= curLayer liftState $ sBfsNextLayer .= IntSet.empty unless (IntSet.null curLayer) $ do traverse_ processRule $ IntSet.toList curLayer executeRules where processRule key = do liftState $ sBfsCurLayer . Lens.contains key .= False ruleRefs <- liftState $ Lens.use (sContext . ruleRefsAt (RuleRef key)) ruleExprs <- traverse getRefExpr ruleRefs traverse_ (uncurry (setRefExpr (Just (RuleRef key, ruleExprs)))) $ Rules.runRule ruleExprs
625
executeRules :: (Eq def, MonadA m) => InferT def m () executeRules = do curLayer <- liftState $ Lens.use sBfsNextLayer liftState $ sBfsCurLayer .= curLayer liftState $ sBfsNextLayer .= IntSet.empty unless (IntSet.null curLayer) $ do traverse_ processRule $ IntSet.toList curLayer executeRules where processRule key = do liftState $ sBfsCurLayer . Lens.contains key .= False ruleRefs <- liftState $ Lens.use (sContext . ruleRefsAt (RuleRef key)) ruleExprs <- traverse getRefExpr ruleRefs traverse_ (uncurry (setRefExpr (Just (RuleRef key, ruleExprs)))) $ Rules.runRule ruleExprs
625
executeRules = do curLayer <- liftState $ Lens.use sBfsNextLayer liftState $ sBfsCurLayer .= curLayer liftState $ sBfsNextLayer .= IntSet.empty unless (IntSet.null curLayer) $ do traverse_ processRule $ IntSet.toList curLayer executeRules where processRule key = do liftState $ sBfsCurLayer . Lens.contains key .= False ruleRefs <- liftState $ Lens.use (sContext . ruleRefsAt (RuleRef key)) ruleExprs <- traverse getRefExpr ruleRefs traverse_ (uncurry (setRefExpr (Just (RuleRef key, ruleExprs)))) $ Rules.runRule ruleExprs
571
false
true
0
16
126
227
105
122
null
null
eigengrau/hlint
data/Default.hs
bsd-3-clause
-- FOLDS error = foldr (>>) (return ()) ==> sequence_ where _ = noQuickCheck
82
error = foldr (>>) (return ()) ==> sequence_ where _ = noQuickCheck
72
error = foldr (>>) (return ()) ==> sequence_ where _ = noQuickCheck
72
true
false
1
9
19
39
18
21
null
null
Mattiemus/LaneWars
IdentityList.hs
mit
listToIL :: [a] -> IL a listToIL as = IL {ilNextKey = length as, ilAssocs = reverse (zip [0..] as)}
117
listToIL :: [a] -> IL a listToIL as = IL {ilNextKey = length as, ilAssocs = reverse (zip [0..] as)}
117
listToIL as = IL {ilNextKey = length as, ilAssocs = reverse (zip [0..] as)}
93
false
true
0
10
37
55
29
26
null
null
ghcjs/ghcjs
src-bin/Boot.hs
mit
installCabal :: B () installCabal = subBuild $ do msg info "installing Cabal library" preparePackage "Cabal" buildCabalPackage "Cabal"
140
installCabal :: B () installCabal = subBuild $ do msg info "installing Cabal library" preparePackage "Cabal" buildCabalPackage "Cabal"
140
installCabal = subBuild $ do msg info "installing Cabal library" preparePackage "Cabal" buildCabalPackage "Cabal"
119
false
true
0
8
23
40
17
23
null
null
MichielDerhaeg/stack
src/Text/PrettyPrint/Leijen/Extended.hs
bsd-3-clause
displayAnsi :: (Display a, HasAnsiAnn (Ann a)) => Int -> a -> T.Text displayAnsi w = LT.toStrict . displayAnsiSimple . renderDefault w . toAnsiDoc . display
156
displayAnsi :: (Display a, HasAnsiAnn (Ann a)) => Int -> a -> T.Text displayAnsi w = LT.toStrict . displayAnsiSimple . renderDefault w . toAnsiDoc . display
156
displayAnsi w = LT.toStrict . displayAnsiSimple . renderDefault w . toAnsiDoc . display
87
false
true
0
10
25
72
34
38
null
null
nomeata/ghc
compiler/cmm/CLabel.hs
bsd-3-clause
toEntryLbl :: CLabel -> CLabel toEntryLbl (IdLabel n c LocalInfoTable) = IdLabel n c LocalEntry
96
toEntryLbl :: CLabel -> CLabel toEntryLbl (IdLabel n c LocalInfoTable) = IdLabel n c LocalEntry
96
toEntryLbl (IdLabel n c LocalInfoTable) = IdLabel n c LocalEntry
65
false
true
0
7
15
35
17
18
null
null
ckaestne/CIDE
other/CaseStudies/Arith/orig_armin/strict-static/Arith.hs
gpl-3.0
eval env (Var name) = case lookupEnv env name of Just x -> Result x Nothing -> Fail UndefVarError
118
eval env (Var name) = case lookupEnv env name of Just x -> Result x Nothing -> Fail UndefVarError
118
eval env (Var name) = case lookupEnv env name of Just x -> Result x Nothing -> Fail UndefVarError
118
false
false
0
8
39
49
21
28
null
null
peti/funcmp
FMP/Symbols.hs
gpl-3.0
--------------------- symNUnions :: [SymNum] -> SymNum symNUnions [] = SymNRelax
117
symNUnions :: [SymNum] -> SymNum symNUnions [] = SymNRelax
94
symNUnions [] = SymNRelax
42
true
true
0
8
46
30
14
16
null
null
GaloisInc/galua
galua-rts/src/Galua/Util/Cache.hs
mit
cacheGC :: Ord k => Cache k v -> Cache k v cacheGC Cache { .. } | size <= tgtSize = Cache { .. } | otherwise = Cache { cacheTime = 1 , cacheValues = Map.fromList updated , .. } where size = Map.size cacheValues tgtSize = div (2 * cacheLimit) 3 olderFirst (_,(_,age1)) (_,(_,age2)) = compare age1 age2 -- smaller age is older sorted = drop (size - tgtSize) $ sortBy olderFirst (Map.toList cacheValues) updated = case sorted of (_,(_,t)) : _ | t > 1 -> [ (k,(v,t'-(t-1))) | (k,(v,t')) <- sorted ] _ -> sorted
686
cacheGC :: Ord k => Cache k v -> Cache k v cacheGC Cache { .. } | size <= tgtSize = Cache { .. } | otherwise = Cache { cacheTime = 1 , cacheValues = Map.fromList updated , .. } where size = Map.size cacheValues tgtSize = div (2 * cacheLimit) 3 olderFirst (_,(_,age1)) (_,(_,age2)) = compare age1 age2 -- smaller age is older sorted = drop (size - tgtSize) $ sortBy olderFirst (Map.toList cacheValues) updated = case sorted of (_,(_,t)) : _ | t > 1 -> [ (k,(v,t'-(t-1))) | (k,(v,t')) <- sorted ] _ -> sorted
686
cacheGC Cache { .. } | size <= tgtSize = Cache { .. } | otherwise = Cache { cacheTime = 1 , cacheValues = Map.fromList updated , .. } where size = Map.size cacheValues tgtSize = div (2 * cacheLimit) 3 olderFirst (_,(_,age1)) (_,(_,age2)) = compare age1 age2 -- smaller age is older sorted = drop (size - tgtSize) $ sortBy olderFirst (Map.toList cacheValues) updated = case sorted of (_,(_,t)) : _ | t > 1 -> [ (k,(v,t'-(t-1))) | (k,(v,t')) <- sorted ] _ -> sorted
643
false
true
3
10
279
281
151
130
null
null
bobgru/conifer
src/Conifer.hs
bsd-3-clause
pruneByScale :: Double -> TreeSpec3 -> TreeSpec3 pruneByScale s (Node n@((_, v), _, _, _, _) ns) | norm v > s = Node n (map (pruneByScale s) ns) | otherwise = Node n []
181
pruneByScale :: Double -> TreeSpec3 -> TreeSpec3 pruneByScale s (Node n@((_, v), _, _, _, _) ns) | norm v > s = Node n (map (pruneByScale s) ns) | otherwise = Node n []
181
pruneByScale s (Node n@((_, v), _, _, _, _) ns) | norm v > s = Node n (map (pruneByScale s) ns) | otherwise = Node n []
132
false
true
2
9
47
115
55
60
null
null
AlexanderPankiv/ghc
libraries/base/Data/List/NonEmpty.hs
bsd-3-clause
-- | 'groupBy1' is to 'group1' as 'groupBy' is to 'group'. groupBy1 :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty (NonEmpty a) groupBy1 eq (x :| xs) = (x :| ys) :| groupBy eq zs where (ys, zs) = List.span (eq x) xs -- | 'groupWith1' is to 'group1' as 'groupWith' is to 'group'
279
groupBy1 :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty (NonEmpty a) groupBy1 eq (x :| xs) = (x :| ys) :| groupBy eq zs where (ys, zs) = List.span (eq x) xs -- | 'groupWith1' is to 'group1' as 'groupWith' is to 'group'
220
groupBy1 eq (x :| xs) = (x :| ys) :| groupBy eq zs where (ys, zs) = List.span (eq x) xs -- | 'groupWith1' is to 'group1' as 'groupWith' is to 'group'
152
true
true
0
9
59
99
51
48
null
null
gibiansky/hlint
src/Hint/Match.hs
bsd-3-clause
unifyPat nm x y = unifyDef nm x y
33
unifyPat nm x y = unifyDef nm x y
33
unifyPat nm x y = unifyDef nm x y
33
false
false
1
5
8
25
9
16
null
null
shayan-najd/HsParser
Language/Haskell/Syntax/SrcLoc.hs
gpl-3.0
mkSrcSpan (RealSrcLoc loc1) (RealSrcLoc loc2) = RealSrcSpan (mkRealSrcSpan loc1 loc2)
89
mkSrcSpan (RealSrcLoc loc1) (RealSrcLoc loc2) = RealSrcSpan (mkRealSrcSpan loc1 loc2)
89
mkSrcSpan (RealSrcLoc loc1) (RealSrcLoc loc2) = RealSrcSpan (mkRealSrcSpan loc1 loc2)
89
false
false
0
7
13
34
16
18
null
null
tjakway/ghcjvm
compiler/hsSyn/HsDecls.hs
bsd-3-clause
tyClGroupTyClDecls :: [TyClGroup name] -> [LTyClDecl name] tyClGroupTyClDecls = concatMap group_tyclds
102
tyClGroupTyClDecls :: [TyClGroup name] -> [LTyClDecl name] tyClGroupTyClDecls = concatMap group_tyclds
102
tyClGroupTyClDecls = concatMap group_tyclds
43
false
true
0
7
10
30
15
15
null
null
lennart/Tidal
Sound/Tidal/Utils.hs
gpl-3.0
mapSnd :: (a -> b) -> (c, a) -> (c, b) mapSnd f (x,y) = (x,f y)
63
mapSnd :: (a -> b) -> (c, a) -> (c, b) mapSnd f (x,y) = (x,f y)
63
mapSnd f (x,y) = (x,f y)
24
false
true
0
7
16
63
34
29
null
null
yihuang/tag-stream
Text/HTML/TagStream/Types.hs
bsd-3-clause
encode :: [Token] -> ByteString encode = encodeHL id
52
encode :: [Token] -> ByteString encode = encodeHL id
52
encode = encodeHL id
20
false
true
0
6
8
21
11
10
null
null
supki/libstackexchange
src/Network/StackExchange/API.hs
mit
-- | <https://api.stackexchange.com/docs/me-associated-users> meAssociatedUsers ∷ Request RequireToken "meAssociatedUsers" [SE NetworkUser] meAssociatedUsers = path "me/associated" <> parse (attoparsec items ".me/associated: ")
231
meAssociatedUsers ∷ Request RequireToken "meAssociatedUsers" [SE NetworkUser] meAssociatedUsers = path "me/associated" <> parse (attoparsec items ".me/associated: ")
169
meAssociatedUsers = path "me/associated" <> parse (attoparsec items ".me/associated: ")
91
true
true
0
8
23
43
21
22
null
null
pparkkin/eta
compiler/ETA/Main/HscTypes.hs
bsd-3-clause
mkTypeEnv :: [TyThing] -> TypeEnv mkTypeEnv things = extendTypeEnvList emptyTypeEnv things
90
mkTypeEnv :: [TyThing] -> TypeEnv mkTypeEnv things = extendTypeEnvList emptyTypeEnv things
90
mkTypeEnv things = extendTypeEnvList emptyTypeEnv things
56
false
true
0
7
10
31
14
17
null
null
bspaans/EditTimeReport
src/Printers.hs
gpl-3.0
printPlainText f (Root ns _ t ti) = concatMap (tts' 1) ns ++ "\n\n Total time: " ++ showFmtTime f ti ++ "\n" where tts' lvl (Leaf time) = printf "%10s" (showFmtTime f time) tts' lvl (Node _ _ s tr) = '\n' : replicate (lvl * 4) ' ' ++ printf "%-70s" s ++ concatMap (tts' (lvl + 1)) tr -- | StatsTree to Html table (no HTML header) --
455
printPlainText f (Root ns _ t ti) = concatMap (tts' 1) ns ++ "\n\n Total time: " ++ showFmtTime f ti ++ "\n" where tts' lvl (Leaf time) = printf "%10s" (showFmtTime f time) tts' lvl (Node _ _ s tr) = '\n' : replicate (lvl * 4) ' ' ++ printf "%-70s" s ++ concatMap (tts' (lvl + 1)) tr -- | StatsTree to Html table (no HTML header) --
455
printPlainText f (Root ns _ t ti) = concatMap (tts' 1) ns ++ "\n\n Total time: " ++ showFmtTime f ti ++ "\n" where tts' lvl (Leaf time) = printf "%10s" (showFmtTime f time) tts' lvl (Node _ _ s tr) = '\n' : replicate (lvl * 4) ' ' ++ printf "%-70s" s ++ concatMap (tts' (lvl + 1)) tr -- | StatsTree to Html table (no HTML header) --
455
false
false
1
10
193
153
75
78
null
null
danr/hipspec
testsuite/prod/zeno_version/PropT41.hs
gpl-3.0
subset (x:xs) ys = x `elem` xs && subset xs ys
46
subset (x:xs) ys = x `elem` xs && subset xs ys
46
subset (x:xs) ys = x `elem` xs && subset xs ys
46
false
false
0
7
10
33
17
16
null
null
juhp/stack
test/integration/tests/3940-base-upgrade-warning/Main.hs
bsd-3-clause
unattainableBaseWarning :: String unattainableBaseWarning = "Build requires unattainable version of base. Since base is a part of GHC, \ \you most likely need to use a different GHC version with the matching base."
218
unattainableBaseWarning :: String unattainableBaseWarning = "Build requires unattainable version of base. Since base is a part of GHC, \ \you most likely need to use a different GHC version with the matching base."
218
unattainableBaseWarning = "Build requires unattainable version of base. Since base is a part of GHC, \ \you most likely need to use a different GHC version with the matching base."
184
false
true
0
4
36
11
6
5
null
null
Saulzar/reflex
src/Reflex/Patch/MapWithMove.hs
bsd-3-clause
-- | Set the 'To' field of a 'NodeInfo' nodeInfoSetTo :: To k -> NodeInfo k v -> NodeInfo k v nodeInfoSetTo to ni = ni { _nodeInfo_to = to }
140
nodeInfoSetTo :: To k -> NodeInfo k v -> NodeInfo k v nodeInfoSetTo to ni = ni { _nodeInfo_to = to }
100
nodeInfoSetTo to ni = ni { _nodeInfo_to = to }
46
true
true
0
8
30
51
24
27
null
null
lambdataro/Dive
Eval.hs
mit
evalPrim Append [LIST vs1] (LIST vs2) = return $ LIST $ vs1 ++ vs2
66
evalPrim Append [LIST vs1] (LIST vs2) = return $ LIST $ vs1 ++ vs2
66
evalPrim Append [LIST vs1] (LIST vs2) = return $ LIST $ vs1 ++ vs2
66
false
false
1
10
13
42
18
24
null
null
xcv-/LCC
lib/Language/LCC/Targets/Java.hs
gpl-3.0
writeInterfaceBody :: (Err.ErrorM m, Writing m) => AnalyzedAST -> m [(PathNode, T.Text)] writeInterfaceBody ast = case ast of Leaf trs -> Err.globalPanic $ "writeInterfaceBody: Translations at the top level: " ++ show (trs^..traverse.trSig) Subtree m -> evalStateT (writeTopLevel m) Map.empty where writeTopLevel :: (Writing m, ConstArrayCountM m) => Map.Map PathNode AnalyzedAST -> m [(PathNode, T.Text)] writeTopLevel m = do let foreach = forM (Map.toList m) . uncurry constructorStatements <- foreach $ \name -> \case Leaf trs -> liftM concat $ forM trs $ \t -> if isConstant t then writeConstValDecl False name t & liftM return else writeAbstractDecl name t >> return [] Subtree m' -> writeNestedClassDecl False name m' & liftM (return . fst) return (concat constructorStatements) writeConstValDecl :: (Writing m, ConstArrayCountM m) => Bool -> PathNode -> AnalyzedTranslation -> m (PathNode, T.Text) writeConstValDecl init name t = do let ret = t^.trSig.sigReturn i <- nextConstArrayIndex ret let array = constArrayName ret let rhs = format "{}[{}]" (array, i) writefn "public final {} {}{};" (javaType ret, name, if init then " = " <> rhs else "") return (name, rhs) writeAbstractDecl :: Writing m => PathNode -> AnalyzedTranslation -> m () writeAbstractDecl name t = do writefn "{} abstract {} {}({});" (sigFmtArgs name t) writeNestedClassDecl :: (Writing m, ConstArrayCountM m) => Bool -> PathNode -> Map.Map PathNode AnalyzedAST -> m ((PathNode, T.Text), Any) writeNestedClassDecl init name m = do writef1 "public abstract class {} {" name hasAbstractMembers <- indent $ foldMapWithTagsM m writeSignature writeNestedClass writeln "}" rhs <- if getAny hasAbstractMembers then do writefn "protected abstract {} _new_{}();" (name, name) return $ format1 "_new_{}()" name else return $ format "new {}() {}" (name, "{}" :: T.Text) writefn "public final {} {}{};" (name, name, if init then " = " <> rhs else "") writeln "" return ((name, rhs), hasAbstractMembers) writeSignature :: (Writing m, ConstArrayCountM m) => PathNode -> AnalyzedTranslation -> m Any writeSignature name t | isConstant t = do writeConstValDecl True name t return (Any False) | otherwise = do writeAbstractDecl name t return (Any True) writeNestedClass :: (Writing m, ConstArrayCountM m) => PathNode -> Map.Map PathNode AnalyzedAST -> m Any writeNestedClass name m = writeNestedClassDecl True name m & liftM snd
3,328
writeInterfaceBody :: (Err.ErrorM m, Writing m) => AnalyzedAST -> m [(PathNode, T.Text)] writeInterfaceBody ast = case ast of Leaf trs -> Err.globalPanic $ "writeInterfaceBody: Translations at the top level: " ++ show (trs^..traverse.trSig) Subtree m -> evalStateT (writeTopLevel m) Map.empty where writeTopLevel :: (Writing m, ConstArrayCountM m) => Map.Map PathNode AnalyzedAST -> m [(PathNode, T.Text)] writeTopLevel m = do let foreach = forM (Map.toList m) . uncurry constructorStatements <- foreach $ \name -> \case Leaf trs -> liftM concat $ forM trs $ \t -> if isConstant t then writeConstValDecl False name t & liftM return else writeAbstractDecl name t >> return [] Subtree m' -> writeNestedClassDecl False name m' & liftM (return . fst) return (concat constructorStatements) writeConstValDecl :: (Writing m, ConstArrayCountM m) => Bool -> PathNode -> AnalyzedTranslation -> m (PathNode, T.Text) writeConstValDecl init name t = do let ret = t^.trSig.sigReturn i <- nextConstArrayIndex ret let array = constArrayName ret let rhs = format "{}[{}]" (array, i) writefn "public final {} {}{};" (javaType ret, name, if init then " = " <> rhs else "") return (name, rhs) writeAbstractDecl :: Writing m => PathNode -> AnalyzedTranslation -> m () writeAbstractDecl name t = do writefn "{} abstract {} {}({});" (sigFmtArgs name t) writeNestedClassDecl :: (Writing m, ConstArrayCountM m) => Bool -> PathNode -> Map.Map PathNode AnalyzedAST -> m ((PathNode, T.Text), Any) writeNestedClassDecl init name m = do writef1 "public abstract class {} {" name hasAbstractMembers <- indent $ foldMapWithTagsM m writeSignature writeNestedClass writeln "}" rhs <- if getAny hasAbstractMembers then do writefn "protected abstract {} _new_{}();" (name, name) return $ format1 "_new_{}()" name else return $ format "new {}() {}" (name, "{}" :: T.Text) writefn "public final {} {}{};" (name, name, if init then " = " <> rhs else "") writeln "" return ((name, rhs), hasAbstractMembers) writeSignature :: (Writing m, ConstArrayCountM m) => PathNode -> AnalyzedTranslation -> m Any writeSignature name t | isConstant t = do writeConstValDecl True name t return (Any False) | otherwise = do writeAbstractDecl name t return (Any True) writeNestedClass :: (Writing m, ConstArrayCountM m) => PathNode -> Map.Map PathNode AnalyzedAST -> m Any writeNestedClass name m = writeNestedClassDecl True name m & liftM snd
3,328
writeInterfaceBody ast = case ast of Leaf trs -> Err.globalPanic $ "writeInterfaceBody: Translations at the top level: " ++ show (trs^..traverse.trSig) Subtree m -> evalStateT (writeTopLevel m) Map.empty where writeTopLevel :: (Writing m, ConstArrayCountM m) => Map.Map PathNode AnalyzedAST -> m [(PathNode, T.Text)] writeTopLevel m = do let foreach = forM (Map.toList m) . uncurry constructorStatements <- foreach $ \name -> \case Leaf trs -> liftM concat $ forM trs $ \t -> if isConstant t then writeConstValDecl False name t & liftM return else writeAbstractDecl name t >> return [] Subtree m' -> writeNestedClassDecl False name m' & liftM (return . fst) return (concat constructorStatements) writeConstValDecl :: (Writing m, ConstArrayCountM m) => Bool -> PathNode -> AnalyzedTranslation -> m (PathNode, T.Text) writeConstValDecl init name t = do let ret = t^.trSig.sigReturn i <- nextConstArrayIndex ret let array = constArrayName ret let rhs = format "{}[{}]" (array, i) writefn "public final {} {}{};" (javaType ret, name, if init then " = " <> rhs else "") return (name, rhs) writeAbstractDecl :: Writing m => PathNode -> AnalyzedTranslation -> m () writeAbstractDecl name t = do writefn "{} abstract {} {}({});" (sigFmtArgs name t) writeNestedClassDecl :: (Writing m, ConstArrayCountM m) => Bool -> PathNode -> Map.Map PathNode AnalyzedAST -> m ((PathNode, T.Text), Any) writeNestedClassDecl init name m = do writef1 "public abstract class {} {" name hasAbstractMembers <- indent $ foldMapWithTagsM m writeSignature writeNestedClass writeln "}" rhs <- if getAny hasAbstractMembers then do writefn "protected abstract {} _new_{}();" (name, name) return $ format1 "_new_{}()" name else return $ format "new {}() {}" (name, "{}" :: T.Text) writefn "public final {} {}{};" (name, name, if init then " = " <> rhs else "") writeln "" return ((name, rhs), hasAbstractMembers) writeSignature :: (Writing m, ConstArrayCountM m) => PathNode -> AnalyzedTranslation -> m Any writeSignature name t | isConstant t = do writeConstValDecl True name t return (Any False) | otherwise = do writeAbstractDecl name t return (Any True) writeNestedClass :: (Writing m, ConstArrayCountM m) => PathNode -> Map.Map PathNode AnalyzedAST -> m Any writeNestedClass name m = writeNestedClassDecl True name m & liftM snd
3,201
false
true
0
18
1,304
931
446
485
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 7888933 = 2517
34
getValueFromProduct 7888933 = 2517
34
getValueFromProduct 7888933 = 2517
34
false
false
0
5
3
9
4
5
null
null
ThoughtWorksInc/DeepDarkFantasy
DDF/DBI.hs
apache-2.0
const1 = app const
18
const1 = app const
18
const1 = app const
18
false
false
0
5
3
9
4
5
null
null
alexander-at-github/eta
compiler/ETA/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
MetaMemoryT/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
getShowArgs (_ : xs) = getShowArgs xs
37
getShowArgs (_ : xs) = getShowArgs xs
37
getShowArgs (_ : xs) = getShowArgs xs
37
false
false
0
7
6
19
9
10
null
null
m-alvarez/jhc
src/Fixer/VMap.hs
mit
vmapArgSingleton :: (Ord p,Ord n,Show p,Show n) => n -> Int -> VMap p n -> VMap p n vmapArgSingleton n i v | isBottom v = emptyVMap | otherwise = pruneVMap $ emptyVMap { vmapArgs = Map.singleton (n,i) v }
212
vmapArgSingleton :: (Ord p,Ord n,Show p,Show n) => n -> Int -> VMap p n -> VMap p n vmapArgSingleton n i v | isBottom v = emptyVMap | otherwise = pruneVMap $ emptyVMap { vmapArgs = Map.singleton (n,i) v }
212
vmapArgSingleton n i v | isBottom v = emptyVMap | otherwise = pruneVMap $ emptyVMap { vmapArgs = Map.singleton (n,i) v }
128
false
true
0
11
48
117
56
61
null
null
julienschmaltz/madl
test/app/Parser/ParserTest.hs
mit
stringlist_testcases :: [String] stringlist_testcases = [ "aap, noot, mies", "aap , noot , mies" ]
111
stringlist_testcases :: [String] stringlist_testcases = [ "aap, noot, mies", "aap , noot , mies" ]
111
stringlist_testcases = [ "aap, noot, mies", "aap , noot , mies" ]
78
false
true
0
7
27
27
13
14
null
null
RefactoringTools/HaRe
test/testdata/TypeUtils/TypeSigs.hs
bsd-3-clause
sq,anotherFun :: Int -> Int sq 0 = 0
36
sq,anotherFun :: Int -> Int sq 0 = 0
36
sq 0 = 0
8
false
true
2
5
8
25
11
14
null
null
kylcarte/structures
src/Data/Structure.hs
bsd-3-clause
(.*) = op (*)
13
(.*) = op (*)
13
(.*) = op (*)
13
false
false
1
5
3
17
8
9
null
null
sol2man2/Learn-You-A-Haskell-For-Great-Good
src/Ch03.hs
mit
-- [a+b | (a,b) <- xs] head' :: [a] -> a head' [] = error "Can't call head on an empty list, dummy!"
101
head' :: [a] -> a head' [] = error "Can't call head on an empty list, dummy!"
77
head' [] = error "Can't call head on an empty list, dummy!"
59
true
true
0
6
23
27
14
13
null
null
danchoi/sqltmpl
Main.hs
mit
tmplValues :: O.Parser [Text] tmplValues = (many (T.pack <$> O.strArgument (O.metavar "VALUE")))
96
tmplValues :: O.Parser [Text] tmplValues = (many (T.pack <$> O.strArgument (O.metavar "VALUE")))
96
tmplValues = (many (T.pack <$> O.strArgument (O.metavar "VALUE")))
66
false
true
0
12
11
47
24
23
null
null
CulpaBS/wbBach
src/Futhark/Representation/Primitive.hs
bsd-3-clause
binOpType (SDiv t) = IntType t
30
binOpType (SDiv t) = IntType t
30
binOpType (SDiv t) = IntType t
30
false
false
0
6
5
19
8
11
null
null
bravit/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
highestFC (PType fc) = Just fc
43
highestFC (PType fc) = Just fc
43
highestFC (PType fc) = Just fc
43
false
false
0
6
18
19
8
11
null
null
ocramz/petsc-hs
src/Numerical/PETSc/Internal/InlineC.hs
gpl-3.0
-- | is the operator Hermitian? epsIsHermitian' :: EPS -> IO (PetscBool, CInt) epsIsHermitian' e = withPtr $ \ish -> [C.exp|int{EPSIsHermitian($(EPS e),$(PetscBool* ish))}|]
175
epsIsHermitian' :: EPS -> IO (PetscBool, CInt) epsIsHermitian' e = withPtr $ \ish -> [C.exp|int{EPSIsHermitian($(EPS e),$(PetscBool* ish))}|]
143
epsIsHermitian' e = withPtr $ \ish -> [C.exp|int{EPSIsHermitian($(EPS e),$(PetscBool* ish))}|]
96
true
true
0
7
24
43
25
18
null
null
glguy/advent2016
Day21.hs
isc
forward scram = case scram of RotateRight i -> rotateRight i RotateLeft i -> rotateLeft i SwapPosition i j -> \xs -> set i (xs!!j) $ set j (xs!!i) xs SwapLetter x y -> map $ \a -> if a == x then y else if a == y then x else a RotateChar e -> rotatePositionOf e ReversePositions i j -> reverseRange i j MovePosition i j -> movePosition i j
398
forward scram = case scram of RotateRight i -> rotateRight i RotateLeft i -> rotateLeft i SwapPosition i j -> \xs -> set i (xs!!j) $ set j (xs!!i) xs SwapLetter x y -> map $ \a -> if a == x then y else if a == y then x else a RotateChar e -> rotatePositionOf e ReversePositions i j -> reverseRange i j MovePosition i j -> movePosition i j
398
forward scram = case scram of RotateRight i -> rotateRight i RotateLeft i -> rotateLeft i SwapPosition i j -> \xs -> set i (xs!!j) $ set j (xs!!i) xs SwapLetter x y -> map $ \a -> if a == x then y else if a == y then x else a RotateChar e -> rotatePositionOf e ReversePositions i j -> reverseRange i j MovePosition i j -> movePosition i j
398
false
false
0
12
131
171
82
89
null
null
McCraeAndrew/cpi-ide
CPi/Signals.hs
gpl-3.0
tDisj12 = ((0,8), [(1,8)]) :: Signal
36
tDisj12 = ((0,8), [(1,8)]) :: Signal
36
tDisj12 = ((0,8), [(1,8)]) :: Signal
36
false
false
0
7
5
30
19
11
null
null
elieux/ghc
compiler/hsSyn/HsBinds.hs
bsd-3-clause
isDefaultMethod :: TcSpecPrags -> Bool isDefaultMethod IsDefaultMethod = True
77
isDefaultMethod :: TcSpecPrags -> Bool isDefaultMethod IsDefaultMethod = True
77
isDefaultMethod IsDefaultMethod = True
38
false
true
0
5
8
22
10
12
null
null
chrisdone/scrobble
src/Scrobble/Server.hs
bsd-3-clause
handleInit :: Config -> Handlers -> Handle -> MVar [Session] -> [(String,String)] -> IO () handleInit cfg handlers h clients params = case params of (makeSession -> Just sess) -> do handleHandshake handlers sess modifyMVar_ clients (return . (sess :)) reply h [show OK ,sesToken sess ,selfurl "nowplaying" ,selfurl "submit"] _ -> reply h [show BADAUTH] where selfurl x = "http://" ++ cfgHost cfg ++ ":" ++ show (cfgPort cfg) ++ "/" ++ x -- | Dispatch on commands.
537
handleInit :: Config -> Handlers -> Handle -> MVar [Session] -> [(String,String)] -> IO () handleInit cfg handlers h clients params = case params of (makeSession -> Just sess) -> do handleHandshake handlers sess modifyMVar_ clients (return . (sess :)) reply h [show OK ,sesToken sess ,selfurl "nowplaying" ,selfurl "submit"] _ -> reply h [show BADAUTH] where selfurl x = "http://" ++ cfgHost cfg ++ ":" ++ show (cfgPort cfg) ++ "/" ++ x -- | Dispatch on commands.
537
handleInit cfg handlers h clients params = case params of (makeSession -> Just sess) -> do handleHandshake handlers sess modifyMVar_ clients (return . (sess :)) reply h [show OK ,sesToken sess ,selfurl "nowplaying" ,selfurl "submit"] _ -> reply h [show BADAUTH] where selfurl x = "http://" ++ cfgHost cfg ++ ":" ++ show (cfgPort cfg) ++ "/" ++ x -- | Dispatch on commands.
446
false
true
0
13
152
201
99
102
null
null
mcschroeder/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
isFFITy :: Type -> Bool -- True for any TyCon that can possibly be an arg or result of an FFI call isFFITy ty = isValid (checkRepTyCon legalFFITyCon ty)
152
isFFITy :: Type -> Bool isFFITy ty = isValid (checkRepTyCon legalFFITyCon ty)
77
isFFITy ty = isValid (checkRepTyCon legalFFITyCon ty)
53
true
true
0
7
28
36
16
20
null
null
bkoropoff/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
{-! deriving instance Binary SpecialName deriving instance NFData SpecialName !-} sInstanceN :: Name -> [String] -> SpecialName sInstanceN n ss = InstanceN n (map T.pack ss)
174
sInstanceN :: Name -> [String] -> SpecialName sInstanceN n ss = InstanceN n (map T.pack ss)
91
sInstanceN n ss = InstanceN n (map T.pack ss)
45
true
true
0
8
26
48
23
25
null
null
AlexanderPankiv/ghc
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
pprImm (ImmCLbl l) = ppr l
29
pprImm (ImmCLbl l) = ppr l
29
pprImm (ImmCLbl l) = ppr l
29
false
false
0
6
8
19
8
11
null
null
nishiuramakoto/erasm-plusplus
src/haskell/Combinators.hs
gpl-3.0
-- | The right exponentiation combinator. rexp :: (b -> c) -> (a -> b) -> (a -> c) rexp f = curry (f . app)
109
rexp :: (b -> c) -> (a -> b) -> (a -> c) rexp f = curry (f . app)
65
rexp f = curry (f . app)
24
true
true
0
10
27
60
30
30
null
null
fcharlie/hgit
tests/src/TestRunner.hs
bsd-3-clause
main :: IO () main = defaultMain tests
42
main :: IO () main = defaultMain tests
42
main = defaultMain tests
26
false
true
0
7
11
25
10
15
null
null
ben-schulz/Idris-dev
src/Idris/Core/Evaluate.hs
bsd-3-clause
lookupInjectiveExact :: Name -> Context -> Maybe Injectivity lookupInjectiveExact n ctxt = fmap mkt $ lookupCtxtExact n (definitions ctxt) where mkt (d, inj, a, t, m) = inj -- Check if a name is reducible in the type checker. Partial definitions -- are not reducible (so treated as a constant)
296
lookupInjectiveExact :: Name -> Context -> Maybe Injectivity lookupInjectiveExact n ctxt = fmap mkt $ lookupCtxtExact n (definitions ctxt) where mkt (d, inj, a, t, m) = inj -- Check if a name is reducible in the type checker. Partial definitions -- are not reducible (so treated as a constant)
296
lookupInjectiveExact n ctxt = fmap mkt $ lookupCtxtExact n (definitions ctxt) where mkt (d, inj, a, t, m) = inj -- Check if a name is reducible in the type checker. Partial definitions -- are not reducible (so treated as a constant)
235
false
true
0
8
52
73
38
35
null
null
Yuras/io-region
lib/Control/IO/Region/Internal.hs
bsd-3-clause
alloc :: Region -> IO a -- ^ action to allocate resource -> (a -> IO ()) -- ^ action to cleanup resource -> IO (a, Key) -- ^ the resource and it's key alloc r acquire cleanup = mask_ $ do res <- acquire uninterruptibleMask_ $ atomically $ do guardOpen r k <- Key <$> pure r <*> newTVar False modifyTVar' (resources r) ((k, cleanup res) :) return (res, k) -- | Free the resource earlier then it's region will be closed. -- It will be removed from the region immediately. -- It is error to free resource twice
567
alloc :: Region -> IO a -- ^ action to allocate resource -> (a -> IO ()) -- ^ action to cleanup resource -> IO (a, Key) alloc r acquire cleanup = mask_ $ do res <- acquire uninterruptibleMask_ $ atomically $ do guardOpen r k <- Key <$> pure r <*> newTVar False modifyTVar' (resources r) ((k, cleanup res) :) return (res, k) -- | Free the resource earlier then it's region will be closed. -- It will be removed from the region immediately. -- It is error to free resource twice
535
alloc r acquire cleanup = mask_ $ do res <- acquire uninterruptibleMask_ $ atomically $ do guardOpen r k <- Key <$> pure r <*> newTVar False modifyTVar' (resources r) ((k, cleanup res) :) return (res, k) -- | Free the resource earlier then it's region will be closed. -- It will be removed from the region immediately. -- It is error to free resource twice
389
true
true
0
14
159
148
74
74
null
null
m-alvarez/jhc
src/Support/CFF.hs
mit
writeByte :: Handle -> Word8 -> IO () writeByte h b = hPutChar h (chr $ fromIntegral b)
87
writeByte :: Handle -> Word8 -> IO () writeByte h b = hPutChar h (chr $ fromIntegral b)
87
writeByte h b = hPutChar h (chr $ fromIntegral b)
49
false
true
0
9
17
48
22
26
null
null
haskell-distributed/distributed-process-supervisor
src/Control/Distributed/Process/Supervisor/Types.hs
bsd-3-clause
isRestarting _ = False
40
isRestarting _ = False
40
isRestarting _ = False
40
false
false
0
5
21
9
4
5
null
null
robertseaton/fregerator
src/fol.hs
gpl-3.0
nnf (Not (Exists x p)) = Forall x (nnf (Not p))
47
nnf (Not (Exists x p)) = Forall x (nnf (Not p))
47
nnf (Not (Exists x p)) = Forall x (nnf (Not p))
47
false
false
0
9
10
41
19
22
null
null
brendanhay/gogol
gogol-billing/gen/Network/Google/Resource/CloudBilling/BillingAccounts/Get.hs
mpl-2.0
-- | V1 error format. bagXgafv :: Lens' BillingAccountsGet (Maybe Xgafv) bagXgafv = lens _bagXgafv (\ s a -> s{_bagXgafv = a})
126
bagXgafv :: Lens' BillingAccountsGet (Maybe Xgafv) bagXgafv = lens _bagXgafv (\ s a -> s{_bagXgafv = a})
104
bagXgafv = lens _bagXgafv (\ s a -> s{_bagXgafv = a})
53
true
true
0
9
21
46
25
21
null
null
mhwombat/creatur-wains-iomha
src/ALife/Creatur/Wain/Iomha/Universe.hs
bsd-3-clause
cPopControl :: Setting Bool cPopControl = requiredSetting "popControl"
70
cPopControl :: Setting Bool cPopControl = requiredSetting "popControl"
70
cPopControl = requiredSetting "popControl"
42
false
true
0
6
7
22
9
13
null
null
christiaanb/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
enumFromThenClassOpKey = mkPreludeMiscIdUnique 164
57
enumFromThenClassOpKey = mkPreludeMiscIdUnique 164
57
enumFromThenClassOpKey = mkPreludeMiscIdUnique 164
57
false
false
0
5
10
9
4
5
null
null
nyorem/skemmtun
src/MAL/Types/Manga.hs
mit
toMangaType 4 = Just Doujin
27
toMangaType 4 = Just Doujin
27
toMangaType 4 = Just Doujin
27
false
false
0
5
4
12
5
7
null
null
artems/blockbattle
src/Util.hs
mit
splitBy :: Char -> String -> [String] splitBy delimiter = foldr f [[]] where f c l@(x : xs) | c == delimiter = [] : l | otherwise = (c : x) : xs
167
splitBy :: Char -> String -> [String] splitBy delimiter = foldr f [[]] where f c l@(x : xs) | c == delimiter = [] : l | otherwise = (c : x) : xs
167
splitBy delimiter = foldr f [[]] where f c l@(x : xs) | c == delimiter = [] : l | otherwise = (c : x) : xs
129
false
true
0
8
57
94
47
47
null
null
ice1000/OI-codes
codewars/101-200/algebraic-isomorphism.hs
agpl-3.0
-- isomorphism is transitive trans :: ISO a b -> ISO b c -> ISO a c trans (ab, ba) (bc, cb) = (bc . ab, ba . cb)
112
trans :: ISO a b -> ISO b c -> ISO a c trans (ab, ba) (bc, cb) = (bc . ab, ba . cb)
83
trans (ab, ba) (bc, cb) = (bc . ab, ba . cb)
44
true
true
0
9
28
71
36
35
null
null
isomorphism/csound-expression
src/Csound/IO.hs
bsd-3-clause
-- | Render Csound file and save it to the give file. writeCsd :: RenderCsd a => String -> a -> IO () writeCsd file a = writeFile file =<< renderCsd a
150
writeCsd :: RenderCsd a => String -> a -> IO () writeCsd file a = writeFile file =<< renderCsd a
96
writeCsd file a = writeFile file =<< renderCsd a
48
true
true
0
9
31
47
22
25
null
null
alphaHeavy/hako
Text/Hako/Parsing.hs
bsd-3-clause
haskellText :: ParsecT String () Q String haskellText = do parts <- many1 haskellPart return $ concat parts
115
haskellText :: ParsecT String () Q String haskellText = do parts <- many1 haskellPart return $ concat parts
115
haskellText = do parts <- many1 haskellPart return $ concat parts
73
false
true
0
8
25
42
19
23
null
null
haskell-lang/haskell-lang
src/HL/View/Home.hs
bsd-3-clause
community :: (Route App -> Text) -> View App () community url = div_ [id_ "community-wrapper"] (do div_ [class_ "community", background url img_community_jpg] (do container_ [id_ "tagline"] (row_ (span8_ [class_ "col-md-8"] (do h1_ "An open source community effort for over 20 years" p_ [class_ "learn-more"] (a_ [href_ (url CommunityR)] "Learn more"))))))
544
community :: (Route App -> Text) -> View App () community url = div_ [id_ "community-wrapper"] (do div_ [class_ "community", background url img_community_jpg] (do container_ [id_ "tagline"] (row_ (span8_ [class_ "col-md-8"] (do h1_ "An open source community effort for over 20 years" p_ [class_ "learn-more"] (a_ [href_ (url CommunityR)] "Learn more"))))))
544
community url = div_ [id_ "community-wrapper"] (do div_ [class_ "community", background url img_community_jpg] (do container_ [id_ "tagline"] (row_ (span8_ [class_ "col-md-8"] (do h1_ "An open source community effort for over 20 years" p_ [class_ "learn-more"] (a_ [href_ (url CommunityR)] "Learn more"))))))
496
false
true
0
27
238
151
72
79
null
null
steveshogren/haskell-katas
src/PokerHands.hs
bsd-3-clause
sameFace :: Card -> Card -> Bool sameFace (Card f1 _) (Card f2 _) = f1 == f2
76
sameFace :: Card -> Card -> Bool sameFace (Card f1 _) (Card f2 _) = f1 == f2
76
sameFace (Card f1 _) (Card f2 _) = f1 == f2
43
false
true
0
10
17
50
23
27
null
null
mapinguari/SC_HS_Proxy
src/Proxy/Query/Unit.hs
mit
mineralsCost ProtossRoboticsFacility = 200
42
mineralsCost ProtossRoboticsFacility = 200
42
mineralsCost ProtossRoboticsFacility = 200
42
false
false
0
5
3
9
4
5
null
null
robbertkrebbers/fewdigits
Data/Multinomial.hs
bsd-2-clause
polyMult (a:x) y = polyPlus (map (a*) y) (0:(polyMult x y))
59
polyMult (a:x) y = polyPlus (map (a*) y) (0:(polyMult x y))
59
polyMult (a:x) y = polyPlus (map (a*) y) (0:(polyMult x y))
59
false
false
1
9
10
54
26
28
null
null
technogeeky/d-A
include/containers-0.5.0.0/Data/IntMap/Base.hs
gpl-3.0
-- | /O(1)/. A map of one element. -- -- > singleton 1 'a' == fromList [(1, 'a')] -- > size (singleton 1 'a') == 1 singleton :: Key -> a -> IntMap a singleton k x = Tip k x
182
singleton :: Key -> a -> IntMap a singleton k x = Tip k x
59
singleton k x = Tip k x
25
true
true
0
7
50
36
19
17
null
null
ice1000/OI-codes
codewars/authoring/haskell/TimesComm.hs
agpl-3.0
plusComm sa@(NumS a) sb@(NumS b) = EqlS ((plusComm a sb) <=> (EqlS $ plusComm b a) <=> plusComm sa b)
101
plusComm sa@(NumS a) sb@(NumS b) = EqlS ((plusComm a sb) <=> (EqlS $ plusComm b a) <=> plusComm sa b)
101
plusComm sa@(NumS a) sb@(NumS b) = EqlS ((plusComm a sb) <=> (EqlS $ plusComm b a) <=> plusComm sa b)
101
false
false
1
11
19
77
34
43
null
null
marcellussiegburg/autotool
yesod/Application.hs
gpl-2.0
makeApplication :: AppConfig DefaultEnv Extra -> IO (Application, LogFunc) makeApplication conf = do foundation <- makeFoundation conf logWare <- mkRequestLogger def { outputFormat = if development then Detailed True else Apache FromSocket , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } app <- toWaiAppPlain foundation let logFunc = messageLoggerSource foundation (appLogger foundation) return (logWare $ defaultMiddlewaresNoLogging app, logFunc)
563
makeApplication :: AppConfig DefaultEnv Extra -> IO (Application, LogFunc) makeApplication conf = do foundation <- makeFoundation conf logWare <- mkRequestLogger def { outputFormat = if development then Detailed True else Apache FromSocket , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } app <- toWaiAppPlain foundation let logFunc = messageLoggerSource foundation (appLogger foundation) return (logWare $ defaultMiddlewaresNoLogging app, logFunc)
563
makeApplication conf = do foundation <- makeFoundation conf logWare <- mkRequestLogger def { outputFormat = if development then Detailed True else Apache FromSocket , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } app <- toWaiAppPlain foundation let logFunc = messageLoggerSource foundation (appLogger foundation) return (logWare $ defaultMiddlewaresNoLogging app, logFunc)
488
false
true
0
13
148
142
68
74
null
null
oqc/oqs
Settings.hs
gpl-3.0
-- The rest of this file contains settings which rarely need changing by a -- user. widgetFile :: String -> Q Exp widgetFile = (if development then widgetFileReload else widgetFileNoReload) widgetFileSettings
252
widgetFile :: String -> Q Exp widgetFile = (if development then widgetFileReload else widgetFileNoReload) widgetFileSettings
167
widgetFile = (if development then widgetFileReload else widgetFileNoReload) widgetFileSettings
137
true
true
0
7
74
34
19
15
null
null
krausest/js-framework-benchmark
frameworks/keyed/miso/src/Main.hs
apache-2.0
initialModel :: StdGen -> Model initialModel seed = Model { rows = mempty , selectedId = Nothing , lastId = 0 , seed = seed }
135
initialModel :: StdGen -> Model initialModel seed = Model { rows = mempty , selectedId = Nothing , lastId = 0 , seed = seed }
135
initialModel seed = Model { rows = mempty , selectedId = Nothing , lastId = 0 , seed = seed }
103
false
true
0
7
35
48
27
21
null
null
themoritz/cabal
Cabal/Distribution/Simple/GHC/Internal.hs
bsd-3-clause
-- | GHC's rendering of it's host or target 'OS' as used in its platform -- strings and certain file locations (such as user package db location). -- ghcOsString :: OS -> String ghcOsString Windows = "mingw32"
209
ghcOsString :: OS -> String ghcOsString Windows = "mingw32"
59
ghcOsString Windows = "mingw32"
31
true
true
0
7
36
27
13
14
null
null
spechub/Hets
HasCASL/Sublogic.hs
gpl-2.0
sl_symbOrMap :: SymbOrMap -> Sublogic sl_symbOrMap m = case m of SymbOrMap s Nothing _ -> sl_symb s SymbOrMap s (Just t) _ -> sublogic_max (sl_symb s) $ sl_symb t {- the maps have no influence since all sorts,ops,preds in them must also appear in the signatures, so any features needed by them will be included by just checking the signatures -}
360
sl_symbOrMap :: SymbOrMap -> Sublogic sl_symbOrMap m = case m of SymbOrMap s Nothing _ -> sl_symb s SymbOrMap s (Just t) _ -> sublogic_max (sl_symb s) $ sl_symb t {- the maps have no influence since all sorts,ops,preds in them must also appear in the signatures, so any features needed by them will be included by just checking the signatures -}
360
sl_symbOrMap m = case m of SymbOrMap s Nothing _ -> sl_symb s SymbOrMap s (Just t) _ -> sublogic_max (sl_symb s) $ sl_symb t {- the maps have no influence since all sorts,ops,preds in them must also appear in the signatures, so any features needed by them will be included by just checking the signatures -}
322
false
true
0
11
76
79
36
43
null
null
AndreasVoellmy/openflow
src/Network/Data/OF13/Message.hs
bsd-3-clause
getOXMs :: Int -> Get [OXM] getOXMs len | len == 0 = return [] | len > 0 = do (oxmlen,oxm) <- getOXM oxms <- getOXMs (len - oxmlen) return $ oxm:oxms | otherwise = error "Bad OXM length"
230
getOXMs :: Int -> Get [OXM] getOXMs len | len == 0 = return [] | len > 0 = do (oxmlen,oxm) <- getOXM oxms <- getOXMs (len - oxmlen) return $ oxm:oxms | otherwise = error "Bad OXM length"
230
getOXMs len | len == 0 = return [] | len > 0 = do (oxmlen,oxm) <- getOXM oxms <- getOXMs (len - oxmlen) return $ oxm:oxms | otherwise = error "Bad OXM length"
202
false
true
1
11
83
105
50
55
null
null
lukexi/ghc
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
iselExpr64 (CmmReg (CmmLocal (LocalReg vu ty))) | isWord64 ty = return (ChildCode64 nilOL (RegVirtual $ mkVirtualReg vu II32))
129
iselExpr64 (CmmReg (CmmLocal (LocalReg vu ty))) | isWord64 ty = return (ChildCode64 nilOL (RegVirtual $ mkVirtualReg vu II32))
129
iselExpr64 (CmmReg (CmmLocal (LocalReg vu ty))) | isWord64 ty = return (ChildCode64 nilOL (RegVirtual $ mkVirtualReg vu II32))
129
false
false
0
10
20
62
28
34
null
null
jahaynes/crawler
src/Urls.hs
mit
normalize :: String -> String normalize = normalizeCase . normalizeEscape . normalizePathSegments
97
normalize :: String -> String normalize = normalizeCase . normalizeEscape . normalizePathSegments
97
normalize = normalizeCase . normalizeEscape . normalizePathSegments
67
false
true
0
6
11
23
12
11
null
null
skedgeme/wrecker
src/Wrecker/Logger.hs
bsd-3-clause
writeLogger :: Logger -> LogLevel -> String -> IO Bool writeLogger Logger {..} messageLevel msg = if (currentLevel <= messageLevel) then U.tryWriteChan inChan $ Just msg else return False
199
writeLogger :: Logger -> LogLevel -> String -> IO Bool writeLogger Logger {..} messageLevel msg = if (currentLevel <= messageLevel) then U.tryWriteChan inChan $ Just msg else return False
199
writeLogger Logger {..} messageLevel msg = if (currentLevel <= messageLevel) then U.tryWriteChan inChan $ Just msg else return False
144
false
true
0
8
40
69
34
35
null
null
przembot/osm-conduit
test/Spec.hs
bsd-3-clause
main :: IO () main = hspec $ do describe "parser success" $ do it "parse node with tags" $ do parsed <- runTest testCase01 conduitOSM parsed `shouldBe` [OSM 0.6 (Just "lulz generator") Nothing [Node 52.153 22.341 (NWRCommon "43221" (Just True) Nothing Nothing Nothing [Tag ("shop", "alcohol"), Tag ("area", "safe")])] [] []] it "parse way" $ do parsed <- runTest testCase03 conduitOSM parsed `shouldBe` [OSM 0.6 (Just "lulz generator") Nothing [] [Way [Nd "1234", Nd "2345", Nd "3456"] (NWRCommon "1995" (Just True) Nothing Nothing Nothing [Tag ("rodzaj drogi", "do ukochanej")]) ] [] ] it "parse relation" $ do parsed <- runTest testCase04 conduitOSM parsed `shouldBe` [OSM 0.6 (Just "lulz generator") Nothing [] [] [Relation [Member NWRn "1234" Nothing] (NWRCommon "4747" (Just True) Nothing Nothing Nothing [Tag ("testk", "testv")])]] describe "parser throws error" $ do it "should throw when reading a double value fails" $ do runTest testCase02 conduitOSM `shouldThrow` errorCall "Could not parse attribute value" describe "reading from file" $ do it "should be able to read using sourceFileOSM" $ do parsed <- runResourceT $ sourceFileOSM "test/readingTest.xml" $$ CL.consume parsed `shouldBe` [OSM 0.6 Nothing Nothing [Node 12.34 34.56 (NWRCommon "1111" Nothing Nothing Nothing Nothing [])] [] []] describe "parsing ommiting osm tag" $ do it "parse nwr at once" $ do parsed <- runTest testCase05 conduitNWR parsed `shouldMatchList` [ N (Node 52.153 22.341 (NWRCommon "43221" (Just True) Nothing Nothing Nothing [])), W (Way [Nd "12"] (NWRCommon "1337" (Just True) Nothing Nothing Nothing [])), R (Relation [Member NWRn "1234" Nothing] (NWRCommon "4747" (Just True) Nothing Nothing Nothing [Tag ("testk", "testv")])) ] it "parse nodes using conduitNodes" $ do parsed <- runTest testCase01 conduitNodes parsed `shouldBe` [Node 52.153 22.341 (NWRCommon "43221" (Just True) Nothing Nothing Nothing [Tag ("shop", "alcohol"), Tag ("area", "safe")])] it "parse ways using conduitWays" $ do parsed <- runTest testCase03 conduitWays parsed `shouldBe` [Way [Nd "1234", Nd "2345", Nd "3456"] (NWRCommon "1995" (Just True) Nothing Nothing Nothing [Tag ("rodzaj drogi", "do ukochanej")])] it "parse relations using conduitRelations" $ do parsed <- runTest testCase04 conduitRelations parsed `shouldBe` [Relation [Member NWRn "1234" Nothing] (NWRCommon "4747" (Just True) Nothing Nothing Nothing [Tag ("testk", "testv")])] it "parse items from many osm tags" $ do parsed <- runTest testCase06 conduitNWR parsed `shouldMatchList` [ N (Node 52 20 (NWRCommon "21" (Just True) Nothing Nothing Nothing [])), N (Node 52.153 22.341 (NWRCommon "43221" (Just True) Nothing Nothing Nothing [])) ]
2,905
main :: IO () main = hspec $ do describe "parser success" $ do it "parse node with tags" $ do parsed <- runTest testCase01 conduitOSM parsed `shouldBe` [OSM 0.6 (Just "lulz generator") Nothing [Node 52.153 22.341 (NWRCommon "43221" (Just True) Nothing Nothing Nothing [Tag ("shop", "alcohol"), Tag ("area", "safe")])] [] []] it "parse way" $ do parsed <- runTest testCase03 conduitOSM parsed `shouldBe` [OSM 0.6 (Just "lulz generator") Nothing [] [Way [Nd "1234", Nd "2345", Nd "3456"] (NWRCommon "1995" (Just True) Nothing Nothing Nothing [Tag ("rodzaj drogi", "do ukochanej")]) ] [] ] it "parse relation" $ do parsed <- runTest testCase04 conduitOSM parsed `shouldBe` [OSM 0.6 (Just "lulz generator") Nothing [] [] [Relation [Member NWRn "1234" Nothing] (NWRCommon "4747" (Just True) Nothing Nothing Nothing [Tag ("testk", "testv")])]] describe "parser throws error" $ do it "should throw when reading a double value fails" $ do runTest testCase02 conduitOSM `shouldThrow` errorCall "Could not parse attribute value" describe "reading from file" $ do it "should be able to read using sourceFileOSM" $ do parsed <- runResourceT $ sourceFileOSM "test/readingTest.xml" $$ CL.consume parsed `shouldBe` [OSM 0.6 Nothing Nothing [Node 12.34 34.56 (NWRCommon "1111" Nothing Nothing Nothing Nothing [])] [] []] describe "parsing ommiting osm tag" $ do it "parse nwr at once" $ do parsed <- runTest testCase05 conduitNWR parsed `shouldMatchList` [ N (Node 52.153 22.341 (NWRCommon "43221" (Just True) Nothing Nothing Nothing [])), W (Way [Nd "12"] (NWRCommon "1337" (Just True) Nothing Nothing Nothing [])), R (Relation [Member NWRn "1234" Nothing] (NWRCommon "4747" (Just True) Nothing Nothing Nothing [Tag ("testk", "testv")])) ] it "parse nodes using conduitNodes" $ do parsed <- runTest testCase01 conduitNodes parsed `shouldBe` [Node 52.153 22.341 (NWRCommon "43221" (Just True) Nothing Nothing Nothing [Tag ("shop", "alcohol"), Tag ("area", "safe")])] it "parse ways using conduitWays" $ do parsed <- runTest testCase03 conduitWays parsed `shouldBe` [Way [Nd "1234", Nd "2345", Nd "3456"] (NWRCommon "1995" (Just True) Nothing Nothing Nothing [Tag ("rodzaj drogi", "do ukochanej")])] it "parse relations using conduitRelations" $ do parsed <- runTest testCase04 conduitRelations parsed `shouldBe` [Relation [Member NWRn "1234" Nothing] (NWRCommon "4747" (Just True) Nothing Nothing Nothing [Tag ("testk", "testv")])] it "parse items from many osm tags" $ do parsed <- runTest testCase06 conduitNWR parsed `shouldMatchList` [ N (Node 52 20 (NWRCommon "21" (Just True) Nothing Nothing Nothing [])), N (Node 52.153 22.341 (NWRCommon "43221" (Just True) Nothing Nothing Nothing [])) ]
2,905
main = hspec $ do describe "parser success" $ do it "parse node with tags" $ do parsed <- runTest testCase01 conduitOSM parsed `shouldBe` [OSM 0.6 (Just "lulz generator") Nothing [Node 52.153 22.341 (NWRCommon "43221" (Just True) Nothing Nothing Nothing [Tag ("shop", "alcohol"), Tag ("area", "safe")])] [] []] it "parse way" $ do parsed <- runTest testCase03 conduitOSM parsed `shouldBe` [OSM 0.6 (Just "lulz generator") Nothing [] [Way [Nd "1234", Nd "2345", Nd "3456"] (NWRCommon "1995" (Just True) Nothing Nothing Nothing [Tag ("rodzaj drogi", "do ukochanej")]) ] [] ] it "parse relation" $ do parsed <- runTest testCase04 conduitOSM parsed `shouldBe` [OSM 0.6 (Just "lulz generator") Nothing [] [] [Relation [Member NWRn "1234" Nothing] (NWRCommon "4747" (Just True) Nothing Nothing Nothing [Tag ("testk", "testv")])]] describe "parser throws error" $ do it "should throw when reading a double value fails" $ do runTest testCase02 conduitOSM `shouldThrow` errorCall "Could not parse attribute value" describe "reading from file" $ do it "should be able to read using sourceFileOSM" $ do parsed <- runResourceT $ sourceFileOSM "test/readingTest.xml" $$ CL.consume parsed `shouldBe` [OSM 0.6 Nothing Nothing [Node 12.34 34.56 (NWRCommon "1111" Nothing Nothing Nothing Nothing [])] [] []] describe "parsing ommiting osm tag" $ do it "parse nwr at once" $ do parsed <- runTest testCase05 conduitNWR parsed `shouldMatchList` [ N (Node 52.153 22.341 (NWRCommon "43221" (Just True) Nothing Nothing Nothing [])), W (Way [Nd "12"] (NWRCommon "1337" (Just True) Nothing Nothing Nothing [])), R (Relation [Member NWRn "1234" Nothing] (NWRCommon "4747" (Just True) Nothing Nothing Nothing [Tag ("testk", "testv")])) ] it "parse nodes using conduitNodes" $ do parsed <- runTest testCase01 conduitNodes parsed `shouldBe` [Node 52.153 22.341 (NWRCommon "43221" (Just True) Nothing Nothing Nothing [Tag ("shop", "alcohol"), Tag ("area", "safe")])] it "parse ways using conduitWays" $ do parsed <- runTest testCase03 conduitWays parsed `shouldBe` [Way [Nd "1234", Nd "2345", Nd "3456"] (NWRCommon "1995" (Just True) Nothing Nothing Nothing [Tag ("rodzaj drogi", "do ukochanej")])] it "parse relations using conduitRelations" $ do parsed <- runTest testCase04 conduitRelations parsed `shouldBe` [Relation [Member NWRn "1234" Nothing] (NWRCommon "4747" (Just True) Nothing Nothing Nothing [Tag ("testk", "testv")])] it "parse items from many osm tags" $ do parsed <- runTest testCase06 conduitNWR parsed `shouldMatchList` [ N (Node 52 20 (NWRCommon "21" (Just True) Nothing Nothing Nothing [])), N (Node 52.153 22.341 (NWRCommon "43221" (Just True) Nothing Nothing Nothing [])) ]
2,891
false
true
0
25
619
1,059
519
540
null
null
wowofbob/gol
src/Grid.hs
bsd-3-clause
-- Sets cell on grid. setCell :: C.Cell -> Pos -> Grid -> Grid setCell c (y, x) g = M.setElem c (y + 1, x + 1) g
112
setCell :: C.Cell -> Pos -> Grid -> Grid setCell c (y, x) g = M.setElem c (y + 1, x + 1) g
90
setCell c (y, x) g = M.setElem c (y + 1, x + 1) g
49
true
true
0
10
28
69
34
35
null
null
uuhan/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LSExt (ITFixed from) ITNative) [x] = v ++ "MKINT((i_int)((" ++ signedTy from ++ ")" ++ creg x ++ "->info.bits" ++ show (nativeTyWidth from) ++ "))"
159
doOp v (LSExt (ITFixed from) ITNative) [x] = v ++ "MKINT((i_int)((" ++ signedTy from ++ ")" ++ creg x ++ "->info.bits" ++ show (nativeTyWidth from) ++ "))"
159
doOp v (LSExt (ITFixed from) ITNative) [x] = v ++ "MKINT((i_int)((" ++ signedTy from ++ ")" ++ creg x ++ "->info.bits" ++ show (nativeTyWidth from) ++ "))"
159
false
false
3
11
30
80
35
45
null
null
keera-studios/hsQt
Qtc/Enums/Core/QUrl.hs
bsd-2-clause
eRemoveAuthority :: FormattingOption eRemoveAuthority = ieFormattingOption $ 30
81
eRemoveAuthority :: FormattingOption eRemoveAuthority = ieFormattingOption $ 30
81
eRemoveAuthority = ieFormattingOption $ 30
44
false
true
0
6
9
18
8
10
null
null
mcmaniac/ghc
compiler/utils/IOEnv.hs
bsd-3-clause
failM :: IOEnv env a failM = IOEnv (\ _ -> throwIO IOEnvFailure)
64
failM :: IOEnv env a failM = IOEnv (\ _ -> throwIO IOEnvFailure)
64
failM = IOEnv (\ _ -> throwIO IOEnvFailure)
43
false
true
0
8
12
30
15
15
null
null
ingemaradahl/bilder
src/Compiler/Dependencies.hs
lgpl-3.0
expDeps (ELt el _ er) = concatMap expDeps [el,er]
49
expDeps (ELt el _ er) = concatMap expDeps [el,er]
49
expDeps (ELt el _ er) = concatMap expDeps [el,er]
49
false
false
0
6
8
31
15
16
null
null
AlexeyRaga/eta
compiler/ETA/TypeCheck/TcType.hs
bsd-3-clause
orphNamesOfCo (NthCo _ co) = orphNamesOfCo co
54
orphNamesOfCo (NthCo _ co) = orphNamesOfCo co
54
orphNamesOfCo (NthCo _ co) = orphNamesOfCo co
54
false
false
0
6
15
21
9
12
null
null
AlbinTheander/oden
src/Oden/Explode.hs
mit
explodeExpr' (Subscript si es (i:ir)) = explodeExpr' (Subscript si (Subscript si es [i]) ir)
94
explodeExpr' (Subscript si es (i:ir)) = explodeExpr' (Subscript si (Subscript si es [i]) ir)
94
explodeExpr' (Subscript si es (i:ir)) = explodeExpr' (Subscript si (Subscript si es [i]) ir)
94
false
false
0
10
15
52
26
26
null
null
CarstenKoenig/AdventOfCode2016
Day4/Parser.hs
mit
parseAlpha :: Parser Char parseAlpha = parseChar isAlpha
56
parseAlpha :: Parser Char parseAlpha = parseChar isAlpha
56
parseAlpha = parseChar isAlpha
30
false
true
0
5
7
17
8
9
null
null
xmonad/xmonad-contrib
XMonad/Hooks/ToggleHook.hs
bsd-3-clause
_get :: String -> ((Bool, Bool) -> a) -> X a _get n f = XS.gets $ f . (findWithDefault (False, False) n . hooks)
112
_get :: String -> ((Bool, Bool) -> a) -> X a _get n f = XS.gets $ f . (findWithDefault (False, False) n . hooks)
112
_get n f = XS.gets $ f . (findWithDefault (False, False) n . hooks)
67
false
true
0
9
24
68
36
32
null
null
jabaraster/MetShop
Utility.hs
bsd-3-clause
parseAndApplyMongoDBUrl conf (Just url) = let tokens = splitOneOf ":@/" url -- 本当はNetwork.URI.parseURIでパースした方が安全なのだが、細かい文字列処理が増えて面倒なので、ここではsplitOneOfを使う. user = pack (tokens !! 3) password = pack (tokens !! 4) host = pack (tokens !! 5) port = PortNumber $ fromIntegral (read (tokens !! 6) :: Int) database = pack (tokens !! 7) in conf { mgDatabase = database , mgHost = host , mgPort = port , mgAuth = Just $ MongoAuth user password }
548
parseAndApplyMongoDBUrl conf (Just url) = let tokens = splitOneOf ":@/" url -- 本当はNetwork.URI.parseURIでパースした方が安全なのだが、細かい文字列処理が増えて面倒なので、ここではsplitOneOfを使う. user = pack (tokens !! 3) password = pack (tokens !! 4) host = pack (tokens !! 5) port = PortNumber $ fromIntegral (read (tokens !! 6) :: Int) database = pack (tokens !! 7) in conf { mgDatabase = database , mgHost = host , mgPort = port , mgAuth = Just $ MongoAuth user password }
548
parseAndApplyMongoDBUrl conf (Just url) = let tokens = splitOneOf ":@/" url -- 本当はNetwork.URI.parseURIでパースした方が安全なのだが、細かい文字列処理が増えて面倒なので、ここではsplitOneOfを使う. user = pack (tokens !! 3) password = pack (tokens !! 4) host = pack (tokens !! 5) port = PortNumber $ fromIntegral (read (tokens !! 6) :: Int) database = pack (tokens !! 7) in conf { mgDatabase = database , mgHost = host , mgPort = port , mgAuth = Just $ MongoAuth user password }
548
false
false
0
14
184
157
84
73
null
null
ndmitchell/qed
src/Proof/Util.hs
bsd-3-clause
rnf3 a b c = rnf a `seq` rnf b `seq` rnf c
42
rnf3 a b c = rnf a `seq` rnf b `seq` rnf c
42
rnf3 a b c = rnf a `seq` rnf b `seq` rnf c
42
false
false
0
7
12
34
17
17
null
null
anttisalonen/cgen
src/CppUtils.hs
bsd-3-clause
isType "enum" = False
24
isType "enum" = False
24
isType "enum" = False
24
false
false
0
5
6
9
4
5
null
null