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
tyler-sommer/stormy-pond
app/Main.hs
mit
writeIndex :: Pond -> FilePath -> IO () writeIndex pond base = do let name = (base ++ "/" ++ "index.json") let tmpName = (name ++ ".tmp") writeFile tmpName (LS.unpack (encode pond)) catchIOError (removeFile name) (\_ -> return $ ()) renameFile tmpName name
266
writeIndex :: Pond -> FilePath -> IO () writeIndex pond base = do let name = (base ++ "/" ++ "index.json") let tmpName = (name ++ ".tmp") writeFile tmpName (LS.unpack (encode pond)) catchIOError (removeFile name) (\_ -> return $ ()) renameFile tmpName name
266
writeIndex pond base = do let name = (base ++ "/" ++ "index.json") let tmpName = (name ++ ".tmp") writeFile tmpName (LS.unpack (encode pond)) catchIOError (removeFile name) (\_ -> return $ ()) renameFile tmpName name
226
false
true
0
12
52
123
59
64
null
null
klarh/hasdy
src/Hasdy/Prop/Bundle.hs
apache-2.0
giveSP::(Elt b, Arrays c)=>Bundle a (Acc (c, A.Scalar b))->Bundle (a, SingleProp b) (Acc c) giveSP (Bundle a v) = Bundle (a, SingleProp (A.snd v)) (A.fst v)
156
giveSP::(Elt b, Arrays c)=>Bundle a (Acc (c, A.Scalar b))->Bundle (a, SingleProp b) (Acc c) giveSP (Bundle a v) = Bundle (a, SingleProp (A.snd v)) (A.fst v)
156
giveSP (Bundle a v) = Bundle (a, SingleProp (A.snd v)) (A.fst v)
64
false
true
0
12
25
118
58
60
null
null
rglew/lyah
person.hs
mit
flavor :: Person -> String flavor (Person _ _ _ _ _ flavor) = flavor
70
flavor :: Person -> String flavor (Person _ _ _ _ _ flavor) = flavor
68
flavor (Person _ _ _ _ _ flavor) = flavor
41
false
true
0
7
16
34
17
17
null
null
pbl64k/HackerRank-Contests
2014-06-20-FP/BoleynSalary/bs.tree.hs
bsd-2-clause
intersects (x1, x2) (y1, y2) = (x1 <= y1 && y1 <= x2) || (x1 <= y2 && y2 <= x2) || (y1 <= x1 && x1 <= y2)
105
intersects (x1, x2) (y1, y2) = (x1 <= y1 && y1 <= x2) || (x1 <= y2 && y2 <= x2) || (y1 <= x1 && x1 <= y2)
105
intersects (x1, x2) (y1, y2) = (x1 <= y1 && y1 <= x2) || (x1 <= y2 && y2 <= x2) || (y1 <= x1 && x1 <= y2)
105
false
false
0
10
28
76
41
35
null
null
nushio3/unittyped
src/UnitTyped/SI/Derived.hs
lgpl-2.1
-- |One volt. volt :: (Fractional f) => Value ElectricPotential (U Volt) f volt = one
85
volt :: (Fractional f) => Value ElectricPotential (U Volt) f volt = one
71
volt = one
10
true
true
0
9
15
40
19
21
null
null
grnet/snf-ganeti
src/Ganeti/Compat.hs
bsd-2-clause
finiteBitSize :: (Data.Bits.Bits a) => a -> Int finiteBitSize = Data.Bits.bitSize
81
finiteBitSize :: (Data.Bits.Bits a) => a -> Int finiteBitSize = Data.Bits.bitSize
81
finiteBitSize = Data.Bits.bitSize
33
false
true
0
7
10
30
17
13
null
null
jvranish/TheExperiment
src/Control/Monad/GraphT.hs
bsd-3-clause
readRef :: (Monad m) => GraphRef f -> GraphT f m (f (GraphRef f)) readRef (GraphRef ref) = GraphT $ ContextT.readRef ref
120
readRef :: (Monad m) => GraphRef f -> GraphT f m (f (GraphRef f)) readRef (GraphRef ref) = GraphT $ ContextT.readRef ref
120
readRef (GraphRef ref) = GraphT $ ContextT.readRef ref
54
false
true
0
11
21
64
31
33
null
null
phischu/fragnix
tests/packages/scotty/System.Log.FastLogger.File.hs
bsd-3-clause
-- | Checking if a log file can be written. check :: FilePath -> IO () check file = do dirExist <- doesDirectoryExist dir unless dirExist $ fail $ dir ++ " does not exist or is not a directory." dirPerm <- getPermissions dir unless (writable dirPerm) $ fail $ dir ++ " is not writable." exist <- doesFileExist file when exist $ do perm <- getPermissions file unless (writable perm) $ fail $ file ++ " is not writable." where dir = takeDirectory file -- | Rotating log files.
521
check :: FilePath -> IO () check file = do dirExist <- doesDirectoryExist dir unless dirExist $ fail $ dir ++ " does not exist or is not a directory." dirPerm <- getPermissions dir unless (writable dirPerm) $ fail $ dir ++ " is not writable." exist <- doesFileExist file when exist $ do perm <- getPermissions file unless (writable perm) $ fail $ file ++ " is not writable." where dir = takeDirectory file -- | Rotating log files.
477
check file = do dirExist <- doesDirectoryExist dir unless dirExist $ fail $ dir ++ " does not exist or is not a directory." dirPerm <- getPermissions dir unless (writable dirPerm) $ fail $ dir ++ " is not writable." exist <- doesFileExist file when exist $ do perm <- getPermissions file unless (writable perm) $ fail $ file ++ " is not writable." where dir = takeDirectory file -- | Rotating log files.
450
true
true
1
15
136
159
69
90
null
null
MadSciGuys/trebuchet
src/Treb/Demo.hs
mit
insDataBlock :: DataBlockMap -> DataBlock -> IO DataBlockMap insDataBlock dbm db = do dbm' <- takeMVar dbm dbl <- newMVar db putMVar dbm (M.insert (dbName db) dbl dbm') return dbm
195
insDataBlock :: DataBlockMap -> DataBlock -> IO DataBlockMap insDataBlock dbm db = do dbm' <- takeMVar dbm dbl <- newMVar db putMVar dbm (M.insert (dbName db) dbl dbm') return dbm
195
insDataBlock dbm db = do dbm' <- takeMVar dbm dbl <- newMVar db putMVar dbm (M.insert (dbName db) dbl dbm') return dbm
134
false
true
0
11
45
79
35
44
null
null
denumerate/raven
src/Raven/Data/Table.hs
bsd-3-clause
-- |takes a list of title and filters out the associated columns. -- Does return an error if a title is missing. -- O(mn) where n is the number of columns and m is the number ttls looked forces. -- Consistently slower than Indices version dropColsByTitle' :: Table a -> [Text] -> Either (Table a) Error dropColsByTitle' t@(Table ttls _) ttls' = let inds = V.toList $ V.findIndices (`elem` ttls') ttls in if length ttls' == length inds then Left $ dropColsByIndex t inds else Right titleNotFoundError
514
dropColsByTitle' :: Table a -> [Text] -> Either (Table a) Error dropColsByTitle' t@(Table ttls _) ttls' = let inds = V.toList $ V.findIndices (`elem` ttls') ttls in if length ttls' == length inds then Left $ dropColsByIndex t inds else Right titleNotFoundError
275
dropColsByTitle' t@(Table ttls _) ttls' = let inds = V.toList $ V.findIndices (`elem` ttls') ttls in if length ttls' == length inds then Left $ dropColsByIndex t inds else Right titleNotFoundError
211
true
true
0
11
101
116
60
56
null
null
adnelson/nix-eval
tests/Nix/Spec/EvaluatorSpec.hs
mit
attrSetSpec :: Spec attrSetSpec = describe "attribute sets" $ do describe "non-recursive" $ do it "should evaluate attr set literals" $ do let mySet = attrsE [("x", 1)] mySet `shouldEvalTo` attrsV [("x", intV 1)] it "should access set members" $ do let mySet = attrsE [("x", 1)] mySet !. "x" `shouldEvalTo` intV 1 it "should access nested set members" $ do let mySet = attrsE [("x", (attrsE [("y", 1)]))] mySet !. "x" !. "y" `shouldEvalTo` intV 1 it "should not have a problem with error members unless accessed" $ do -- Create an attribute set in which one of the members causes an -- error when evaluated. let mySet = attrsE [("good", mkStr "hello"), ("bad", "undefined-variable")] mySet !. "good" `shouldEvalTo` strV "hello" mySet !. "bad" `shouldErrorWith` ["NameError", "undefined-variable"] it "should throw a KeyError if key doesn't exist" $ do attrsE [] !. "x" `shouldErrorWith` ["KeyError", "x"] describe "recursive" $ do it "should evaluate attr set literals" $ do let mySet = recAttrsE [("x", 1)] shouldEvalToWithEnv emptyE mySet $ attrsV [("x", intV 1)] it "should access set members" $ do let mySet = recAttrsE [("x", 1)] mySet !. "x" `shouldEvalTo` intV 1 it "should access nested set members" $ do -- This value is -- rec {x = {y = x; z = 2};} -- So accessing mySet.x.y.z should give 2. let mySet = recAttrsE [("x", attrsE [("y", "x"), ("z", 2)])] mySet !. "x" !. "y" !. "z" `shouldEvalTo` intV 2 it "should allow inter-references in the set" $ do let mySet = recAttrsE [("x", 1), ("y", "x")] mySet !. "y" `shouldEvalTo` intV 1 it "should detect infinite loops" $ do let infiniteSet = recAttrsE [("x", "y"), ("y", "x")] pendingWith "we're not detecting these yet" infiniteSet !. "y" `shouldErrorWith` ["InfiniteRecursion"]
2,006
attrSetSpec :: Spec attrSetSpec = describe "attribute sets" $ do describe "non-recursive" $ do it "should evaluate attr set literals" $ do let mySet = attrsE [("x", 1)] mySet `shouldEvalTo` attrsV [("x", intV 1)] it "should access set members" $ do let mySet = attrsE [("x", 1)] mySet !. "x" `shouldEvalTo` intV 1 it "should access nested set members" $ do let mySet = attrsE [("x", (attrsE [("y", 1)]))] mySet !. "x" !. "y" `shouldEvalTo` intV 1 it "should not have a problem with error members unless accessed" $ do -- Create an attribute set in which one of the members causes an -- error when evaluated. let mySet = attrsE [("good", mkStr "hello"), ("bad", "undefined-variable")] mySet !. "good" `shouldEvalTo` strV "hello" mySet !. "bad" `shouldErrorWith` ["NameError", "undefined-variable"] it "should throw a KeyError if key doesn't exist" $ do attrsE [] !. "x" `shouldErrorWith` ["KeyError", "x"] describe "recursive" $ do it "should evaluate attr set literals" $ do let mySet = recAttrsE [("x", 1)] shouldEvalToWithEnv emptyE mySet $ attrsV [("x", intV 1)] it "should access set members" $ do let mySet = recAttrsE [("x", 1)] mySet !. "x" `shouldEvalTo` intV 1 it "should access nested set members" $ do -- This value is -- rec {x = {y = x; z = 2};} -- So accessing mySet.x.y.z should give 2. let mySet = recAttrsE [("x", attrsE [("y", "x"), ("z", 2)])] mySet !. "x" !. "y" !. "z" `shouldEvalTo` intV 2 it "should allow inter-references in the set" $ do let mySet = recAttrsE [("x", 1), ("y", "x")] mySet !. "y" `shouldEvalTo` intV 1 it "should detect infinite loops" $ do let infiniteSet = recAttrsE [("x", "y"), ("y", "x")] pendingWith "we're not detecting these yet" infiniteSet !. "y" `shouldErrorWith` ["InfiniteRecursion"]
2,006
attrSetSpec = describe "attribute sets" $ do describe "non-recursive" $ do it "should evaluate attr set literals" $ do let mySet = attrsE [("x", 1)] mySet `shouldEvalTo` attrsV [("x", intV 1)] it "should access set members" $ do let mySet = attrsE [("x", 1)] mySet !. "x" `shouldEvalTo` intV 1 it "should access nested set members" $ do let mySet = attrsE [("x", (attrsE [("y", 1)]))] mySet !. "x" !. "y" `shouldEvalTo` intV 1 it "should not have a problem with error members unless accessed" $ do -- Create an attribute set in which one of the members causes an -- error when evaluated. let mySet = attrsE [("good", mkStr "hello"), ("bad", "undefined-variable")] mySet !. "good" `shouldEvalTo` strV "hello" mySet !. "bad" `shouldErrorWith` ["NameError", "undefined-variable"] it "should throw a KeyError if key doesn't exist" $ do attrsE [] !. "x" `shouldErrorWith` ["KeyError", "x"] describe "recursive" $ do it "should evaluate attr set literals" $ do let mySet = recAttrsE [("x", 1)] shouldEvalToWithEnv emptyE mySet $ attrsV [("x", intV 1)] it "should access set members" $ do let mySet = recAttrsE [("x", 1)] mySet !. "x" `shouldEvalTo` intV 1 it "should access nested set members" $ do -- This value is -- rec {x = {y = x; z = 2};} -- So accessing mySet.x.y.z should give 2. let mySet = recAttrsE [("x", attrsE [("y", "x"), ("z", 2)])] mySet !. "x" !. "y" !. "z" `shouldEvalTo` intV 2 it "should allow inter-references in the set" $ do let mySet = recAttrsE [("x", 1), ("y", "x")] mySet !. "y" `shouldEvalTo` intV 1 it "should detect infinite loops" $ do let infiniteSet = recAttrsE [("x", "y"), ("y", "x")] pendingWith "we're not detecting these yet" infiniteSet !. "y" `shouldErrorWith` ["InfiniteRecursion"]
1,986
false
true
0
23
557
629
318
311
null
null
prokls/edmonds-branching-algorithm
haskell/edmonds.hs
cc0-1.0
minWeightEdge es = minimumBy (comparing weight) es
50
minWeightEdge es = minimumBy (comparing weight) es
50
minWeightEdge es = minimumBy (comparing weight) es
50
false
false
0
7
6
20
9
11
null
null
flipstone/orville
orville-postgresql-libpq/src/Orville/PostgreSQL/Internal/Expr/Where/BooleanExpr.hs
mit
orExpr :: BooleanExpr -> BooleanExpr -> BooleanExpr orExpr left right = BooleanExpr $ RawSql.toRawSql left <> RawSql.fromString " OR " <> RawSql.toRawSql right
177
orExpr :: BooleanExpr -> BooleanExpr -> BooleanExpr orExpr left right = BooleanExpr $ RawSql.toRawSql left <> RawSql.fromString " OR " <> RawSql.toRawSql right
177
orExpr left right = BooleanExpr $ RawSql.toRawSql left <> RawSql.fromString " OR " <> RawSql.toRawSql right
125
false
true
0
9
40
51
24
27
null
null
thoughtpolice/vacuum
src/GHC/Vacuum.hs
lgpl-3.0
getId' :: HValue -> H (HNodeId, Bool) getId' hval = do clos <- io (getClosure hval) let itab = closITab clos case itabType itab of t | isThunk t -> getId' =<< io (defined hval) | otherwise -> getId hval ------------------------------------------------ {- rts/StgMiscClosures.cmm /* ---------------------------------------------------------------------------- Arrays These come in two basic flavours: arrays of data (StgArrWords) and arrays of pointers (StgArrPtrs). They all have a similar layout: ___________________________ | Info | No. of | data.... | Ptr | Words | --------------------------- These are *unpointed* objects: i.e. they cannot be entered. ------------------------------------------------------------------------- */ INFO_TABLE(stg_ARR_WORDS, 0, 0, ARR_WORDS, "ARR_WORDS", "ARR_WORDS") { foreign "C" barf("ARR_WORDS object entered!") never returns; } INFO_TABLE(stg_MUT_ARR_PTRS_CLEAN, 0, 0, MUT_ARR_PTRS_CLEAN, "MUT_ARR_PTRS_CLEAN", "MUT_ARR_PTRS_CLEAN") { foreign "C" barf("MUT_ARR_PTRS_CLEAN object entered!") never returns; } INFO_TABLE(stg_MUT_ARR_PTRS_DIRTY, 0, 0, MUT_ARR_PTRS_DIRTY, "MUT_ARR_PTRS_DIRTY", "MUT_ARR_PTRS_DIRTY") { foreign "C" barf("MUT_ARR_PTRS_DIRTY object entered!") never returns; } INFO_TABLE(stg_MUT_ARR_PTRS_FROZEN, 0, 0, MUT_ARR_PTRS_FROZEN, "MUT_ARR_PTRS_FROZEN", "MUT_ARR_PTRS_FROZEN") { foreign "C" barf("MUT_ARR_PTRS_FROZEN object entered!") never returns; } INFO_TABLE(stg_MUT_ARR_PTRS_FROZEN0, 0, 0, MUT_ARR_PTRS_FROZEN0, "MUT_ARR_PTRS_FROZEN0", "MUT_ARR_PTRS_FROZEN0") { foreign "C" barf("MUT_ARR_PTRS_FROZEN0 object entered!") never returns; } -} {- unpackClosurezh_fast { /* args: R1 = closure to analyze */ // TODO: Consider the absence of ptrs or nonptrs as a special case ? W_ info, ptrs, nptrs, p, ptrs_arr, nptrs_arr; info = %GET_STD_INFO(UNTAG(R1)); // Some closures have non-standard layout, so we omit those here. W_ type; type = TO_W_(%INFO_TYPE(info)); switch [0 .. N_CLOSURE_TYPES] type { case THUNK_SELECTOR : { ptrs = 1; nptrs = 0; goto out; } case THUNK, THUNK_1_0, THUNK_0_1, THUNK_2_0, THUNK_1_1, THUNK_0_2, THUNK_STATIC, AP, PAP, AP_STACK, BCO : { ptrs = 0; nptrs = 0; goto out; } default: { ptrs = TO_W_(%INFO_PTRS(info)); nptrs = TO_W_(%INFO_NPTRS(info)); goto out; }} out: W_ ptrs_arr_sz, nptrs_arr_sz; nptrs_arr_sz = SIZEOF_StgArrWords + WDS(nptrs); ptrs_arr_sz = SIZEOF_StgMutArrPtrs + WDS(ptrs); ALLOC_PRIM (ptrs_arr_sz + nptrs_arr_sz, R1_PTR, unpackClosurezh_fast); W_ clos; clos = UNTAG(R1); ptrs_arr = Hp - nptrs_arr_sz - ptrs_arr_sz + WDS(1); nptrs_arr = Hp - nptrs_arr_sz + WDS(1); SET_HDR(ptrs_arr, stg_MUT_ARR_PTRS_FROZEN_info, W_[CCCS]); StgMutArrPtrs_ptrs(ptrs_arr) = ptrs; p = 0; for: if(p < ptrs) { W_[ptrs_arr + SIZEOF_StgMutArrPtrs + WDS(p)] = StgClosure_payload(clos,p); p = p + 1; goto for; } SET_HDR(nptrs_arr, stg_ARR_WORDS_info, W_[CCCS]); StgArrWords_words(nptrs_arr) = nptrs; p = 0; for2: if(p < nptrs) { W_[BYTE_ARR_CTS(nptrs_arr) + WDS(p)] = StgClosure_payload(clos, p+ptrs); p = p + 1; goto for2; } RET_NPP(info, ptrs_arr, nptrs_arr); } -}
3,342
getId' :: HValue -> H (HNodeId, Bool) getId' hval = do clos <- io (getClosure hval) let itab = closITab clos case itabType itab of t | isThunk t -> getId' =<< io (defined hval) | otherwise -> getId hval ------------------------------------------------ {- rts/StgMiscClosures.cmm /* ---------------------------------------------------------------------------- Arrays These come in two basic flavours: arrays of data (StgArrWords) and arrays of pointers (StgArrPtrs). They all have a similar layout: ___________________________ | Info | No. of | data.... | Ptr | Words | --------------------------- These are *unpointed* objects: i.e. they cannot be entered. ------------------------------------------------------------------------- */ INFO_TABLE(stg_ARR_WORDS, 0, 0, ARR_WORDS, "ARR_WORDS", "ARR_WORDS") { foreign "C" barf("ARR_WORDS object entered!") never returns; } INFO_TABLE(stg_MUT_ARR_PTRS_CLEAN, 0, 0, MUT_ARR_PTRS_CLEAN, "MUT_ARR_PTRS_CLEAN", "MUT_ARR_PTRS_CLEAN") { foreign "C" barf("MUT_ARR_PTRS_CLEAN object entered!") never returns; } INFO_TABLE(stg_MUT_ARR_PTRS_DIRTY, 0, 0, MUT_ARR_PTRS_DIRTY, "MUT_ARR_PTRS_DIRTY", "MUT_ARR_PTRS_DIRTY") { foreign "C" barf("MUT_ARR_PTRS_DIRTY object entered!") never returns; } INFO_TABLE(stg_MUT_ARR_PTRS_FROZEN, 0, 0, MUT_ARR_PTRS_FROZEN, "MUT_ARR_PTRS_FROZEN", "MUT_ARR_PTRS_FROZEN") { foreign "C" barf("MUT_ARR_PTRS_FROZEN object entered!") never returns; } INFO_TABLE(stg_MUT_ARR_PTRS_FROZEN0, 0, 0, MUT_ARR_PTRS_FROZEN0, "MUT_ARR_PTRS_FROZEN0", "MUT_ARR_PTRS_FROZEN0") { foreign "C" barf("MUT_ARR_PTRS_FROZEN0 object entered!") never returns; } -} {- unpackClosurezh_fast { /* args: R1 = closure to analyze */ // TODO: Consider the absence of ptrs or nonptrs as a special case ? W_ info, ptrs, nptrs, p, ptrs_arr, nptrs_arr; info = %GET_STD_INFO(UNTAG(R1)); // Some closures have non-standard layout, so we omit those here. W_ type; type = TO_W_(%INFO_TYPE(info)); switch [0 .. N_CLOSURE_TYPES] type { case THUNK_SELECTOR : { ptrs = 1; nptrs = 0; goto out; } case THUNK, THUNK_1_0, THUNK_0_1, THUNK_2_0, THUNK_1_1, THUNK_0_2, THUNK_STATIC, AP, PAP, AP_STACK, BCO : { ptrs = 0; nptrs = 0; goto out; } default: { ptrs = TO_W_(%INFO_PTRS(info)); nptrs = TO_W_(%INFO_NPTRS(info)); goto out; }} out: W_ ptrs_arr_sz, nptrs_arr_sz; nptrs_arr_sz = SIZEOF_StgArrWords + WDS(nptrs); ptrs_arr_sz = SIZEOF_StgMutArrPtrs + WDS(ptrs); ALLOC_PRIM (ptrs_arr_sz + nptrs_arr_sz, R1_PTR, unpackClosurezh_fast); W_ clos; clos = UNTAG(R1); ptrs_arr = Hp - nptrs_arr_sz - ptrs_arr_sz + WDS(1); nptrs_arr = Hp - nptrs_arr_sz + WDS(1); SET_HDR(ptrs_arr, stg_MUT_ARR_PTRS_FROZEN_info, W_[CCCS]); StgMutArrPtrs_ptrs(ptrs_arr) = ptrs; p = 0; for: if(p < ptrs) { W_[ptrs_arr + SIZEOF_StgMutArrPtrs + WDS(p)] = StgClosure_payload(clos,p); p = p + 1; goto for; } SET_HDR(nptrs_arr, stg_ARR_WORDS_info, W_[CCCS]); StgArrWords_words(nptrs_arr) = nptrs; p = 0; for2: if(p < nptrs) { W_[BYTE_ARR_CTS(nptrs_arr) + WDS(p)] = StgClosure_payload(clos, p+ptrs); p = p + 1; goto for2; } RET_NPP(info, ptrs_arr, nptrs_arr); } -}
3,342
getId' hval = do clos <- io (getClosure hval) let itab = closITab clos case itabType itab of t | isThunk t -> getId' =<< io (defined hval) | otherwise -> getId hval ------------------------------------------------ {- rts/StgMiscClosures.cmm /* ---------------------------------------------------------------------------- Arrays These come in two basic flavours: arrays of data (StgArrWords) and arrays of pointers (StgArrPtrs). They all have a similar layout: ___________________________ | Info | No. of | data.... | Ptr | Words | --------------------------- These are *unpointed* objects: i.e. they cannot be entered. ------------------------------------------------------------------------- */ INFO_TABLE(stg_ARR_WORDS, 0, 0, ARR_WORDS, "ARR_WORDS", "ARR_WORDS") { foreign "C" barf("ARR_WORDS object entered!") never returns; } INFO_TABLE(stg_MUT_ARR_PTRS_CLEAN, 0, 0, MUT_ARR_PTRS_CLEAN, "MUT_ARR_PTRS_CLEAN", "MUT_ARR_PTRS_CLEAN") { foreign "C" barf("MUT_ARR_PTRS_CLEAN object entered!") never returns; } INFO_TABLE(stg_MUT_ARR_PTRS_DIRTY, 0, 0, MUT_ARR_PTRS_DIRTY, "MUT_ARR_PTRS_DIRTY", "MUT_ARR_PTRS_DIRTY") { foreign "C" barf("MUT_ARR_PTRS_DIRTY object entered!") never returns; } INFO_TABLE(stg_MUT_ARR_PTRS_FROZEN, 0, 0, MUT_ARR_PTRS_FROZEN, "MUT_ARR_PTRS_FROZEN", "MUT_ARR_PTRS_FROZEN") { foreign "C" barf("MUT_ARR_PTRS_FROZEN object entered!") never returns; } INFO_TABLE(stg_MUT_ARR_PTRS_FROZEN0, 0, 0, MUT_ARR_PTRS_FROZEN0, "MUT_ARR_PTRS_FROZEN0", "MUT_ARR_PTRS_FROZEN0") { foreign "C" barf("MUT_ARR_PTRS_FROZEN0 object entered!") never returns; } -} {- unpackClosurezh_fast { /* args: R1 = closure to analyze */ // TODO: Consider the absence of ptrs or nonptrs as a special case ? W_ info, ptrs, nptrs, p, ptrs_arr, nptrs_arr; info = %GET_STD_INFO(UNTAG(R1)); // Some closures have non-standard layout, so we omit those here. W_ type; type = TO_W_(%INFO_TYPE(info)); switch [0 .. N_CLOSURE_TYPES] type { case THUNK_SELECTOR : { ptrs = 1; nptrs = 0; goto out; } case THUNK, THUNK_1_0, THUNK_0_1, THUNK_2_0, THUNK_1_1, THUNK_0_2, THUNK_STATIC, AP, PAP, AP_STACK, BCO : { ptrs = 0; nptrs = 0; goto out; } default: { ptrs = TO_W_(%INFO_PTRS(info)); nptrs = TO_W_(%INFO_NPTRS(info)); goto out; }} out: W_ ptrs_arr_sz, nptrs_arr_sz; nptrs_arr_sz = SIZEOF_StgArrWords + WDS(nptrs); ptrs_arr_sz = SIZEOF_StgMutArrPtrs + WDS(ptrs); ALLOC_PRIM (ptrs_arr_sz + nptrs_arr_sz, R1_PTR, unpackClosurezh_fast); W_ clos; clos = UNTAG(R1); ptrs_arr = Hp - nptrs_arr_sz - ptrs_arr_sz + WDS(1); nptrs_arr = Hp - nptrs_arr_sz + WDS(1); SET_HDR(ptrs_arr, stg_MUT_ARR_PTRS_FROZEN_info, W_[CCCS]); StgMutArrPtrs_ptrs(ptrs_arr) = ptrs; p = 0; for: if(p < ptrs) { W_[ptrs_arr + SIZEOF_StgMutArrPtrs + WDS(p)] = StgClosure_payload(clos,p); p = p + 1; goto for; } SET_HDR(nptrs_arr, stg_ARR_WORDS_info, W_[CCCS]); StgArrWords_words(nptrs_arr) = nptrs; p = 0; for2: if(p < nptrs) { W_[BYTE_ARR_CTS(nptrs_arr) + WDS(p)] = StgClosure_payload(clos, p+ptrs); p = p + 1; goto for2; } RET_NPP(info, ptrs_arr, nptrs_arr); } -}
3,304
false
true
0
14
675
108
50
58
null
null
thoughtpolice/cabal
Cabal/Distribution/Simple/GHC.hs
bsd-3-clause
hcPkgInfo :: ProgramConfiguration -> HcPkg.HcPkgInfo hcPkgInfo conf = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = ghcPkgProg , HcPkg.noPkgDbStack = v < [6,9] , HcPkg.noVerboseFlag = v < [6,11] , HcPkg.flagPackageConf = v < [7,5] , HcPkg.useSingleFileDb = v < [7,9] } where v = versionBranch ver Just ghcPkgProg = lookupProgram ghcPkgProgram conf Just ver = programVersion ghcPkgProg
585
hcPkgInfo :: ProgramConfiguration -> HcPkg.HcPkgInfo hcPkgInfo conf = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = ghcPkgProg , HcPkg.noPkgDbStack = v < [6,9] , HcPkg.noVerboseFlag = v < [6,11] , HcPkg.flagPackageConf = v < [7,5] , HcPkg.useSingleFileDb = v < [7,9] } where v = versionBranch ver Just ghcPkgProg = lookupProgram ghcPkgProgram conf Just ver = programVersion ghcPkgProg
585
hcPkgInfo conf = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = ghcPkgProg , HcPkg.noPkgDbStack = v < [6,9] , HcPkg.noVerboseFlag = v < [6,11] , HcPkg.flagPackageConf = v < [7,5] , HcPkg.useSingleFileDb = v < [7,9] } where v = versionBranch ver Just ghcPkgProg = lookupProgram ghcPkgProgram conf Just ver = programVersion ghcPkgProg
532
false
true
2
8
261
137
77
60
null
null
andrewMacmurray/haskell-book-solutions
src/ch30/StoppingTheParty.hs
mit
main :: IO () main = forever $ do let tryS :: IO () -> IO (Either SomeException ()) tryS = try x <- tryS randomException putStrLn "Live to loop another day" threadDelay 1000000
190
main :: IO () main = forever $ do let tryS :: IO () -> IO (Either SomeException ()) tryS = try x <- tryS randomException putStrLn "Live to loop another day" threadDelay 1000000
190
main = forever $ do let tryS :: IO () -> IO (Either SomeException ()) tryS = try x <- tryS randomException putStrLn "Live to loop another day" threadDelay 1000000
176
false
true
0
15
47
78
35
43
null
null
noteed/tcc
Language/TCC.hs
bsd-3-clause
getSymbol :: TCCState -> String -> IO (Maybe CULong) getSymbol s name = do (addr,ret) <- withCString name (\str -> withAlloca (\addr -> c_get_symbol s addr str)) if ret == 0 then return (Just addr) else return Nothing
239
getSymbol :: TCCState -> String -> IO (Maybe CULong) getSymbol s name = do (addr,ret) <- withCString name (\str -> withAlloca (\addr -> c_get_symbol s addr str)) if ret == 0 then return (Just addr) else return Nothing
239
getSymbol s name = do (addr,ret) <- withCString name (\str -> withAlloca (\addr -> c_get_symbol s addr str)) if ret == 0 then return (Just addr) else return Nothing
186
false
true
0
14
59
104
52
52
null
null
cyruscousins/HarmLang
src/HarmLang/InitialBasis.hs
mit
interpretNamedInterval "2nd" = Interval 2
41
interpretNamedInterval "2nd" = Interval 2
41
interpretNamedInterval "2nd" = Interval 2
41
false
false
0
5
4
12
5
7
null
null
MarcelineVQ/advent2016
src/Day8.hs
bsd-3-clause
ppPixel :: Pixel -> String ppPixel Hash = "#"
45
ppPixel :: Pixel -> String ppPixel Hash = "#"
45
ppPixel Hash = "#"
18
false
true
0
5
8
18
9
9
null
null
jcowgill/cs-work
syac/compilers/Prac3/2Simple.hs
gpl-3.0
-- Tests for valid prepositional calculus strings parser :: [Token] -> Bool parser xs = rFst && (null rSnd) where (rFst, rSnd) = parserP xs
151
parser :: [Token] -> Bool parser xs = rFst && (null rSnd) where (rFst, rSnd) = parserP xs
101
parser xs = rFst && (null rSnd) where (rFst, rSnd) = parserP xs
75
true
true
2
7
36
56
27
29
null
null
diku-dk/futhark
src/Futhark/Compiler/Program.hs
isc
newImportMVar :: IO UncheckedImport -> IO (Maybe (MVar UncheckedImport)) newImportMVar m = do mvar <- newEmptyMVar void $ forkIO $ putMVar mvar =<< m pure $ Just mvar
172
newImportMVar :: IO UncheckedImport -> IO (Maybe (MVar UncheckedImport)) newImportMVar m = do mvar <- newEmptyMVar void $ forkIO $ putMVar mvar =<< m pure $ Just mvar
172
newImportMVar m = do mvar <- newEmptyMVar void $ forkIO $ putMVar mvar =<< m pure $ Just mvar
99
false
true
0
10
33
71
32
39
null
null
gcampax/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
tcSplitPredFunTy_maybe _ = Nothing
36
tcSplitPredFunTy_maybe _ = Nothing
36
tcSplitPredFunTy_maybe _ = Nothing
36
false
false
0
5
5
9
4
5
null
null
brendanhay/gogol
gogol-debugger/gen/Network/Google/Debugger/Types/Product.hs
mpl-2.0
-- | The full project name within the host. Projects may be nested, so -- \"project\/subproject\" is a valid project name. The \"repo name\" is -- hostURI\/project. gscGerritProject :: Lens' GerritSourceContext (Maybe Text) gscGerritProject = lens _gscGerritProject (\ s a -> s{_gscGerritProject = a})
309
gscGerritProject :: Lens' GerritSourceContext (Maybe Text) gscGerritProject = lens _gscGerritProject (\ s a -> s{_gscGerritProject = a})
144
gscGerritProject = lens _gscGerritProject (\ s a -> s{_gscGerritProject = a})
85
true
true
0
9
51
50
27
23
null
null
mboogerd/hello-haskell
src/lyah/OwnTypesClasses.hs
apache-2.0
singleton :: a -> Tree a singleton x = Node x EmptyTree EmptyTree
65
singleton :: a -> Tree a singleton x = Node x EmptyTree EmptyTree
65
singleton x = Node x EmptyTree EmptyTree
40
false
true
0
6
12
28
13
15
null
null
paradoxix/haskellplayground
src/Lib.hs
bsd-3-clause
selectBankObjectById :: Int64 -> PGT.PGTransactionT IO (Maybe B.BankObject) selectBankObjectById boId = do res <- PGT.query (Only boId) "SELECT id, name, created, updated FROM bankobjects WHERE id=?" :: PGT.PGTransactionT IO [B.BankObject] case res of [] -> return $ Nothing (x : _) -> do tl <- selectAllTagsForBankObjectId (B.bankObjectId x) return $ Just x { B.bankObjectTags = tl }
408
selectBankObjectById :: Int64 -> PGT.PGTransactionT IO (Maybe B.BankObject) selectBankObjectById boId = do res <- PGT.query (Only boId) "SELECT id, name, created, updated FROM bankobjects WHERE id=?" :: PGT.PGTransactionT IO [B.BankObject] case res of [] -> return $ Nothing (x : _) -> do tl <- selectAllTagsForBankObjectId (B.bankObjectId x) return $ Just x { B.bankObjectTags = tl }
408
selectBankObjectById boId = do res <- PGT.query (Only boId) "SELECT id, name, created, updated FROM bankobjects WHERE id=?" :: PGT.PGTransactionT IO [B.BankObject] case res of [] -> return $ Nothing (x : _) -> do tl <- selectAllTagsForBankObjectId (B.bankObjectId x) return $ Just x { B.bankObjectTags = tl }
332
false
true
1
19
80
140
67
73
null
null
ssaavedra/liquidhaskell
benchmarks/containers-0.5.0.0/Data/Map/Base1.hs
bsd-3-clause
-- | /O(log n)/. Delete and find the minimal element. -- -- > deleteFindMin (fromList [(5,"a"), (3,"b"), (10,"c")]) == ((3,"b"), fromList[(5,"a"), (10,"c")]) -- > deleteFindMin Error: can not return the minimal element of an empty map deleteFindMin :: Map k a -> ((k,a),Map k a) deleteFindMin t = case t of Bin _ k x Tip r -> ((k,x),r) Bin _ k x l r -> let (km,l') = deleteFindMin l in (km,balanceR k x l' r) Tip -> (error "Map.deleteFindMin: can not return the minimal element of an empty map", Tip) -- | /O(log n)/. Delete and find the maximal element. -- -- > deleteFindMax (fromList [(5,"a"), (3,"b"), (10,"c")]) == ((10,"c"), fromList [(3,"b"), (5,"a")]) -- > deleteFindMax empty Error: can not return the maximal element of an empty map
858
deleteFindMin :: Map k a -> ((k,a),Map k a) deleteFindMin t = case t of Bin _ k x Tip r -> ((k,x),r) Bin _ k x l r -> let (km,l') = deleteFindMin l in (km,balanceR k x l' r) Tip -> (error "Map.deleteFindMin: can not return the minimal element of an empty map", Tip) -- | /O(log n)/. Delete and find the maximal element. -- -- > deleteFindMax (fromList [(5,"a"), (3,"b"), (10,"c")]) == ((10,"c"), fromList [(3,"b"), (5,"a")]) -- > deleteFindMax empty Error: can not return the maximal element of an empty map
579
deleteFindMin t = case t of Bin _ k x Tip r -> ((k,x),r) Bin _ k x l r -> let (km,l') = deleteFindMin l in (km,balanceR k x l' r) Tip -> (error "Map.deleteFindMin: can not return the minimal element of an empty map", Tip) -- | /O(log n)/. Delete and find the maximal element. -- -- > deleteFindMax (fromList [(5,"a"), (3,"b"), (10,"c")]) == ((10,"c"), fromList [(3,"b"), (5,"a")]) -- > deleteFindMax empty Error: can not return the maximal element of an empty map
535
true
true
0
12
245
149
81
68
null
null
fmapfmapfmap/amazonka
amazonka-opsworks/test/Test/AWS/Gen/OpsWorks.hs
mpl-2.0
testDeleteAppResponse :: DeleteAppResponse -> TestTree testDeleteAppResponse = res "DeleteAppResponse" "fixture/DeleteAppResponse.proto" opsWorks (Proxy :: Proxy DeleteApp)
188
testDeleteAppResponse :: DeleteAppResponse -> TestTree testDeleteAppResponse = res "DeleteAppResponse" "fixture/DeleteAppResponse.proto" opsWorks (Proxy :: Proxy DeleteApp)
188
testDeleteAppResponse = res "DeleteAppResponse" "fixture/DeleteAppResponse.proto" opsWorks (Proxy :: Proxy DeleteApp)
133
false
true
0
6
30
36
17
19
null
null
nevrenato/HetsAlloy
Common/Lib/SizedList.hs
gpl-2.0
toList :: SizedList a -> [a] toList (N _ xs) = xs
49
toList :: SizedList a -> [a] toList (N _ xs) = xs
49
toList (N _ xs) = xs
20
false
true
0
7
11
32
16
16
null
null
kfish/hogg
tools/hogg.hs
bsd-3-clause
mergePages :: Hot () mergePages = do matchPages <- pages -- XXX: only use the first chain of each input file. Using subsequent -- chains won't work anyway unless corresponding chains in each file are -- of identical duration. let firstChainPages = map head matchPages outputL $ L.concat $ map pageWrite $ merge firstChainPages ------------------------------------------------------------ -- sortPages (sort) --
435
mergePages :: Hot () mergePages = do matchPages <- pages -- XXX: only use the first chain of each input file. Using subsequent -- chains won't work anyway unless corresponding chains in each file are -- of identical duration. let firstChainPages = map head matchPages outputL $ L.concat $ map pageWrite $ merge firstChainPages ------------------------------------------------------------ -- sortPages (sort) --
435
mergePages = do matchPages <- pages -- XXX: only use the first chain of each input file. Using subsequent -- chains won't work anyway unless corresponding chains in each file are -- of identical duration. let firstChainPages = map head matchPages outputL $ L.concat $ map pageWrite $ merge firstChainPages ------------------------------------------------------------ -- sortPages (sort) --
414
false
true
0
11
83
72
34
38
null
null
green-haskell/ghc
compiler/llvmGen/Llvm/Types.hs
bsd-3-clause
isFloat LMFloat80 = True
25
isFloat LMFloat80 = True
25
isFloat LMFloat80 = True
25
false
false
0
5
4
9
4
5
null
null
massudaw/mtk
Solver/RungeKutta.hs
bsd-3-clause
show_rkv65_aux = rk_show1 "Verner (5)" cs_v65 as_v65 bs_v65_aux
63
show_rkv65_aux = rk_show1 "Verner (5)" cs_v65 as_v65 bs_v65_aux
63
show_rkv65_aux = rk_show1 "Verner (5)" cs_v65 as_v65 bs_v65_aux
63
false
false
0
5
7
15
7
8
null
null
greatest-ape/hs-bt-tracker
src/Web/BitTorrent/Tracker/Utils.hs
gpl-3.0
getTimestamp :: IO Timestamp getTimestamp = Timestamp . round <$> getPOSIXTime
78
getTimestamp :: IO Timestamp getTimestamp = Timestamp . round <$> getPOSIXTime
78
getTimestamp = Timestamp . round <$> getPOSIXTime
49
false
true
3
6
10
30
12
18
null
null
wtsi-hgi/hgc-tools
Hgc/Cvmfs.hs
bsd-3-clause
publish :: String -> IO () publish repo = safeSystem "cvmfs_server" ["publish", repo] >>= \ex -> case ex of ExitSuccess -> return () ExitFailure r -> ioError . userError $ "Cannot publish repo (exit code " ++ show r ++ ")." -- | Abort a transaction on a CVMFS repository.
284
publish :: String -> IO () publish repo = safeSystem "cvmfs_server" ["publish", repo] >>= \ex -> case ex of ExitSuccess -> return () ExitFailure r -> ioError . userError $ "Cannot publish repo (exit code " ++ show r ++ ")." -- | Abort a transaction on a CVMFS repository.
282
publish repo = safeSystem "cvmfs_server" ["publish", repo] >>= \ex -> case ex of ExitSuccess -> return () ExitFailure r -> ioError . userError $ "Cannot publish repo (exit code " ++ show r ++ ")." -- | Abort a transaction on a CVMFS repository.
255
false
true
0
13
62
87
43
44
null
null
adinapoli/api-tools
src/Data/API/Changes.hs
bsd-3-clause
-- just apply each of the individual changes in sequence to the whole dataset applyChangeToDatabase :: TypeName -> CustomMigrationsTagged -> JS.Value -> APITableChange -> Either (ValueError, Position) JS.Value applyChangeToDatabase root custom v (APIChange c upds) = updateTypeAt upds (applyChangeToData c custom) (UpdateNamed root) v []
386
applyChangeToDatabase :: TypeName -> CustomMigrationsTagged -> JS.Value -> APITableChange -> Either (ValueError, Position) JS.Value applyChangeToDatabase root custom v (APIChange c upds) = updateTypeAt upds (applyChangeToData c custom) (UpdateNamed root) v []
307
applyChangeToDatabase root custom v (APIChange c upds) = updateTypeAt upds (applyChangeToData c custom) (UpdateNamed root) v []
131
true
true
0
12
93
93
45
48
null
null
bennofs/cabal2nix
src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs
bsd-3-clause
libNixName "sctp" = return "lksctp-tools"
71
libNixName "sctp" = return "lksctp-tools"
71
libNixName "sctp" = return "lksctp-tools"
71
false
false
0
5
34
13
5
8
null
null
plclub/cis670-16fa
projects/DynamicLang/src/DataDynamic.hs
mit
showDynTypeRep :: Dynamic -> String showDynTypeRep (Dyn ra (x :: a)) = show ra
78
showDynTypeRep :: Dynamic -> String showDynTypeRep (Dyn ra (x :: a)) = show ra
78
showDynTypeRep (Dyn ra (x :: a)) = show ra
42
false
true
0
9
13
36
18
18
null
null
michalkonecny/aern
aern-interval/src/Numeric/AERN/RealArithmetic/Interval/FieldOps.hs
bsd-3-clause
multiplyIntervals :: HasZero t => (t1 -> (Maybe Bool, Maybe Bool)) -> ((t1, t1) -> (Maybe Bool, Maybe Bool)) -> (t2 -> (Maybe Bool, Maybe Bool)) -> ((t2, t2) -> (Maybe Bool, Maybe Bool)) -> (t1 -> t2 -> t) -> (t1 -> t2 -> t) -> (t -> t -> t) -> (t -> t -> t) -> (t -> t -> t) -> (t -> t -> t) -> (t -> t -> t) -> (t -> t -> t) -> (t1, t1) -> (t2, t2) -> (t, t) multiplyIntervals pNonnegNonpos1 pConsistency1 pNonnegNonpos2 pConsistency2 timesL timesR minL minR maxL maxR combineL combineR (l1, r1) (l2, r2) -------------------------------------------------------------- -- Cases where either i1 or i2 is shown to be positive/negative -------------------------------------------------------------- -------- i1 negative: -- i1 negative, i2 positive | i1Nonpos && i2Nonneg = (l1 `timesL` r2, r1 `timesR` l2) -- i1 negative, i2 negative | i1Nonpos && i2Nonpos = (r1 `timesL` r2, l1 `timesR` l2) -- i1 negative, i2 consistent and containing zero | i1Nonpos && i2ContZero = (l1 `timesL` r2, l1 `timesR` l2) -- i1 negative, i2 anti-consistent and anti-containing zero | i1Nonpos && i2AntiContZero = (r1 `timesL` r2, r1 `timesR` l2) -- i1 negative, nothing known about i2: | i1Nonpos = -- this could be any combination of the four cases above: ((r1 `timesL` r2) `combineL` (l1 `timesL` r2), (r1 `timesR` l2) `combineR` (l1 `timesR` l2)) -------- i1 positive: -- i1 positive, i2 positive | i1Nonneg && i2Nonneg = (l1 `timesL` l2, r1 `timesR` r2) -- i1 positive, i2 negative | i1Nonneg && i2Nonpos = (r1 `timesL` l2, l1 `timesR` r2) -- i1 positive, i2 consistent and containing zero | i1Nonneg && i2ContZero = (r1 `timesL` l2, r1 `timesR` r2) -- i1 positive, i2 anti-consistent and anti-containing zero | i1Nonneg && i2AntiContZero = (l1 `timesL` l2, l1 `timesR` r2) -- i1 positive, nothing known about i2: | i1Nonneg = -- this could be any combination of the four cases above: ((r1 `timesL` l2) `combineL` (l1 `timesL` l2), (r1 `timesR` r2) `combineR` (l1 `timesR` r2)) -------- i2 positive: -- i1 consistent and containing zero, i2 positive | i1ContZero && i2Nonneg = (l1 `timesL` r2, r1 `timesR` r2) -- i1 anti-consistent and anti-containing zero, i2 positive | i1AntiContZero && i2Nonneg = (l1 `timesL` l2, r1 `timesR` l2) -- nothing known about i1, i2 positive | i2Nonneg = ((l1 `timesL` r2) `combineL` (l1 `timesL` l2), (r1 `timesR` r2) `combineR` (r1 `timesR` l2)) -------- i2 negative: -- i1 consistent and containing zero, i2 negative | i1ContZero && i2Nonpos = (r1 `timesL` l2, l1 `timesR` l2) -- i1 anti-consistent and anti-containing zero, i2 negative | i1AntiContZero && i2Nonpos = (r1 `timesL` r2, l1 `timesR` r2) -- nothing known about i1, i2 negative | i2Nonpos = ((r1 `timesL` r2) `combineL` (r1 `timesL` l2), (l1 `timesR` r2) `combineR` (l1 `timesR` l2)) ----------------------------------------------------------- -- cases where both i1 or i2 are around zero ----------------------------------------------------------- -- both consistent, at least one contains zero | (i1ContZero && i2Consistent) || (i2ContZero && i1Consistent) = ((l1 `timesL` r2) `minL` (r1 `timesL` l2), (l1 `timesR` l2) `maxR` (r1 `timesR` r2)) -- i1 consistent and containing zero, i2 anti-consistent and anti-containing zero | i1ContZero && i2AntiContZero = (z, z) -- i1 consistent and containing zero, i2 unknown | i1ContZero = (((l1 `timesL` r2) `combineL` (r1 `timesL` l2)) `combineL` z, ((l1 `timesR` l2) `combineR` (r1 `timesR` r2)) `combineR` z) -- i1 anti-consistent and anti-containing zero, i2 consistent and containing zero | i1AntiContZero && i2ContZero = (z, z) -- i1 anti-consistent and anti-containing zero, i2 anti-consistent and anti-containing zero | i1AntiContZero && i2AntiContZero = -- | (i1AntiContZero && i2Anticonsistent) || (i1Anticonsistent && i2AntiContZero) = -- TODO: is this correct? ((l1 `timesL` l2) `maxL` (r1 `timesL` r2), (l1 `timesR` r2) `minR` (r1 `timesR` l2)) -- i1 anti-consistent and anti-containing zero, i2 unknown | i1AntiContZero = ((l1 `timesL` l2) `combineL` (r1 `timesL` r2) `combineL` z, (l1 `timesR` r2) `combineR` (r1 `timesR` l2) `combineR` z) -- i1 unknown, i2 anti-consistent and anti-containing zero | i2AntiContZero = ((l1 `timesL` l2) `combineL` (r1 `timesL` r2) `combineL` z, (l1 `timesR` r2) `combineR` (r1 `timesR` l2) `combineR` z) -- i1 unknown, i2 consistent and containing zero | i2ContZero = ((l1 `timesL` r2) `combineL` (r1 `timesL` l2) `combineL` z, (l1 `timesR` l2) `combineR` (r1 `timesR` r2) `combineR` z) -- both i1 and i2 unknown | otherwise = (foldl1 combineL [l1 `timesL` r2, r1 `timesL` l2, l1 `timesL` l2, r1 `timesL` r2], foldl1 combineR [l1 `timesR` r2, r1 `timesR` l2, l1 `timesR` l2, r1 `timesR` r2]) where z = zero sampleT sampleT = l1 `timesL` l2 -- the 2 x 4 booleans that determine the 16 cases of the Kaucher multiplication table: i1Nonpos = l1Nonpos && r1Nonpos i1Nonneg = l1Nonneg && r1Nonneg i1ContZero = l1Nonpos && r1Nonneg i1AntiContZero = l1Nonneg && r1Nonpos i2Nonpos = l2Nonpos && r2Nonpos i2Nonneg = l2Nonneg && r2Nonneg i2ContZero = l2Nonpos && r2Nonneg i2AntiContZero = l2Nonneg && r2Nonpos [l1Nonneg, l1Nonpos, r1Nonneg, r1Nonpos, l2Nonneg, l2Nonpos, r2Nonneg, r2Nonpos] = map (== Just True) [l1MNonneg, l1MNonpos, r1MNonneg, r1MNonpos, l2MNonneg, l2MNonpos, r2MNonneg, r2MNonpos] (l1MNonneg, l1MNonpos) = pNonnegNonpos1 l1 (r1MNonneg, r1MNonpos) = pNonnegNonpos1 r1 (l2MNonneg, l2MNonpos) = pNonnegNonpos2 l2 (r2MNonneg, r2MNonpos) = pNonnegNonpos2 r2 -- consistency information can help when the above is not available: [i1Consistent, i1Anticonsistent, i2Consistent, i2Anticonsistent] = map (== Just True) [i1MConsistent, i1MAnticonsistent, i2MConsistent, i2MAnticonsistent] (i1MConsistent, i1MAnticonsistent) = pConsistency1 (l1, r1) (i2MConsistent, i2MAnticonsistent) = pConsistency2 (l2, r2)
7,569
multiplyIntervals :: HasZero t => (t1 -> (Maybe Bool, Maybe Bool)) -> ((t1, t1) -> (Maybe Bool, Maybe Bool)) -> (t2 -> (Maybe Bool, Maybe Bool)) -> ((t2, t2) -> (Maybe Bool, Maybe Bool)) -> (t1 -> t2 -> t) -> (t1 -> t2 -> t) -> (t -> t -> t) -> (t -> t -> t) -> (t -> t -> t) -> (t -> t -> t) -> (t -> t -> t) -> (t -> t -> t) -> (t1, t1) -> (t2, t2) -> (t, t) multiplyIntervals pNonnegNonpos1 pConsistency1 pNonnegNonpos2 pConsistency2 timesL timesR minL minR maxL maxR combineL combineR (l1, r1) (l2, r2) -------------------------------------------------------------- -- Cases where either i1 or i2 is shown to be positive/negative -------------------------------------------------------------- -------- i1 negative: -- i1 negative, i2 positive | i1Nonpos && i2Nonneg = (l1 `timesL` r2, r1 `timesR` l2) -- i1 negative, i2 negative | i1Nonpos && i2Nonpos = (r1 `timesL` r2, l1 `timesR` l2) -- i1 negative, i2 consistent and containing zero | i1Nonpos && i2ContZero = (l1 `timesL` r2, l1 `timesR` l2) -- i1 negative, i2 anti-consistent and anti-containing zero | i1Nonpos && i2AntiContZero = (r1 `timesL` r2, r1 `timesR` l2) -- i1 negative, nothing known about i2: | i1Nonpos = -- this could be any combination of the four cases above: ((r1 `timesL` r2) `combineL` (l1 `timesL` r2), (r1 `timesR` l2) `combineR` (l1 `timesR` l2)) -------- i1 positive: -- i1 positive, i2 positive | i1Nonneg && i2Nonneg = (l1 `timesL` l2, r1 `timesR` r2) -- i1 positive, i2 negative | i1Nonneg && i2Nonpos = (r1 `timesL` l2, l1 `timesR` r2) -- i1 positive, i2 consistent and containing zero | i1Nonneg && i2ContZero = (r1 `timesL` l2, r1 `timesR` r2) -- i1 positive, i2 anti-consistent and anti-containing zero | i1Nonneg && i2AntiContZero = (l1 `timesL` l2, l1 `timesR` r2) -- i1 positive, nothing known about i2: | i1Nonneg = -- this could be any combination of the four cases above: ((r1 `timesL` l2) `combineL` (l1 `timesL` l2), (r1 `timesR` r2) `combineR` (l1 `timesR` r2)) -------- i2 positive: -- i1 consistent and containing zero, i2 positive | i1ContZero && i2Nonneg = (l1 `timesL` r2, r1 `timesR` r2) -- i1 anti-consistent and anti-containing zero, i2 positive | i1AntiContZero && i2Nonneg = (l1 `timesL` l2, r1 `timesR` l2) -- nothing known about i1, i2 positive | i2Nonneg = ((l1 `timesL` r2) `combineL` (l1 `timesL` l2), (r1 `timesR` r2) `combineR` (r1 `timesR` l2)) -------- i2 negative: -- i1 consistent and containing zero, i2 negative | i1ContZero && i2Nonpos = (r1 `timesL` l2, l1 `timesR` l2) -- i1 anti-consistent and anti-containing zero, i2 negative | i1AntiContZero && i2Nonpos = (r1 `timesL` r2, l1 `timesR` r2) -- nothing known about i1, i2 negative | i2Nonpos = ((r1 `timesL` r2) `combineL` (r1 `timesL` l2), (l1 `timesR` r2) `combineR` (l1 `timesR` l2)) ----------------------------------------------------------- -- cases where both i1 or i2 are around zero ----------------------------------------------------------- -- both consistent, at least one contains zero | (i1ContZero && i2Consistent) || (i2ContZero && i1Consistent) = ((l1 `timesL` r2) `minL` (r1 `timesL` l2), (l1 `timesR` l2) `maxR` (r1 `timesR` r2)) -- i1 consistent and containing zero, i2 anti-consistent and anti-containing zero | i1ContZero && i2AntiContZero = (z, z) -- i1 consistent and containing zero, i2 unknown | i1ContZero = (((l1 `timesL` r2) `combineL` (r1 `timesL` l2)) `combineL` z, ((l1 `timesR` l2) `combineR` (r1 `timesR` r2)) `combineR` z) -- i1 anti-consistent and anti-containing zero, i2 consistent and containing zero | i1AntiContZero && i2ContZero = (z, z) -- i1 anti-consistent and anti-containing zero, i2 anti-consistent and anti-containing zero | i1AntiContZero && i2AntiContZero = -- | (i1AntiContZero && i2Anticonsistent) || (i1Anticonsistent && i2AntiContZero) = -- TODO: is this correct? ((l1 `timesL` l2) `maxL` (r1 `timesL` r2), (l1 `timesR` r2) `minR` (r1 `timesR` l2)) -- i1 anti-consistent and anti-containing zero, i2 unknown | i1AntiContZero = ((l1 `timesL` l2) `combineL` (r1 `timesL` r2) `combineL` z, (l1 `timesR` r2) `combineR` (r1 `timesR` l2) `combineR` z) -- i1 unknown, i2 anti-consistent and anti-containing zero | i2AntiContZero = ((l1 `timesL` l2) `combineL` (r1 `timesL` r2) `combineL` z, (l1 `timesR` r2) `combineR` (r1 `timesR` l2) `combineR` z) -- i1 unknown, i2 consistent and containing zero | i2ContZero = ((l1 `timesL` r2) `combineL` (r1 `timesL` l2) `combineL` z, (l1 `timesR` l2) `combineR` (r1 `timesR` r2) `combineR` z) -- both i1 and i2 unknown | otherwise = (foldl1 combineL [l1 `timesL` r2, r1 `timesL` l2, l1 `timesL` l2, r1 `timesL` r2], foldl1 combineR [l1 `timesR` r2, r1 `timesR` l2, l1 `timesR` l2, r1 `timesR` r2]) where z = zero sampleT sampleT = l1 `timesL` l2 -- the 2 x 4 booleans that determine the 16 cases of the Kaucher multiplication table: i1Nonpos = l1Nonpos && r1Nonpos i1Nonneg = l1Nonneg && r1Nonneg i1ContZero = l1Nonpos && r1Nonneg i1AntiContZero = l1Nonneg && r1Nonpos i2Nonpos = l2Nonpos && r2Nonpos i2Nonneg = l2Nonneg && r2Nonneg i2ContZero = l2Nonpos && r2Nonneg i2AntiContZero = l2Nonneg && r2Nonpos [l1Nonneg, l1Nonpos, r1Nonneg, r1Nonpos, l2Nonneg, l2Nonpos, r2Nonneg, r2Nonpos] = map (== Just True) [l1MNonneg, l1MNonpos, r1MNonneg, r1MNonpos, l2MNonneg, l2MNonpos, r2MNonneg, r2MNonpos] (l1MNonneg, l1MNonpos) = pNonnegNonpos1 l1 (r1MNonneg, r1MNonpos) = pNonnegNonpos1 r1 (l2MNonneg, l2MNonpos) = pNonnegNonpos2 l2 (r2MNonneg, r2MNonpos) = pNonnegNonpos2 r2 -- consistency information can help when the above is not available: [i1Consistent, i1Anticonsistent, i2Consistent, i2Anticonsistent] = map (== Just True) [i1MConsistent, i1MAnticonsistent, i2MConsistent, i2MAnticonsistent] (i1MConsistent, i1MAnticonsistent) = pConsistency1 (l1, r1) (i2MConsistent, i2MAnticonsistent) = pConsistency2 (l2, r2)
7,569
multiplyIntervals pNonnegNonpos1 pConsistency1 pNonnegNonpos2 pConsistency2 timesL timesR minL minR maxL maxR combineL combineR (l1, r1) (l2, r2) -------------------------------------------------------------- -- Cases where either i1 or i2 is shown to be positive/negative -------------------------------------------------------------- -------- i1 negative: -- i1 negative, i2 positive | i1Nonpos && i2Nonneg = (l1 `timesL` r2, r1 `timesR` l2) -- i1 negative, i2 negative | i1Nonpos && i2Nonpos = (r1 `timesL` r2, l1 `timesR` l2) -- i1 negative, i2 consistent and containing zero | i1Nonpos && i2ContZero = (l1 `timesL` r2, l1 `timesR` l2) -- i1 negative, i2 anti-consistent and anti-containing zero | i1Nonpos && i2AntiContZero = (r1 `timesL` r2, r1 `timesR` l2) -- i1 negative, nothing known about i2: | i1Nonpos = -- this could be any combination of the four cases above: ((r1 `timesL` r2) `combineL` (l1 `timesL` r2), (r1 `timesR` l2) `combineR` (l1 `timesR` l2)) -------- i1 positive: -- i1 positive, i2 positive | i1Nonneg && i2Nonneg = (l1 `timesL` l2, r1 `timesR` r2) -- i1 positive, i2 negative | i1Nonneg && i2Nonpos = (r1 `timesL` l2, l1 `timesR` r2) -- i1 positive, i2 consistent and containing zero | i1Nonneg && i2ContZero = (r1 `timesL` l2, r1 `timesR` r2) -- i1 positive, i2 anti-consistent and anti-containing zero | i1Nonneg && i2AntiContZero = (l1 `timesL` l2, l1 `timesR` r2) -- i1 positive, nothing known about i2: | i1Nonneg = -- this could be any combination of the four cases above: ((r1 `timesL` l2) `combineL` (l1 `timesL` l2), (r1 `timesR` r2) `combineR` (l1 `timesR` r2)) -------- i2 positive: -- i1 consistent and containing zero, i2 positive | i1ContZero && i2Nonneg = (l1 `timesL` r2, r1 `timesR` r2) -- i1 anti-consistent and anti-containing zero, i2 positive | i1AntiContZero && i2Nonneg = (l1 `timesL` l2, r1 `timesR` l2) -- nothing known about i1, i2 positive | i2Nonneg = ((l1 `timesL` r2) `combineL` (l1 `timesL` l2), (r1 `timesR` r2) `combineR` (r1 `timesR` l2)) -------- i2 negative: -- i1 consistent and containing zero, i2 negative | i1ContZero && i2Nonpos = (r1 `timesL` l2, l1 `timesR` l2) -- i1 anti-consistent and anti-containing zero, i2 negative | i1AntiContZero && i2Nonpos = (r1 `timesL` r2, l1 `timesR` r2) -- nothing known about i1, i2 negative | i2Nonpos = ((r1 `timesL` r2) `combineL` (r1 `timesL` l2), (l1 `timesR` r2) `combineR` (l1 `timesR` l2)) ----------------------------------------------------------- -- cases where both i1 or i2 are around zero ----------------------------------------------------------- -- both consistent, at least one contains zero | (i1ContZero && i2Consistent) || (i2ContZero && i1Consistent) = ((l1 `timesL` r2) `minL` (r1 `timesL` l2), (l1 `timesR` l2) `maxR` (r1 `timesR` r2)) -- i1 consistent and containing zero, i2 anti-consistent and anti-containing zero | i1ContZero && i2AntiContZero = (z, z) -- i1 consistent and containing zero, i2 unknown | i1ContZero = (((l1 `timesL` r2) `combineL` (r1 `timesL` l2)) `combineL` z, ((l1 `timesR` l2) `combineR` (r1 `timesR` r2)) `combineR` z) -- i1 anti-consistent and anti-containing zero, i2 consistent and containing zero | i1AntiContZero && i2ContZero = (z, z) -- i1 anti-consistent and anti-containing zero, i2 anti-consistent and anti-containing zero | i1AntiContZero && i2AntiContZero = -- | (i1AntiContZero && i2Anticonsistent) || (i1Anticonsistent && i2AntiContZero) = -- TODO: is this correct? ((l1 `timesL` l2) `maxL` (r1 `timesL` r2), (l1 `timesR` r2) `minR` (r1 `timesR` l2)) -- i1 anti-consistent and anti-containing zero, i2 unknown | i1AntiContZero = ((l1 `timesL` l2) `combineL` (r1 `timesL` r2) `combineL` z, (l1 `timesR` r2) `combineR` (r1 `timesR` l2) `combineR` z) -- i1 unknown, i2 anti-consistent and anti-containing zero | i2AntiContZero = ((l1 `timesL` l2) `combineL` (r1 `timesL` r2) `combineL` z, (l1 `timesR` r2) `combineR` (r1 `timesR` l2) `combineR` z) -- i1 unknown, i2 consistent and containing zero | i2ContZero = ((l1 `timesL` r2) `combineL` (r1 `timesL` l2) `combineL` z, (l1 `timesR` l2) `combineR` (r1 `timesR` r2) `combineR` z) -- both i1 and i2 unknown | otherwise = (foldl1 combineL [l1 `timesL` r2, r1 `timesL` l2, l1 `timesL` l2, r1 `timesL` r2], foldl1 combineR [l1 `timesR` r2, r1 `timesR` l2, l1 `timesR` l2, r1 `timesR` r2]) where z = zero sampleT sampleT = l1 `timesL` l2 -- the 2 x 4 booleans that determine the 16 cases of the Kaucher multiplication table: i1Nonpos = l1Nonpos && r1Nonpos i1Nonneg = l1Nonneg && r1Nonneg i1ContZero = l1Nonpos && r1Nonneg i1AntiContZero = l1Nonneg && r1Nonpos i2Nonpos = l2Nonpos && r2Nonpos i2Nonneg = l2Nonneg && r2Nonneg i2ContZero = l2Nonpos && r2Nonneg i2AntiContZero = l2Nonneg && r2Nonpos [l1Nonneg, l1Nonpos, r1Nonneg, r1Nonpos, l2Nonneg, l2Nonpos, r2Nonneg, r2Nonpos] = map (== Just True) [l1MNonneg, l1MNonpos, r1MNonneg, r1MNonpos, l2MNonneg, l2MNonpos, r2MNonneg, r2MNonpos] (l1MNonneg, l1MNonpos) = pNonnegNonpos1 l1 (r1MNonneg, r1MNonpos) = pNonnegNonpos1 r1 (l2MNonneg, l2MNonpos) = pNonnegNonpos2 l2 (r2MNonneg, r2MNonpos) = pNonnegNonpos2 r2 -- consistency information can help when the above is not available: [i1Consistent, i1Anticonsistent, i2Consistent, i2Anticonsistent] = map (== Just True) [i1MConsistent, i1MAnticonsistent, i2MConsistent, i2MAnticonsistent] (i1MConsistent, i1MAnticonsistent) = pConsistency1 (l1, r1) (i2MConsistent, i2MAnticonsistent) = pConsistency2 (l2, r2)
7,152
false
true
0
22
2,681
1,864
1,123
741
null
null
ancientlanguage/haskell-analysis
prepare/src/Prepare/Decompose.hs
mit
decomposeChar '\x1FF7' = "\x03C9\x0342\x0345"
45
decomposeChar '\x1FF7' = "\x03C9\x0342\x0345"
45
decomposeChar '\x1FF7' = "\x03C9\x0342\x0345"
45
false
false
1
5
3
13
4
9
null
null
typelead/epm
Cabal/Distribution/Simple/BuildTarget.hs
bsd-3-clause
nubMatches (InexactMatch d xs) = InexactMatch d (nub xs)
58
nubMatches (InexactMatch d xs) = InexactMatch d (nub xs)
58
nubMatches (InexactMatch d xs) = InexactMatch d (nub xs)
58
false
false
0
7
10
28
13
15
null
null
NorfairKing/the-notes
src/Topology/MetricSpace.hs
gpl-2.0
pseudometricSpaceDefinition :: Note pseudometricSpaceDefinition = de $ do lab pseudometricSpaceDefinitionLabel s ["Let ", m topset, " be a ", set, and, m toppm, " a ", pseudometric_, on, m topset] s ["The tuple ", m toppms, " is called a ", pseudometricSpace']
272
pseudometricSpaceDefinition :: Note pseudometricSpaceDefinition = de $ do lab pseudometricSpaceDefinitionLabel s ["Let ", m topset, " be a ", set, and, m toppm, " a ", pseudometric_, on, m topset] s ["The tuple ", m toppms, " is called a ", pseudometricSpace']
272
pseudometricSpaceDefinition = de $ do lab pseudometricSpaceDefinitionLabel s ["Let ", m topset, " be a ", set, and, m toppm, " a ", pseudometric_, on, m topset] s ["The tuple ", m toppms, " is called a ", pseudometricSpace']
236
false
true
0
10
53
87
46
41
null
null
skogsbaer/HTF
Test/Framework/TestReporter.hs
lgpl-2.1
reportGlobalStartHP :: ReportGlobalStart reportGlobalStartHP _ = return ()
74
reportGlobalStartHP :: ReportGlobalStart reportGlobalStartHP _ = return ()
74
reportGlobalStartHP _ = return ()
33
false
true
0
6
7
19
9
10
null
null
cdornan/keystore
src/Data/KeyStore/Types.hs
bsd-3-clause
fromConfiguration_ :: Configuration_ -> Configuration fromConfiguration_ Configuration_{..} = Configuration { _cfg_settings = _z_cfg_settings , _cfg_triggers = fromTriggerMap_ _z_cfg_triggers }
223
fromConfiguration_ :: Configuration_ -> Configuration fromConfiguration_ Configuration_{..} = Configuration { _cfg_settings = _z_cfg_settings , _cfg_triggers = fromTriggerMap_ _z_cfg_triggers }
223
fromConfiguration_ Configuration_{..} = Configuration { _cfg_settings = _z_cfg_settings , _cfg_triggers = fromTriggerMap_ _z_cfg_triggers }
169
false
true
0
7
48
41
22
19
null
null
urbanslug/ghc
compiler/rename/RnBinds.hs
bsd-3-clause
renameSig ctxt sig@(FixSig (FixitySig vs f)) = do { new_vs <- mapM (lookupSigOccRn ctxt sig) vs ; return (FixSig (FixitySig new_vs f), emptyFVs) }
157
renameSig ctxt sig@(FixSig (FixitySig vs f)) = do { new_vs <- mapM (lookupSigOccRn ctxt sig) vs ; return (FixSig (FixitySig new_vs f), emptyFVs) }
157
renameSig ctxt sig@(FixSig (FixitySig vs f)) = do { new_vs <- mapM (lookupSigOccRn ctxt sig) vs ; return (FixSig (FixitySig new_vs f), emptyFVs) }
157
false
false
0
11
34
74
37
37
null
null
firegurafiku/ImplicitEMC
test/TestSimpleNetCDF.hs
gpl-2.0
materialScene = MS.MaterialScene { MS.objects2D = [], MS.objects3D = [], MS.backgroundMaterial = const MS.vacuum }
138
materialScene = MS.MaterialScene { MS.objects2D = [], MS.objects3D = [], MS.backgroundMaterial = const MS.vacuum }
138
materialScene = MS.MaterialScene { MS.objects2D = [], MS.objects3D = [], MS.backgroundMaterial = const MS.vacuum }
138
false
false
0
8
38
43
24
19
null
null
CindyLinz/Haskell-Perl
src/Perl/Constant.hs
mit
const_SVt_PVFM = 14
19
const_SVt_PVFM = 14
19
const_SVt_PVFM = 14
19
false
false
0
4
2
6
3
3
null
null
ben-schulz/Idris-dev
src/Idris/IdrisDoc.hs
bsd-3-clause
extractPTactic (Exact p) = extract p
45
extractPTactic (Exact p) = extract p
45
extractPTactic (Exact p) = extract p
45
false
false
0
7
14
18
8
10
null
null
damoxc/ganeti
src/Ganeti/Luxi.hs
gpl-2.0
-- | Check that luxi request contains the required keys and parse it. validateCall :: String -> Result LuxiCall validateCall s = do arr <- fromJResult "parsing top-level luxi message" $ decodeStrict s::Result (JSObject JSValue) let aobj = fromJSObject arr call <- fromObj aobj (strOfKey Method)::Result LuxiReq args <- fromObj aobj (strOfKey Args) return (LuxiCall call args) -- | Converts Luxi call arguments into a 'LuxiOp' data structure. -- -- This is currently hand-coded until we make it more uniform so that -- it can be generated using TH.
567
validateCall :: String -> Result LuxiCall validateCall s = do arr <- fromJResult "parsing top-level luxi message" $ decodeStrict s::Result (JSObject JSValue) let aobj = fromJSObject arr call <- fromObj aobj (strOfKey Method)::Result LuxiReq args <- fromObj aobj (strOfKey Args) return (LuxiCall call args) -- | Converts Luxi call arguments into a 'LuxiOp' data structure. -- -- This is currently hand-coded until we make it more uniform so that -- it can be generated using TH.
497
validateCall s = do arr <- fromJResult "parsing top-level luxi message" $ decodeStrict s::Result (JSObject JSValue) let aobj = fromJSObject arr call <- fromObj aobj (strOfKey Method)::Result LuxiReq args <- fromObj aobj (strOfKey Args) return (LuxiCall call args) -- | Converts Luxi call arguments into a 'LuxiOp' data structure. -- -- This is currently hand-coded until we make it more uniform so that -- it can be generated using TH.
455
true
true
0
11
108
128
59
69
null
null
grnet/snf-ganeti
src/Ganeti/OpParams.hs
bsd-2-clause
pIgnoreRemoveFailures :: Field pIgnoreRemoveFailures = withDoc "Whether to ignore failures while removing instances" $ defaultFalse "ignore_remove_failures"
160
pIgnoreRemoveFailures :: Field pIgnoreRemoveFailures = withDoc "Whether to ignore failures while removing instances" $ defaultFalse "ignore_remove_failures"
160
pIgnoreRemoveFailures = withDoc "Whether to ignore failures while removing instances" $ defaultFalse "ignore_remove_failures"
129
false
true
0
6
19
21
10
11
null
null
mrlovre/super-memory
Pro1/src/FuzzySets/MutableFuzzySet.hs
gpl-3.0
-- | Bulk update for the set. See 'setMutableFuzzySet' for updating single domain element. updateMutableFuzzySet :: MutableFuzzySet -> [(DomainElement, Double)] -> MutableFuzzySet updateMutableFuzzySet (MutableFuzzySet d memberships) elementValuePairs = let indexValuePairs = map (first (indexOfElement d)) elementValuePairs in MutableFuzzySet d (memberships // indexValuePairs)
386
updateMutableFuzzySet :: MutableFuzzySet -> [(DomainElement, Double)] -> MutableFuzzySet updateMutableFuzzySet (MutableFuzzySet d memberships) elementValuePairs = let indexValuePairs = map (first (indexOfElement d)) elementValuePairs in MutableFuzzySet d (memberships // indexValuePairs)
295
updateMutableFuzzySet (MutableFuzzySet d memberships) elementValuePairs = let indexValuePairs = map (first (indexOfElement d)) elementValuePairs in MutableFuzzySet d (memberships // indexValuePairs)
206
true
true
0
13
49
89
43
46
null
null
amutake/imp
src/Main.hs
bsd-3-clause
repl :: IO () repl = do env <- initialEnv loop env where loop env = do putStr "imp> " hFlush stdout code <- T.getLine case parseCode code of Left err -> print err >> loop env Right prog -> do catch (run env prog >> return ()) $ \e -> do putStrLn $ show (e :: ImpError) loop env
399
repl :: IO () repl = do env <- initialEnv loop env where loop env = do putStr "imp> " hFlush stdout code <- T.getLine case parseCode code of Left err -> print err >> loop env Right prog -> do catch (run env prog >> return ()) $ \e -> do putStrLn $ show (e :: ImpError) loop env
399
repl = do env <- initialEnv loop env where loop env = do putStr "imp> " hFlush stdout code <- T.getLine case parseCode code of Left err -> print err >> loop env Right prog -> do catch (run env prog >> return ()) $ \e -> do putStrLn $ show (e :: ImpError) loop env
385
false
true
0
18
181
153
67
86
null
null
ezyang/ghc
compiler/basicTypes/NameSet.hs
bsd-3-clause
delListFromNameSet set ns = foldl delFromNameSet set ns
55
delListFromNameSet set ns = foldl delFromNameSet set ns
55
delListFromNameSet set ns = foldl delFromNameSet set ns
55
false
false
0
5
7
18
8
10
null
null
charlesrosenbauer/Bzo-Compiler
src/Core.hs
gpl-3.0
showDefinition (FuncSyntax _ fnid file hedr defs) = " FNSYN:\n " ++ (show fnid) ++ "\n " ++ (show file) ++ "\n T: " ++ (show hedr) ++ "\n D: " ++ (show defs) ++ "\n"
368
showDefinition (FuncSyntax _ fnid file hedr defs) = " FNSYN:\n " ++ (show fnid) ++ "\n " ++ (show file) ++ "\n T: " ++ (show hedr) ++ "\n D: " ++ (show defs) ++ "\n"
368
showDefinition (FuncSyntax _ fnid file hedr defs) = " FNSYN:\n " ++ (show fnid) ++ "\n " ++ (show file) ++ "\n T: " ++ (show hedr) ++ "\n D: " ++ (show defs) ++ "\n"
368
false
false
0
14
238
80
39
41
null
null
shlevy/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
gHC_STATICPTR_INTERNAL :: Module gHC_STATICPTR_INTERNAL = mkBaseModule (fsLit "GHC.StaticPtr.Internal")
103
gHC_STATICPTR_INTERNAL :: Module gHC_STATICPTR_INTERNAL = mkBaseModule (fsLit "GHC.StaticPtr.Internal")
103
gHC_STATICPTR_INTERNAL = mkBaseModule (fsLit "GHC.StaticPtr.Internal")
70
false
true
0
7
7
20
10
10
null
null
headprogrammingczar/cabal
cabal-install/Distribution/Solver/Types/PackageIndex.hs
bsd-3-clause
-- | Removes all packages with this (case-sensitive) name from the index. -- deletePackageName :: Package pkg => PackageName -> PackageIndex pkg -> PackageIndex pkg deletePackageName name = delete name (\pkg -> packageName pkg == name)
237
deletePackageName :: Package pkg => PackageName -> PackageIndex pkg -> PackageIndex pkg deletePackageName name = delete name (\pkg -> packageName pkg == name)
160
deletePackageName name = delete name (\pkg -> packageName pkg == name)
72
true
true
0
9
37
57
28
29
null
null
kawu/mrf
Data/MRF/Generic/ParamSet.hs
bsd-3-clause
mkParamSet :: (Ord f, ParamSet p f c x) => [f] -> p mkParamSet fs = let fSet = Set.fromList fs fs' = Set.toList fSet vs = replicate (Set.size fSet) 0.0 in fromList (zip fs' vs)
204
mkParamSet :: (Ord f, ParamSet p f c x) => [f] -> p mkParamSet fs = let fSet = Set.fromList fs fs' = Set.toList fSet vs = replicate (Set.size fSet) 0.0 in fromList (zip fs' vs)
204
mkParamSet fs = let fSet = Set.fromList fs fs' = Set.toList fSet vs = replicate (Set.size fSet) 0.0 in fromList (zip fs' vs)
152
false
true
0
12
63
97
48
49
null
null
GaroBrik/haskell-compiler
src/CodeBuilders.hs
gpl-3.0
showOp :: ArithOp -> String showOp Plus = "add"
47
showOp :: ArithOp -> String showOp Plus = "add"
47
showOp Plus = "add"
19
false
true
0
5
8
22
10
12
null
null
ganeti/ganeti
src/Ganeti/OpCodes.hs
bsd-2-clause
-- | Default common parameter values. defOpParams :: CommonOpParams defOpParams = CommonOpParams { opDryRun = Nothing , opDebugLevel = Nothing , opPriority = OpPrioNormal , opDepends = Nothing , opComment = Nothing , opReason = [] }
352
defOpParams :: CommonOpParams defOpParams = CommonOpParams { opDryRun = Nothing , opDebugLevel = Nothing , opPriority = OpPrioNormal , opDepends = Nothing , opComment = Nothing , opReason = [] }
314
defOpParams = CommonOpParams { opDryRun = Nothing , opDebugLevel = Nothing , opPriority = OpPrioNormal , opDepends = Nothing , opComment = Nothing , opReason = [] }
284
true
true
0
7
156
52
33
19
null
null
AngelitoJ/HsDynamics
src/Molcas.hs
bsd-3-clause
molcasBlock :: BlockParser molcasBlock = do userState <- getState -- get block level parsers from the user state choice $ blockLevel userState -- try the top level parsers -- Try to parse as many blank text lines as it can, and collapse them into a single TextData MolBlock
310
molcasBlock :: BlockParser molcasBlock = do userState <- getState -- get block level parsers from the user state choice $ blockLevel userState -- try the top level parsers -- Try to parse as many blank text lines as it can, and collapse them into a single TextData MolBlock
310
molcasBlock = do userState <- getState -- get block level parsers from the user state choice $ blockLevel userState -- try the top level parsers -- Try to parse as many blank text lines as it can, and collapse them into a single TextData MolBlock
283
false
true
0
9
84
38
17
21
null
null
osa1/StrictCore
programs/List.hs
bsd-3-clause
lrev :: LList a -> LList a lrev LNil = LNil
51
lrev :: LList a -> LList a lrev LNil = LNil
51
lrev LNil = LNil
24
false
true
0
6
18
28
12
16
null
null
MichelBoucey/cayley-client
Database/Cayley/Client.hs
bsd-3-clause
isValid :: Quad -> Bool isValid Quad{..} = T.empty `notElem` [subject, predicate, object]
89
isValid :: Quad -> Bool isValid Quad{..} = T.empty `notElem` [subject, predicate, object]
89
isValid Quad{..} = T.empty `notElem` [subject, predicate, object]
65
false
true
0
7
12
41
23
18
null
null
raventid/coursera_learning
haskell/will_kurt/30_monads_worksheet.hs
mit
bind Nothing f = Nothing
24
bind Nothing f = Nothing
24
bind Nothing f = Nothing
24
false
false
0
5
4
11
5
6
null
null
mnick/hsparse
src/Numeric/Sparse/Matrix.hs
bsd-3-clause
-- | Sparse matrix-matrix multiplication mult :: (Eq a, Num a, DIM r, DIM c1, DIM c2) => SparseMatrix r c1 a -> SparseMatrix c1 c2 a -> SparseMatrix r c2 a mult x y = SM $ M.mapMaybe (spMvMaybe (trans y)) (mat x)
212
mult :: (Eq a, Num a, DIM r, DIM c1, DIM c2) => SparseMatrix r c1 a -> SparseMatrix c1 c2 a -> SparseMatrix r c2 a mult x y = SM $ M.mapMaybe (spMvMaybe (trans y)) (mat x)
171
mult x y = SM $ M.mapMaybe (spMvMaybe (trans y)) (mat x)
56
true
true
0
10
43
108
53
55
null
null
pxqr/language-cl-c
Language/CL/C/CodeGen.hs
mit
mapLeft :: (a -> b) -> Either a c -> Either b c mapLeft f = either (Left . f) Right
83
mapLeft :: (a -> b) -> Either a c -> Either b c mapLeft f = either (Left . f) Right
83
mapLeft f = either (Left . f) Right
35
false
true
0
7
20
51
25
26
null
null
mcschroeder/ghc
compiler/coreSyn/CoreSyn.hs
bsd-3-clause
flattenBinds (Rec prs1 : binds) = prs1 ++ flattenBinds binds
62
flattenBinds (Rec prs1 : binds) = prs1 ++ flattenBinds binds
62
flattenBinds (Rec prs1 : binds) = prs1 ++ flattenBinds binds
62
false
false
0
8
11
26
12
14
null
null
adituv/qbscript
src/Compiler/QbScript/CodeGen.hs
bsd-3-clause
putExpr (Neq e1 e2) = putInfix 0x4D e1 e2
41
putExpr (Neq e1 e2) = putInfix 0x4D e1 e2
41
putExpr (Neq e1 e2) = putInfix 0x4D e1 e2
41
false
false
0
7
8
24
11
13
null
null
ulrikrasmussen/BoxProver
src/RenderHtml.hs
mit
renderObj :: Obj -> Html renderObj o = case o of ObjTerm (Open bs t) -> lam bs >> renderTerm t ObjProp (Open bs phi) -> lam bs >> renderFormula phi ObjRef (Open bs ref) -> lam bs >> renderRef ref ObjSequent (Open bs sq) -> lam bs >> renderSequent sq ObjProof (Open bs _pt) -> lam bs >> fromString "<proof term>" where lam [] = (return () :: Html) lam bs = do _ <- fromString "λ" let hs = map (fromString . maybe "_" id . bindVar) bs sequence_ $ intersperse (fromString ", ") hs fromString ". "
579
renderObj :: Obj -> Html renderObj o = case o of ObjTerm (Open bs t) -> lam bs >> renderTerm t ObjProp (Open bs phi) -> lam bs >> renderFormula phi ObjRef (Open bs ref) -> lam bs >> renderRef ref ObjSequent (Open bs sq) -> lam bs >> renderSequent sq ObjProof (Open bs _pt) -> lam bs >> fromString "<proof term>" where lam [] = (return () :: Html) lam bs = do _ <- fromString "λ" let hs = map (fromString . maybe "_" id . bindVar) bs sequence_ $ intersperse (fromString ", ") hs fromString ". "
579
renderObj o = case o of ObjTerm (Open bs t) -> lam bs >> renderTerm t ObjProp (Open bs phi) -> lam bs >> renderFormula phi ObjRef (Open bs ref) -> lam bs >> renderRef ref ObjSequent (Open bs sq) -> lam bs >> renderSequent sq ObjProof (Open bs _pt) -> lam bs >> fromString "<proof term>" where lam [] = (return () :: Html) lam bs = do _ <- fromString "λ" let hs = map (fromString . maybe "_" id . bindVar) bs sequence_ $ intersperse (fromString ", ") hs fromString ". "
554
false
true
0
14
185
253
115
138
null
null
eric-ch/idl
rpcgen/Backend/C.hs
gpl-2.0
dbusTypeTag D.DBusDouble = "DBUS_TYPE_DOUBLE"
45
dbusTypeTag D.DBusDouble = "DBUS_TYPE_DOUBLE"
45
dbusTypeTag D.DBusDouble = "DBUS_TYPE_DOUBLE"
45
false
false
0
6
3
11
5
6
null
null
frontrowed/stratosphere
library-gen/Stratosphere/ResourceProperties/KinesisFirehoseDeliveryStreamSplunkDestinationConfiguration.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-splunkdestinationconfiguration-cloudwatchloggingoptions kfdsspdcCloudWatchLoggingOptions :: Lens' KinesisFirehoseDeliveryStreamSplunkDestinationConfiguration (Maybe KinesisFirehoseDeliveryStreamCloudWatchLoggingOptions) kfdsspdcCloudWatchLoggingOptions = lens _kinesisFirehoseDeliveryStreamSplunkDestinationConfigurationCloudWatchLoggingOptions (\s a -> s { _kinesisFirehoseDeliveryStreamSplunkDestinationConfigurationCloudWatchLoggingOptions = a })
633
kfdsspdcCloudWatchLoggingOptions :: Lens' KinesisFirehoseDeliveryStreamSplunkDestinationConfiguration (Maybe KinesisFirehoseDeliveryStreamCloudWatchLoggingOptions) kfdsspdcCloudWatchLoggingOptions = lens _kinesisFirehoseDeliveryStreamSplunkDestinationConfigurationCloudWatchLoggingOptions (\s a -> s { _kinesisFirehoseDeliveryStreamSplunkDestinationConfigurationCloudWatchLoggingOptions = a })
393
kfdsspdcCloudWatchLoggingOptions = lens _kinesisFirehoseDeliveryStreamSplunkDestinationConfigurationCloudWatchLoggingOptions (\s a -> s { _kinesisFirehoseDeliveryStreamSplunkDestinationConfigurationCloudWatchLoggingOptions = a })
229
true
true
0
9
21
46
25
21
null
null
kishoredbn/barrelfish
tools/sockeye/SockeyeBackendProlog.hs
mit
ate_add_accept :: Integer -> String -> String state_add_accept i reg = "assert_accept" ++ parens ((statevar i) ++ ", " ++ reg ++ ", " ++ (statevar (i + 1)))
161
state_add_accept :: Integer -> String -> String state_add_accept i reg = "assert_accept" ++ parens ((statevar i) ++ ", " ++ reg ++ ", " ++ (statevar (i + 1)))
160
state_add_accept i reg = "assert_accept" ++ parens ((statevar i) ++ ", " ++ reg ++ ", " ++ (statevar (i + 1)))
111
false
true
0
13
33
74
36
38
null
null
nbrunt/JSHOP
src/Analyser.hs
mit
-- | If statement anIfStmt :: IfStmt -> JSCC() anIfStmt (IfElse expr stmtTrue stmtFalse) = do anExpr expr anStmt stmtTrue anStmt stmtFalse
150
anIfStmt :: IfStmt -> JSCC() anIfStmt (IfElse expr stmtTrue stmtFalse) = do anExpr expr anStmt stmtTrue anStmt stmtFalse
132
anIfStmt (IfElse expr stmtTrue stmtFalse) = do anExpr expr anStmt stmtTrue anStmt stmtFalse
103
true
true
0
7
33
52
23
29
null
null
phischu/fragnix
tests/packages/scotty/Data.Text.IO.hs
bsd-3-clause
-- | Write a string to 'stdout', followed by a newline. putStrLn :: Text -> IO () putStrLn = hPutStrLn stdout
109
putStrLn :: Text -> IO () putStrLn = hPutStrLn stdout
53
putStrLn = hPutStrLn stdout
27
true
true
0
8
20
30
13
17
null
null
pparkkin/eta
compiler/ETA/SimplCore/SimplEnv.hs
bsd-3-clause
substIdBndr :: SimplEnv -> InBndr -> (SimplEnv, OutBndr) -- Might be a coercion variable substIdBndr env bndr | isCoVar bndr = substCoVarBndr env bndr | otherwise = substNonCoVarIdBndr env bndr
202
substIdBndr :: SimplEnv -> InBndr -> (SimplEnv, OutBndr) substIdBndr env bndr | isCoVar bndr = substCoVarBndr env bndr | otherwise = substNonCoVarIdBndr env bndr
170
substIdBndr env bndr | isCoVar bndr = substCoVarBndr env bndr | otherwise = substNonCoVarIdBndr env bndr
113
true
true
1
8
38
57
28
29
null
null
nushio3/Paraiso
Language/Paraiso/OM/Builder/Boolean.hs
bsd-3-clause
-- | Greater than or equal to ge :: CompareOp ge = mkOp2B A.GE
62
ge :: CompareOp ge = mkOp2B A.GE
32
ge = mkOp2B A.GE
16
true
true
0
6
13
23
10
13
null
null
thomasjm/ot.hs
src/Control/OperationalTransformation/JSON/Affects.hs
mit
affects (ApplySubtypeOperation path1 _ _) (ObjectReplace path2 key2 _ _) | path1 == path2 = False
97
affects (ApplySubtypeOperation path1 _ _) (ObjectReplace path2 key2 _ _) | path1 == path2 = False
97
affects (ApplySubtypeOperation path1 _ _) (ObjectReplace path2 key2 _ _) | path1 == path2 = False
97
false
false
2
8
15
45
20
25
null
null
shlevy/ghc
testsuite/tests/driver/recomp017/B.hs
bsd-3-clause
b :: () -> F (B,b) b = id
25
b :: () -> F (B,b) b = id
25
b = id
6
false
true
0
8
8
32
15
17
null
null
ekmett/ghclive
prototypes/sharededitor/WsTest.hs
bsd-3-clause
actions :: [J.Value] -> J.Value actions as = J.object ["actions" .= as ]
72
actions :: [J.Value] -> J.Value actions as = J.object ["actions" .= as ]
72
actions as = J.object ["actions" .= as ]
40
false
true
0
7
12
37
19
18
null
null
ezyang/ghc
compiler/hsSyn/HsPat.hs
bsd-3-clause
pprPat (NPat l Nothing _ _) = ppr l
37
pprPat (NPat l Nothing _ _) = ppr l
37
pprPat (NPat l Nothing _ _) = ppr l
37
false
false
0
7
10
24
11
13
null
null
ad0/pirana
src/Hash.hs
gpl-3.0
pack' (Nu n p) = do { putTag 1; putBit 0; putInt n; pack' p }
68
pack' (Nu n p) = do { putTag 1; putBit 0; putInt n; pack' p }
68
pack' (Nu n p) = do { putTag 1; putBit 0; putInt n; pack' p }
68
false
false
0
7
22
46
21
25
null
null
kawu/nerf-misc
src/Data/IOB.hs
bsd-3-clause
popMaybe :: IOB w a -> Maybe (Atom a, IOB w a) popMaybe (IOB word (x:xs)) = Just (x, IOB word xs)
97
popMaybe :: IOB w a -> Maybe (Atom a, IOB w a) popMaybe (IOB word (x:xs)) = Just (x, IOB word xs)
97
popMaybe (IOB word (x:xs)) = Just (x, IOB word xs)
50
false
true
0
9
21
69
34
35
null
null
atsukotakahashi/wi
src/library/Yi/Mode/Haskell/Dollarify.hs
gpl-2.0
isNormalParen _ = False
37
isNormalParen _ = False
37
isNormalParen _ = False
37
false
false
0
5
17
9
4
5
null
null
headprogrammingczar/cabal
Cabal/Distribution/Simple/Setup.hs
bsd-3-clause
isAllowNewer :: AllowNewer -> Bool isAllowNewer AllowNewerNone = False
74
isAllowNewer :: AllowNewer -> Bool isAllowNewer AllowNewerNone = False
74
isAllowNewer AllowNewerNone = False
39
false
true
0
5
12
18
9
9
null
null
gcross/LogicGrowsOnTrees-MPI
sources/LogicGrowsOnTrees/Parallel/Adapter/MPI.hs
bsd-2-clause
finalizeMPI = liftIO c_finalizeMPI
34
finalizeMPI = liftIO c_finalizeMPI
34
finalizeMPI = liftIO c_finalizeMPI
34
false
false
0
5
3
9
4
5
null
null
dysinger/amazonka
amazonka-cognito-identity/gen/Network/AWS/CognitoIdentity/GetId.hs
mpl-2.0
-- | An identity pool ID in the format REGION:GUID. giIdentityPoolId :: Lens' GetId Text giIdentityPoolId = lens _giIdentityPoolId (\s a -> s { _giIdentityPoolId = a })
168
giIdentityPoolId :: Lens' GetId Text giIdentityPoolId = lens _giIdentityPoolId (\s a -> s { _giIdentityPoolId = a })
116
giIdentityPoolId = lens _giIdentityPoolId (\s a -> s { _giIdentityPoolId = a })
79
true
true
0
9
27
40
22
18
null
null
Saulzar/reflex-gloss-scene
examples/Widgets.hs
bsd-3-clause
smallText :: String -> Picture smallText str = scale 0.1 0.1 $ text str
71
smallText :: String -> Picture smallText str = scale 0.1 0.1 $ text str
71
smallText str = scale 0.1 0.1 $ text str
40
false
true
0
7
13
36
15
21
null
null
keithodulaigh/Hets
CSL/Parse_AS_Basic.hs
gpl-2.0
parseVarList :: CharParser st EXPRESSION parseVarList = do Lexer.keySign (string "{") elems <- Lexer.separatedBy parseVar pComma Lexer.keySign (string "}") return (List (fst elems) nullRange)
199
parseVarList :: CharParser st EXPRESSION parseVarList = do Lexer.keySign (string "{") elems <- Lexer.separatedBy parseVar pComma Lexer.keySign (string "}") return (List (fst elems) nullRange)
199
parseVarList = do Lexer.keySign (string "{") elems <- Lexer.separatedBy parseVar pComma Lexer.keySign (string "}") return (List (fst elems) nullRange)
158
false
true
1
12
31
82
35
47
null
null
madjestic/b1
src/B1/Data/Price/Google.hs
bsd-3-clause
parsePriceLines :: [String] -> [Maybe Price] parsePriceLines = map (parsePriceTokens . split ',')
97
parsePriceLines :: [String] -> [Maybe Price] parsePriceLines = map (parsePriceTokens . split ',')
97
parsePriceLines = map (parsePriceTokens . split ',')
52
false
true
0
8
12
37
19
18
null
null
mgold/Elm
src/Type/Environment.hs
bsd-3-clause
instantiatorHelp :: Environment -> Set.Set String -> T.Canonical -> State.StateT VarDict IO Type instantiatorHelp env aliasVars sourceType = let go = instantiatorHelp env aliasVars in case sourceType of T.Lambda t1 t2 -> (==>) <$> go t1 <*> go t2 T.Var name -> if Set.member name aliasVars then return (PlaceHolder name) else do dict <- State.get case Map.lookup name dict of Just variable -> return (VarN variable) Nothing -> do variable <- State.liftIO (mkNamedVar name) State.put (Map.insert name variable dict) return (VarN variable) T.Aliased name args aliasType -> do targs <- mapM (\(arg,tipe) -> (,) arg <$> go tipe) args realType <- case aliasType of T.Filled tipe -> instantiatorHelp env Set.empty tipe T.Holey tipe -> instantiatorHelp env (Set.fromList (map fst args)) tipe return (AliasN name targs realType) T.Type name -> case Map.lookup (V.toString name) (_types env) of Just tipe -> return tipe Nothing -> error $ "Could not find type constructor `" ++ V.toString name ++ "` while checking types." T.App func args -> do tfunc <- go func targs <- mapM go args return $ foldl (<|) tfunc targs T.Record fields ext -> do tfields <- traverse go (Map.fromList fields) text <- case ext of Nothing -> return $ TermN EmptyRecord1 Just extType -> go extType return $ TermN (Record1 tfields text)
2,020
instantiatorHelp :: Environment -> Set.Set String -> T.Canonical -> State.StateT VarDict IO Type instantiatorHelp env aliasVars sourceType = let go = instantiatorHelp env aliasVars in case sourceType of T.Lambda t1 t2 -> (==>) <$> go t1 <*> go t2 T.Var name -> if Set.member name aliasVars then return (PlaceHolder name) else do dict <- State.get case Map.lookup name dict of Just variable -> return (VarN variable) Nothing -> do variable <- State.liftIO (mkNamedVar name) State.put (Map.insert name variable dict) return (VarN variable) T.Aliased name args aliasType -> do targs <- mapM (\(arg,tipe) -> (,) arg <$> go tipe) args realType <- case aliasType of T.Filled tipe -> instantiatorHelp env Set.empty tipe T.Holey tipe -> instantiatorHelp env (Set.fromList (map fst args)) tipe return (AliasN name targs realType) T.Type name -> case Map.lookup (V.toString name) (_types env) of Just tipe -> return tipe Nothing -> error $ "Could not find type constructor `" ++ V.toString name ++ "` while checking types." T.App func args -> do tfunc <- go func targs <- mapM go args return $ foldl (<|) tfunc targs T.Record fields ext -> do tfields <- traverse go (Map.fromList fields) text <- case ext of Nothing -> return $ TermN EmptyRecord1 Just extType -> go extType return $ TermN (Record1 tfields text)
2,020
instantiatorHelp env aliasVars sourceType = let go = instantiatorHelp env aliasVars in case sourceType of T.Lambda t1 t2 -> (==>) <$> go t1 <*> go t2 T.Var name -> if Set.member name aliasVars then return (PlaceHolder name) else do dict <- State.get case Map.lookup name dict of Just variable -> return (VarN variable) Nothing -> do variable <- State.liftIO (mkNamedVar name) State.put (Map.insert name variable dict) return (VarN variable) T.Aliased name args aliasType -> do targs <- mapM (\(arg,tipe) -> (,) arg <$> go tipe) args realType <- case aliasType of T.Filled tipe -> instantiatorHelp env Set.empty tipe T.Holey tipe -> instantiatorHelp env (Set.fromList (map fst args)) tipe return (AliasN name targs realType) T.Type name -> case Map.lookup (V.toString name) (_types env) of Just tipe -> return tipe Nothing -> error $ "Could not find type constructor `" ++ V.toString name ++ "` while checking types." T.App func args -> do tfunc <- go func targs <- mapM go args return $ foldl (<|) tfunc targs T.Record fields ext -> do tfields <- traverse go (Map.fromList fields) text <- case ext of Nothing -> return $ TermN EmptyRecord1 Just extType -> go extType return $ TermN (Record1 tfields text)
1,923
false
true
0
21
930
571
264
307
null
null
Frefreak/Gideon
src/Auth.hs
bsd-3-clause
execute :: Gideon a -> IO (Either GideonException a) execute action = do authinfo <- try getAuthInfo case authinfo of Right auth' -> runGideon (execute' action) auth' Left err -> return (Left err) -- unsafe mode, used in batch mode (no database query)
276
execute :: Gideon a -> IO (Either GideonException a) execute action = do authinfo <- try getAuthInfo case authinfo of Right auth' -> runGideon (execute' action) auth' Left err -> return (Left err) -- unsafe mode, used in batch mode (no database query)
276
execute action = do authinfo <- try getAuthInfo case authinfo of Right auth' -> runGideon (execute' action) auth' Left err -> return (Left err) -- unsafe mode, used in batch mode (no database query)
223
false
true
0
12
67
88
40
48
null
null
maffh92/AFP-ANT
src/Abstractions.hs
bsd-3-clause
caseM :: (MonadFix m, Label l) => [(SenseTest , AntT m l ())] -> AntT m l () caseM = foldr (uncurry if') (return ())
136
caseM :: (MonadFix m, Label l) => [(SenseTest , AntT m l ())] -> AntT m l () caseM = foldr (uncurry if') (return ())
136
caseM = foldr (uncurry if') (return ())
39
false
true
0
10
44
76
39
37
null
null
foollbar/Ponga
src/Utils.hs
bsd-3-clause
diff :: Gene -> Gene -> Int diff a b = length $ filter (uncurry (/=)) $ zip a b
79
diff :: Gene -> Gene -> Int diff a b = length $ filter (uncurry (/=)) $ zip a b
79
diff a b = length $ filter (uncurry (/=)) $ zip a b
51
false
true
0
9
19
48
24
24
null
null
ekmett/hmpfr
src/Data/Number/MPFR/Arithmetic.hs
bsd-3-clause
root :: RoundMode -> Precision -> MPFR -> Word -> MPFR root r p d = fst . root_ r p d
91
root :: RoundMode -> Precision -> MPFR -> Word -> MPFR root r p d = fst . root_ r p d
91
root r p d = fst . root_ r p d
30
false
true
1
10
27
51
23
28
null
null
mcschroeder/ghc
compiler/simplCore/CallArity.hs
bsd-3-clause
emptyArityRes :: CallArityRes emptyArityRes = (emptyUnVarGraph, emptyVarEnv)
76
emptyArityRes :: CallArityRes emptyArityRes = (emptyUnVarGraph, emptyVarEnv)
76
emptyArityRes = (emptyUnVarGraph, emptyVarEnv)
46
false
true
0
6
6
24
11
13
null
null
hvr/vector
tests/Tests/Vector.hs
bsd-3-clause
testGeneralUnboxedVector :: forall a. (COMMON_CONTEXT(a, Data.Vector.Unboxed.Vector), Data.Vector.Unboxed.Unbox a, Ord a) => Data.Vector.Unboxed.Vector a -> [Test] testGeneralUnboxedVector dummy = concatMap ($ dummy) [ testSanity, testPolymorphicFunctions, testOrdFunctions, testMonoidFunctions ]
332
testGeneralUnboxedVector :: forall a. (COMMON_CONTEXT(a, Data.Vector.Unboxed.Vector), Data.Vector.Unboxed.Unbox a, Ord a) => Data.Vector.Unboxed.Vector a -> [Test] testGeneralUnboxedVector dummy = concatMap ($ dummy) [ testSanity, testPolymorphicFunctions, testOrdFunctions, testMonoidFunctions ]
332
testGeneralUnboxedVector dummy = concatMap ($ dummy) [ testSanity, testPolymorphicFunctions, testOrdFunctions, testMonoidFunctions ]
168
false
true
0
9
62
89
52
37
null
null
kebertx/GoFu
src/Go/Board.hs
bsd-3-clause
-- -- -- -- -- -- -- -- -- Updating the board: -- -- -- -- -- -- -- -- -- Create a new Go board of a given size newBoard' :: Int -> Int -> Board newBoard' w h = Array.listArray ((0, 0), (w-1, h-1)) $ repeat Empty
213
newBoard' :: Int -> Int -> Board newBoard' w h = Array.listArray ((0, 0), (w-1, h-1)) $ repeat Empty
100
newBoard' w h = Array.listArray ((0, 0), (w-1, h-1)) $ repeat Empty
67
true
true
0
9
49
66
37
29
null
null
siddhanathan/ghc
compiler/hsSyn/HsUtils.hs
bsd-3-clause
collectStmtBinders :: StmtLR idL idR body -> [idL] -- Id Binders for a Stmt... [but what about pattern-sig type vars]? collectStmtBinders (BindStmt pat _ _ _) = collectPatBinders pat
184
collectStmtBinders :: StmtLR idL idR body -> [idL] collectStmtBinders (BindStmt pat _ _ _) = collectPatBinders pat
114
collectStmtBinders (BindStmt pat _ _ _) = collectPatBinders pat
63
true
true
0
7
30
44
22
22
null
null
brendanhay/gogol
gogol-qpxexpress/gen/Network/Google/QPXExpress/Types/Product.hs
mpl-2.0
-- | Creates a value of 'BagDescriptor' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'bdKind' -- -- * 'bdCommercialName' -- -- * 'bdCount' -- -- * 'bdDescription' -- -- * 'bdSubcode' bagDescriptor :: BagDescriptor bagDescriptor = BagDescriptor' { _bdKind = "qpxexpress#bagDescriptor" , _bdCommercialName = Nothing , _bdCount = Nothing , _bdDescription = Nothing , _bdSubcode = Nothing }
504
bagDescriptor :: BagDescriptor bagDescriptor = BagDescriptor' { _bdKind = "qpxexpress#bagDescriptor" , _bdCommercialName = Nothing , _bdCount = Nothing , _bdDescription = Nothing , _bdSubcode = Nothing }
233
bagDescriptor = BagDescriptor' { _bdKind = "qpxexpress#bagDescriptor" , _bdCommercialName = Nothing , _bdCount = Nothing , _bdDescription = Nothing , _bdSubcode = Nothing }
198
true
true
1
7
106
63
41
22
null
null
alexvong1995/pandoc
src/Text/Pandoc/Parsing.hs
gpl-2.0
stringAnyCase (x:xs) = do firstChar <- char (toUpper x) <|> char (toLower x) rest <- stringAnyCase xs return (firstChar:rest) -- | Parse contents of 'str' using 'parser' and return result.
195
stringAnyCase (x:xs) = do firstChar <- char (toUpper x) <|> char (toLower x) rest <- stringAnyCase xs return (firstChar:rest) -- | Parse contents of 'str' using 'parser' and return result.
195
stringAnyCase (x:xs) = do firstChar <- char (toUpper x) <|> char (toLower x) rest <- stringAnyCase xs return (firstChar:rest) -- | Parse contents of 'str' using 'parser' and return result.
195
false
false
0
11
36
69
32
37
null
null
JacquesCarette/literate-scientific-software
code/drasil-example/Drasil/SSP/Body.hs
bsd-2-clause
section :: [Section] section = extractSection srs
49
section :: [Section] section = extractSection srs
49
section = extractSection srs
28
false
true
0
5
6
17
9
8
null
null
ehlemur/HLearn
src/HLearn/Data/LoadData.hs
bsd-3-clause
-------------------------------------------------------------------------------- -- | This loads files in the format used by the BagOfWords UCI dataset. -- See: https://archive.ics.uci.edu/ml/machine-learning-databases/bag-of-words/readme.txt loadBagOfWords :: FilePath -> IO (Array (Map' Int Float)) loadBagOfWords filepath = do hin <- openFile filepath ReadMode numdp :: Int <- liftM read $ hGetLine hin numdim :: Int <- liftM read $ hGetLine hin numlines :: Int <- liftM read $ hGetLine hin ret <- VGM.replicate numdp zero forM [0..numlines-1] $ \i -> do line <- hGetLine hin let [dp,dim,val] :: [Int] = map read $ L.words line curdp <- VGM.read ret (dp-1) VGM.write ret (dp-1) $ insertAt dim (fromIntegral val) curdp hClose hin VG.unsafeFreeze ret -- | Loads a dataset of strings in the unix words file format (i.e. one word per line). -- This format is also used by the UCI Bag Of Words dataset. -- See: https://archive.ics.uci.edu/ml/machine-learning-databases/bag-of-words/readme.txt
1,058
loadBagOfWords :: FilePath -> IO (Array (Map' Int Float)) loadBagOfWords filepath = do hin <- openFile filepath ReadMode numdp :: Int <- liftM read $ hGetLine hin numdim :: Int <- liftM read $ hGetLine hin numlines :: Int <- liftM read $ hGetLine hin ret <- VGM.replicate numdp zero forM [0..numlines-1] $ \i -> do line <- hGetLine hin let [dp,dim,val] :: [Int] = map read $ L.words line curdp <- VGM.read ret (dp-1) VGM.write ret (dp-1) $ insertAt dim (fromIntegral val) curdp hClose hin VG.unsafeFreeze ret -- | Loads a dataset of strings in the unix words file format (i.e. one word per line). -- This format is also used by the UCI Bag Of Words dataset. -- See: https://archive.ics.uci.edu/ml/machine-learning-databases/bag-of-words/readme.txt
814
loadBagOfWords filepath = do hin <- openFile filepath ReadMode numdp :: Int <- liftM read $ hGetLine hin numdim :: Int <- liftM read $ hGetLine hin numlines :: Int <- liftM read $ hGetLine hin ret <- VGM.replicate numdp zero forM [0..numlines-1] $ \i -> do line <- hGetLine hin let [dp,dim,val] :: [Int] = map read $ L.words line curdp <- VGM.read ret (dp-1) VGM.write ret (dp-1) $ insertAt dim (fromIntegral val) curdp hClose hin VG.unsafeFreeze ret -- | Loads a dataset of strings in the unix words file format (i.e. one word per line). -- This format is also used by the UCI Bag Of Words dataset. -- See: https://archive.ics.uci.edu/ml/machine-learning-databases/bag-of-words/readme.txt
756
true
true
0
17
207
275
128
147
null
null
vincenthz/hs-packer
Data/Packer.hs
bsd-2-clause
-- | Read a Float in little endian IEEE-754 format getFloat32LE :: Unpacking Float getFloat32LE = wordToFloat <$> getWord32LE
125
getFloat32LE :: Unpacking Float getFloat32LE = wordToFloat <$> getWord32LE
74
getFloat32LE = wordToFloat <$> getWord32LE
42
true
true
1
6
18
23
10
13
null
null