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
shayan-najd/HsParser
U/Pretty.hs
gpl-3.0
above_' g p q = Above p g q
31
above_' g p q = Above p g q
31
above_' g p q = Above p g q
31
false
false
0
5
12
20
9
11
null
null
iblumenfeld/cryptol
tests/Main.hs
bsd-3-clause
displayUsage :: [String] -> IO () displayUsage errs = do prog <- getProgName let banner = unlines (errs ++ ["Usage: " ++ prog ++ " [OPTIONS] [FILES]"]) putStrLn (usageInfo banner options) -- Test Generation ------------------------------------------------------------- -- | Write the output of a run of cryptol-2 to this handle. Stdin and stderr -- will both be given the handle provided.
398
displayUsage :: [String] -> IO () displayUsage errs = do prog <- getProgName let banner = unlines (errs ++ ["Usage: " ++ prog ++ " [OPTIONS] [FILES]"]) putStrLn (usageInfo banner options) -- Test Generation ------------------------------------------------------------- -- | Write the output of a run of cryptol-2 to this handle. Stdin and stderr -- will both be given the handle provided.
398
displayUsage errs = do prog <- getProgName let banner = unlines (errs ++ ["Usage: " ++ prog ++ " [OPTIONS] [FILES]"]) putStrLn (usageInfo banner options) -- Test Generation ------------------------------------------------------------- -- | Write the output of a run of cryptol-2 to this handle. Stdin and stderr -- will both be given the handle provided.
364
false
true
0
16
68
85
41
44
null
null
antalsz/hs-to-coq
src/lib/HsToCoq/Coq/Pretty.hs
mit
ifPrec :: Int ifPrec = fromCoqLevel 200
41
ifPrec :: Int ifPrec = fromCoqLevel 200
41
ifPrec = fromCoqLevel 200
26
false
true
0
6
8
20
8
12
null
null
bj4rtmar/sdl2
examples/lazyfoo/Lesson04.hs
bsd-3-clause
loadBMP :: FilePath -> IO (SDL.Surface) loadBMP path = getDataFileName path >>= SDL.loadBMP
91
loadBMP :: FilePath -> IO (SDL.Surface) loadBMP path = getDataFileName path >>= SDL.loadBMP
91
loadBMP path = getDataFileName path >>= SDL.loadBMP
51
false
true
0
8
12
35
17
18
null
null
adamse/haddock
haddock-api/src/Haddock/Backends/Hoogle.hs
bsd-2-clause
mdoc :: Outputable o => DynFlags -> Maybe (MDoc o) -> [String] mdoc dflags = docWith dflags "" . fmap _doc
106
mdoc :: Outputable o => DynFlags -> Maybe (MDoc o) -> [String] mdoc dflags = docWith dflags "" . fmap _doc
106
mdoc dflags = docWith dflags "" . fmap _doc
43
false
true
0
11
20
59
26
33
null
null
ardfard/protolude
src/Protolude.hs
mit
applyN :: Int -> (a -> a) -> a -> a applyN n f = X.foldr (.) identity (X.replicate n f)
87
applyN :: Int -> (a -> a) -> a -> a applyN n f = X.foldr (.) identity (X.replicate n f)
87
applyN n f = X.foldr (.) identity (X.replicate n f)
51
false
true
0
8
20
56
29
27
null
null
mdsteele/fallback
src/Fallback/Event.hs
gpl-3.0
fromSDLKey SDL.SDLK_p = KeyP
28
fromSDLKey SDL.SDLK_p = KeyP
28
fromSDLKey SDL.SDLK_p = KeyP
28
false
false
0
6
3
11
5
6
null
null
cliffano/swaggy-jenkins
clients/haskell-http-client/generated/lib/SwaggyJenkins/ModelLens.hs
mit
-- | 'githubRespositoryContainerRepositories' Lens githubRespositoryContainerRepositoriesL :: Lens_' GithubRespositoryContainer (Maybe GithubRepositories) githubRespositoryContainerRepositoriesL f GithubRespositoryContainer{..} = (\githubRespositoryContainerRepositories -> GithubRespositoryContainer { githubRespositoryContainerRepositories, ..} ) <$> f githubRespositoryContainerRepositories
393
githubRespositoryContainerRepositoriesL :: Lens_' GithubRespositoryContainer (Maybe GithubRepositories) githubRespositoryContainerRepositoriesL f GithubRespositoryContainer{..} = (\githubRespositoryContainerRepositories -> GithubRespositoryContainer { githubRespositoryContainerRepositories, ..} ) <$> f githubRespositoryContainerRepositories
342
githubRespositoryContainerRepositoriesL f GithubRespositoryContainer{..} = (\githubRespositoryContainerRepositories -> GithubRespositoryContainer { githubRespositoryContainerRepositories, ..} ) <$> f githubRespositoryContainerRepositories
238
true
true
0
8
23
57
30
27
null
null
ideas-edu/ideas
src/Ideas/Common/Rule/Abstract.hs
apache-2.0
addTransRecognizer :: (a -> a -> Bool) -> Rule a -> Rule a addTransRecognizer eq r = flip addRecognizer r $ let t = first (transformation r) >>> transList (uncurry p) p x y = [ () | eq x y ] in makeRecognizerTrans t
232
addTransRecognizer :: (a -> a -> Bool) -> Rule a -> Rule a addTransRecognizer eq r = flip addRecognizer r $ let t = first (transformation r) >>> transList (uncurry p) p x y = [ () | eq x y ] in makeRecognizerTrans t
231
addTransRecognizer eq r = flip addRecognizer r $ let t = first (transformation r) >>> transList (uncurry p) p x y = [ () | eq x y ] in makeRecognizerTrans t
172
false
true
0
13
61
110
52
58
null
null
tgdavies/codeworld
funblocks-client/src/Blocks/Types.hs
apache-2.0
typeBool = Truth
16
typeBool = Truth
16
typeBool = Truth
16
false
false
1
5
2
10
3
7
null
null
frontrowed/stratosphere
library-gen/Stratosphere/ResourceProperties/ECSServiceDeploymentConfiguration.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-deploymentconfiguration.html#cfn-ecs-service-deploymentconfiguration-minimumhealthypercent ecssdcMinimumHealthyPercent :: Lens' ECSServiceDeploymentConfiguration (Maybe (Val Integer)) ecssdcMinimumHealthyPercent = lens _eCSServiceDeploymentConfigurationMinimumHealthyPercent (\s a -> s { _eCSServiceDeploymentConfigurationMinimumHealthyPercent = a })
444
ecssdcMinimumHealthyPercent :: Lens' ECSServiceDeploymentConfiguration (Maybe (Val Integer)) ecssdcMinimumHealthyPercent = lens _eCSServiceDeploymentConfigurationMinimumHealthyPercent (\s a -> s { _eCSServiceDeploymentConfigurationMinimumHealthyPercent = a })
259
ecssdcMinimumHealthyPercent = lens _eCSServiceDeploymentConfigurationMinimumHealthyPercent (\s a -> s { _eCSServiceDeploymentConfigurationMinimumHealthyPercent = a })
166
true
true
0
9
22
52
28
24
null
null
alanz/Blobs
lib/DData/Set.hs
lgpl-2.1
balance :: a -> Set a -> Set a -> Set a balance x l r | sizeL + sizeR <= 1 = Bin sizeX x l r | sizeR >= delta*sizeL = rotateL x l r | sizeL >= delta*sizeR = rotateR x l r | otherwise = Bin sizeX x l r where sizeL = size l sizeR = size r sizeX = sizeL + sizeR + 1 -- rotate
312
balance :: a -> Set a -> Set a -> Set a balance x l r | sizeL + sizeR <= 1 = Bin sizeX x l r | sizeR >= delta*sizeL = rotateL x l r | sizeL >= delta*sizeR = rotateR x l r | otherwise = Bin sizeX x l r where sizeL = size l sizeR = size r sizeX = sizeL + sizeR + 1 -- rotate
312
balance x l r | sizeL + sizeR <= 1 = Bin sizeX x l r | sizeR >= delta*sizeL = rotateL x l r | sizeL >= delta*sizeR = rotateR x l r | otherwise = Bin sizeX x l r where sizeL = size l sizeR = size r sizeX = sizeL + sizeR + 1 -- rotate
272
false
true
1
9
111
164
77
87
null
null
tonyfischetti/99-haskell-problems
Q1to10.hs
unlicense
-- from the internet -- uses tail recursion -- .01s - .02s - .03s length' xs = len xs 0 where len [] l = l len (x:xs) l = len xs (l+1) -- from the internet -- change all values to 1 and sum it -- .03s - .05s - .06s
229
length' xs = len xs 0 where len [] l = l len (x:xs) l = len xs (l+1) -- from the internet -- change all values to 1 and sum it -- .03s - .05s - .06s
163
length' xs = len xs 0 where len [] l = l len (x:xs) l = len xs (l+1) -- from the internet -- change all values to 1 and sum it -- .03s - .05s - .06s
163
true
false
1
7
66
63
34
29
null
null
suhailshergill/liboleg
System/IterateeM.hs
bsd-3-clause
-- | The following is a `variant' of join in the IterateeGM el m monad. -- When el' is the same as el, the type of joinI is indeed that of -- true monadic join. However, joinI is subtly different: since -- generally el' is different from el, it makes no sense to -- continue using the internal, IterateeG el' m a: we no longer -- have elements of the type el' to feed to that iteratee. -- We thus send EOF to the internal Iteratee and propagate its result. -- This join function is useful when dealing with `derived iteratees' -- for embedded/nested streams. In particular, joinI is useful to -- process the result of stake, map_stream, or conv_stream below. joinI :: Monad m => IterateeGM el m (IterateeG el' m a) -> IterateeGM el m a joinI m = m >>= (\iter -> enum_eof iter >>== check) where check (IE_done x (Err str)) = liftI $ (IE_done x (Err str)) check (IE_done x _) = liftI $ (IE_done x EOF) check (IE_cont _) = error "joinI: can't happen: EOF didn't terminate" -- | It turns out, IterateeGM form a monad. We can use the familiar do -- notation for composing Iteratees --
1,102
joinI :: Monad m => IterateeGM el m (IterateeG el' m a) -> IterateeGM el m a joinI m = m >>= (\iter -> enum_eof iter >>== check) where check (IE_done x (Err str)) = liftI $ (IE_done x (Err str)) check (IE_done x _) = liftI $ (IE_done x EOF) check (IE_cont _) = error "joinI: can't happen: EOF didn't terminate" -- | It turns out, IterateeGM form a monad. We can use the familiar do -- notation for composing Iteratees --
443
joinI m = m >>= (\iter -> enum_eof iter >>== check) where check (IE_done x (Err str)) = liftI $ (IE_done x (Err str)) check (IE_done x _) = liftI $ (IE_done x EOF) check (IE_cont _) = error "joinI: can't happen: EOF didn't terminate" -- | It turns out, IterateeGM form a monad. We can use the familiar do -- notation for composing Iteratees --
366
true
true
2
10
226
178
91
87
null
null
YoshikuniJujo/xmpipe
test/testChan.hs
bsd-3-clause
main :: IO () main = do c <- threadA replicateM_ 4 . atomically $ writeTChan c 10
83
main :: IO () main = do c <- threadA replicateM_ 4 . atomically $ writeTChan c 10
83
main = do c <- threadA replicateM_ 4 . atomically $ writeTChan c 10
69
false
true
0
9
19
42
19
23
null
null
katychuang/raw-pixels
src/Web/Routes.hs
gpl-2.0
homeH :: Handler App App () homeH = render "/index"
51
homeH :: Handler App App () homeH = render "/index"
51
homeH = render "/index"
23
false
true
0
7
9
29
12
17
null
null
SimSaladin/hahet
src/Hahet/Logging.hs
mit
status, action :: Q Exp status = logOther "status"
50
status, action :: Q Exp status = logOther "status"
50
status = logOther "status"
26
false
true
0
5
8
19
10
9
null
null
tjakway/ghcjvm
compiler/prelude/PrelNames.hs
bsd-3-clause
thenIOName = varQual gHC_BASE (fsLit "thenIO") thenIOIdKey
68
thenIOName = varQual gHC_BASE (fsLit "thenIO") thenIOIdKey
68
thenIOName = varQual gHC_BASE (fsLit "thenIO") thenIOIdKey
68
false
false
0
7
16
19
9
10
null
null
KaneTW/Idris-dev
src/Idris/Docs.hs
bsd-3-clause
pprintDocs ist (DataDoc t args) = text "Data type" <+> pprintFDWithoutTotality ist True t <$> if null args then text "No constructors." else nest 4 (text "Constructors:" <> line <> vsep (map (pprintFDWithoutTotality ist False) args))
296
pprintDocs ist (DataDoc t args) = text "Data type" <+> pprintFDWithoutTotality ist True t <$> if null args then text "No constructors." else nest 4 (text "Constructors:" <> line <> vsep (map (pprintFDWithoutTotality ist False) args))
296
pprintDocs ist (DataDoc t args) = text "Data type" <+> pprintFDWithoutTotality ist True t <$> if null args then text "No constructors." else nest 4 (text "Constructors:" <> line <> vsep (map (pprintFDWithoutTotality ist False) args))
296
false
false
0
14
98
89
42
47
null
null
icyfork/shellcheck
ShellCheck/Analytics.hs
gpl-3.0
checkSudoRedirect _ (T_Redirecting _ redirs cmd) | cmd `isCommand` "sudo" = mapM_ warnAbout redirs where warnAbout (T_FdRedirect _ s (T_IoFile id op file)) | (s == "" || s == "&") && not (special file) = case op of T_Less _ -> info (getId op) 2024 "sudo doesn't affect redirects. Use sudo cat file | .." T_Greater _ -> warn (getId op) 2024 "sudo doesn't affect redirects. Use ..| sudo tee file" T_DGREAT _ -> warn (getId op) 2024 "sudo doesn't affect redirects. Use .. | sudo tee -a file" _ -> return () warnAbout _ = return () special file = concat (deadSimple file) == "/dev/null"
754
checkSudoRedirect _ (T_Redirecting _ redirs cmd) | cmd `isCommand` "sudo" = mapM_ warnAbout redirs where warnAbout (T_FdRedirect _ s (T_IoFile id op file)) | (s == "" || s == "&") && not (special file) = case op of T_Less _ -> info (getId op) 2024 "sudo doesn't affect redirects. Use sudo cat file | .." T_Greater _ -> warn (getId op) 2024 "sudo doesn't affect redirects. Use ..| sudo tee file" T_DGREAT _ -> warn (getId op) 2024 "sudo doesn't affect redirects. Use .. | sudo tee -a file" _ -> return () warnAbout _ = return () special file = concat (deadSimple file) == "/dev/null"
754
checkSudoRedirect _ (T_Redirecting _ redirs cmd) | cmd `isCommand` "sudo" = mapM_ warnAbout redirs where warnAbout (T_FdRedirect _ s (T_IoFile id op file)) | (s == "" || s == "&") && not (special file) = case op of T_Less _ -> info (getId op) 2024 "sudo doesn't affect redirects. Use sudo cat file | .." T_Greater _ -> warn (getId op) 2024 "sudo doesn't affect redirects. Use ..| sudo tee file" T_DGREAT _ -> warn (getId op) 2024 "sudo doesn't affect redirects. Use .. | sudo tee -a file" _ -> return () warnAbout _ = return () special file = concat (deadSimple file) == "/dev/null"
754
false
false
2
12
278
227
102
125
null
null
ditto/ditto
src/Ditto/Parse.hs
gpl-3.0
symRBrace = symbol "}"
22
symRBrace = symbol "}"
22
symRBrace = symbol "}"
22
false
false
1
5
3
12
4
8
null
null
mumuki/mulang
src/Language/Mulang/Interpreter.hs
gpl-3.0
evalArrow e = raiseString ("malformed object arrow: " ++ show e)
78
evalArrow e = raiseString ("malformed object arrow: " ++ show e)
78
evalArrow e = raiseString ("malformed object arrow: " ++ show e)
78
false
false
1
8
24
26
10
16
null
null
Tosainu/pwn.hs
src/Pwn/Log.hs
mit
success :: MonadPwn m => String -> m () success = message ("+", Green)
70
success :: MonadPwn m => String -> m () success = message ("+", Green)
70
success = message ("+", Green)
30
false
true
0
9
13
41
19
22
null
null
chjp2046/fbthrift
thrift/lib/hs/tests/IntegrationTests.hs
apache-2.0
-- | Serialize a TestStruct from C++ and deserialize in Haskell propCToHs :: Protocol p => (Ptr MemoryBuffer -> p (Ptr MemoryBuffer)) -> (Ptr MemoryBuffer -> Ptr TestStruct -> IO ()) -> TestStruct -> Property propCToHs pCons cToHS struct = ioProperty $ bracket c_newStructPtr c_freeTestStruct $ \structPtr -> bracket c_openMB tClose $ \mb -> do poke structPtr struct cToHS mb structPtr (== struct) <$> read_TestStruct (pCons mb) -- | Serialize a TestStruct in Haskell and deserialize in C++
559
propCToHs :: Protocol p => (Ptr MemoryBuffer -> p (Ptr MemoryBuffer)) -> (Ptr MemoryBuffer -> Ptr TestStruct -> IO ()) -> TestStruct -> Property propCToHs pCons cToHS struct = ioProperty $ bracket c_newStructPtr c_freeTestStruct $ \structPtr -> bracket c_openMB tClose $ \mb -> do poke structPtr struct cToHS mb structPtr (== struct) <$> read_TestStruct (pCons mb) -- | Serialize a TestStruct in Haskell and deserialize in C++
495
propCToHs pCons cToHS struct = ioProperty $ bracket c_newStructPtr c_freeTestStruct $ \structPtr -> bracket c_openMB tClose $ \mb -> do poke structPtr struct cToHS mb structPtr (== struct) <$> read_TestStruct (pCons mb) -- | Serialize a TestStruct in Haskell and deserialize in C++
298
true
true
0
14
146
148
71
77
null
null
suhailshergill/liboleg
Lambda/CCG.hs
bsd-3-clause
phrase1 = like / mary
21
phrase1 = like / mary
21
phrase1 = like / mary
21
false
false
3
5
4
15
5
10
null
null
MaxDaten/yage
src/Yage/Rendering/Resources/GL/Framebuffer.hs
mit
-- | wraps an instance of 'FramebufferAttachment' into an 'Attachment' to allow a polymorphic -- color attachment list mkAttachment :: (FramebufferAttachment a, Show a) => a -> Attachment mkAttachment = Attachment
213
mkAttachment :: (FramebufferAttachment a, Show a) => a -> Attachment mkAttachment = Attachment
94
mkAttachment = Attachment
25
true
true
0
6
30
32
18
14
null
null
nomeata/ghc
compiler/cmm/CLabel.hs
bsd-3-clause
pprCLbl (DeadStripPreventer {}) = panic "pprCLbl DeadStripPreventer"
68
pprCLbl (DeadStripPreventer {}) = panic "pprCLbl DeadStripPreventer"
68
pprCLbl (DeadStripPreventer {}) = panic "pprCLbl DeadStripPreventer"
68
false
false
0
7
6
19
9
10
null
null
snowleopard/alga
src/Algebra/Graph/Bipartite/AdjacencyMap.hs
mit
-- | Transform a graph by applying given functions to the vertices of each part. -- Complexity: /O((n + m) * log(n))/ time. -- -- @ -- bimap f g 'empty' == 'empty' -- bimap f g . 'vertex' == 'vertex' . Data.Bifunctor.'Data.Bifunctor.bimap' f g -- bimap f g ('edge' x y) == 'edge' (f x) (g y) -- bimap 'id' 'id' == 'id' -- bimap f1 g1 . bimap f2 g2 == bimap (f1 . f2) (g1 . g2) -- @ bimap :: (Ord a, Ord b, Ord c, Ord d) => (a -> c) -> (b -> d) -> AdjacencyMap a b -> AdjacencyMap c d bimap f g (BAM ab ba) = BAM cd dc where cd = Map.map (Set.map g) $ Map.mapKeysWith Set.union f ab dc = Map.map (Set.map f) $ Map.mapKeysWith Set.union g ba -- TODO: Add torus? -- | Construct a /mesh/ graph from two lists of vertices. -- Complexity: /O(L1 * L2 * log(L1 * L2))/ time, where /L1/ and /L2/ are the -- lengths of the given lists. -- -- @ -- mesh xs [] == 'empty' -- mesh [] ys == 'empty' -- mesh [x] [y] == 'leftVertex' (x,y) -- mesh [1,1] [\'a\',\'b\'] == 'biclique' [(1,\'a\'), (1,\'b\')] [(1,\'a\'), (1,\'b\')] -- mesh [1,2] [\'a\',\'b\'] == 'biclique' [(1,\'a\'), (2,\'b\')] [(1,\'b\'), (2,\'a\')] -- @
1,177
bimap :: (Ord a, Ord b, Ord c, Ord d) => (a -> c) -> (b -> d) -> AdjacencyMap a b -> AdjacencyMap c d bimap f g (BAM ab ba) = BAM cd dc where cd = Map.map (Set.map g) $ Map.mapKeysWith Set.union f ab dc = Map.map (Set.map f) $ Map.mapKeysWith Set.union g ba -- TODO: Add torus? -- | Construct a /mesh/ graph from two lists of vertices. -- Complexity: /O(L1 * L2 * log(L1 * L2))/ time, where /L1/ and /L2/ are the -- lengths of the given lists. -- -- @ -- mesh xs [] == 'empty' -- mesh [] ys == 'empty' -- mesh [x] [y] == 'leftVertex' (x,y) -- mesh [1,1] [\'a\',\'b\'] == 'biclique' [(1,\'a\'), (1,\'b\')] [(1,\'a\'), (1,\'b\')] -- mesh [1,2] [\'a\',\'b\'] == 'biclique' [(1,\'a\'), (2,\'b\')] [(1,\'b\'), (2,\'a\')] -- @
759
bimap f g (BAM ab ba) = BAM cd dc where cd = Map.map (Set.map g) $ Map.mapKeysWith Set.union f ab dc = Map.map (Set.map f) $ Map.mapKeysWith Set.union g ba -- TODO: Add torus? -- | Construct a /mesh/ graph from two lists of vertices. -- Complexity: /O(L1 * L2 * log(L1 * L2))/ time, where /L1/ and /L2/ are the -- lengths of the given lists. -- -- @ -- mesh xs [] == 'empty' -- mesh [] ys == 'empty' -- mesh [x] [y] == 'leftVertex' (x,y) -- mesh [1,1] [\'a\',\'b\'] == 'biclique' [(1,\'a\'), (1,\'b\')] [(1,\'a\'), (1,\'b\')] -- mesh [1,2] [\'a\',\'b\'] == 'biclique' [(1,\'a\'), (2,\'b\')] [(1,\'b\'), (2,\'a\')] -- @
657
true
true
1
10
294
185
102
83
null
null
futufeld/eclogues
eclogues-impl/gen-hs/AuroraSchedulerManager.hs
bsd-3-clause
to_ReplaceCronTemplate_args _ = P.error "not a struct"
54
to_ReplaceCronTemplate_args _ = P.error "not a struct"
54
to_ReplaceCronTemplate_args _ = P.error "not a struct"
54
false
false
0
6
6
14
6
8
null
null
benjaminselfridge/logix
src/Calculus.hs
bsd-3-clause
unboundTerms termBindings t = case lookup (termPatId t) termBindings of Nothing -> [t] Just _ -> [] -- | Given an assignment and a formula pattern, return a list of all the patterns in -- the formula that are unbound. Use this in conjunction with instFormulaPat.
274
unboundTerms termBindings t = case lookup (termPatId t) termBindings of Nothing -> [t] Just _ -> [] -- | Given an assignment and a formula pattern, return a list of all the patterns in -- the formula that are unbound. Use this in conjunction with instFormulaPat.
274
unboundTerms termBindings t = case lookup (termPatId t) termBindings of Nothing -> [t] Just _ -> [] -- | Given an assignment and a formula pattern, return a list of all the patterns in -- the formula that are unbound. Use this in conjunction with instFormulaPat.
274
false
false
0
8
57
48
24
24
null
null
diku-dk/futhark
src/Futhark/IR/Traversals.hs
isc
walkExpM tv (BasicOp (Iota n x s _)) = walkOnSubExp tv n >> walkOnSubExp tv x >> walkOnSubExp tv s
100
walkExpM tv (BasicOp (Iota n x s _)) = walkOnSubExp tv n >> walkOnSubExp tv x >> walkOnSubExp tv s
100
walkExpM tv (BasicOp (Iota n x s _)) = walkOnSubExp tv n >> walkOnSubExp tv x >> walkOnSubExp tv s
100
false
false
0
9
21
52
24
28
null
null
spyked/writer-monkey
src/Monkey/Util/Processing.hs
bsd-3-clause
consecutivesOf _ _ = []
23
consecutivesOf _ _ = []
23
consecutivesOf _ _ = []
23
false
false
1
6
4
14
6
8
null
null
urbanslug/ghc
compiler/types/Type.hs
bsd-3-clause
isForAllTy :: Type -> Bool isForAllTy (ForAllTy _ _) = True
59
isForAllTy :: Type -> Bool isForAllTy (ForAllTy _ _) = True
59
isForAllTy (ForAllTy _ _) = True
32
false
true
0
9
10
32
14
18
null
null
jystic/QuickSpec
qs1/TinyWMProperties.hs
bsd-3-clause
prop_eq_symm (a :: T) b = a == b ==> b == a
45
prop_eq_symm (a :: T) b = a == b ==> b == a
45
prop_eq_symm (a :: T) b = a == b ==> b == a
45
false
false
1
7
14
34
15
19
null
null
adept/hledger
hledger/Hledger/Cli/Commands/Accounts.hs
gpl-3.0
-- | The accounts command. accounts :: CliOpts -> Journal -> IO () accounts CliOpts{rawopts_=rawopts, reportspec_=ReportSpec{_rsQuery=query,_rsReportOpts=ropts}} j = do -- 1. identify the accounts we'll show let tree = tree_ ropts declared = boolopt "declared" rawopts used = boolopt "used" rawopts types = boolopt "types" rawopts -- a depth limit will clip and exclude account names later, but we don't want to exclude accounts at this stage nodepthq = dbg1 "nodepthq" $ filterQuery (not . queryIsDepth) query -- just the acct: part of the query will be reapplied later, after clipping acctq = dbg1 "acctq" $ filterQuery queryIsAcct query depth = dbg1 "depth" $ queryDepth $ filterQuery queryIsDepth query matcheddeclaredaccts = dbg1 "matcheddeclaredaccts" $ filter (matchesAccountExtra (journalAccountType j) (journalInheritedAccountTags j) nodepthq) $ map fst $ jdeclaredaccounts j matchedusedaccts = dbg5 "matchedusedaccts" $ map paccount $ journalPostings $ filterJournalPostings nodepthq j accts = dbg5 "accts to show" $ -- no need to nub/sort, accountTree will if | declared && not used -> matcheddeclaredaccts | not declared && used -> matchedusedaccts | otherwise -> matcheddeclaredaccts ++ matchedusedaccts -- 2. sort them by declaration order and name, at each level of their tree structure sortedaccts = sortAccountNamesByDeclaration j tree accts -- 3. if there's a depth limit, depth-clip and remove any no longer useful items clippedaccts = dbg1 "clippedaccts" $ filter (matchesAccount acctq) $ -- clipping can leave accounts that no longer match the query, remove such nub $ -- clipping can leave duplicates (adjacent, hopefully) filter (not . T.null) $ -- depth:0 can leave nulls map (clipAccountName depth) $ -- clip at depth if specified sortedaccts -- 4. print what remains as a list or tree, maybe applying --drop in the former case. -- With --types, also show the account type. let -- some contortions here to show types nicely aligned showName a = case accountlistmode_ ropts of ALTree -> indent <> accountLeafName droppedName ALFlat -> droppedName where indent = T.replicate (2 * (max 0 (accountNameLevel a - drop_ ropts) - 1)) " " droppedName = accountNameDrop (drop_ ropts) a showType a | types = spacer <> " ; type: " <> maybe "" (T.pack . show) (journalAccountType j a) | otherwise = "" where spacer = T.replicate (maxwidth - T.length (showName a)) " " maxwidth = maximum $ map (T.length . showName) clippedaccts forM_ clippedaccts $ \a -> T.putStrLn $ showName a <> showType a
2,926
accounts :: CliOpts -> Journal -> IO () accounts CliOpts{rawopts_=rawopts, reportspec_=ReportSpec{_rsQuery=query,_rsReportOpts=ropts}} j = do -- 1. identify the accounts we'll show let tree = tree_ ropts declared = boolopt "declared" rawopts used = boolopt "used" rawopts types = boolopt "types" rawopts -- a depth limit will clip and exclude account names later, but we don't want to exclude accounts at this stage nodepthq = dbg1 "nodepthq" $ filterQuery (not . queryIsDepth) query -- just the acct: part of the query will be reapplied later, after clipping acctq = dbg1 "acctq" $ filterQuery queryIsAcct query depth = dbg1 "depth" $ queryDepth $ filterQuery queryIsDepth query matcheddeclaredaccts = dbg1 "matcheddeclaredaccts" $ filter (matchesAccountExtra (journalAccountType j) (journalInheritedAccountTags j) nodepthq) $ map fst $ jdeclaredaccounts j matchedusedaccts = dbg5 "matchedusedaccts" $ map paccount $ journalPostings $ filterJournalPostings nodepthq j accts = dbg5 "accts to show" $ -- no need to nub/sort, accountTree will if | declared && not used -> matcheddeclaredaccts | not declared && used -> matchedusedaccts | otherwise -> matcheddeclaredaccts ++ matchedusedaccts -- 2. sort them by declaration order and name, at each level of their tree structure sortedaccts = sortAccountNamesByDeclaration j tree accts -- 3. if there's a depth limit, depth-clip and remove any no longer useful items clippedaccts = dbg1 "clippedaccts" $ filter (matchesAccount acctq) $ -- clipping can leave accounts that no longer match the query, remove such nub $ -- clipping can leave duplicates (adjacent, hopefully) filter (not . T.null) $ -- depth:0 can leave nulls map (clipAccountName depth) $ -- clip at depth if specified sortedaccts -- 4. print what remains as a list or tree, maybe applying --drop in the former case. -- With --types, also show the account type. let -- some contortions here to show types nicely aligned showName a = case accountlistmode_ ropts of ALTree -> indent <> accountLeafName droppedName ALFlat -> droppedName where indent = T.replicate (2 * (max 0 (accountNameLevel a - drop_ ropts) - 1)) " " droppedName = accountNameDrop (drop_ ropts) a showType a | types = spacer <> " ; type: " <> maybe "" (T.pack . show) (journalAccountType j a) | otherwise = "" where spacer = T.replicate (maxwidth - T.length (showName a)) " " maxwidth = maximum $ map (T.length . showName) clippedaccts forM_ clippedaccts $ \a -> T.putStrLn $ showName a <> showType a
2,899
accounts CliOpts{rawopts_=rawopts, reportspec_=ReportSpec{_rsQuery=query,_rsReportOpts=ropts}} j = do -- 1. identify the accounts we'll show let tree = tree_ ropts declared = boolopt "declared" rawopts used = boolopt "used" rawopts types = boolopt "types" rawopts -- a depth limit will clip and exclude account names later, but we don't want to exclude accounts at this stage nodepthq = dbg1 "nodepthq" $ filterQuery (not . queryIsDepth) query -- just the acct: part of the query will be reapplied later, after clipping acctq = dbg1 "acctq" $ filterQuery queryIsAcct query depth = dbg1 "depth" $ queryDepth $ filterQuery queryIsDepth query matcheddeclaredaccts = dbg1 "matcheddeclaredaccts" $ filter (matchesAccountExtra (journalAccountType j) (journalInheritedAccountTags j) nodepthq) $ map fst $ jdeclaredaccounts j matchedusedaccts = dbg5 "matchedusedaccts" $ map paccount $ journalPostings $ filterJournalPostings nodepthq j accts = dbg5 "accts to show" $ -- no need to nub/sort, accountTree will if | declared && not used -> matcheddeclaredaccts | not declared && used -> matchedusedaccts | otherwise -> matcheddeclaredaccts ++ matchedusedaccts -- 2. sort them by declaration order and name, at each level of their tree structure sortedaccts = sortAccountNamesByDeclaration j tree accts -- 3. if there's a depth limit, depth-clip and remove any no longer useful items clippedaccts = dbg1 "clippedaccts" $ filter (matchesAccount acctq) $ -- clipping can leave accounts that no longer match the query, remove such nub $ -- clipping can leave duplicates (adjacent, hopefully) filter (not . T.null) $ -- depth:0 can leave nulls map (clipAccountName depth) $ -- clip at depth if specified sortedaccts -- 4. print what remains as a list or tree, maybe applying --drop in the former case. -- With --types, also show the account type. let -- some contortions here to show types nicely aligned showName a = case accountlistmode_ ropts of ALTree -> indent <> accountLeafName droppedName ALFlat -> droppedName where indent = T.replicate (2 * (max 0 (accountNameLevel a - drop_ ropts) - 1)) " " droppedName = accountNameDrop (drop_ ropts) a showType a | types = spacer <> " ; type: " <> maybe "" (T.pack . show) (journalAccountType j a) | otherwise = "" where spacer = T.replicate (maxwidth - T.length (showName a)) " " maxwidth = maximum $ map (T.length . showName) clippedaccts forM_ clippedaccts $ \a -> T.putStrLn $ showName a <> showType a
2,859
true
true
0
20
815
624
309
315
null
null
kim/amazonka
amazonka-s3/gen/Network/AWS/S3/GetBucketPolicy.hs
mpl-2.0
-- | 'GetBucketPolicy' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'gbpBucket' @::@ 'Text' -- getBucketPolicy :: Text -- ^ 'gbpBucket' -> GetBucketPolicy getBucketPolicy p1 = GetBucketPolicy { _gbpBucket = p1 }
273
getBucketPolicy :: Text -- ^ 'gbpBucket' -> GetBucketPolicy getBucketPolicy p1 = GetBucketPolicy { _gbpBucket = p1 }
140
getBucketPolicy p1 = GetBucketPolicy { _gbpBucket = p1 }
64
true
true
0
7
60
37
22
15
null
null
brendanhay/gogol
gogol-cloudtasks/gen/Network/Google/Resource/CloudTasks/Projects/Locations/Queues/Pause.hs
mpl-2.0
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\"). proUploadType :: Lens' ProjectsLocationsQueuesPause (Maybe Text) proUploadType = lens _proUploadType (\ s a -> s{_proUploadType = a})
212
proUploadType :: Lens' ProjectsLocationsQueuesPause (Maybe Text) proUploadType = lens _proUploadType (\ s a -> s{_proUploadType = a})
141
proUploadType = lens _proUploadType (\ s a -> s{_proUploadType = a})
76
true
true
0
9
34
48
25
23
null
null
craynafinal/cs557_functional_languages
practice/week4/aug.hs
mit
findWord :: Word -> Dictionary -> [Type] findWord w Nil = []
69
findWord :: Word -> Dictionary -> [Type] findWord w Nil = []
69
findWord w Nil = []
21
false
true
0
7
20
29
15
14
null
null
snowleopard/shaking-up-ghc
src/Expression.hs
bsd-3-clause
-- | Is the build currently in stage 0? stage0 :: Predicate stage0 = stage Stage0
81
stage0 :: Predicate stage0 = stage Stage0
41
stage0 = stage Stage0
21
true
true
0
6
15
21
9
12
null
null
HJvT/com
System/Win32/Com.hs
bsd-3-clause
versionInfo :: OSVersionInfo versionInfo = unsafePerformIO $ do (j,n,d) <- primGetVersionInfo return (OSVersionInfo j n d) -- | The @CLSCTX@ enumeration is used by @comCreateInstance@ to specify -- execution context in which we'd like to component to be created -- (just use @AnyProcess@ if you're not too fussed..) --
324
versionInfo :: OSVersionInfo versionInfo = unsafePerformIO $ do (j,n,d) <- primGetVersionInfo return (OSVersionInfo j n d) -- | The @CLSCTX@ enumeration is used by @comCreateInstance@ to specify -- execution context in which we'd like to component to be created -- (just use @AnyProcess@ if you're not too fussed..) --
324
versionInfo = unsafePerformIO $ do (j,n,d) <- primGetVersionInfo return (OSVersionInfo j n d) -- | The @CLSCTX@ enumeration is used by @comCreateInstance@ to specify -- execution context in which we'd like to component to be created -- (just use @AnyProcess@ if you're not too fussed..) --
295
false
true
0
10
54
51
28
23
null
null
ennocramer/hindent
src/HIndent/Styles/Gibiansky.hs
bsd-3-clause
lambdaCaseExpr :: Exp NodeInfo -> Printer State () lambdaCaseExpr (LCase _ alts) = do write "\\case" newline writeCaseAlts alts
133
lambdaCaseExpr :: Exp NodeInfo -> Printer State () lambdaCaseExpr (LCase _ alts) = do write "\\case" newline writeCaseAlts alts
133
lambdaCaseExpr (LCase _ alts) = do write "\\case" newline writeCaseAlts alts
82
false
true
0
7
24
51
22
29
null
null
juodaspaulius/bclafer_old
src/Language/Clafer/Intermediate/Desugarer.hs
mit
desugarDeclaration :: Declaration -> [IElement] desugarDeclaration x = case x of ElementDecl element -> desugarDeclaration $ PosElementDecl noSpan element PosElementDecl s element -> desugarElement element _ -> error "desugared"
237
desugarDeclaration :: Declaration -> [IElement] desugarDeclaration x = case x of ElementDecl element -> desugarDeclaration $ PosElementDecl noSpan element PosElementDecl s element -> desugarElement element _ -> error "desugared"
237
desugarDeclaration x = case x of ElementDecl element -> desugarDeclaration $ PosElementDecl noSpan element PosElementDecl s element -> desugarElement element _ -> error "desugared"
189
false
true
2
6
37
59
29
30
null
null
polygonhell/textEditor
src/Layout.hs
bsd-3-clause
test :: Root test = Root (Rect 0 0 20 50) $ toLayout (HSplit 24 (toLayout Empty) (toLayout Empty))
98
test :: Root test = Root (Rect 0 0 20 50) $ toLayout (HSplit 24 (toLayout Empty) (toLayout Empty))
98
test = Root (Rect 0 0 20 50) $ toLayout (HSplit 24 (toLayout Empty) (toLayout Empty))
85
false
true
0
10
18
61
28
33
null
null
todays-mitsui/discussion
src/Discussion/Converter.hs
mit
compact (Lambda vs1 (Lambda vs2 t)) = compact $ Lambda (vs1 ++ vs2) (compact t)
79
compact (Lambda vs1 (Lambda vs2 t)) = compact $ Lambda (vs1 ++ vs2) (compact t)
79
compact (Lambda vs1 (Lambda vs2 t)) = compact $ Lambda (vs1 ++ vs2) (compact t)
79
false
false
0
9
14
47
23
24
null
null
k0001/pipes-attoparsec
tests/Test/Attoparsec.hs
bsd-3-clause
isRight _ = False
25
isRight _ = False
25
isRight _ = False
25
false
false
0
5
11
9
4
5
null
null
sdiehl/unirewrite
src/Eval.hs
mit
incIter :: Eval c a () incIter = modify $ \s -> s { iter = iter s + 1 }
71
incIter :: Eval c a () incIter = modify $ \s -> s { iter = iter s + 1 }
71
incIter = modify $ \s -> s { iter = iter s + 1 }
48
false
true
2
9
20
54
25
29
null
null
alphaHeavy/hlint
src/Hint/List.hs
gpl-2.0
useCons False (view -> App2 op x y) | op ~= "++", Just x2 <- f x, not $ isAppend y = Just $ InfixApp an x2 (QConOp an $ list_cons_name an) y where f (Lit _ (String _ [x] _)) = Just $ Lit an $ Char an x (show x) f (List _ [x]) = Just $ paren x f _ = Nothing
292
useCons False (view -> App2 op x y) | op ~= "++", Just x2 <- f x, not $ isAppend y = Just $ InfixApp an x2 (QConOp an $ list_cons_name an) y where f (Lit _ (String _ [x] _)) = Just $ Lit an $ Char an x (show x) f (List _ [x]) = Just $ paren x f _ = Nothing
292
useCons False (view -> App2 op x y) | op ~= "++", Just x2 <- f x, not $ isAppend y = Just $ InfixApp an x2 (QConOp an $ list_cons_name an) y where f (Lit _ (String _ [x] _)) = Just $ Lit an $ Char an x (show x) f (List _ [x]) = Just $ paren x f _ = Nothing
292
false
false
2
10
100
175
83
92
null
null
AlexeyRaga/eta
compiler/ETA/Main/HscMain.hs
bsd-3-clause
hscTcRnLookupRdrName :: HscEnv -> Located RdrName -> IO [Name] hscTcRnLookupRdrName hsc_env0 rdr_name = runInteractiveHsc hsc_env0 $ do { hsc_env <- getHscEnv ; ioMsgMaybe $ tcRnLookupRdrName hsc_env rdr_name }
223
hscTcRnLookupRdrName :: HscEnv -> Located RdrName -> IO [Name] hscTcRnLookupRdrName hsc_env0 rdr_name = runInteractiveHsc hsc_env0 $ do { hsc_env <- getHscEnv ; ioMsgMaybe $ tcRnLookupRdrName hsc_env rdr_name }
223
hscTcRnLookupRdrName hsc_env0 rdr_name = runInteractiveHsc hsc_env0 $ do { hsc_env <- getHscEnv ; ioMsgMaybe $ tcRnLookupRdrName hsc_env rdr_name }
160
false
true
0
9
40
62
30
32
null
null
Southern-Exposure-Seed-Exchange/southernexposure.com
manage.hs
gpl-3.0
installDependency :: FilePath -> [String] -> FilePath -> (Handle -> IO ()) -> String -> IO () installDependency cmd args dir outputHandler description = printInfo ("Installing " ++ description) >> run cmd args dir outputHandler >>= waitForProcess >>= printExitMessage (description ++ " Installed") (description ++ "Installation Failed")
380
installDependency :: FilePath -> [String] -> FilePath -> (Handle -> IO ()) -> String -> IO () installDependency cmd args dir outputHandler description = printInfo ("Installing " ++ description) >> run cmd args dir outputHandler >>= waitForProcess >>= printExitMessage (description ++ " Installed") (description ++ "Installation Failed")
380
installDependency cmd args dir outputHandler description = printInfo ("Installing " ++ description) >> run cmd args dir outputHandler >>= waitForProcess >>= printExitMessage (description ++ " Installed") (description ++ "Installation Failed")
286
false
true
0
12
90
112
56
56
null
null
ezyang/ghc
compiler/utils/BooleanFormula.hs
bsd-3-clause
simplify f (And xs) = mkAnd (map (\(L l x) -> L l (simplify f x)) xs)
69
simplify f (And xs) = mkAnd (map (\(L l x) -> L l (simplify f x)) xs)
69
simplify f (And xs) = mkAnd (map (\(L l x) -> L l (simplify f x)) xs)
69
false
false
0
12
16
57
28
29
null
null
brendanhay/gogol
gogol-adexchangebuyer2/gen/Network/Google/Resource/AdExchangeBuyer2/Accounts/Creatives/List.hs
mpl-2.0
-- | OAuth access token. aclAccessToken :: Lens' AccountsCreativesList (Maybe Text) aclAccessToken = lens _aclAccessToken (\ s a -> s{_aclAccessToken = a})
163
aclAccessToken :: Lens' AccountsCreativesList (Maybe Text) aclAccessToken = lens _aclAccessToken (\ s a -> s{_aclAccessToken = a})
138
aclAccessToken = lens _aclAccessToken (\ s a -> s{_aclAccessToken = a})
79
true
true
0
9
29
48
25
23
null
null
bagl/takusen-oracle
Database/Util.hs
bsd-3-clause
utcTimeToPGDatetime :: UTCTime -> String utcTimeToPGDatetime utc = utcTimeToIsoString utc "T" adjYear mkSuffix where mkSuffix year1 = if year1 < 1 then " BC" else " AD" adjYear year1 = if year1 < 1 then abs(year1 - 1) else year1
243
utcTimeToPGDatetime :: UTCTime -> String utcTimeToPGDatetime utc = utcTimeToIsoString utc "T" adjYear mkSuffix where mkSuffix year1 = if year1 < 1 then " BC" else " AD" adjYear year1 = if year1 < 1 then abs(year1 - 1) else year1
242
utcTimeToPGDatetime utc = utcTimeToIsoString utc "T" adjYear mkSuffix where mkSuffix year1 = if year1 < 1 then " BC" else " AD" adjYear year1 = if year1 < 1 then abs(year1 - 1) else year1
201
false
true
0
8
54
80
41
39
null
null
simhu/cubical
Eval.hs
mit
look x r@(OEnv (PDef es r1) o) = case lookupIdent x es of Just (y,t) -> (y,eval r t) Nothing -> look x (OEnv r1 o)
123
look x r@(OEnv (PDef es r1) o) = case lookupIdent x es of Just (y,t) -> (y,eval r t) Nothing -> look x (OEnv r1 o)
123
look x r@(OEnv (PDef es r1) o) = case lookupIdent x es of Just (y,t) -> (y,eval r t) Nothing -> look x (OEnv r1 o)
123
false
false
1
10
34
90
42
48
null
null
gnn/Hets
OWL2/ColonKeywords.hs
gpl-2.0
annotationsC :: String annotationsC = "Annotations:"
52
annotationsC :: String annotationsC = "Annotations:"
52
annotationsC = "Annotations:"
29
false
true
0
4
5
11
6
5
null
null
shayan-najd/HsParser
U/Outputable.hs
gpl-3.0
fcat ds = SDoc $ \sty -> U.Pretty.fcat [runSDoc d sty | d <- ds]
64
fcat ds = SDoc $ \sty -> U.Pretty.fcat [runSDoc d sty | d <- ds]
64
fcat ds = SDoc $ \sty -> U.Pretty.fcat [runSDoc d sty | d <- ds]
64
false
false
1
10
14
43
20
23
null
null
dmalikov/lambdabot
Plugin/Pl/Optimize.hs
mit
toMonadPlus :: MonadPlus m => Maybe a -> m a toMonadPlus Nothing = mzero
72
toMonadPlus :: MonadPlus m => Maybe a -> m a toMonadPlus Nothing = mzero
72
toMonadPlus Nothing = mzero
27
false
true
0
8
13
36
15
21
null
null
PeterScott/haskell-kyoto-tycoon
Database/KyotoTycoon.hs
bsd-3-clause
-- Helper function for doing several optional arguments. maybeArgs :: [(ByteString, ByteString)] -> [(ByteString, Maybe ByteString)] -> [(ByteString, ByteString)] lst `maybeArgs` args = foldl' maybeArg lst args
220
maybeArgs :: [(ByteString, ByteString)] -> [(ByteString, Maybe ByteString)] -> [(ByteString, ByteString)] lst `maybeArgs` args = foldl' maybeArg lst args
163
lst `maybeArgs` args = foldl' maybeArg lst args
47
true
true
0
9
36
68
38
30
null
null
jtobin/deprecated-observable
src/Observable/MCMC/MALA.hs
bsd-3-clause
mala e = do Chain current target _ store <- get let step = getStepSize e store proposal <- lift $ perturb target current step zc <- lift unit let cMean = localMean target current step pMean = localMean target proposal step next = nextState target (current, cMean) (proposal, pMean) step zc newStore = updateStepSize step store put $ Chain next target (logObjective target next) newStore return next
448
mala e = do Chain current target _ store <- get let step = getStepSize e store proposal <- lift $ perturb target current step zc <- lift unit let cMean = localMean target current step pMean = localMean target proposal step next = nextState target (current, cMean) (proposal, pMean) step zc newStore = updateStepSize step store put $ Chain next target (logObjective target next) newStore return next
448
mala e = do Chain current target _ store <- get let step = getStepSize e store proposal <- lift $ perturb target current step zc <- lift unit let cMean = localMean target current step pMean = localMean target proposal step next = nextState target (current, cMean) (proposal, pMean) step zc newStore = updateStepSize step store put $ Chain next target (logObjective target next) newStore return next
448
false
false
0
11
117
163
76
87
null
null
norm2782/uuagc
src/CommonTypes.hs
bsd-3-clause
capitalize :: String -> String capitalize [] = []
60
capitalize :: String -> String capitalize [] = []
60
capitalize [] = []
22
false
true
0
6
19
22
11
11
null
null
nicball/fvckbot
src/Main.hs
bsd-3-clause
setAnswer :: Text -> Text -> IO () setAnswer question answer = execute sqlConn "insert into pia values (?, ?)" (question, answer)
131
setAnswer :: Text -> Text -> IO () setAnswer question answer = execute sqlConn "insert into pia values (?, ?)" (question, answer)
131
setAnswer question answer = execute sqlConn "insert into pia values (?, ?)" (question, answer)
96
false
true
0
9
23
48
22
26
null
null
ChrisCoffey/synacor_challenge
Synacor/src/Synacor/Interpreter.hs
gpl-3.0
interpret :: CurrentState -> (Maybe Output, CurrentState) interpret machine@(CurrentState idx stk mem) = let memList = map snd . M.toList $ mem (opcode, length) = parseOpcode . (drop (asInt idx)) $ memList --ha, being lazy here nextOp = idx + (fromIntegral length) handle = f where --0 f Halt = (Just Exit, machine) --1 f (Set a b) = let valB = readFrom b mem newMem = writeTo a valB mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --2 f (Push a) = let a' = readFrom a mem in (Nothing, CurrentState {inst = nextOp, stack = a':stk, memory = mem }) --3 f (Pop a) = let newMem = writeTo a (head stk) mem res = if L.null stk then Just Exit else Nothing in (res , CurrentState {inst = nextOp, stack = tail stk, memory = newMem} ) --4 f (Equ a b c) = let b' = readFrom b mem c' = readFrom c mem newR = if b' == c' then 1 else 0 newMem = writeTo a newR mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --5 f (Gt a b c) = let b' = readFrom b mem c' = readFrom c mem newR = if b' > c' then 1 else 0 newMem = writeTo a newR mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --6 f (Jmp a) = let a' = readFrom a mem in (Nothing, CurrentState {inst = a', stack = stk, memory = mem} ) --7 f (Jt a b) = let a' = readFrom a mem b' = readFrom b mem ni = if a' > 0 then b' else nextOp in (Nothing, CurrentState {inst = ni, stack = stk, memory = mem} ) --8 f (Jf a b) = let a' = readFrom a mem b' = readFrom b mem ni = if a' == 0 then b' else nextOp in (Nothing, CurrentState {inst = ni, stack = stk, memory = mem} ) --9 f (Add a b c) = let b' = readFrom b mem c' = readFrom c mem res = (b' + c') `mod` (32768 :: Word16) newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --10 f (Mult a b c) = let b' = readFrom b mem c' = readFrom c mem res = (b' * c') `mod` (32768 :: Word16) newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --11 f (Mod a b c) = let b' = readFrom b mem c' = readFrom c mem res = b' `mod` c' newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --12 f (And a b c) = let --todo add helpers to reduce all this boiler plate b' = readFrom b mem c' = readFrom c mem res = (.&.) b' c' newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --13 f (Or a b c) = let b' = readFrom b mem c' = readFrom c mem res = (.|.) b' c' newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --14 f (Not a b) = let b' = readFrom b mem res = (complement b') `xor` (32768 :: Word16) newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --15 f (RMem a b) = let isReg = maxAddress < b b' = if isReg then (M.! (asInt (readFrom b mem))) mem else (M.! (asInt b)) mem newMem = writeTo a b' mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --16 f (WMem a b) = let isReg = maxAddress < a a' = if isReg then readFrom a mem else a b' = readFrom b mem newMem = writeTo a' b' mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --17 f (Call a) = let a' = readFrom a mem in (Nothing, CurrentState {inst = a', stack = nextOp:stk, memory = mem }) --18 f Ret = (if null stk then Just Exit else Nothing, CurrentState {inst = head stk, stack = tail stk, memory = mem }) --19 f (Out c) = let c' = readFrom c mem in (Just (Term c'), CurrentState {inst = nextOp, stack = stk, memory = mem} ) --20 f (In a) = (Just (TermIn a), CurrentState {inst = nextOp, stack = stk, memory = mem} ) --21 f NoOp = (Nothing, CurrentState {inst = nextOp, stack = stk, memory = mem} ) --unknown f x = (Just Exit, CurrentState {inst = nextOp, stack = stk, memory = mem} ) in handle opcode
5,101
interpret :: CurrentState -> (Maybe Output, CurrentState) interpret machine@(CurrentState idx stk mem) = let memList = map snd . M.toList $ mem (opcode, length) = parseOpcode . (drop (asInt idx)) $ memList --ha, being lazy here nextOp = idx + (fromIntegral length) handle = f where --0 f Halt = (Just Exit, machine) --1 f (Set a b) = let valB = readFrom b mem newMem = writeTo a valB mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --2 f (Push a) = let a' = readFrom a mem in (Nothing, CurrentState {inst = nextOp, stack = a':stk, memory = mem }) --3 f (Pop a) = let newMem = writeTo a (head stk) mem res = if L.null stk then Just Exit else Nothing in (res , CurrentState {inst = nextOp, stack = tail stk, memory = newMem} ) --4 f (Equ a b c) = let b' = readFrom b mem c' = readFrom c mem newR = if b' == c' then 1 else 0 newMem = writeTo a newR mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --5 f (Gt a b c) = let b' = readFrom b mem c' = readFrom c mem newR = if b' > c' then 1 else 0 newMem = writeTo a newR mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --6 f (Jmp a) = let a' = readFrom a mem in (Nothing, CurrentState {inst = a', stack = stk, memory = mem} ) --7 f (Jt a b) = let a' = readFrom a mem b' = readFrom b mem ni = if a' > 0 then b' else nextOp in (Nothing, CurrentState {inst = ni, stack = stk, memory = mem} ) --8 f (Jf a b) = let a' = readFrom a mem b' = readFrom b mem ni = if a' == 0 then b' else nextOp in (Nothing, CurrentState {inst = ni, stack = stk, memory = mem} ) --9 f (Add a b c) = let b' = readFrom b mem c' = readFrom c mem res = (b' + c') `mod` (32768 :: Word16) newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --10 f (Mult a b c) = let b' = readFrom b mem c' = readFrom c mem res = (b' * c') `mod` (32768 :: Word16) newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --11 f (Mod a b c) = let b' = readFrom b mem c' = readFrom c mem res = b' `mod` c' newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --12 f (And a b c) = let --todo add helpers to reduce all this boiler plate b' = readFrom b mem c' = readFrom c mem res = (.&.) b' c' newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --13 f (Or a b c) = let b' = readFrom b mem c' = readFrom c mem res = (.|.) b' c' newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --14 f (Not a b) = let b' = readFrom b mem res = (complement b') `xor` (32768 :: Word16) newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --15 f (RMem a b) = let isReg = maxAddress < b b' = if isReg then (M.! (asInt (readFrom b mem))) mem else (M.! (asInt b)) mem newMem = writeTo a b' mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --16 f (WMem a b) = let isReg = maxAddress < a a' = if isReg then readFrom a mem else a b' = readFrom b mem newMem = writeTo a' b' mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --17 f (Call a) = let a' = readFrom a mem in (Nothing, CurrentState {inst = a', stack = nextOp:stk, memory = mem }) --18 f Ret = (if null stk then Just Exit else Nothing, CurrentState {inst = head stk, stack = tail stk, memory = mem }) --19 f (Out c) = let c' = readFrom c mem in (Just (Term c'), CurrentState {inst = nextOp, stack = stk, memory = mem} ) --20 f (In a) = (Just (TermIn a), CurrentState {inst = nextOp, stack = stk, memory = mem} ) --21 f NoOp = (Nothing, CurrentState {inst = nextOp, stack = stk, memory = mem} ) --unknown f x = (Just Exit, CurrentState {inst = nextOp, stack = stk, memory = mem} ) in handle opcode
5,101
interpret machine@(CurrentState idx stk mem) = let memList = map snd . M.toList $ mem (opcode, length) = parseOpcode . (drop (asInt idx)) $ memList --ha, being lazy here nextOp = idx + (fromIntegral length) handle = f where --0 f Halt = (Just Exit, machine) --1 f (Set a b) = let valB = readFrom b mem newMem = writeTo a valB mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --2 f (Push a) = let a' = readFrom a mem in (Nothing, CurrentState {inst = nextOp, stack = a':stk, memory = mem }) --3 f (Pop a) = let newMem = writeTo a (head stk) mem res = if L.null stk then Just Exit else Nothing in (res , CurrentState {inst = nextOp, stack = tail stk, memory = newMem} ) --4 f (Equ a b c) = let b' = readFrom b mem c' = readFrom c mem newR = if b' == c' then 1 else 0 newMem = writeTo a newR mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --5 f (Gt a b c) = let b' = readFrom b mem c' = readFrom c mem newR = if b' > c' then 1 else 0 newMem = writeTo a newR mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --6 f (Jmp a) = let a' = readFrom a mem in (Nothing, CurrentState {inst = a', stack = stk, memory = mem} ) --7 f (Jt a b) = let a' = readFrom a mem b' = readFrom b mem ni = if a' > 0 then b' else nextOp in (Nothing, CurrentState {inst = ni, stack = stk, memory = mem} ) --8 f (Jf a b) = let a' = readFrom a mem b' = readFrom b mem ni = if a' == 0 then b' else nextOp in (Nothing, CurrentState {inst = ni, stack = stk, memory = mem} ) --9 f (Add a b c) = let b' = readFrom b mem c' = readFrom c mem res = (b' + c') `mod` (32768 :: Word16) newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --10 f (Mult a b c) = let b' = readFrom b mem c' = readFrom c mem res = (b' * c') `mod` (32768 :: Word16) newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --11 f (Mod a b c) = let b' = readFrom b mem c' = readFrom c mem res = b' `mod` c' newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --12 f (And a b c) = let --todo add helpers to reduce all this boiler plate b' = readFrom b mem c' = readFrom c mem res = (.&.) b' c' newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --13 f (Or a b c) = let b' = readFrom b mem c' = readFrom c mem res = (.|.) b' c' newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --14 f (Not a b) = let b' = readFrom b mem res = (complement b') `xor` (32768 :: Word16) newMem = writeTo a res mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --15 f (RMem a b) = let isReg = maxAddress < b b' = if isReg then (M.! (asInt (readFrom b mem))) mem else (M.! (asInt b)) mem newMem = writeTo a b' mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --16 f (WMem a b) = let isReg = maxAddress < a a' = if isReg then readFrom a mem else a b' = readFrom b mem newMem = writeTo a' b' mem in (Nothing, CurrentState {inst = nextOp, stack = stk, memory = newMem} ) --17 f (Call a) = let a' = readFrom a mem in (Nothing, CurrentState {inst = a', stack = nextOp:stk, memory = mem }) --18 f Ret = (if null stk then Just Exit else Nothing, CurrentState {inst = head stk, stack = tail stk, memory = mem }) --19 f (Out c) = let c' = readFrom c mem in (Just (Term c'), CurrentState {inst = nextOp, stack = stk, memory = mem} ) --20 f (In a) = (Just (TermIn a), CurrentState {inst = nextOp, stack = stk, memory = mem} ) --21 f NoOp = (Nothing, CurrentState {inst = nextOp, stack = stk, memory = mem} ) --unknown f x = (Just Exit, CurrentState {inst = nextOp, stack = stk, memory = mem} ) in handle opcode
5,043
false
true
0
21
2,078
1,907
1,058
849
null
null
solvery/lang-features
haskell/function_4.hs
gpl-2.0
1 = 1
5
1 = 1
5
1 = 1
5
false
false
1
5
2
10
3
7
null
null
brendanhay/gogol
gogol-people/gen/Network/Google/People/Types/Product.hs
mpl-2.0
-- | The person\'s external IDs. perExternalIds :: Lens' Person [ExternalId] perExternalIds = lens _perExternalIds (\ s a -> s{_perExternalIds = a}) . _Default . _Coerce
189
perExternalIds :: Lens' Person [ExternalId] perExternalIds = lens _perExternalIds (\ s a -> s{_perExternalIds = a}) . _Default . _Coerce
156
perExternalIds = lens _perExternalIds (\ s a -> s{_perExternalIds = a}) . _Default . _Coerce
112
true
true
0
11
45
53
28
25
null
null
oisdk/SSystemOpt
src/Data/Utils.hs
mit
repS :: [a] -> Int -> [a] -> [a] repS s m r = go m where go 0 = r go n = s ++ go (n-1)
90
repS :: [a] -> Int -> [a] -> [a] repS s m r = go m where go 0 = r go n = s ++ go (n-1)
90
repS s m r = go m where go 0 = r go n = s ++ go (n-1)
57
false
true
4
10
31
88
39
49
null
null
michaelt/streaming-bytestring
bench/benchbuilders.hs
bsd-3-clause
table :: Table table = [map StringC strings, map IntC [-3..3]]
62
table :: Table table = [map StringC strings, map IntC [-3..3]]
62
table = [map StringC strings, map IntC [-3..3]]
47
false
true
0
8
10
34
18
16
null
null
jaanos/TPJ-2015-16
microhaskell/examples_mh.hs
mit
- Representing infinite lists as functions hd :: (Integer -> Integer) -> Integer ; hd l = l 1;
95
hd :: (Integer -> Integer) -> Integer hd l = l 1
48
hd l = l 1
10
true
true
1
7
19
38
20
18
null
null
GaloisInc/ivory-tower-stm32
ivory-bsp-tests/BSP/Tests/UART/DebugApp.hs
bsd-3-clause
failed_timeout :: Uint8 failed_timeout = 3
42
failed_timeout :: Uint8 failed_timeout = 3
42
failed_timeout = 3
18
false
true
0
4
5
11
6
5
null
null
pbiggar/rash
src/Rash/IR/Bash2Rough.hs
bsd-3-clause
convertRedir :: Expr -> S.Redir -> Expr convertRedir expr (S.Heredoc S.Here _ False doc) = (Stdin (convertWord doc) expr)
121
convertRedir :: Expr -> S.Redir -> Expr convertRedir expr (S.Heredoc S.Here _ False doc) = (Stdin (convertWord doc) expr)
121
convertRedir expr (S.Heredoc S.Here _ False doc) = (Stdin (convertWord doc) expr)
81
false
true
0
8
18
56
28
28
null
null
andre-artus/handbook-of-practical-logic-and-automated-reasoning-haskell
src/ATP/Complex.hs
gpl-3.0
can (Right _) = True
20
can (Right _) = True
20
can (Right _) = True
20
false
false
0
7
4
15
7
8
null
null
HalfWayMan/meadowstalk
src/Meadowstalk/Handlers/Public.hs
bsd-3-clause
getArticleR :: Text -> Handler Html getArticleR slug = do (Entity aid article, tags, author) <- runDB $ do article <- getBy404 (UniqueArticle slug) (article,, ) <$> getArticleTags (entityKey article) <*> get404 (articleAuthor (entityVal article)) now <- liftIO getCurrentTime defaultLayout $ do setTitleI (articleTitle article) addScript (StaticR lightbox_lightbox_min_js) addStylesheet (StaticR lightbox_lightbox_min_css) toWidget [julius| var lightbox = new Lightbox (); lightbox.load (); |] toWidget $(juliusFile "templates/pages/article.julius") $(whamletFile "templates/pages/article.hamlet")
664
getArticleR :: Text -> Handler Html getArticleR slug = do (Entity aid article, tags, author) <- runDB $ do article <- getBy404 (UniqueArticle slug) (article,, ) <$> getArticleTags (entityKey article) <*> get404 (articleAuthor (entityVal article)) now <- liftIO getCurrentTime defaultLayout $ do setTitleI (articleTitle article) addScript (StaticR lightbox_lightbox_min_js) addStylesheet (StaticR lightbox_lightbox_min_css) toWidget [julius| var lightbox = new Lightbox (); lightbox.load (); |] toWidget $(juliusFile "templates/pages/article.julius") $(whamletFile "templates/pages/article.hamlet")
664
getArticleR slug = do (Entity aid article, tags, author) <- runDB $ do article <- getBy404 (UniqueArticle slug) (article,, ) <$> getArticleTags (entityKey article) <*> get404 (articleAuthor (entityVal article)) now <- liftIO getCurrentTime defaultLayout $ do setTitleI (articleTitle article) addScript (StaticR lightbox_lightbox_min_js) addStylesheet (StaticR lightbox_lightbox_min_css) toWidget [julius| var lightbox = new Lightbox (); lightbox.load (); |] toWidget $(juliusFile "templates/pages/article.julius") $(whamletFile "templates/pages/article.hamlet")
628
false
true
0
16
133
188
87
101
null
null
goalieca/haskelling
042.hs
gpl-3.0
parse txt = wordsBy (==',') $ filter ((/=) '"') txt
51
parse txt = wordsBy (==',') $ filter ((/=) '"') txt
51
parse txt = wordsBy (==',') $ filter ((/=) '"') txt
51
false
false
0
8
9
33
17
16
null
null
eallik/clint-DAV
Network/Protocol/HTTP/DAV.hs
gpl-3.0
closeDAVContext :: MonadIO m => DAVContext -> m () closeDAVContext _ = return ()
80
closeDAVContext :: MonadIO m => DAVContext -> m () closeDAVContext _ = return ()
80
closeDAVContext _ = return ()
29
false
true
0
8
13
35
16
19
null
null
ChrisCoffey/haskell_sandbox
99problems.hs
mit
huffman :: (Ord a, Ord b, Num b) => [(a, b)] -> [(a, String)] huffman ls = sortBy (comparing fst) $ serialize $ makeTree $ sortBy (comparing fst) $ [(weight, Leaf v)| (v, weight) <- ls] where makeTree [(_, t)] = t makeTree ((weight, a):(weight',b):rest) = makeTree $ insertBy (comparing fst) (weight + weight', Branch a b) rest serialize (Branch l r) = [(c, '0':code) | (c, code) <- serialize l] ++ [(c, '1':code)| (c, code) <- serialize r] serialize (Leaf c) = [(c, "")]
545
huffman :: (Ord a, Ord b, Num b) => [(a, b)] -> [(a, String)] huffman ls = sortBy (comparing fst) $ serialize $ makeTree $ sortBy (comparing fst) $ [(weight, Leaf v)| (v, weight) <- ls] where makeTree [(_, t)] = t makeTree ((weight, a):(weight',b):rest) = makeTree $ insertBy (comparing fst) (weight + weight', Branch a b) rest serialize (Branch l r) = [(c, '0':code) | (c, code) <- serialize l] ++ [(c, '1':code)| (c, code) <- serialize r] serialize (Leaf c) = [(c, "")]
545
huffman ls = sortBy (comparing fst) $ serialize $ makeTree $ sortBy (comparing fst) $ [(weight, Leaf v)| (v, weight) <- ls] where makeTree [(_, t)] = t makeTree ((weight, a):(weight',b):rest) = makeTree $ insertBy (comparing fst) (weight + weight', Branch a b) rest serialize (Branch l r) = [(c, '0':code) | (c, code) <- serialize l] ++ [(c, '1':code)| (c, code) <- serialize r] serialize (Leaf c) = [(c, "")]
483
false
true
3
11
158
304
165
139
null
null
damoxc/ganeti
src/Ganeti/Jobs.hs
gpl-2.0
waitForJobs :: [L.JobId] -> L.Client -> IO (Result [(L.JobId, JobStatus)]) waitForJobs jids client = waitForJobs' 500000 15000000 where waitForJobs' delay maxdelay = do -- TODO: this should use WaitForJobChange once it's available in Haskell -- land, instead of a fixed schedule of sleeping intervals. threadDelay $ min delay maxdelay sts <- L.queryJobsStatus client jids case sts of Bad e -> return . Bad $ "Checking job status: " ++ formatError e Ok sts' -> if any (<= JOB_STATUS_RUNNING) sts' then waitForJobs' (delay * 2) maxdelay else return . Ok $ zip jids sts' -- | Execute jobs and return @Ok@ only if all of them succeeded.
746
waitForJobs :: [L.JobId] -> L.Client -> IO (Result [(L.JobId, JobStatus)]) waitForJobs jids client = waitForJobs' 500000 15000000 where waitForJobs' delay maxdelay = do -- TODO: this should use WaitForJobChange once it's available in Haskell -- land, instead of a fixed schedule of sleeping intervals. threadDelay $ min delay maxdelay sts <- L.queryJobsStatus client jids case sts of Bad e -> return . Bad $ "Checking job status: " ++ formatError e Ok sts' -> if any (<= JOB_STATUS_RUNNING) sts' then waitForJobs' (delay * 2) maxdelay else return . Ok $ zip jids sts' -- | Execute jobs and return @Ok@ only if all of them succeeded.
746
waitForJobs jids client = waitForJobs' 500000 15000000 where waitForJobs' delay maxdelay = do -- TODO: this should use WaitForJobChange once it's available in Haskell -- land, instead of a fixed schedule of sleeping intervals. threadDelay $ min delay maxdelay sts <- L.queryJobsStatus client jids case sts of Bad e -> return . Bad $ "Checking job status: " ++ formatError e Ok sts' -> if any (<= JOB_STATUS_RUNNING) sts' then waitForJobs' (delay * 2) maxdelay else return . Ok $ zip jids sts' -- | Execute jobs and return @Ok@ only if all of them succeeded.
671
false
true
0
13
219
179
89
90
null
null
eklavya/Idris-dev
src/Idris/Delaborate.hs
bsd-3-clause
delabMV :: IState -> Term -> PTerm delabMV i tm = delab' i tm False True
72
delabMV :: IState -> Term -> PTerm delabMV i tm = delab' i tm False True
72
delabMV i tm = delab' i tm False True
37
false
true
0
6
15
33
16
17
null
null
brendanhay/gogol
gogol-healthcare/gen/Network/Google/Resource/Healthcare/Projects/Locations/DataSets/ConsentStores/QueryAccessibleData.hs
mpl-2.0
-- | JSONP pldscsqadCallback :: Lens' ProjectsLocationsDataSetsConsentStoresQueryAccessibleData (Maybe Text) pldscsqadCallback = lens _pldscsqadCallback (\ s a -> s{_pldscsqadCallback = a})
197
pldscsqadCallback :: Lens' ProjectsLocationsDataSetsConsentStoresQueryAccessibleData (Maybe Text) pldscsqadCallback = lens _pldscsqadCallback (\ s a -> s{_pldscsqadCallback = a})
186
pldscsqadCallback = lens _pldscsqadCallback (\ s a -> s{_pldscsqadCallback = a})
88
true
true
1
9
27
51
25
26
null
null
GaloisInc/halvm-ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
hsExprNeedsParens (HsLit {}) = False
45
hsExprNeedsParens (HsLit {}) = False
45
hsExprNeedsParens (HsLit {}) = False
45
false
false
0
7
13
16
8
8
null
null
frantisekfarka/ghc-dsi
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
pprInstr LWSYNC = ptext (sLit "\tlwsync")
41
pprInstr LWSYNC = ptext (sLit "\tlwsync")
41
pprInstr LWSYNC = ptext (sLit "\tlwsync")
41
false
false
1
7
5
21
8
13
null
null
egaburov/funstuff
Haskell/lenses/lens2.hs
apache-2.0
--(.~) = set --(%~) = view setPostcode :: String -> Person -> Person setPostcode pc p = set (addr . postcode) pc p
115
setPostcode :: String -> Person -> Person setPostcode pc p = set (addr . postcode) pc p
87
setPostcode pc p = set (addr . postcode) pc p
45
true
true
0
7
23
40
21
19
null
null
olorin/amazonka
amazonka-iam/gen/Network/AWS/IAM/GenerateCredentialReport.hs
mpl-2.0
-- | Information about the credential report. gcrrsDescription :: Lens' GenerateCredentialReportResponse (Maybe Text) gcrrsDescription = lens _gcrrsDescription (\ s a -> s{_gcrrsDescription = a})
195
gcrrsDescription :: Lens' GenerateCredentialReportResponse (Maybe Text) gcrrsDescription = lens _gcrrsDescription (\ s a -> s{_gcrrsDescription = a})
149
gcrrsDescription = lens _gcrrsDescription (\ s a -> s{_gcrrsDescription = a})
77
true
true
1
9
23
51
25
26
null
null
bennofs/vplan
src/Data/VPlan/Modifier/Enum.hs
gpl-3.0
-- | Build an enum value as a single item. enumItem :: (EnumContains a e) => a (Schedule s) c i v -> Builder (e (Schedule s) c i v) () enumItem = item . enumValue
162
enumItem :: (EnumContains a e) => a (Schedule s) c i v -> Builder (e (Schedule s) c i v) () enumItem = item . enumValue
119
enumItem = item . enumValue
27
true
true
0
11
35
71
36
35
null
null
lambda-11235/lambda-calc
src/Main.hs
bsd-3-clause
maybeParen True s = "(" ++ s ++ ")"
35
maybeParen True s = "(" ++ s ++ ")"
35
maybeParen True s = "(" ++ s ++ ")"
35
false
false
0
6
8
20
9
11
null
null
keera-studios/pang-a-lambda
Experiments/splitballs/Constants.hs
gpl-3.0
ballHeight = 25
15
ballHeight = 25
15
ballHeight = 25
15
false
false
0
4
2
6
3
3
null
null
ml9951/ghc
compiler/llvmGen/Llvm/PpLlvm.hs
bsd-3-clause
ppSyncOrdering SyncAcquire = text "acquire"
45
ppSyncOrdering SyncAcquire = text "acquire"
45
ppSyncOrdering SyncAcquire = text "acquire"
45
false
false
0
5
6
12
5
7
null
null
CoryXie/BarrelfishOS
hake/ArchDefaults.hs
mit
-- -- the C preprocessor, like C compiler but with -E -- cPreprocessor arch compiler opts phase src obj = let incls = (optIncludes opts) ++ (extraIncludes opts) flags = (optFlags opts) ++ (optDefines opts) ++ [ Str f | f <- extraFlags opts ] ++ [ Str f | f <- extraDefines opts ] deps = (optDependencies opts) ++ (extraDependencies opts) cOptFlags = unwords ((words Config.cOptFlags) \\ ["-g"]) in [ Str compiler ] ++ flags ++ [ Str cOptFlags ] ++ concat [ [ NStr "-I", i ] | i <- incls ] ++ [ Str "-o", Out arch obj, Str "-E", In (if phase == "src" then SrcTree else BuildTree) phase src ] ++ deps
716
cPreprocessor arch compiler opts phase src obj = let incls = (optIncludes opts) ++ (extraIncludes opts) flags = (optFlags opts) ++ (optDefines opts) ++ [ Str f | f <- extraFlags opts ] ++ [ Str f | f <- extraDefines opts ] deps = (optDependencies opts) ++ (extraDependencies opts) cOptFlags = unwords ((words Config.cOptFlags) \\ ["-g"]) in [ Str compiler ] ++ flags ++ [ Str cOptFlags ] ++ concat [ [ NStr "-I", i ] | i <- incls ] ++ [ Str "-o", Out arch obj, Str "-E", In (if phase == "src" then SrcTree else BuildTree) phase src ] ++ deps
659
cPreprocessor arch compiler opts phase src obj = let incls = (optIncludes opts) ++ (extraIncludes opts) flags = (optFlags opts) ++ (optDefines opts) ++ [ Str f | f <- extraFlags opts ] ++ [ Str f | f <- extraDefines opts ] deps = (optDependencies opts) ++ (extraDependencies opts) cOptFlags = unwords ((words Config.cOptFlags) \\ ["-g"]) in [ Str compiler ] ++ flags ++ [ Str cOptFlags ] ++ concat [ [ NStr "-I", i ] | i <- incls ] ++ [ Str "-o", Out arch obj, Str "-E", In (if phase == "src" then SrcTree else BuildTree) phase src ] ++ deps
659
true
false
6
14
234
263
133
130
null
null
lettier/gifcurry
src/cli/Main.hs
bsd-3-clause
main :: IO () main = do putStrLn $ info logo cliArgs' <- cmdArgs cliArgs maybePlayableMetadata <- Gifcurry.getPlayableMetadata $ input_file cliArgs' let maybeWidthHeight = case maybePlayableMetadata of Nothing -> Nothing Just Gifcurry.PlayableMetadata { Gifcurry.playableMetadataWidth , Gifcurry.playableMetadataHeight } -> Just (playableMetadataWidth, playableMetadataHeight) textOverlays <- Gifcurry.convertFileToTextOverlays (text_file cliArgs') maybeWidthHeight let params = (makeGifParams cliArgs') { Gifcurry.textOverlays = textOverlays } paramsValid <- Gifcurry.validateGifParams params if paramsValid then void $ Gifcurry.createGif params else putStrLn $ "[INFO] Type \"" ++ programName ++ " -?\" for help." return ()
828
main :: IO () main = do putStrLn $ info logo cliArgs' <- cmdArgs cliArgs maybePlayableMetadata <- Gifcurry.getPlayableMetadata $ input_file cliArgs' let maybeWidthHeight = case maybePlayableMetadata of Nothing -> Nothing Just Gifcurry.PlayableMetadata { Gifcurry.playableMetadataWidth , Gifcurry.playableMetadataHeight } -> Just (playableMetadataWidth, playableMetadataHeight) textOverlays <- Gifcurry.convertFileToTextOverlays (text_file cliArgs') maybeWidthHeight let params = (makeGifParams cliArgs') { Gifcurry.textOverlays = textOverlays } paramsValid <- Gifcurry.validateGifParams params if paramsValid then void $ Gifcurry.createGif params else putStrLn $ "[INFO] Type \"" ++ programName ++ " -?\" for help." return ()
828
main = do putStrLn $ info logo cliArgs' <- cmdArgs cliArgs maybePlayableMetadata <- Gifcurry.getPlayableMetadata $ input_file cliArgs' let maybeWidthHeight = case maybePlayableMetadata of Nothing -> Nothing Just Gifcurry.PlayableMetadata { Gifcurry.playableMetadataWidth , Gifcurry.playableMetadataHeight } -> Just (playableMetadataWidth, playableMetadataHeight) textOverlays <- Gifcurry.convertFileToTextOverlays (text_file cliArgs') maybeWidthHeight let params = (makeGifParams cliArgs') { Gifcurry.textOverlays = textOverlays } paramsValid <- Gifcurry.validateGifParams params if paramsValid then void $ Gifcurry.createGif params else putStrLn $ "[INFO] Type \"" ++ programName ++ " -?\" for help." return ()
814
false
true
0
16
185
201
95
106
null
null
IgorRodic/fp16-Pongout
dist/build/autogen/Paths_fp16_Pongout.hs
mit
getPrefixDirRel :: FilePath -> IO FilePath getPrefixDirRel dirRel = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. where try_size size = allocaArray (fromIntegral size) $ \buf -> do ret <- c_GetModuleFileName nullPtr buf size case ret of 0 -> return (prefix `joinFileName` dirRel) _ | ret < size -> do exePath <- peekCWString buf let (bindir,_) = splitFileName exePath return ((bindir `minusFileName` bindirrel) `joinFileName` dirRel) | otherwise -> try_size (size * 2)
573
getPrefixDirRel :: FilePath -> IO FilePath getPrefixDirRel dirRel = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. where try_size size = allocaArray (fromIntegral size) $ \buf -> do ret <- c_GetModuleFileName nullPtr buf size case ret of 0 -> return (prefix `joinFileName` dirRel) _ | ret < size -> do exePath <- peekCWString buf let (bindir,_) = splitFileName exePath return ((bindir `minusFileName` bindirrel) `joinFileName` dirRel) | otherwise -> try_size (size * 2)
573
getPrefixDirRel dirRel = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. where try_size size = allocaArray (fromIntegral size) $ \buf -> do ret <- c_GetModuleFileName nullPtr buf size case ret of 0 -> return (prefix `joinFileName` dirRel) _ | ret < size -> do exePath <- peekCWString buf let (bindir,_) = splitFileName exePath return ((bindir `minusFileName` bindirrel) `joinFileName` dirRel) | otherwise -> try_size (size * 2)
530
false
true
1
20
169
189
89
100
null
null
jvmap/Reactive.Banana.Gtk
Reactive/Banana/Gtk.hs
bsd-3-clause
-- | "Animate" a property with a stream of events sink :: w -> [Prop' w] -> Rb.NetworkDescription () sink widget props = mapM_ sink1 props where sink1 (attr :== x) = do Rb.liftIOLater $ Gtk.set widget [attr := Rb.initial x] Rb.reactimate $ (\x -> Gtk.set widget [attr := x]) <$> Rb.changes x
311
sink :: w -> [Prop' w] -> Rb.NetworkDescription () sink widget props = mapM_ sink1 props where sink1 (attr :== x) = do Rb.liftIOLater $ Gtk.set widget [attr := Rb.initial x] Rb.reactimate $ (\x -> Gtk.set widget [attr := x]) <$> Rb.changes x
261
sink widget props = mapM_ sink1 props where sink1 (attr :== x) = do Rb.liftIOLater $ Gtk.set widget [attr := Rb.initial x] Rb.reactimate $ (\x -> Gtk.set widget [attr := x]) <$> Rb.changes x
210
true
true
0
15
72
128
63
65
null
null
beni55/fay
tests/List.hs
bsd-3-clause
showList :: [Int] -> String showList = ffi "JSON.stringify(%1)"
63
showList :: [Int] -> String showList = ffi "JSON.stringify(%1)"
63
showList = ffi "JSON.stringify(%1)"
35
false
true
0
7
8
28
12
16
null
null
bgold-cosmos/Tidal
src/Sound/Tidal/Params.hs
gpl-3.0
drumN "ml" = 33
15
drumN "ml" = 33
15
drumN "ml" = 33
15
false
false
1
5
3
13
4
9
null
null
AlexeyRaga/eta
compiler/ETA/Prelude/PrimOp.hs
bsd-3-clause
primOpInfo MakeStablePtrOp = mkGenPrimOp (fsLit "makeStablePtr#") [alphaTyVar] [alphaTy, mkStatePrimTy realWorldTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy realWorldTy, mkStablePtrPrimTy alphaTy]))
198
primOpInfo MakeStablePtrOp = mkGenPrimOp (fsLit "makeStablePtr#") [alphaTyVar] [alphaTy, mkStatePrimTy realWorldTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy realWorldTy, mkStablePtrPrimTy alphaTy]))
198
primOpInfo MakeStablePtrOp = mkGenPrimOp (fsLit "makeStablePtr#") [alphaTyVar] [alphaTy, mkStatePrimTy realWorldTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy realWorldTy, mkStablePtrPrimTy alphaTy]))
198
false
false
0
10
16
60
30
30
null
null
RossOgilvie/MathPrelude
MathPrelude/Classes/Group.hs
gpl-3.0
-- | Fold a list together with the monoid operation. sum ∷ Monoid a ⇒ [a] → a sum = foldr mappend mempty
104
sum ∷ Monoid a ⇒ [a] → a sum = foldr mappend mempty
51
sum = foldr mappend mempty
26
true
true
0
8
22
38
17
21
null
null
nomeata/ghc
compiler/cmm/PprC.hs
bsd-3-clause
-- --------------------------------------------------------------------- -- conditional branches to local labels pprCondBranch :: CmmExpr -> BlockId -> SDoc pprCondBranch expr ident = hsep [ ptext (sLit "if") , parens(pprExpr expr) , ptext (sLit "goto") , (pprBlockId ident) <> semi ]
316
pprCondBranch :: CmmExpr -> BlockId -> SDoc pprCondBranch expr ident = hsep [ ptext (sLit "if") , parens(pprExpr expr) , ptext (sLit "goto") , (pprBlockId ident) <> semi ]
203
pprCondBranch expr ident = hsep [ ptext (sLit "if") , parens(pprExpr expr) , ptext (sLit "goto") , (pprBlockId ident) <> semi ]
159
true
true
0
9
68
78
40
38
null
null
Zankoku-Okuno/octopus
Language/Octopus/Primitive.hs
gpl-3.0
index args = return . Left $ mkTypeError (Pr Index) "(Ar *, Nat)" args
70
index args = return . Left $ mkTypeError (Pr Index) "(Ar *, Nat)" args
70
index args = return . Left $ mkTypeError (Pr Index) "(Ar *, Nat)" args
70
false
false
2
8
13
34
14
20
null
null
ngeiswei/atomspace
tests/haskell/haskellTest/Main.hs
agpl-3.0
evaluationTest :: IO Bool evaluationTest = do curdir <- getCurrentDirectory let atom = Link "EvaluationLink" [Node "GroundedPredicateNode" ("lib: " ++ curdir ++ "/libopencoglib-0.1.0.0.so\\somePredicate") noTv ,Link "ListLink" [Node "ConceptNode" "test" (SimpleTV 0.5 0.5)] noTv ] noTv prog = insert atom >> evaluate atom res <- runOnNewAtomSpace prog case res of Just (SimpleTV 0.5 0.5) -> return True _ -> error $ "EvaluationTest failed and returned: " ++ show res
574
evaluationTest :: IO Bool evaluationTest = do curdir <- getCurrentDirectory let atom = Link "EvaluationLink" [Node "GroundedPredicateNode" ("lib: " ++ curdir ++ "/libopencoglib-0.1.0.0.so\\somePredicate") noTv ,Link "ListLink" [Node "ConceptNode" "test" (SimpleTV 0.5 0.5)] noTv ] noTv prog = insert atom >> evaluate atom res <- runOnNewAtomSpace prog case res of Just (SimpleTV 0.5 0.5) -> return True _ -> error $ "EvaluationTest failed and returned: " ++ show res
574
evaluationTest = do curdir <- getCurrentDirectory let atom = Link "EvaluationLink" [Node "GroundedPredicateNode" ("lib: " ++ curdir ++ "/libopencoglib-0.1.0.0.so\\somePredicate") noTv ,Link "ListLink" [Node "ConceptNode" "test" (SimpleTV 0.5 0.5)] noTv ] noTv prog = insert atom >> evaluate atom res <- runOnNewAtomSpace prog case res of Just (SimpleTV 0.5 0.5) -> return True _ -> error $ "EvaluationTest failed and returned: " ++ show res
548
false
true
0
16
175
155
73
82
null
null
spechub/Hets
QBF/Analysis.hs
gpl-2.0
propsOfFormula (AS_BASIC.Disjunction xs _) = List.foldl (\ sig frm -> Sign.unite sig $ propsOfFormula frm) Sign.emptySig xs
125
propsOfFormula (AS_BASIC.Disjunction xs _) = List.foldl (\ sig frm -> Sign.unite sig $ propsOfFormula frm) Sign.emptySig xs
125
propsOfFormula (AS_BASIC.Disjunction xs _) = List.foldl (\ sig frm -> Sign.unite sig $ propsOfFormula frm) Sign.emptySig xs
125
false
false
0
9
18
55
25
30
null
null
rueshyna/gogol
gogol-ml/gen/Network/Google/Resource/Ml/Projects/Models/Versions/SetDefault.hs
mpl-2.0
-- | Creates a value of 'ProjectsModelsVersionsSetDefault' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'pmvsdXgafv' -- -- * 'pmvsdUploadProtocol' -- -- * 'pmvsdPp' -- -- * 'pmvsdAccessToken' -- -- * 'pmvsdUploadType' -- -- * 'pmvsdPayload' -- -- * 'pmvsdBearerToken' -- -- * 'pmvsdName' -- -- * 'pmvsdCallback' projectsModelsVersionsSetDefault :: GoogleCloudMlV1beta1__SetDefaultVersionRequest -- ^ 'pmvsdPayload' -> Text -- ^ 'pmvsdName' -> ProjectsModelsVersionsSetDefault projectsModelsVersionsSetDefault pPmvsdPayload_ pPmvsdName_ = ProjectsModelsVersionsSetDefault' { _pmvsdXgafv = Nothing , _pmvsdUploadProtocol = Nothing , _pmvsdPp = True , _pmvsdAccessToken = Nothing , _pmvsdUploadType = Nothing , _pmvsdPayload = pPmvsdPayload_ , _pmvsdBearerToken = Nothing , _pmvsdName = pPmvsdName_ , _pmvsdCallback = Nothing }
968
projectsModelsVersionsSetDefault :: GoogleCloudMlV1beta1__SetDefaultVersionRequest -- ^ 'pmvsdPayload' -> Text -- ^ 'pmvsdName' -> ProjectsModelsVersionsSetDefault projectsModelsVersionsSetDefault pPmvsdPayload_ pPmvsdName_ = ProjectsModelsVersionsSetDefault' { _pmvsdXgafv = Nothing , _pmvsdUploadProtocol = Nothing , _pmvsdPp = True , _pmvsdAccessToken = Nothing , _pmvsdUploadType = Nothing , _pmvsdPayload = pPmvsdPayload_ , _pmvsdBearerToken = Nothing , _pmvsdName = pPmvsdName_ , _pmvsdCallback = Nothing }
568
projectsModelsVersionsSetDefault pPmvsdPayload_ pPmvsdName_ = ProjectsModelsVersionsSetDefault' { _pmvsdXgafv = Nothing , _pmvsdUploadProtocol = Nothing , _pmvsdPp = True , _pmvsdAccessToken = Nothing , _pmvsdUploadType = Nothing , _pmvsdPayload = pPmvsdPayload_ , _pmvsdBearerToken = Nothing , _pmvsdName = pPmvsdName_ , _pmvsdCallback = Nothing }
392
true
true
0
8
176
112
74
38
null
null
ml9951/ghc
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
limitShiftRI II32 (RIImm (ImmInt i)) | i > 31 || i < 0 = panic $ "PPC.Ppr: 32 bit: Shift by " ++ show i ++ " bits is not allowed."
132
limitShiftRI II32 (RIImm (ImmInt i)) | i > 31 || i < 0 = panic $ "PPC.Ppr: 32 bit: Shift by " ++ show i ++ " bits is not allowed."
132
limitShiftRI II32 (RIImm (ImmInt i)) | i > 31 || i < 0 = panic $ "PPC.Ppr: 32 bit: Shift by " ++ show i ++ " bits is not allowed."
132
false
false
2
10
32
60
26
34
null
null
siddhanathan/ghc
compiler/typecheck/TcGenGenerics.hs
bsd-3-clause
metaTyConsToDerivStuff :: TyCon -> MetaTyCons -> TcM BagDerivStuff metaTyConsToDerivStuff tc metaDts = do dClas <- tcLookupClass datatypeClassName d_dfun_name <- newDFunName' dClas tc cClas <- tcLookupClass constructorClassName c_dfun_names <- sequence [ (conTy,) <$> newDFunName' cClas tc | conTy <- metaC metaDts ] sClas <- tcLookupClass selectorClassName s_dfun_names <- sequence (map sequence [ [ (selector,) <$> newDFunName' sClas tc | selector <- selectors ] | selectors <- metaS metaDts ]) fix_env <- getFixityEnv let (dBinds,cBinds,sBinds) = mkBindsMetaD fix_env tc mk_inst clas tc dfun_name = newClsInst (Just (NoOverlap "")) dfun_name [] [] clas tys where tys = [mkTyConTy tc] let d_metaTycon = metaD metaDts d_inst <- mk_inst dClas d_metaTycon d_dfun_name c_insts <- sequence [ mk_inst cClas c ds | (c, ds) <- c_dfun_names ] s_insts <- mapM (mapM (\(s,ds) -> mk_inst sClas s ds)) s_dfun_names let -- Datatype d_binds = InstBindings { ib_binds = dBinds , ib_tyvars = [] , ib_pragmas = [] , ib_extensions = [] , ib_derived = True } d_mkInst = DerivInst (InstInfo { iSpec = d_inst, iBinds = d_binds }) -- Constructor c_binds = [ InstBindings { ib_binds = c , ib_tyvars = [] , ib_pragmas = [] , ib_extensions = [] , ib_derived = True } | c <- cBinds ] c_mkInst = [ DerivInst (InstInfo { iSpec = is, iBinds = bs }) | (is,bs) <- myZip1 c_insts c_binds ] -- Selector s_binds = [ [ InstBindings { ib_binds = s , ib_tyvars = [] , ib_pragmas = [] , ib_extensions = [] , ib_derived = True } | s <- ss ] | ss <- sBinds ] s_mkInst = map (map (\(is,bs) -> DerivInst (InstInfo { iSpec = is , iBinds = bs}))) (myZip2 s_insts s_binds) myZip1 :: [a] -> [b] -> [(a,b)] myZip1 l1 l2 = ASSERT(length l1 == length l2) zip l1 l2 myZip2 :: [[a]] -> [[b]] -> [[(a,b)]] myZip2 l1 l2 = ASSERT(and (zipWith (>=) (map length l1) (map length l2))) [ zip x1 x2 | (x1,x2) <- zip l1 l2 ] return $ mapBag DerivTyCon (metaTyCons2TyCons metaDts) `unionBags` listToBag (d_mkInst : c_mkInst ++ concat s_mkInst) {- ************************************************************************ * * \subsection{Generating representation types} * * ************************************************************************ -}
3,252
metaTyConsToDerivStuff :: TyCon -> MetaTyCons -> TcM BagDerivStuff metaTyConsToDerivStuff tc metaDts = do dClas <- tcLookupClass datatypeClassName d_dfun_name <- newDFunName' dClas tc cClas <- tcLookupClass constructorClassName c_dfun_names <- sequence [ (conTy,) <$> newDFunName' cClas tc | conTy <- metaC metaDts ] sClas <- tcLookupClass selectorClassName s_dfun_names <- sequence (map sequence [ [ (selector,) <$> newDFunName' sClas tc | selector <- selectors ] | selectors <- metaS metaDts ]) fix_env <- getFixityEnv let (dBinds,cBinds,sBinds) = mkBindsMetaD fix_env tc mk_inst clas tc dfun_name = newClsInst (Just (NoOverlap "")) dfun_name [] [] clas tys where tys = [mkTyConTy tc] let d_metaTycon = metaD metaDts d_inst <- mk_inst dClas d_metaTycon d_dfun_name c_insts <- sequence [ mk_inst cClas c ds | (c, ds) <- c_dfun_names ] s_insts <- mapM (mapM (\(s,ds) -> mk_inst sClas s ds)) s_dfun_names let -- Datatype d_binds = InstBindings { ib_binds = dBinds , ib_tyvars = [] , ib_pragmas = [] , ib_extensions = [] , ib_derived = True } d_mkInst = DerivInst (InstInfo { iSpec = d_inst, iBinds = d_binds }) -- Constructor c_binds = [ InstBindings { ib_binds = c , ib_tyvars = [] , ib_pragmas = [] , ib_extensions = [] , ib_derived = True } | c <- cBinds ] c_mkInst = [ DerivInst (InstInfo { iSpec = is, iBinds = bs }) | (is,bs) <- myZip1 c_insts c_binds ] -- Selector s_binds = [ [ InstBindings { ib_binds = s , ib_tyvars = [] , ib_pragmas = [] , ib_extensions = [] , ib_derived = True } | s <- ss ] | ss <- sBinds ] s_mkInst = map (map (\(is,bs) -> DerivInst (InstInfo { iSpec = is , iBinds = bs}))) (myZip2 s_insts s_binds) myZip1 :: [a] -> [b] -> [(a,b)] myZip1 l1 l2 = ASSERT(length l1 == length l2) zip l1 l2 myZip2 :: [[a]] -> [[b]] -> [[(a,b)]] myZip2 l1 l2 = ASSERT(and (zipWith (>=) (map length l1) (map length l2))) [ zip x1 x2 | (x1,x2) <- zip l1 l2 ] return $ mapBag DerivTyCon (metaTyCons2TyCons metaDts) `unionBags` listToBag (d_mkInst : c_mkInst ++ concat s_mkInst) {- ************************************************************************ * * \subsection{Generating representation types} * * ************************************************************************ -}
3,252
metaTyConsToDerivStuff tc metaDts = do dClas <- tcLookupClass datatypeClassName d_dfun_name <- newDFunName' dClas tc cClas <- tcLookupClass constructorClassName c_dfun_names <- sequence [ (conTy,) <$> newDFunName' cClas tc | conTy <- metaC metaDts ] sClas <- tcLookupClass selectorClassName s_dfun_names <- sequence (map sequence [ [ (selector,) <$> newDFunName' sClas tc | selector <- selectors ] | selectors <- metaS metaDts ]) fix_env <- getFixityEnv let (dBinds,cBinds,sBinds) = mkBindsMetaD fix_env tc mk_inst clas tc dfun_name = newClsInst (Just (NoOverlap "")) dfun_name [] [] clas tys where tys = [mkTyConTy tc] let d_metaTycon = metaD metaDts d_inst <- mk_inst dClas d_metaTycon d_dfun_name c_insts <- sequence [ mk_inst cClas c ds | (c, ds) <- c_dfun_names ] s_insts <- mapM (mapM (\(s,ds) -> mk_inst sClas s ds)) s_dfun_names let -- Datatype d_binds = InstBindings { ib_binds = dBinds , ib_tyvars = [] , ib_pragmas = [] , ib_extensions = [] , ib_derived = True } d_mkInst = DerivInst (InstInfo { iSpec = d_inst, iBinds = d_binds }) -- Constructor c_binds = [ InstBindings { ib_binds = c , ib_tyvars = [] , ib_pragmas = [] , ib_extensions = [] , ib_derived = True } | c <- cBinds ] c_mkInst = [ DerivInst (InstInfo { iSpec = is, iBinds = bs }) | (is,bs) <- myZip1 c_insts c_binds ] -- Selector s_binds = [ [ InstBindings { ib_binds = s , ib_tyvars = [] , ib_pragmas = [] , ib_extensions = [] , ib_derived = True } | s <- ss ] | ss <- sBinds ] s_mkInst = map (map (\(is,bs) -> DerivInst (InstInfo { iSpec = is , iBinds = bs}))) (myZip2 s_insts s_binds) myZip1 :: [a] -> [b] -> [(a,b)] myZip1 l1 l2 = ASSERT(length l1 == length l2) zip l1 l2 myZip2 :: [[a]] -> [[b]] -> [[(a,b)]] myZip2 l1 l2 = ASSERT(and (zipWith (>=) (map length l1) (map length l2))) [ zip x1 x2 | (x1,x2) <- zip l1 l2 ] return $ mapBag DerivTyCon (metaTyCons2TyCons metaDts) `unionBags` listToBag (d_mkInst : c_mkInst ++ concat s_mkInst) {- ************************************************************************ * * \subsection{Generating representation types} * * ************************************************************************ -}
3,185
false
true
0
18
1,418
860
459
401
null
null
iblumenfeld/saw-core
src/Verifier/SAW/Simulator/BitBlast.hs
bsd-3-clause
muxBVal be b (VBool x) (VBool y) = VBool <$> AIG.mux be b x y
73
muxBVal be b (VBool x) (VBool y) = VBool <$> AIG.mux be b x y
73
muxBVal be b (VBool x) (VBool y) = VBool <$> AIG.mux be b x y
73
false
false
0
7
26
42
20
22
null
null