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
fpco/ghcjs-react
src/React/Builder.hs
bsd-3-clause
-- | Add attributes. Does not overwrite existing keys. attr :: Monad m => Text -- ^ Name. -> Text -- ^ Value. -> ReactT state m () attr name prop = modifyProps (\ep -> ep {epOtherProps = epOtherProps ep `Map.union` Map.fromList [(name,prop)]})
271
attr :: Monad m => Text -- ^ Name. -> Text -- ^ Value. -> ReactT state m () attr name prop = modifyProps (\ep -> ep {epOtherProps = epOtherProps ep `Map.union` Map.fromList [(name,prop)]})
216
attr name prop = modifyProps (\ep -> ep {epOtherProps = epOtherProps ep `Map.union` Map.fromList [(name,prop)]})
125
true
true
0
13
70
87
47
40
null
null
sampou-org/pfad
Code/Code18.hs
bsd-3-clause
freecells :: Grid -> [Cell] freecells g = allcells \\ occupied g
64
freecells :: Grid -> [Cell] freecells g = allcells \\ occupied g
64
freecells g = allcells \\ occupied g
36
false
true
0
6
11
28
14
14
null
null
seppeljordan/hichachoe
Board.hs
gpl-3.0
otherPlayer :: Player -> Player otherPlayer PlayerOne = PlayerTwo
65
otherPlayer :: Player -> Player otherPlayer PlayerOne = PlayerTwo
65
otherPlayer PlayerOne = PlayerTwo
33
false
true
0
5
8
18
9
9
null
null
thalerjonathan/phd
thesis/code/concurrent/sugarscape/SugarScapeSTMTVar/src/Discrete.hs
gpl-3.0
topLeftDelta :: Discrete2dCoord topLeftDelta = (-1, -1)
60
topLeftDelta :: Discrete2dCoord topLeftDelta = (-1, -1)
60
topLeftDelta = (-1, -1)
28
false
true
0
6
11
21
12
9
null
null
cirquit/hjc
src/Cmm/X86/Core.hs
mit
replaceComment :: (MonadNameGen m, MonadIO m) => X86 m () -> String -> X86 m () replaceComment f c = do f sideEffectComments %= replaceLast (X86Comment c)
163
replaceComment :: (MonadNameGen m, MonadIO m) => X86 m () -> String -> X86 m () replaceComment f c = do f sideEffectComments %= replaceLast (X86Comment c)
162
replaceComment f c = do f sideEffectComments %= replaceLast (X86Comment c)
82
false
true
0
10
35
72
34
38
null
null
sdiehl/ghc
compiler/coreSyn/CoreFVs.hs
bsd-3-clause
orphNamesOfCo :: Coercion -> NameSet orphNamesOfCo (Refl ty) = orphNamesOfType ty
93
orphNamesOfCo :: Coercion -> NameSet orphNamesOfCo (Refl ty) = orphNamesOfType ty
93
orphNamesOfCo (Refl ty) = orphNamesOfType ty
56
false
true
0
7
22
27
13
14
null
null
athanclark/Idris-dev
src/Idris/REPLParser.hs
bsd-3-clause
cmd_pprint :: String -> P.IdrisParser (Either String Command) cmd_pprint name = do fmt <- ppFormat P.whiteSpace n <- fmap (fromInteger . fst) P.natural P.whiteSpace t <- P.fullExpr defaultSyntax return (Right (PPrint fmt n t)) where ppFormat :: P.IdrisParser OutputFmt ppFormat = (discard (P.symbol "html") >> return HTMLOutput) <|> (discard (P.symbol "latex") >> return LaTeXOutput)
449
cmd_pprint :: String -> P.IdrisParser (Either String Command) cmd_pprint name = do fmt <- ppFormat P.whiteSpace n <- fmap (fromInteger . fst) P.natural P.whiteSpace t <- P.fullExpr defaultSyntax return (Right (PPrint fmt n t)) where ppFormat :: P.IdrisParser OutputFmt ppFormat = (discard (P.symbol "html") >> return HTMLOutput) <|> (discard (P.symbol "latex") >> return LaTeXOutput)
449
cmd_pprint name = do fmt <- ppFormat P.whiteSpace n <- fmap (fromInteger . fst) P.natural P.whiteSpace t <- P.fullExpr defaultSyntax return (Right (PPrint fmt n t)) where ppFormat :: P.IdrisParser OutputFmt ppFormat = (discard (P.symbol "html") >> return HTMLOutput) <|> (discard (P.symbol "latex") >> return LaTeXOutput)
387
false
true
0
13
119
166
78
88
null
null
emmanueltouzery/imprint
src/GtkViewModel.hs
mit
listModelAddItem :: ListModel a -> Model a -> IO () listModelAddItem listModel itemModel = do -- would be faster to add at the beginning, but it's -- not what the user expects... modifyIORef (items listModel) (\l -> l ++ [itemModel]) readIORef (addedCallbacks listModel) >>= mapM_ ($ itemModel)
310
listModelAddItem :: ListModel a -> Model a -> IO () listModelAddItem listModel itemModel = do -- would be faster to add at the beginning, but it's -- not what the user expects... modifyIORef (items listModel) (\l -> l ++ [itemModel]) readIORef (addedCallbacks listModel) >>= mapM_ ($ itemModel)
310
listModelAddItem listModel itemModel = do -- would be faster to add at the beginning, but it's -- not what the user expects... modifyIORef (items listModel) (\l -> l ++ [itemModel]) readIORef (addedCallbacks listModel) >>= mapM_ ($ itemModel)
258
false
true
0
11
62
89
44
45
null
null
pjones/xmonad-test
vendor/xmonad-contrib/XMonad/Hooks/FadeInactive.hs
bsd-2-clause
-- $usage -- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@: -- -- > import XMonad -- > import XMonad.Hooks.FadeInactive -- > -- > myLogHook :: X () -- > myLogHook = fadeInactiveLogHook fadeAmount -- > where fadeAmount = 0.8 -- > -- > main = xmonad def { logHook = myLogHook } -- -- fadeAmount can be any rational between 0 and 1. -- you will need to have xcompmgr <http://freedesktop.org/wiki/Software/xapps> -- or something similar for this to do anything -- -- For more detailed instructions on editing the logHook see: -- -- "XMonad.Doc.Extending#The_log_hook_and_external_status_bars" -- -- For more detailed instructions on editing the layoutHook see: -- -- "XMonad.Doc.Extending#Editing_the_layout_hook" -- | Converts a percentage to the format required for _NET_WM_WINDOW_OPACITY rationalToOpacity :: Integral a => Rational -> a rationalToOpacity perc | perc < 0 || perc > 1 = round perc -- to maintain backwards-compatability | otherwise = round $ perc * 0xffffffff
1,015
rationalToOpacity :: Integral a => Rational -> a rationalToOpacity perc | perc < 0 || perc > 1 = round perc -- to maintain backwards-compatability | otherwise = round $ perc * 0xffffffff
194
rationalToOpacity perc | perc < 0 || perc > 1 = round perc -- to maintain backwards-compatability | otherwise = round $ perc * 0xffffffff
145
true
true
2
10
168
96
56
40
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/SVGMarkerElement.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGMarkerElement.markerHeight Mozilla SVGMarkerElement.markerHeight documentation> getMarkerHeight :: (MonadDOM m) => SVGMarkerElement -> m SVGAnimatedLength getMarkerHeight self = liftDOM ((self ^. js "markerHeight") >>= fromJSValUnchecked)
315
getMarkerHeight :: (MonadDOM m) => SVGMarkerElement -> m SVGAnimatedLength getMarkerHeight self = liftDOM ((self ^. js "markerHeight") >>= fromJSValUnchecked)
176
getMarkerHeight self = liftDOM ((self ^. js "markerHeight") >>= fromJSValUnchecked)
85
true
true
0
10
43
51
26
25
null
null
kadena-io/pact
src/Pact/Types/PactValue.hs
bsd-3-clause
fromPactValue (PObject o) = TObject (Object (fmap fromPactValue o) TyAny def def) def
85
fromPactValue (PObject o) = TObject (Object (fmap fromPactValue o) TyAny def def) def
85
fromPactValue (PObject o) = TObject (Object (fmap fromPactValue o) TyAny def def) def
85
false
false
0
9
12
40
19
21
null
null
stevely/hspirv
src/SpirV/Builder/Types/Internal.hs
bsd-3-clause
emptyModule :: Module emptyModule = Module Nothing empty empty empty M.empty defMemModel empty empty emptyDebug M.empty M.empty empty empty empty where emptyDebug = DebugInstructions M.empty empty empty empty empty defMemModel = OpMemoryModel Logical Simple
271
emptyModule :: Module emptyModule = Module Nothing empty empty empty M.empty defMemModel empty empty emptyDebug M.empty M.empty empty empty empty where emptyDebug = DebugInstructions M.empty empty empty empty empty defMemModel = OpMemoryModel Logical Simple
271
emptyModule = Module Nothing empty empty empty M.empty defMemModel empty empty emptyDebug M.empty M.empty empty empty empty where emptyDebug = DebugInstructions M.empty empty empty empty empty defMemModel = OpMemoryModel Logical Simple
249
false
true
1
6
47
91
39
52
null
null
victoredwardocallaghan/hlibBladeRF
src/LibBladeRF/Flash.hs
lgpl-2.1
bladeRFWriteFlash :: DeviceHandle -- ^ Device handle -> BS.ByteString -- ^ Data to write to flash -> Word32 -- ^ page Page to begin writing at -> Word32 -- ^ count -> IO (BladeRFReturnType ()) bladeRFWriteFlash dev b p c = allocaBytes (fromIntegral $ p * c'BLADERF_FLASH_PAGE_SIZE) $ \bptr -> do -- XXX - Buffer allocation size must be `page` * BLADERF_FLASH_PAGE_SIZE bytes or larger. pokeArray bptr (BS.unpack b) -- XXX can we overflow here?? ret <- c'bladerf_write_flash (unDeviceHandle dev) bptr p c return $ bladeRFErrorTy ret
639
bladeRFWriteFlash :: DeviceHandle -- ^ Device handle -> BS.ByteString -- ^ Data to write to flash -> Word32 -- ^ page Page to begin writing at -> Word32 -- ^ count -> IO (BladeRFReturnType ()) bladeRFWriteFlash dev b p c = allocaBytes (fromIntegral $ p * c'BLADERF_FLASH_PAGE_SIZE) $ \bptr -> do -- XXX - Buffer allocation size must be `page` * BLADERF_FLASH_PAGE_SIZE bytes or larger. pokeArray bptr (BS.unpack b) -- XXX can we overflow here?? ret <- c'bladerf_write_flash (unDeviceHandle dev) bptr p c return $ bladeRFErrorTy ret
639
bladeRFWriteFlash dev b p c = allocaBytes (fromIntegral $ p * c'BLADERF_FLASH_PAGE_SIZE) $ \bptr -> do -- XXX - Buffer allocation size must be `page` * BLADERF_FLASH_PAGE_SIZE bytes or larger. pokeArray bptr (BS.unpack b) -- XXX can we overflow here?? ret <- c'bladerf_write_flash (unDeviceHandle dev) bptr p c return $ bladeRFErrorTy ret
346
false
true
0
12
194
126
63
63
null
null
mxswd/ylj-2014
4_data/Vec.hs
bsd-3-clause
sum :: forall l t. (KnownNat l, BlasNum t) => MVec l t -> IO t sum (MVec v) = M.unsafeWith v (\p -> blas_sum NAT(l) p 1)
120
sum :: forall l t. (KnownNat l, BlasNum t) => MVec l t -> IO t sum (MVec v) = M.unsafeWith v (\p -> blas_sum NAT(l) p 1)
120
sum (MVec v) = M.unsafeWith v (\p -> blas_sum NAT(l) p 1)
57
false
true
0
9
27
80
41
39
null
null
keithodulaigh/Hets
HasCASL/RunMixfixParser.hs
gpl-2.0
stdOps :: Set.Set Id stdOps = mkIds $ stdOpsL ++ ["__#", "D__", "if__then__else__"] ++ map (: []) "#0123456789abcdefghijklmnopqxABCDEFGHIJKLMNO"
146
stdOps :: Set.Set Id stdOps = mkIds $ stdOpsL ++ ["__#", "D__", "if__then__else__"] ++ map (: []) "#0123456789abcdefghijklmnopqxABCDEFGHIJKLMNO"
146
stdOps = mkIds $ stdOpsL ++ ["__#", "D__", "if__then__else__"] ++ map (: []) "#0123456789abcdefghijklmnopqxABCDEFGHIJKLMNO"
125
false
true
6
7
19
54
27
27
null
null
Toxaris/Grammarkov
src/Text/Grammarkov.hs
bsd-3-clause
markov :: RandomGen g => Model s e -- ^ Markov model. -> State e -- ^ State space to walk through. -> g -- ^ Random number generator. -> [e] -- ^ Random walk through the state space. markov (Model step finish s) (State _ m) g = go m s g where go m s g = let nexts = [(p, (e, s, state)) | (e, state) <- Map.toList m, let (p, s) = step s e] n = length nexts k = sum (map fst nexts) (x, g') = randomR (0, k - 1) g (e, s', State f' m') = select x nexts in e : if f' then let (x, g'') = randomR (0, 1) g in if x < finish s' then [] else go m' s' g'' else go m' s' g'
668
markov :: RandomGen g => Model s e -- ^ Markov model. -> State e -- ^ State space to walk through. -> g -- ^ Random number generator. -> [e] markov (Model step finish s) (State _ m) g = go m s g where go m s g = let nexts = [(p, (e, s, state)) | (e, state) <- Map.toList m, let (p, s) = step s e] n = length nexts k = sum (map fst nexts) (x, g') = randomR (0, k - 1) g (e, s', State f' m') = select x nexts in e : if f' then let (x, g'') = randomR (0, 1) g in if x < finish s' then [] else go m' s' g'' else go m' s' g'
624
markov (Model step finish s) (State _ m) g = go m s g where go m s g = let nexts = [(p, (e, s, state)) | (e, state) <- Map.toList m, let (p, s) = step s e] n = length nexts k = sum (map fst nexts) (x, g') = randomR (0, k - 1) g (e, s', State f' m') = select x nexts in e : if f' then let (x, g'') = randomR (0, 1) g in if x < finish s' then [] else go m' s' g'' else go m' s' g'
466
true
true
0
16
245
311
161
150
null
null
vincenthz/hs-gen-storable
src/DSL.hs
bsd-3-clause
numberToInt :: Number -> Int numberToInt (Hexadecimal i) = i
60
numberToInt :: Number -> Int numberToInt (Hexadecimal i) = i
60
numberToInt (Hexadecimal i) = i
31
false
true
0
7
9
24
12
12
null
null
wimdu/alonzo
src/Channel/Match.hs
mit
message :: Monad m => (UserName -> String -> m ()) -> Event -> m () message action ev = case ev of Message nick msg -> action nick msg _ -> return ()
153
message :: Monad m => (UserName -> String -> m ()) -> Event -> m () message action ev = case ev of Message nick msg -> action nick msg _ -> return ()
153
message action ev = case ev of Message nick msg -> action nick msg _ -> return ()
85
false
true
3
11
37
81
39
42
null
null
supki/libjenkins
src/Jenkins/Rest/Method/Internal.hs
bsd-2-clause
renderF (_ :@ SPython) = Just "api/python"
42
renderF (_ :@ SPython) = Just "api/python"
42
renderF (_ :@ SPython) = Just "api/python"
42
false
false
0
7
6
19
9
10
null
null
jeroennoels/exact-real
test/Ternary/TestTernary.hs
mit
coreTest = quickSuite $ [testBasicTernary, miscUnitTest]
58
coreTest = quickSuite $ [testBasicTernary, miscUnitTest]
58
coreTest = quickSuite $ [testBasicTernary, miscUnitTest]
58
false
false
0
6
7
16
9
7
null
null
kelnage/tamarin-prover
lib/term/src/Term/Builtin/Convenience.hs
gpl-3.0
revealSign (a,b) = fAppNoEq revealSignSym [a,b]
47
revealSign (a,b) = fAppNoEq revealSignSym [a,b]
47
revealSign (a,b) = fAppNoEq revealSignSym [a,b]
47
false
false
0
6
5
26
14
12
null
null
pikajude/explain
src/Main.hs
mit
explainDec DataDecl{} = error "Data declarations not supported in let bindings."
88
explainDec DataDecl{} = error "Data declarations not supported in let bindings."
88
explainDec DataDecl{} = error "Data declarations not supported in let bindings."
88
false
false
0
6
18
16
7
9
null
null
kishoredbn/barrelfish
hake/RuleDefs.hs
mit
mackerelDevFileLoc d = In SrcTree "src" ("/devices" </> (d ++ ".dev"))
70
mackerelDevFileLoc d = In SrcTree "src" ("/devices" </> (d ++ ".dev"))
70
mackerelDevFileLoc d = In SrcTree "src" ("/devices" </> (d ++ ".dev"))
70
false
false
0
9
10
30
15
15
null
null
gridaphobe/ghc
compiler/main/DynFlags.hs
bsd-3-clause
-- | Combine two Safe Haskell modes correctly. Used for dealing with multiple flags. -- This makes Safe Haskell very much a monoid but for now I prefer this as I don't -- want to export this functionality from the module but do want to export the -- type constructors. combineSafeFlags :: SafeHaskellMode -> SafeHaskellMode -> DynP SafeHaskellMode combineSafeFlags a b | a == Sf_None = return b | b == Sf_None = return a | a == b = return a | otherwise = addErr errm >> return (panic errm) where errm = "Incompatible Safe Haskell flags! (" ++ show a ++ ", " ++ show b ++ ")" -- | A list of unsafe flags under Safe Haskell. Tuple elements are: -- * name of the flag -- * function to get srcspan that enabled the flag -- * function to test if the flag is on -- * function to turn the flag off
935
combineSafeFlags :: SafeHaskellMode -> SafeHaskellMode -> DynP SafeHaskellMode combineSafeFlags a b | a == Sf_None = return b | b == Sf_None = return a | a == b = return a | otherwise = addErr errm >> return (panic errm) where errm = "Incompatible Safe Haskell flags! (" ++ show a ++ ", " ++ show b ++ ")" -- | A list of unsafe flags under Safe Haskell. Tuple elements are: -- * name of the flag -- * function to get srcspan that enabled the flag -- * function to test if the flag is on -- * function to turn the flag off
666
combineSafeFlags a b | a == Sf_None = return b | b == Sf_None = return a | a == b = return a | otherwise = addErr errm >> return (panic errm) where errm = "Incompatible Safe Haskell flags! (" ++ show a ++ ", " ++ show b ++ ")" -- | A list of unsafe flags under Safe Haskell. Tuple elements are: -- * name of the flag -- * function to get srcspan that enabled the flag -- * function to test if the flag is on -- * function to turn the flag off
587
true
true
0
9
301
136
66
70
null
null
jystic/river
src/River/Map.hs
bsd-3-clause
mapIntersectionSet :: Ord k => Map k v -> Set k -> Map k v mapIntersectionSet m = Map.intersection m . Map.fromSet (const ())
127
mapIntersectionSet :: Ord k => Map k v -> Set k -> Map k v mapIntersectionSet m = Map.intersection m . Map.fromSet (const ())
127
mapIntersectionSet m = Map.intersection m . Map.fromSet (const ())
68
false
true
0
9
25
64
29
35
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
translateOp dflags ISraOp = Just (mo_wordSShr dflags)
61
translateOp dflags ISraOp = Just (mo_wordSShr dflags)
61
translateOp dflags ISraOp = Just (mo_wordSShr dflags)
61
false
false
0
7
14
20
9
11
null
null
HJvT/com
System/Win32/Com/Exception.hs
bsd-3-clause
sTG_E_OLDDLL :: HRESULT sTG_E_OLDDLL = word32ToInt32 (0x80030105 ::Word32)
74
sTG_E_OLDDLL :: HRESULT sTG_E_OLDDLL = word32ToInt32 (0x80030105 ::Word32)
74
sTG_E_OLDDLL = word32ToInt32 (0x80030105 ::Word32)
50
false
true
0
6
7
26
12
14
null
null
aaronc/Idris-dev
src/Idris/Delaborate.hs
bsd-3-clause
pprintErr' i (InvalidTCArg n t) = annTm t (pprintTerm i (delabSugared i t)) <+> text " cannot be a parameter of " <> annName n <$> text "(Type class arguments must be injective)"
198
pprintErr' i (InvalidTCArg n t) = annTm t (pprintTerm i (delabSugared i t)) <+> text " cannot be a parameter of " <> annName n <$> text "(Type class arguments must be injective)"
198
pprintErr' i (InvalidTCArg n t) = annTm t (pprintTerm i (delabSugared i t)) <+> text " cannot be a parameter of " <> annName n <$> text "(Type class arguments must be injective)"
198
false
false
4
9
52
67
28
39
null
null
spockwangs/scheme.in.haskell
list10.hs
unlicense
closePort :: [LispVal] -> IOThrowsError LispVal closePort [Port port] = liftIO $ hClose port >> (return $ Bool True)
116
closePort :: [LispVal] -> IOThrowsError LispVal closePort [Port port] = liftIO $ hClose port >> (return $ Bool True)
116
closePort [Port port] = liftIO $ hClose port >> (return $ Bool True)
68
false
true
0
8
18
55
26
29
null
null
lpenz/realworldhaskell-exercises
ch03/Palindrome.hs
mit
palindrome1 :: [a] -> [a] palindrome1 l = l ++ reverse l
56
palindrome1 :: [a] -> [a] palindrome1 l = l ++ reverse l
56
palindrome1 l = l ++ reverse l
30
false
true
2
8
11
37
17
20
null
null
jbracker/supermonad-plugin
src/Control/Super/Plugin/Detect.hs
bsd-3-clause
indModule :: Maybe UnitId -> String -> TcPluginM (Either SDoc Module) findModule pkgKeyToFind mdlNameToFind = do (gblEnv, _lclEnv) <- getEnvs let mdls = moduleEnvKeys $ imp_mods $ tcg_imports $ gblEnv case find (isModule . splitModule) mdls of Just mdl -> return $ Right mdl Nothing -> return $ Left $ text $ "Could not find module '" ++ mdlNameToFind ++ "'" where isModule :: (UnitId, ModuleName) -> Bool isModule (pkgKey, mdlName) = maybe True (pkgKey ==) pkgKeyToFind && mdlName == mkModuleName mdlNameToFind splitModule :: Module -> (UnitId, ModuleName) splitModule mdl = (moduleUnitId mdl, moduleName mdl) -- | Makes sure that only one of the given modules was found and returns that -- found module. If many or none of them were found an error is returned. -- The returned error message can be customized using the optional -- function.
904
findModule :: Maybe UnitId -> String -> TcPluginM (Either SDoc Module) findModule pkgKeyToFind mdlNameToFind = do (gblEnv, _lclEnv) <- getEnvs let mdls = moduleEnvKeys $ imp_mods $ tcg_imports $ gblEnv case find (isModule . splitModule) mdls of Just mdl -> return $ Right mdl Nothing -> return $ Left $ text $ "Could not find module '" ++ mdlNameToFind ++ "'" where isModule :: (UnitId, ModuleName) -> Bool isModule (pkgKey, mdlName) = maybe True (pkgKey ==) pkgKeyToFind && mdlName == mkModuleName mdlNameToFind splitModule :: Module -> (UnitId, ModuleName) splitModule mdl = (moduleUnitId mdl, moduleName mdl) -- | Makes sure that only one of the given modules was found and returns that -- found module. If many or none of them were found an error is returned. -- The returned error message can be customized using the optional -- function.
904
findModule pkgKeyToFind mdlNameToFind = do (gblEnv, _lclEnv) <- getEnvs let mdls = moduleEnvKeys $ imp_mods $ tcg_imports $ gblEnv case find (isModule . splitModule) mdls of Just mdl -> return $ Right mdl Nothing -> return $ Left $ text $ "Could not find module '" ++ mdlNameToFind ++ "'" where isModule :: (UnitId, ModuleName) -> Bool isModule (pkgKey, mdlName) = maybe True (pkgKey ==) pkgKeyToFind && mdlName == mkModuleName mdlNameToFind splitModule :: Module -> (UnitId, ModuleName) splitModule mdl = (moduleUnitId mdl, moduleName mdl) -- | Makes sure that only one of the given modules was found and returns that -- found module. If many or none of them were found an error is returned. -- The returned error message can be customized using the optional -- function.
833
false
true
3
14
200
227
116
111
null
null
apyrgio/ganeti
src/Ganeti/Locking/Allocation.hs
bsd-2-clause
-- | Internal function to update the state according to a single -- lock request, assuming all prerequisites are met. updateLock :: (Ord a, Ord b) => b -> LockAllocation a b -> LockRequest a -> LockAllocation a b updateLock owner state (LockRequest lock (Just OwnExclusive)) = let locks = laLocks state lockstate' = case M.lookup lock locks of Just (Exclusive _ i) -> Exclusive owner i Just (Shared _ i) -> Exclusive owner i Nothing -> Exclusive owner M.empty locks' = M.insert lock lockstate' locks ownersLocks' = M.insert lock OwnExclusive $ listLocks owner state owned' = M.insert owner ownersLocks' $ laOwned state in state { laLocks = locks', laOwned = owned' }
740
updateLock :: (Ord a, Ord b) => b -> LockAllocation a b -> LockRequest a -> LockAllocation a b updateLock owner state (LockRequest lock (Just OwnExclusive)) = let locks = laLocks state lockstate' = case M.lookup lock locks of Just (Exclusive _ i) -> Exclusive owner i Just (Shared _ i) -> Exclusive owner i Nothing -> Exclusive owner M.empty locks' = M.insert lock lockstate' locks ownersLocks' = M.insert lock OwnExclusive $ listLocks owner state owned' = M.insert owner ownersLocks' $ laOwned state in state { laLocks = locks', laOwned = owned' }
622
updateLock owner state (LockRequest lock (Just OwnExclusive)) = let locks = laLocks state lockstate' = case M.lookup lock locks of Just (Exclusive _ i) -> Exclusive owner i Just (Shared _ i) -> Exclusive owner i Nothing -> Exclusive owner M.empty locks' = M.insert lock lockstate' locks ownersLocks' = M.insert lock OwnExclusive $ listLocks owner state owned' = M.insert owner ownersLocks' $ laOwned state in state { laLocks = locks', laOwned = owned' }
505
true
true
0
14
186
229
112
117
null
null
faylang/snaplet-fay
src/Snap/Snaplet/Fay.hs
bsd-3-clause
decode :: (Data f1, Read f1) => Handler h1 h2 (Either ByteString f1) decode = do body <- readRequestBody 1024 -- Nothing will break by abusing this :)! res <- return $ A.decode body >>= readFromFay return $ case res of Nothing -> Left. BS.concat . BL.toChunks $ "Could not decode " `BL.append` body Just x -> Right x -- | Compiles according to the specified mode.
378
decode :: (Data f1, Read f1) => Handler h1 h2 (Either ByteString f1) decode = do body <- readRequestBody 1024 -- Nothing will break by abusing this :)! res <- return $ A.decode body >>= readFromFay return $ case res of Nothing -> Left. BS.concat . BL.toChunks $ "Could not decode " `BL.append` body Just x -> Right x -- | Compiles according to the specified mode.
378
decode = do body <- readRequestBody 1024 -- Nothing will break by abusing this :)! res <- return $ A.decode body >>= readFromFay return $ case res of Nothing -> Left. BS.concat . BL.toChunks $ "Could not decode " `BL.append` body Just x -> Right x -- | Compiles according to the specified mode.
309
false
true
0
15
81
126
62
64
null
null
alexander-at-github/eta
compiler/ETA/BasicTypes/VarEnv.hs
bsd-3-clause
plusVarEnv_C = plusUFM_C
28
plusVarEnv_C = plusUFM_C
28
plusVarEnv_C = plusUFM_C
28
false
false
1
5
6
10
3
7
null
null
ardfard/protolude
src/Bool.hs
mit
ifM :: Monad m => m Bool -> m a -> m a -> m a ifM p x y = p >>= \b -> if b then x else y
88
ifM :: Monad m => m Bool -> m a -> m a -> m a ifM p x y = p >>= \b -> if b then x else y
88
ifM p x y = p >>= \b -> if b then x else y
42
false
true
0
9
30
66
32
34
null
null
tippenein/job-application
src/JobApplication/Client.hs
mit
getApplicants' :<|> postApplicant' = client applicationAPI host where host = BaseUrl Http "localhost" 8081
118
getApplicants' :<|> postApplicant' = client applicationAPI host where host = BaseUrl Http "localhost" 8081
118
getApplicants' :<|> postApplicant' = client applicationAPI host where host = BaseUrl Http "localhost" 8081
118
false
false
5
5
25
43
16
27
null
null
da-x/ghc
compiler/ghci/ByteCodeItbls.hs
bsd-3-clause
-- Make info tables for the data decls in this module mkITbls :: DynFlags -> [TyCon] -> IO ItblEnv mkITbls _ [] = return emptyNameEnv
133
mkITbls :: DynFlags -> [TyCon] -> IO ItblEnv mkITbls _ [] = return emptyNameEnv
79
mkITbls _ [] = return emptyNameEnv
34
true
true
0
9
24
41
19
22
null
null
junjihashimoto/mathflow
src/MathFlow/TF/Train.hs
bsd-3-clause
maybeBatchJoin' :: String -> String -> String -> String -> String -> String -> String -> String -> String -> String -> Tensor n t a maybeBatchJoin' tensors_list keep_input batch_size capacity enqueue_many shapes dynamic_pad allow_smaller_final_batch shared_name name = TSym "tf.maybe_batch_join" <+> TArgS "tensors_list" tensors_list <+> TArgS "keep_input" keep_input <+> TArgS "batch_size" batch_size <+> TArgS "capacity" capacity <+> TArgS "enqueue_many" enqueue_many <+> TArgS "shapes" shapes <+> TArgS "dynamic_pad" dynamic_pad <+> TArgS "allow_smaller_final_batch" allow_smaller_final_batch <+> TArgS "shared_name" shared_name <+> TArgS "name" name
654
maybeBatchJoin' :: String -> String -> String -> String -> String -> String -> String -> String -> String -> String -> Tensor n t a maybeBatchJoin' tensors_list keep_input batch_size capacity enqueue_many shapes dynamic_pad allow_smaller_final_batch shared_name name = TSym "tf.maybe_batch_join" <+> TArgS "tensors_list" tensors_list <+> TArgS "keep_input" keep_input <+> TArgS "batch_size" batch_size <+> TArgS "capacity" capacity <+> TArgS "enqueue_many" enqueue_many <+> TArgS "shapes" shapes <+> TArgS "dynamic_pad" dynamic_pad <+> TArgS "allow_smaller_final_batch" allow_smaller_final_batch <+> TArgS "shared_name" shared_name <+> TArgS "name" name
653
maybeBatchJoin' tensors_list keep_input batch_size capacity enqueue_many shapes dynamic_pad allow_smaller_final_batch shared_name name = TSym "tf.maybe_batch_join" <+> TArgS "tensors_list" tensors_list <+> TArgS "keep_input" keep_input <+> TArgS "batch_size" batch_size <+> TArgS "capacity" capacity <+> TArgS "enqueue_many" enqueue_many <+> TArgS "shapes" shapes <+> TArgS "dynamic_pad" dynamic_pad <+> TArgS "allow_smaller_final_batch" allow_smaller_final_batch <+> TArgS "shared_name" shared_name <+> TArgS "name" name
521
false
true
0
15
80
172
80
92
null
null
bredelings/BAli-Phy
haskell/Tree.hs
gpl-2.0
node_times (RateTimeTree tt _) = node_times tt
46
node_times (RateTimeTree tt _) = node_times tt
46
node_times (RateTimeTree tt _) = node_times tt
46
false
false
0
7
6
20
9
11
null
null
richardfergie/tag-manager
Tests/main.hs
bsd-3-clause
prop_encodedecode t = (decode $ encode t) == Just t where types = (t :: [Tag])
81
prop_encodedecode t = (decode $ encode t) == Just t where types = (t :: [Tag])
81
prop_encodedecode t = (decode $ encode t) == Just t where types = (t :: [Tag])
81
false
false
0
8
18
43
22
21
null
null
tel/saltine
src/Crypto/Saltine/Core/AEAD/XChaCha20Poly1305.hs
mit
-- | Creates a random 'XChaCha20Poly1305' key newKey :: IO Key newKey = Key <$> randomByteString Bytes.aead_xchacha20poly1305_ietf_keybytes
139
newKey :: IO Key newKey = Key <$> randomByteString Bytes.aead_xchacha20poly1305_ietf_keybytes
93
newKey = Key <$> randomByteString Bytes.aead_xchacha20poly1305_ietf_keybytes
76
true
true
2
6
16
30
13
17
null
null
ezyang/ghc
testsuite/tests/th/T12977.hs
bsd-3-clause
zero :: () -> $(conT (unboxedTupleTypeName 0)) zero () = $(conE (unboxedTupleDataName 0))
90
zero :: () -> $(conT (unboxedTupleTypeName 0)) zero () = $(conE (unboxedTupleDataName 0))
90
zero () = $(conE (unboxedTupleDataName 0))
43
false
true
0
10
13
48
23
25
null
null
mightymoose/liquidhaskell
src/Language/Haskell/Liquid/Parse.hs
bsd-3-clause
mkPredVarType t | isOk = Right $ zip xs ts | otherwise = Left err where isOk = isPropBareType tOut || isHPropBareType tOut tOut = ty_res trep trep = toRTypeRep t xs = ty_binds trep ts = toRSort <$> ty_args trep err = "Predicate Variable with non-Prop output sort: " ++ showpp t
347
mkPredVarType t | isOk = Right $ zip xs ts | otherwise = Left err where isOk = isPropBareType tOut || isHPropBareType tOut tOut = ty_res trep trep = toRTypeRep t xs = ty_binds trep ts = toRSort <$> ty_args trep err = "Predicate Variable with non-Prop output sort: " ++ showpp t
347
mkPredVarType t | isOk = Right $ zip xs ts | otherwise = Left err where isOk = isPropBareType tOut || isHPropBareType tOut tOut = ty_res trep trep = toRTypeRep t xs = ty_binds trep ts = toRSort <$> ty_args trep err = "Predicate Variable with non-Prop output sort: " ++ showpp t
347
false
false
1
7
122
100
47
53
null
null
benclifford/lsc-todaybot
Main.hs
bsd-3-clause
dateSeparator = P.oneOf "/-.\\"
31
dateSeparator = P.oneOf "/-.\\"
31
dateSeparator = P.oneOf "/-.\\"
31
false
false
0
6
3
11
5
6
null
null
zerobuzz/packunused
packunused.hs
bsd-3-clause
readImports :: FilePath -> FilePath -> IO (ModuleName, [(ModuleName, [String])]) readImports outDir fn = do unless (".imports" `isSuffixOf` fn) $ fail ("argument "++show fn++" doesn't have .imports extension") let m = MN.fromString $ take (length fn - length ".imports") fn contents <- readFile (outDir </> fn) case parseImportsFile contents of (H.ParseOk (H.Module _ _ _ _ _ imps _)) -> do let imps' = [ (MN.fromString mn, extractSpecs (H.importSpecs imp)) | imp <- imps, let H.ModuleName mn = H.importModule imp ] return (m, imps') H.ParseFailed loc msg -> do putStrLn "*ERROR* failed to parse .imports file" putStrLn $ H.prettyPrint loc ++ ": " ++ msg exitFailure where extractSpecs (Just (False, impspecs)) = map H.prettyPrint impspecs extractSpecs _ = error "unexpected import specs" parseImportsFile = H.parseFileContentsWithMode (H.defaultParseMode { H.extensions = exts, H.parseFilename = outDir </> fn }) . stripExplicitNamespaces . stripSafe -- hack to remove -XExplicitNamespaces until haskell-src-exts supports that stripExplicitNamespaces = unwords . splitOn " type " stripSafe = unwords . splitOn " safe " #if MIN_VERSION_haskell_src_exts(1,14,0) exts = map H.EnableExtension [ H.MagicHash, H.PackageImports, H.CPP, H.TypeOperators, H.TypeFamilies {- , H.ExplicitNamespaces -} ] #else exts = [ H.MagicHash, H.PackageImports, H.CPP, H.TypeOperators, H.TypeFamilies ] #endif
1,551
readImports :: FilePath -> FilePath -> IO (ModuleName, [(ModuleName, [String])]) readImports outDir fn = do unless (".imports" `isSuffixOf` fn) $ fail ("argument "++show fn++" doesn't have .imports extension") let m = MN.fromString $ take (length fn - length ".imports") fn contents <- readFile (outDir </> fn) case parseImportsFile contents of (H.ParseOk (H.Module _ _ _ _ _ imps _)) -> do let imps' = [ (MN.fromString mn, extractSpecs (H.importSpecs imp)) | imp <- imps, let H.ModuleName mn = H.importModule imp ] return (m, imps') H.ParseFailed loc msg -> do putStrLn "*ERROR* failed to parse .imports file" putStrLn $ H.prettyPrint loc ++ ": " ++ msg exitFailure where extractSpecs (Just (False, impspecs)) = map H.prettyPrint impspecs extractSpecs _ = error "unexpected import specs" parseImportsFile = H.parseFileContentsWithMode (H.defaultParseMode { H.extensions = exts, H.parseFilename = outDir </> fn }) . stripExplicitNamespaces . stripSafe -- hack to remove -XExplicitNamespaces until haskell-src-exts supports that stripExplicitNamespaces = unwords . splitOn " type " stripSafe = unwords . splitOn " safe " #if MIN_VERSION_haskell_src_exts(1,14,0) exts = map H.EnableExtension [ H.MagicHash, H.PackageImports, H.CPP, H.TypeOperators, H.TypeFamilies {- , H.ExplicitNamespaces -} ] #else exts = [ H.MagicHash, H.PackageImports, H.CPP, H.TypeOperators, H.TypeFamilies ] #endif
1,551
readImports outDir fn = do unless (".imports" `isSuffixOf` fn) $ fail ("argument "++show fn++" doesn't have .imports extension") let m = MN.fromString $ take (length fn - length ".imports") fn contents <- readFile (outDir </> fn) case parseImportsFile contents of (H.ParseOk (H.Module _ _ _ _ _ imps _)) -> do let imps' = [ (MN.fromString mn, extractSpecs (H.importSpecs imp)) | imp <- imps, let H.ModuleName mn = H.importModule imp ] return (m, imps') H.ParseFailed loc msg -> do putStrLn "*ERROR* failed to parse .imports file" putStrLn $ H.prettyPrint loc ++ ": " ++ msg exitFailure where extractSpecs (Just (False, impspecs)) = map H.prettyPrint impspecs extractSpecs _ = error "unexpected import specs" parseImportsFile = H.parseFileContentsWithMode (H.defaultParseMode { H.extensions = exts, H.parseFilename = outDir </> fn }) . stripExplicitNamespaces . stripSafe -- hack to remove -XExplicitNamespaces until haskell-src-exts supports that stripExplicitNamespaces = unwords . splitOn " type " stripSafe = unwords . splitOn " safe " #if MIN_VERSION_haskell_src_exts(1,14,0) exts = map H.EnableExtension [ H.MagicHash, H.PackageImports, H.CPP, H.TypeOperators, H.TypeFamilies {- , H.ExplicitNamespaces -} ] #else exts = [ H.MagicHash, H.PackageImports, H.CPP, H.TypeOperators, H.TypeFamilies ] #endif
1,470
false
true
0
21
357
443
223
220
null
null
brenov/set
interpreter/Expressions.hs
mit
eval (Nat x p) (Greater _) (Real y _) = Bool (integerToFloat(x) > y) p
71
eval (Nat x p) (Greater _) (Real y _) = Bool (integerToFloat(x) > y) p
71
eval (Nat x p) (Greater _) (Real y _) = Bool (integerToFloat(x) > y) p
71
false
false
0
9
15
57
27
30
null
null
cartazio/omega
src/Auxillary.hs
bsd-3-clause
useDisplay :: Eq a => (String -> String) -> DispInfo a -> a -> (DispInfo a,String) useDisplay newnamef (info@(DI(xs,bad,supply))) uniq = case lookup uniq xs of Just y -> (info,y) Nothing -> let (m,supply2) = next bad supply name = newnamef m in (DI((uniq,name):xs,bad,supply2),name)
326
useDisplay :: Eq a => (String -> String) -> DispInfo a -> a -> (DispInfo a,String) useDisplay newnamef (info@(DI(xs,bad,supply))) uniq = case lookup uniq xs of Just y -> (info,y) Nothing -> let (m,supply2) = next bad supply name = newnamef m in (DI((uniq,name):xs,bad,supply2),name)
326
useDisplay newnamef (info@(DI(xs,bad,supply))) uniq = case lookup uniq xs of Just y -> (info,y) Nothing -> let (m,supply2) = next bad supply name = newnamef m in (DI((uniq,name):xs,bad,supply2),name)
243
false
true
3
10
87
162
88
74
null
null
Noeda/compiled-expressions
test/Main.hs
mit
testOp1 :: (forall a. Floating a => a -> a) -> (Double -> Bool) testOp1 op x = let correct_result = op x compiled_expr = compileExpression3 (\z -> op z) in correct_result `eq2` compiled_expr x
217
testOp1 :: (forall a. Floating a => a -> a) -> (Double -> Bool) testOp1 op x = let correct_result = op x compiled_expr = compileExpression3 (\z -> op z) in correct_result `eq2` compiled_expr x
217
testOp1 op x = let correct_result = op x compiled_expr = compileExpression3 (\z -> op z) in correct_result `eq2` compiled_expr x
145
false
true
0
12
59
88
45
43
null
null
pparkkin/eta
compiler/ETA/Prelude/PrelNames.hs
bsd-3-clause
modIntegerName = varQual gHC_INTEGER_TYPE (fsLit "modInteger") modIntegerIdKey
92
modIntegerName = varQual gHC_INTEGER_TYPE (fsLit "modInteger") modIntegerIdKey
92
modIntegerName = varQual gHC_INTEGER_TYPE (fsLit "modInteger") modIntegerIdKey
92
false
false
0
7
20
19
9
10
null
null
garetxe/cabal
Cabal/Distribution/Simple/Setup.hs
bsd-3-clause
splitArgs :: String -> [String] splitArgs = space [] where space :: String -> String -> [String] space w [] = word w [] space w ( c :s) | isSpace c = word w (space [] s) space w ('"':s) = string w s space w s = nonstring w s string :: String -> String -> [String] string w [] = word w [] string w ('"':s) = space w s string w ( c :s) = string (c:w) s nonstring :: String -> String -> [String] nonstring w [] = word w [] nonstring w ('"':s) = string w s nonstring w ( c :s) = space (c:w) s word [] s = s word w s = reverse w : s -- The test cases kinda have to be rewritten from the ground up... :/ --hunitTests :: [Test] --hunitTests = -- let m = [("ghc", GHC), ("nhc98", NHC), ("hugs", Hugs)] -- (flags, commands', unkFlags, ers) -- = getOpt Permute options ["configure", "foobar", "--prefix=/foo", "--ghc", "--nhc98", "--hugs", "--with-compiler=/comp", "--unknown1", "--unknown2", "--install-prefix=/foo", "--user", "--global"] -- in [TestLabel "very basic option parsing" $ TestList [ -- "getOpt flags" ~: "failed" ~: -- [Prefix "/foo", GhcFlag, NhcFlag, HugsFlag, -- WithCompiler "/comp", InstPrefix "/foo", UserFlag, GlobalFlag] -- ~=? flags, -- "getOpt commands" ~: "failed" ~: ["configure", "foobar"] ~=? commands', -- "getOpt unknown opts" ~: "failed" ~: -- ["--unknown1", "--unknown2"] ~=? unkFlags, -- "getOpt errors" ~: "failed" ~: [] ~=? ers], -- -- TestLabel "test location of various compilers" $ TestList -- ["configure parsing for prefix and compiler flag" ~: "failed" ~: -- (Right (ConfigCmd (Just comp, Nothing, Just "/usr/local"), [])) -- ~=? (parseArgs ["--prefix=/usr/local", "--"++name, "configure"]) -- | (name, comp) <- m], -- -- TestLabel "find the package tool" $ TestList -- ["configure parsing for prefix comp flag, withcompiler" ~: "failed" ~: -- (Right (ConfigCmd (Just comp, Just "/foo/comp", Just "/usr/local"), [])) -- ~=? (parseArgs ["--prefix=/usr/local", "--"++name, -- "--with-compiler=/foo/comp", "configure"]) -- | (name, comp) <- m], -- -- TestLabel "simpler commands" $ TestList -- [flag ~: "failed" ~: (Right (flagCmd, [])) ~=? (parseArgs [flag]) -- | (flag, flagCmd) <- [("build", BuildCmd), -- ("install", InstallCmd Nothing False), -- ("sdist", SDistCmd), -- ("register", RegisterCmd False)] -- ] -- ] {- Testing ideas: * IO to look for hugs and hugs-pkg (which hugs, etc) * quickCheck to test permutations of arguments * what other options can we over-ride with a command-line flag? -}
3,103
splitArgs :: String -> [String] splitArgs = space [] where space :: String -> String -> [String] space w [] = word w [] space w ( c :s) | isSpace c = word w (space [] s) space w ('"':s) = string w s space w s = nonstring w s string :: String -> String -> [String] string w [] = word w [] string w ('"':s) = space w s string w ( c :s) = string (c:w) s nonstring :: String -> String -> [String] nonstring w [] = word w [] nonstring w ('"':s) = string w s nonstring w ( c :s) = space (c:w) s word [] s = s word w s = reverse w : s -- The test cases kinda have to be rewritten from the ground up... :/ --hunitTests :: [Test] --hunitTests = -- let m = [("ghc", GHC), ("nhc98", NHC), ("hugs", Hugs)] -- (flags, commands', unkFlags, ers) -- = getOpt Permute options ["configure", "foobar", "--prefix=/foo", "--ghc", "--nhc98", "--hugs", "--with-compiler=/comp", "--unknown1", "--unknown2", "--install-prefix=/foo", "--user", "--global"] -- in [TestLabel "very basic option parsing" $ TestList [ -- "getOpt flags" ~: "failed" ~: -- [Prefix "/foo", GhcFlag, NhcFlag, HugsFlag, -- WithCompiler "/comp", InstPrefix "/foo", UserFlag, GlobalFlag] -- ~=? flags, -- "getOpt commands" ~: "failed" ~: ["configure", "foobar"] ~=? commands', -- "getOpt unknown opts" ~: "failed" ~: -- ["--unknown1", "--unknown2"] ~=? unkFlags, -- "getOpt errors" ~: "failed" ~: [] ~=? ers], -- -- TestLabel "test location of various compilers" $ TestList -- ["configure parsing for prefix and compiler flag" ~: "failed" ~: -- (Right (ConfigCmd (Just comp, Nothing, Just "/usr/local"), [])) -- ~=? (parseArgs ["--prefix=/usr/local", "--"++name, "configure"]) -- | (name, comp) <- m], -- -- TestLabel "find the package tool" $ TestList -- ["configure parsing for prefix comp flag, withcompiler" ~: "failed" ~: -- (Right (ConfigCmd (Just comp, Just "/foo/comp", Just "/usr/local"), [])) -- ~=? (parseArgs ["--prefix=/usr/local", "--"++name, -- "--with-compiler=/foo/comp", "configure"]) -- | (name, comp) <- m], -- -- TestLabel "simpler commands" $ TestList -- [flag ~: "failed" ~: (Right (flagCmd, [])) ~=? (parseArgs [flag]) -- | (flag, flagCmd) <- [("build", BuildCmd), -- ("install", InstallCmd Nothing False), -- ("sdist", SDistCmd), -- ("register", RegisterCmd False)] -- ] -- ] {- Testing ideas: * IO to look for hugs and hugs-pkg (which hugs, etc) * quickCheck to test permutations of arguments * what other options can we over-ride with a command-line flag? -}
3,103
splitArgs = space [] where space :: String -> String -> [String] space w [] = word w [] space w ( c :s) | isSpace c = word w (space [] s) space w ('"':s) = string w s space w s = nonstring w s string :: String -> String -> [String] string w [] = word w [] string w ('"':s) = space w s string w ( c :s) = string (c:w) s nonstring :: String -> String -> [String] nonstring w [] = word w [] nonstring w ('"':s) = string w s nonstring w ( c :s) = space (c:w) s word [] s = s word w s = reverse w : s -- The test cases kinda have to be rewritten from the ground up... :/ --hunitTests :: [Test] --hunitTests = -- let m = [("ghc", GHC), ("nhc98", NHC), ("hugs", Hugs)] -- (flags, commands', unkFlags, ers) -- = getOpt Permute options ["configure", "foobar", "--prefix=/foo", "--ghc", "--nhc98", "--hugs", "--with-compiler=/comp", "--unknown1", "--unknown2", "--install-prefix=/foo", "--user", "--global"] -- in [TestLabel "very basic option parsing" $ TestList [ -- "getOpt flags" ~: "failed" ~: -- [Prefix "/foo", GhcFlag, NhcFlag, HugsFlag, -- WithCompiler "/comp", InstPrefix "/foo", UserFlag, GlobalFlag] -- ~=? flags, -- "getOpt commands" ~: "failed" ~: ["configure", "foobar"] ~=? commands', -- "getOpt unknown opts" ~: "failed" ~: -- ["--unknown1", "--unknown2"] ~=? unkFlags, -- "getOpt errors" ~: "failed" ~: [] ~=? ers], -- -- TestLabel "test location of various compilers" $ TestList -- ["configure parsing for prefix and compiler flag" ~: "failed" ~: -- (Right (ConfigCmd (Just comp, Nothing, Just "/usr/local"), [])) -- ~=? (parseArgs ["--prefix=/usr/local", "--"++name, "configure"]) -- | (name, comp) <- m], -- -- TestLabel "find the package tool" $ TestList -- ["configure parsing for prefix comp flag, withcompiler" ~: "failed" ~: -- (Right (ConfigCmd (Just comp, Just "/foo/comp", Just "/usr/local"), [])) -- ~=? (parseArgs ["--prefix=/usr/local", "--"++name, -- "--with-compiler=/foo/comp", "configure"]) -- | (name, comp) <- m], -- -- TestLabel "simpler commands" $ TestList -- [flag ~: "failed" ~: (Right (flagCmd, [])) ~=? (parseArgs [flag]) -- | (flag, flagCmd) <- [("build", BuildCmd), -- ("install", InstallCmd Nothing False), -- ("sdist", SDistCmd), -- ("register", RegisterCmd False)] -- ] -- ] {- Testing ideas: * IO to look for hugs and hugs-pkg (which hugs, etc) * quickCheck to test permutations of arguments * what other options can we over-ride with a command-line flag? -}
3,071
false
true
0
9
1,070
378
208
170
null
null
CindyLinz/zoomcraft
src/Shader.hs
mit
mkImageShader :: IO ( Program , AttribLocation -- pos , AttribLocation -- uv , UniformLocation -- tex ) mkImageShader = do vshdr <- mkShader VertexShader imageVertexShaderCode fshdr <- mkShader FragmentShader imageFragmentShaderCode prg <- createProgram attachShader prg vshdr attachShader prg fshdr linkProgram prg posLoc <- get $ attribLocation prg "pos" uvLoc <- get $ attribLocation prg "uv" texLoc <- get $ uniformLocation prg "tex" return (prg, posLoc, uvLoc, texLoc)
518
mkImageShader :: IO ( Program , AttribLocation -- pos , AttribLocation -- uv , UniformLocation -- tex ) mkImageShader = do vshdr <- mkShader VertexShader imageVertexShaderCode fshdr <- mkShader FragmentShader imageFragmentShaderCode prg <- createProgram attachShader prg vshdr attachShader prg fshdr linkProgram prg posLoc <- get $ attribLocation prg "pos" uvLoc <- get $ attribLocation prg "uv" texLoc <- get $ uniformLocation prg "tex" return (prg, posLoc, uvLoc, texLoc)
518
mkImageShader = do vshdr <- mkShader VertexShader imageVertexShaderCode fshdr <- mkShader FragmentShader imageFragmentShaderCode prg <- createProgram attachShader prg vshdr attachShader prg fshdr linkProgram prg posLoc <- get $ attribLocation prg "pos" uvLoc <- get $ attribLocation prg "uv" texLoc <- get $ uniformLocation prg "tex" return (prg, posLoc, uvLoc, texLoc)
392
false
true
1
10
112
152
70
82
null
null
VyacheslavHashov/parus
src/TAC.hs
bsd-3-clause
tacCodeBlock cb = concat <$> traverse (setLabel . tacInstruction) cb
68
tacCodeBlock cb = concat <$> traverse (setLabel . tacInstruction) cb
68
tacCodeBlock cb = concat <$> traverse (setLabel . tacInstruction) cb
68
false
false
3
6
9
31
12
19
null
null
ucam-cl-dtg/naps-camfort
Transformation/CommonBlockElim.hs
mit
allCoherentCommonsP :: [TLCommon A] -> (Report, Bool) allCoherentCommonsP commons = foldM (\p (c1, c2) -> (coherentCommonsP c1 c2) >>= (\p' -> return $ p && p')) True (pairs commons)
182
allCoherentCommonsP :: [TLCommon A] -> (Report, Bool) allCoherentCommonsP commons = foldM (\p (c1, c2) -> (coherentCommonsP c1 c2) >>= (\p' -> return $ p && p')) True (pairs commons)
182
allCoherentCommonsP commons = foldM (\p (c1, c2) -> (coherentCommonsP c1 c2) >>= (\p' -> return $ p && p')) True (pairs commons)
128
false
true
0
12
28
87
47
40
null
null
brendanhay/gogol
gogol-container/gen/Network/Google/Resource/Container/Projects/Locations/Clusters/NodePools/List.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). plcnplUploadProtocol :: Lens' ProjectsLocationsClustersNodePoolsList (Maybe Text) plcnplUploadProtocol = lens _plcnplUploadProtocol (\ s a -> s{_plcnplUploadProtocol = a})
241
plcnplUploadProtocol :: Lens' ProjectsLocationsClustersNodePoolsList (Maybe Text) plcnplUploadProtocol = lens _plcnplUploadProtocol (\ s a -> s{_plcnplUploadProtocol = a})
179
plcnplUploadProtocol = lens _plcnplUploadProtocol (\ s a -> s{_plcnplUploadProtocol = a})
97
true
true
1
9
33
51
25
26
null
null
MasseR/Views
Coffee.hs
bsd-3-clause
outOfDate :: FilePath -> IO Bool outOfDate = fmap not . isUpToDate
66
outOfDate :: FilePath -> IO Bool outOfDate = fmap not . isUpToDate
66
outOfDate = fmap not . isUpToDate
33
false
true
1
7
11
32
13
19
null
null
5outh/Elm
src/Generate/JavaScript.hs
bsd-3-clause
-- INTRO useStrict :: [Statement ()] useStrict = [ ExprStmt () (StringLit () "use strict") ]
98
useStrict :: [Statement ()] useStrict = [ ExprStmt () (StringLit () "use strict") ]
87
useStrict = [ ExprStmt () (StringLit () "use strict") ]
59
true
true
0
9
21
40
21
19
null
null
pbl64k/icfpc2014
code/ghc80.hs
bsd-2-clause
p_opmov = do lbl <- p_label string "mov" p_ws dest <- p_ramorreg p_ows char ',' p_ows src <- p_val return (Op lbl "mov" [dest, src])
168
p_opmov = do lbl <- p_label string "mov" p_ws dest <- p_ramorreg p_ows char ',' p_ows src <- p_val return (Op lbl "mov" [dest, src])
168
p_opmov = do lbl <- p_label string "mov" p_ws dest <- p_ramorreg p_ows char ',' p_ows src <- p_val return (Op lbl "mov" [dest, src])
168
false
false
0
10
60
70
30
40
null
null
ekmett/containers
Data/Map/Base.hs
bsd-3-clause
mapMaybeWithKey f (Bin _ kx x l r) = case f kx x of Just y -> join kx y (mapMaybeWithKey f l) (mapMaybeWithKey f r) Nothing -> merge (mapMaybeWithKey f l) (mapMaybeWithKey f r) -- | /O(n)/. Map values and separate the 'Left' and 'Right' results. -- -- > let f a = if a < "c" then Left a else Right a -- > mapEither f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) -- > == (fromList [(3,"b"), (5,"a")], fromList [(1,"x"), (7,"z")]) -- > -- > mapEither (\ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) -- > == (empty, fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])
593
mapMaybeWithKey f (Bin _ kx x l r) = case f kx x of Just y -> join kx y (mapMaybeWithKey f l) (mapMaybeWithKey f r) Nothing -> merge (mapMaybeWithKey f l) (mapMaybeWithKey f r) -- | /O(n)/. Map values and separate the 'Left' and 'Right' results. -- -- > let f a = if a < "c" then Left a else Right a -- > mapEither f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) -- > == (fromList [(3,"b"), (5,"a")], fromList [(1,"x"), (7,"z")]) -- > -- > mapEither (\ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) -- > == (empty, fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])
593
mapMaybeWithKey f (Bin _ kx x l r) = case f kx x of Just y -> join kx y (mapMaybeWithKey f l) (mapMaybeWithKey f r) Nothing -> merge (mapMaybeWithKey f l) (mapMaybeWithKey f r) -- | /O(n)/. Map values and separate the 'Left' and 'Right' results. -- -- > let f a = if a < "c" then Left a else Right a -- > mapEither f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) -- > == (fromList [(3,"b"), (5,"a")], fromList [(1,"x"), (7,"z")]) -- > -- > mapEither (\ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) -- > == (empty, fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])
593
false
false
0
10
119
105
53
52
null
null
Megaleo/Minehack
src/Effect.hs
bsd-3-clause
onEffect (W.World s str tiles) (Effect t@(c, (T.Tiles (T.Tile tt@(TT.TEntity _) a) t2)) (ChangeInHP hp)) = W.World s str $ (c, T.Tiles (T.Tile tt ((A.addHp (A.findSomeData a) hp) : (delete (A.findSomeData a) a))) t2) : (W.deleteTile t tiles)
265
onEffect (W.World s str tiles) (Effect t@(c, (T.Tiles (T.Tile tt@(TT.TEntity _) a) t2)) (ChangeInHP hp)) = W.World s str $ (c, T.Tiles (T.Tile tt ((A.addHp (A.findSomeData a) hp) : (delete (A.findSomeData a) a))) t2) : (W.deleteTile t tiles)
265
onEffect (W.World s str tiles) (Effect t@(c, (T.Tiles (T.Tile tt@(TT.TEntity _) a) t2)) (ChangeInHP hp)) = W.World s str $ (c, T.Tiles (T.Tile tt ((A.addHp (A.findSomeData a) hp) : (delete (A.findSomeData a) a))) t2) : (W.deleteTile t tiles)
265
false
false
0
17
61
166
85
81
null
null
ezyang/ghc
iserv/proxy-src/Remote.hs
bsd-3-clause
socketToPipe :: Socket -> IO Pipe socketToPipe sock = do hdl <- socketToHandle sock ReadWriteMode hSetBuffering hdl NoBuffering lo_ref <- newIORef Nothing pure Pipe{ pipeRead = hdl, pipeWrite = hdl, pipeLeftovers = lo_ref }
232
socketToPipe :: Socket -> IO Pipe socketToPipe sock = do hdl <- socketToHandle sock ReadWriteMode hSetBuffering hdl NoBuffering lo_ref <- newIORef Nothing pure Pipe{ pipeRead = hdl, pipeWrite = hdl, pipeLeftovers = lo_ref }
232
socketToPipe sock = do hdl <- socketToHandle sock ReadWriteMode hSetBuffering hdl NoBuffering lo_ref <- newIORef Nothing pure Pipe{ pipeRead = hdl, pipeWrite = hdl, pipeLeftovers = lo_ref }
198
false
true
0
9
42
77
37
40
null
null
snoyberg/ghc
compiler/basicTypes/OccName.hs
bsd-3-clause
delListFromOccEnv (A x) y = A $ delListFromUFM x y
51
delListFromOccEnv (A x) y = A $ delListFromUFM x y
51
delListFromOccEnv (A x) y = A $ delListFromUFM x y
51
false
false
0
7
10
26
12
14
null
null
AlexanderPankiv/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
stringTy_RDR, fromString_RDR :: RdrName stringTy_RDR = tcQual_RDR gHC_BASE (fsLit "String")
102
stringTy_RDR, fromString_RDR :: RdrName stringTy_RDR = tcQual_RDR gHC_BASE (fsLit "String")
102
stringTy_RDR = tcQual_RDR gHC_BASE (fsLit "String")
62
false
true
0
7
20
24
13
11
null
null
justinethier/husk-scheme
hs-src/Language/Scheme/Core.hs
mit
eval env cont val@(Number _) = continueEval env cont val Nothing
64
eval env cont val@(Number _) = continueEval env cont val Nothing
64
eval env cont val@(Number _) = continueEval env cont val Nothing
64
false
false
0
8
10
31
15
16
null
null
Potregon/while
src/Parser/While.hs
gpl-3.0
goto 5 5 = 40
13
goto 5 5 = 40
13
goto 5 5 = 40
13
false
false
1
5
4
14
5
9
null
null
geophf/1HaskellADay
exercises/HAD/Y2016/M08/D16/Solution.hs
mit
{-- How many unique tweets are in the data set? *Y2016.M08.D16.Solution> let idxt = indexedTweets tweets *Y2016.M08.D16.Solution> length idxt ~> 33 --} -- And with all the above we have: tweetsFrom :: FilePath -> IO [TimedTweet] tweetsFrom = fmap (map t2tt . Map.elems . indexedTweets) . readGraphJSON
304
tweetsFrom :: FilePath -> IO [TimedTweet] tweetsFrom = fmap (map t2tt . Map.elems . indexedTweets) . readGraphJSON
114
tweetsFrom = fmap (map t2tt . Map.elems . indexedTweets) . readGraphJSON
72
true
true
0
9
49
52
25
27
null
null
ublubu/wyascheme
src/Parse.hs
mit
parseQuoted :: Parser LispVal parseQuoted = do void $ char '\'' x <- parseExpr return $ List [Atom "quote", x]
116
parseQuoted :: Parser LispVal parseQuoted = do void $ char '\'' x <- parseExpr return $ List [Atom "quote", x]
116
parseQuoted = do void $ char '\'' x <- parseExpr return $ List [Atom "quote", x]
86
false
true
0
10
25
50
23
27
null
null
projectorhq/haskell-liquid
test/Text/Liquid/Generators.hs
bsd-3-clause
genCaseLogic :: Gen Expr genCaseLogic = CaseLogic <$> genVariable <*> ((resize 2 $ listOf1 tup) >>= \l -> ((<>) l <$> oneof [ pure <$> ((,) <$> genElse <*> genTrueStatements) , pure [] ])) where tup = (,) <$> oneof [genQuoteString, genNum] <*> genTrueStatements
391
genCaseLogic :: Gen Expr genCaseLogic = CaseLogic <$> genVariable <*> ((resize 2 $ listOf1 tup) >>= \l -> ((<>) l <$> oneof [ pure <$> ((,) <$> genElse <*> genTrueStatements) , pure [] ])) where tup = (,) <$> oneof [genQuoteString, genNum] <*> genTrueStatements
391
genCaseLogic = CaseLogic <$> genVariable <*> ((resize 2 $ listOf1 tup) >>= \l -> ((<>) l <$> oneof [ pure <$> ((,) <$> genElse <*> genTrueStatements) , pure [] ])) where tup = (,) <$> oneof [genQuoteString, genNum] <*> genTrueStatements
366
false
true
0
17
173
119
63
56
null
null
pheaver/hSimpleDB
src/Network/AWS/AWSConnection.hs
bsd-3-clause
-- | Port number used for connecting to Amazon's production SimpleDB service (@80@). defaultAmazonSimpleDBPort :: Int defaultAmazonSimpleDBPort = 80
148
defaultAmazonSimpleDBPort :: Int defaultAmazonSimpleDBPort = 80
63
defaultAmazonSimpleDBPort = 80
30
true
true
0
4
18
12
7
5
null
null
rahulmutt/ghcvm
compiler/Eta/CodeGen/Prim.hs
bsd-3-clause
simpleOp WriteByteArrayOp_Int32 = Just $ byteArrayWriteOp jint mempty
69
simpleOp WriteByteArrayOp_Int32 = Just $ byteArrayWriteOp jint mempty
69
simpleOp WriteByteArrayOp_Int32 = Just $ byteArrayWriteOp jint mempty
69
false
false
0
6
7
18
8
10
null
null
snoyberg/ghc
libraries/base/GHC/List.hs
bsd-3-clause
lengthFB :: x -> (Int -> Int) -> Int -> Int lengthFB _ r = \ !a -> r (a + 1)
76
lengthFB :: x -> (Int -> Int) -> Int -> Int lengthFB _ r = \ !a -> r (a + 1)
76
lengthFB _ r = \ !a -> r (a + 1)
32
false
true
0
8
21
51
26
25
null
null
Ian-Stewart-Binks/courseography
hs/Response/Grid.hs
gpl-3.0
searchPanel :: H.Html searchPanel = H.div ! A.id "search-layout" ! A.class_ "col-md-2 col-xs-6 col-md-push-8" $ do H.div ! A.id "filter-container" $ H.form ! A.onsubmit "return false;" $ H.input ! A.id "course-filter" ! A.class_ "form-control" ! A.placeholder "Enter a course!" ! A.autocomplete "off" ! A.type_ "text" H.div ! A.id "search-container" $ H.div ! A.id "search-list" $ ""
539
searchPanel :: H.Html searchPanel = H.div ! A.id "search-layout" ! A.class_ "col-md-2 col-xs-6 col-md-push-8" $ do H.div ! A.id "filter-container" $ H.form ! A.onsubmit "return false;" $ H.input ! A.id "course-filter" ! A.class_ "form-control" ! A.placeholder "Enter a course!" ! A.autocomplete "off" ! A.type_ "text" H.div ! A.id "search-container" $ H.div ! A.id "search-list" $ ""
539
searchPanel = H.div ! A.id "search-layout" ! A.class_ "col-md-2 col-xs-6 col-md-push-8" $ do H.div ! A.id "filter-container" $ H.form ! A.onsubmit "return false;" $ H.input ! A.id "course-filter" ! A.class_ "form-control" ! A.placeholder "Enter a course!" ! A.autocomplete "off" ! A.type_ "text" H.div ! A.id "search-container" $ H.div ! A.id "search-list" $ ""
517
false
true
0
18
211
150
69
81
null
null
ezyang/ghc
compiler/codeGen/StgCmmClosure.hs
bsd-3-clause
-------------------------------------- -- Profiling -------------------------------------- -- Profiling requires two pieces of information to be determined for -- each closure's info table --- description and type. -- The description is stored directly in the @CClosureInfoTable@ when the -- info table is built. -- The type is determined from the type information stored with the @Id@ -- in the closure info using @closureTypeDescr@. mkProfilingInfo :: DynFlags -> Id -> String -> ProfilingInfo mkProfilingInfo dflags id val_descr | not (gopt Opt_SccProfilingOn dflags) = NoProfilingInfo | otherwise = ProfilingInfo ty_descr_w8 val_descr_w8 where ty_descr_w8 = stringToWord8s (getTyDescription (idType id)) val_descr_w8 = stringToWord8s val_descr
768
mkProfilingInfo :: DynFlags -> Id -> String -> ProfilingInfo mkProfilingInfo dflags id val_descr | not (gopt Opt_SccProfilingOn dflags) = NoProfilingInfo | otherwise = ProfilingInfo ty_descr_w8 val_descr_w8 where ty_descr_w8 = stringToWord8s (getTyDescription (idType id)) val_descr_w8 = stringToWord8s val_descr
327
mkProfilingInfo dflags id val_descr | not (gopt Opt_SccProfilingOn dflags) = NoProfilingInfo | otherwise = ProfilingInfo ty_descr_w8 val_descr_w8 where ty_descr_w8 = stringToWord8s (getTyDescription (idType id)) val_descr_w8 = stringToWord8s val_descr
266
true
true
1
10
117
99
52
47
null
null
NickAger/LearningHaskell
HaskellProgrammingFromFirstPrinciples/Chapter14/WordNumber/tests/WordNumberTest.hs
mit
main :: IO () main = hspec $ do describe "digitToWord does what we want" $ do it "returns zero for 0" $ do digitToWord 0 `shouldBe` "zero" it "returns one for 1" $ do print "???" describe "digits does what we want" $ do it "returns [1] for 1" $ do digits 1 `shouldBe` [1] it "returns [1, 0, 0] for 100" $ do print "???" describe "wordNumber does what we want" $ do it "returns one-zero-zero for 100" $ do wordNumber 100 `shouldBe` "one-zero-zero" it "returns nine-zero-zero-one for 9001" $ do print "???"
570
main :: IO () main = hspec $ do describe "digitToWord does what we want" $ do it "returns zero for 0" $ do digitToWord 0 `shouldBe` "zero" it "returns one for 1" $ do print "???" describe "digits does what we want" $ do it "returns [1] for 1" $ do digits 1 `shouldBe` [1] it "returns [1, 0, 0] for 100" $ do print "???" describe "wordNumber does what we want" $ do it "returns one-zero-zero for 100" $ do wordNumber 100 `shouldBe` "one-zero-zero" it "returns nine-zero-zero-one for 9001" $ do print "???"
570
main = hspec $ do describe "digitToWord does what we want" $ do it "returns zero for 0" $ do digitToWord 0 `shouldBe` "zero" it "returns one for 1" $ do print "???" describe "digits does what we want" $ do it "returns [1] for 1" $ do digits 1 `shouldBe` [1] it "returns [1, 0, 0] for 100" $ do print "???" describe "wordNumber does what we want" $ do it "returns one-zero-zero for 100" $ do wordNumber 100 `shouldBe` "one-zero-zero" it "returns nine-zero-zero-one for 9001" $ do print "???"
556
false
true
0
17
160
168
72
96
null
null
xmonad/xmonad-contrib
XMonad/Util/DynamicScratchpads.hs
bsd-3-clause
spawnDynamicSP' :: Window -> X () spawnDynamicSP' w = withWindowSet $ \s -> do let matchingWindows = filter (== w) ((maybe [] W.integrate . W.stack . W.workspace . W.current) s) case matchingWindows of [] -> showWindow w _ -> hideWindow w -- | Make a window a dynamic scratchpad
304
spawnDynamicSP' :: Window -> X () spawnDynamicSP' w = withWindowSet $ \s -> do let matchingWindows = filter (== w) ((maybe [] W.integrate . W.stack . W.workspace . W.current) s) case matchingWindows of [] -> showWindow w _ -> hideWindow w -- | Make a window a dynamic scratchpad
304
spawnDynamicSP' w = withWindowSet $ \s -> do let matchingWindows = filter (== w) ((maybe [] W.integrate . W.stack . W.workspace . W.current) s) case matchingWindows of [] -> showWindow w _ -> hideWindow w -- | Make a window a dynamic scratchpad
270
false
true
0
20
74
114
56
58
null
null
Axure/elm-compiler
src/Elm/Package.hs
bsd-3-clause
fromString :: String -> Either String Name fromString string = case break (=='/') string of ( user, '/' : project ) -> if null user then Left "You did not provide a user name (USER/PROJECT)" else if null project then Left "You did not provide a project name (USER/PROJECT)" else if all (/='/') project then Name user <$> validate project else Left "Expecting only one slash, separating the user and project name (USER/PROJECT)" _ -> Left "There should be a slash separating the user and project name (USER/PROJECT)"
641
fromString :: String -> Either String Name fromString string = case break (=='/') string of ( user, '/' : project ) -> if null user then Left "You did not provide a user name (USER/PROJECT)" else if null project then Left "You did not provide a project name (USER/PROJECT)" else if all (/='/') project then Name user <$> validate project else Left "Expecting only one slash, separating the user and project name (USER/PROJECT)" _ -> Left "There should be a slash separating the user and project name (USER/PROJECT)"
641
fromString string = case break (=='/') string of ( user, '/' : project ) -> if null user then Left "You did not provide a user name (USER/PROJECT)" else if null project then Left "You did not provide a project name (USER/PROJECT)" else if all (/='/') project then Name user <$> validate project else Left "Expecting only one slash, separating the user and project name (USER/PROJECT)" _ -> Left "There should be a slash separating the user and project name (USER/PROJECT)"
598
false
true
0
12
213
119
60
59
null
null
sdiehl/ghc
compiler/basicTypes/Literal.hs
bsd-3-clause
literalType (LitNumber _ _ t) = t
33
literalType (LitNumber _ _ t) = t
33
literalType (LitNumber _ _ t) = t
33
false
false
0
6
6
20
9
11
null
null
aconbere/Hed
Hed/VTY.hs
mit
renderBuffer :: Int -> Int -> EditBuffer -> Image renderBuffer w h buf = vert_cat (map (\l -> renderLine w l dumpA) $ take h (lines (contents buf ++ repeat '\n')))
168
renderBuffer :: Int -> Int -> EditBuffer -> Image renderBuffer w h buf = vert_cat (map (\l -> renderLine w l dumpA) $ take h (lines (contents buf ++ repeat '\n')))
168
renderBuffer w h buf = vert_cat (map (\l -> renderLine w l dumpA) $ take h (lines (contents buf ++ repeat '\n')))
118
false
true
0
13
35
82
40
42
null
null
gabesoft/kapi
src/Data/AesonBson.hs
bsd-3-clause
bsonifyValue AESON.Null = BSON.Null
35
bsonifyValue AESON.Null = BSON.Null
35
bsonifyValue AESON.Null = BSON.Null
35
false
false
1
6
3
17
6
11
null
null
parapluu/encore
src/ir/AST/Util.hs
bsd-3-clause
mark asParent s@Assign {lhs, rhs} = asStat s{lhs=markAsExpr lhs, rhs=markAsExpr rhs}
84
mark asParent s@Assign {lhs, rhs} = asStat s{lhs=markAsExpr lhs, rhs=markAsExpr rhs}
84
mark asParent s@Assign {lhs, rhs} = asStat s{lhs=markAsExpr lhs, rhs=markAsExpr rhs}
84
false
false
1
8
10
53
25
28
null
null
siddhanathan/ghc
compiler/basicTypes/Module.hs
bsd-3-clause
rtsUnitId = fsToUnitId (fsLit "rts")
44
rtsUnitId = fsToUnitId (fsLit "rts")
44
rtsUnitId = fsToUnitId (fsLit "rts")
44
false
false
0
7
12
15
7
8
null
null
limaner2002/ghcjs-test
src/SortableTable.hs
bsd-3-clause
handleSortUpdate :: Int -> (Int, Bool) -> (Int, Bool) handleSortUpdate idx (idxOld, revBool) = case idx == idxOld of True -> (idx, not revBool) False -> (idx, False)
181
handleSortUpdate :: Int -> (Int, Bool) -> (Int, Bool) handleSortUpdate idx (idxOld, revBool) = case idx == idxOld of True -> (idx, not revBool) False -> (idx, False)
181
handleSortUpdate idx (idxOld, revBool) = case idx == idxOld of True -> (idx, not revBool) False -> (idx, False)
127
false
true
0
9
43
77
43
34
null
null
Adjective-Object/prism
src/TerminalColours.hs
apache-2.0
shiftHues :: Double -> [Hue] -> [Hue] shiftHues cap (x:xs) = let offsetList = map (\a -> a - x) xs in offsetList ++ [cap - x]
133
shiftHues :: Double -> [Hue] -> [Hue] shiftHues cap (x:xs) = let offsetList = map (\a -> a - x) xs in offsetList ++ [cap - x]
133
shiftHues cap (x:xs) = let offsetList = map (\a -> a - x) xs in offsetList ++ [cap - x]
95
false
true
0
12
34
76
40
36
null
null
atlaua/hbf
test/math.hs
mit
main :: IO () main = mapM_ (\t -> putStrLn (name t ++ ":") >> quickCheck (runBinaryTest t)) binaryTests
103
main :: IO () main = mapM_ (\t -> putStrLn (name t ++ ":") >> quickCheck (runBinaryTest t)) binaryTests
103
main = mapM_ (\t -> putStrLn (name t ++ ":") >> quickCheck (runBinaryTest t)) binaryTests
89
false
true
1
12
18
58
27
31
null
null
R-Morgan/NGramCrackers
src/NGramCrackers/Utilities/Tuple.hs
agpl-3.0
compareTriples :: Ord c => (a, b, c) -> (a, b, c) -> (a, b, c) compareTriples xs ys | max (thrd xs) (thrd ys) == thrd xs = xs | max (thrd xs) (thrd ys) == thrd ys = ys | otherwise = error "Fail"
206
compareTriples :: Ord c => (a, b, c) -> (a, b, c) -> (a, b, c) compareTriples xs ys | max (thrd xs) (thrd ys) == thrd xs = xs | max (thrd xs) (thrd ys) == thrd ys = ys | otherwise = error "Fail"
206
compareTriples xs ys | max (thrd xs) (thrd ys) == thrd xs = xs | max (thrd xs) (thrd ys) == thrd ys = ys | otherwise = error "Fail"
143
false
true
1
11
57
133
67
66
null
null
JeanJoskin/JsLib
src/Language/JsLib/Parser/Parser.hs
bsd-3-clause
pCECall = flip ECall <$> pArguments <?> "call braces"
53
pCECall = flip ECall <$> pArguments <?> "call braces"
53
pCECall = flip ECall <$> pArguments <?> "call braces"
53
false
false
0
7
8
17
8
9
null
null
WraithM/network-bitcoin
src/Network/Bitcoin/BlockChain.hs
bsd-3-clause
-- | Returns the proof-of-work difficulty as a multiple of the minimum -- difficulty. getDifficulty :: Client -> IO Integer getDifficulty client = callApi client "getdifficulty" []
182
getDifficulty :: Client -> IO Integer getDifficulty client = callApi client "getdifficulty" []
94
getDifficulty client = callApi client "getdifficulty" []
56
true
true
0
7
28
36
17
19
null
null
bgamari/text
tests/Tests/Properties.hs
bsd-2-clause
t_filter p = L.filter p `eqP` (unpackS . T.filter p)
62
t_filter p = L.filter p `eqP` (unpackS . T.filter p)
62
t_filter p = L.filter p `eqP` (unpackS . T.filter p)
62
false
false
0
9
19
32
16
16
null
null
Mr-Click/PFQ
user/Haskell/Network/PFq/Default.hs
gpl-2.0
-- | Evaluate to /True/ if the SkBuff has the given destination port. -- -- If the transport protocol is not present or has no port, the predicate evaluates to False. has_dst_port x = Predicate "has_dst_port" x () () () () () () ()
231
has_dst_port x = Predicate "has_dst_port" x () () () () () () ()
64
has_dst_port x = Predicate "has_dst_port" x () () () () () () ()
64
true
false
0
6
43
45
23
22
null
null
andreasfrom/truths
Form.hs
mit
plains, lefts, rights, boths :: (Formula -> T.Text) -> Formula -> T.Text -> Formula -> T.Text plains showF p op q = showF p <> op <> showF q
140
plains, lefts, rights, boths :: (Formula -> T.Text) -> Formula -> T.Text -> Formula -> T.Text plains showF p op q = showF p <> op <> showF q
140
plains showF p op q = showF p <> op <> showF q
46
false
true
0
9
28
69
37
32
null
null
rueshyna/gogol
gogol-proximitybeacon/gen/Network/Google/Resource/ProximityBeacon/Beacons/Diagnostics/List.hs
mpl-2.0
-- | V1 error format. bdlXgafv :: Lens' BeaconsDiagnosticsList (Maybe Text) bdlXgafv = lens _bdlXgafv (\ s a -> s{_bdlXgafv = a})
129
bdlXgafv :: Lens' BeaconsDiagnosticsList (Maybe Text) bdlXgafv = lens _bdlXgafv (\ s a -> s{_bdlXgafv = a})
107
bdlXgafv = lens _bdlXgafv (\ s a -> s{_bdlXgafv = a})
53
true
true
0
9
21
46
25
21
null
null
badp/ganeti
test/hs/Test/Ganeti/OpCodes.hs
gpl-2.0
-- | Small helper to check for a failed JSON deserialisation isJsonError :: J.Result a -> Bool isJsonError (J.Error _) = True
125
isJsonError :: J.Result a -> Bool isJsonError (J.Error _) = True
64
isJsonError (J.Error _) = True
30
true
true
0
8
21
32
16
16
null
null
tel/saltine
src/Crypto/Saltine/Core/ScalarMult.hs
mit
mult :: Scalar -> GroupElement -> GroupElement mult (Sc n) (GE p) = GE . snd . buildUnsafeByteString Bytes.scalarmult_bytes $ \pq -> constByteStrings [n, p] $ \[(pn, _), (pp, _)] -> c_scalarmult pq pn pp
209
mult :: Scalar -> GroupElement -> GroupElement mult (Sc n) (GE p) = GE . snd . buildUnsafeByteString Bytes.scalarmult_bytes $ \pq -> constByteStrings [n, p] $ \[(pn, _), (pp, _)] -> c_scalarmult pq pn pp
209
mult (Sc n) (GE p) = GE . snd . buildUnsafeByteString Bytes.scalarmult_bytes $ \pq -> constByteStrings [n, p] $ \[(pn, _), (pp, _)] -> c_scalarmult pq pn pp
162
false
true
0
10
40
101
54
47
null
null
svenssonjoel/MonadObsidian
Obsidian/MonadObsidian/GenCuda.hs
bsd-3-clause
name :: DExp -> Name name (Index x _) = x
41
name :: DExp -> Name name (Index x _) = x
41
name (Index x _) = x
20
false
true
0
7
10
26
13
13
null
null
unisonweb/platform
parser-typechecker/src/Unison/Runtime/Builtin.hs
mit
boxBoxTo0 :: ForeignOp boxBoxTo0 instr = ([BX,BX],) . TAbss [arg1,arg2] . TLets Direct [] [] (TFOp instr [arg1,arg2]) $ TCon Ty.unitRef 0 [] where (arg1, arg2) = fresh2 -- Nat -> ()
194
boxBoxTo0 :: ForeignOp boxBoxTo0 instr = ([BX,BX],) . TAbss [arg1,arg2] . TLets Direct [] [] (TFOp instr [arg1,arg2]) $ TCon Ty.unitRef 0 [] where (arg1, arg2) = fresh2 -- Nat -> ()
194
boxBoxTo0 instr = ([BX,BX],) . TAbss [arg1,arg2] . TLets Direct [] [] (TFOp instr [arg1,arg2]) $ TCon Ty.unitRef 0 [] where (arg1, arg2) = fresh2 -- Nat -> ()
171
false
true
4
9
44
97
52
45
null
null
zhensydow/ljcsandbox
edx/fp101x/lab8.hs
gpl-3.0
f1 = flip foldr const
21
f1 = flip foldr const
21
f1 = flip foldr const
21
false
false
1
5
4
14
5
9
null
null
scott-fleischman/greek-grammar
haskell/greek-grammar/executables/Perseus.hs
mit
main :: IO () main = do paths <- greekFilePaths documents <- mapM tryLoadDocument paths mapM_ (printResult (\_ -> putStrLn "Success")) documents
150
main :: IO () main = do paths <- greekFilePaths documents <- mapM tryLoadDocument paths mapM_ (printResult (\_ -> putStrLn "Success")) documents
150
main = do paths <- greekFilePaths documents <- mapM tryLoadDocument paths mapM_ (printResult (\_ -> putStrLn "Success")) documents
136
false
true
0
12
27
60
28
32
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/SVGPatternElement.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGPatternElement.height Mozilla SVGPatternElement.height documentation> getHeight :: (MonadDOM m) => SVGPatternElement -> m SVGAnimatedLength getHeight self = liftDOM ((self ^. js "height") >>= fromJSValUnchecked)
282
getHeight :: (MonadDOM m) => SVGPatternElement -> m SVGAnimatedLength getHeight self = liftDOM ((self ^. js "height") >>= fromJSValUnchecked)
153
getHeight self = liftDOM ((self ^. js "height") >>= fromJSValUnchecked)
73
true
true
0
10
37
56
27
29
null
null
lukexi/ghc
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
-- for 32-bit architectuers, support some 64 -> 32 bit conversions: -- TO_W_(x), TO_W_(x >> 32) getRegister' _ is32Bit (CmmMachOp (MO_UU_Conv W64 W32) [CmmMachOp (MO_U_Shr W64) [x,CmmLit (CmmInt 32 _)]]) | is32Bit = do ChildCode64 code rlo <- iselExpr64 x return $ Fixed II32 (getHiVRegFromLo rlo) code
329
getRegister' _ is32Bit (CmmMachOp (MO_UU_Conv W64 W32) [CmmMachOp (MO_U_Shr W64) [x,CmmLit (CmmInt 32 _)]]) | is32Bit = do ChildCode64 code rlo <- iselExpr64 x return $ Fixed II32 (getHiVRegFromLo rlo) code
232
getRegister' _ is32Bit (CmmMachOp (MO_UU_Conv W64 W32) [CmmMachOp (MO_U_Shr W64) [x,CmmLit (CmmInt 32 _)]]) | is32Bit = do ChildCode64 code rlo <- iselExpr64 x return $ Fixed II32 (getHiVRegFromLo rlo) code
232
true
false
1
12
73
107
49
58
null
null
np/lens
src/Control/Lens/Plated.hs
bsd-3-clause
------------------------------------------------------------------------------- -- Compos ------------------------------------------------------------------------------- -- $compos -- -- Provided for compatibility with Björn Bringert's @compos@ library. -- -- Note: Other operations from compos that were inherited by @uniplate@ are /not/ included -- to avoid having even more redundant names for the same operators. For comparison: -- -- @ -- 'composOpMonoid' ≡ 'foldMapOf' 'plate' -- 'composOpMPlus' f ≡ 'msumOf' ('plate' '.' 'to' f) -- 'composOp' ≡ 'descend' ≡ 'over' 'plate' -- 'composOpM' ≡ 'descendM' ≡ 'mapMOf' 'plate' -- 'composOpM_' ≡ 'descendM_' ≡ 'mapMOf_' 'plate' -- @ -- | Fold the immediate children of a 'Plated' container. -- -- @'composOpFold' z c f = 'foldrOf' 'plate' (c '.' f) z@ composOpFold :: Plated a => b -> (b -> b -> b) -> (a -> b) -> a -> b composOpFold z c f = foldrOf plate (c . f) z
915
composOpFold :: Plated a => b -> (b -> b -> b) -> (a -> b) -> a -> b composOpFold z c f = foldrOf plate (c . f) z
113
composOpFold z c f = foldrOf plate (c . f) z
44
true
true
0
10
140
93
57
36
null
null
mightymoose/liquidhaskell
src/Language/Haskell/Liquid/Parse.hs
bsd-3-clause
bareAllP = do reserved "forall" as <- many tyVarIdP ps <- predVarDefsP dot t <- bareTypeP return $ foldr RAllT (foldr RAllP t ps) as
170
bareAllP = do reserved "forall" as <- many tyVarIdP ps <- predVarDefsP dot t <- bareTypeP return $ foldr RAllT (foldr RAllP t ps) as
170
bareAllP = do reserved "forall" as <- many tyVarIdP ps <- predVarDefsP dot t <- bareTypeP return $ foldr RAllT (foldr RAllP t ps) as
170
false
false
1
11
62
67
27
40
null
null