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
rueshyna/gogol
gogol-compute/gen/Network/Google/Resource/Compute/MachineTypes/Get.hs
mpl-2.0
-- | The name of the zone for this request. mtgZone :: Lens' MachineTypesGet Text mtgZone = lens _mtgZone (\ s a -> s{_mtgZone = a})
132
mtgZone :: Lens' MachineTypesGet Text mtgZone = lens _mtgZone (\ s a -> s{_mtgZone = a})
88
mtgZone = lens _mtgZone (\ s a -> s{_mtgZone = a})
50
true
true
0
9
25
40
22
18
null
null
ruicc/structured-concurrent
src/Control/Concurrent/Structured/STM.hs
mit
newBroadcastTChan :: CSTM r (TChan a) newBroadcastTChan = liftSTM S.newBroadcastTChan
85
newBroadcastTChan :: CSTM r (TChan a) newBroadcastTChan = liftSTM S.newBroadcastTChan
85
newBroadcastTChan = liftSTM S.newBroadcastTChan
47
false
true
0
7
9
27
13
14
null
null
DaMSL/K3
src/Language/K3/Interpreter/Builtins.hs
apache-2.0
-- Real to String genBuiltin "rtos" _ = vfun $ \(VReal x) -> return $ VString $ show x
86
genBuiltin "rtos" _ = vfun $ \(VReal x) -> return $ VString $ show x
68
genBuiltin "rtos" _ = vfun $ \(VReal x) -> return $ VString $ show x
68
true
false
0
8
18
38
19
19
null
null
ghc-android/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
emitPrimOp dflags res IndexOffAddrOp_Word16 args = doIndexOffAddrOp (Just (mo_u_16ToWord dflags)) b16 res args
122
emitPrimOp dflags res IndexOffAddrOp_Word16 args = doIndexOffAddrOp (Just (mo_u_16ToWord dflags)) b16 res args
122
emitPrimOp dflags res IndexOffAddrOp_Word16 args = doIndexOffAddrOp (Just (mo_u_16ToWord dflags)) b16 res args
122
false
false
0
9
24
36
17
19
null
null
iu-parfunc/AutoObsidian
interface_brainstorming/06_ExtensibleEffects/newVer/Eff1.hs
bsd-3-clause
ex2r_2 = (Right [5,7,1] ==) $ run . runErrBig . makeChoice $ exRec (ex2 (choose [5,7,1]))
98
ex2r_2 = (Right [5,7,1] ==) $ run . runErrBig . makeChoice $ exRec (ex2 (choose [5,7,1]))
98
ex2r_2 = (Right [5,7,1] ==) $ run . runErrBig . makeChoice $ exRec (ex2 (choose [5,7,1]))
98
false
false
0
11
24
62
34
28
null
null
yiannist/ganeti
src/Ganeti/THH/PyRPC.hs
bsd-2-clause
genPyUDSRpcStubStr :: String -- ^ the name of the class to be generated -> String -- ^ the constant in @pathutils.py@ holding the socket path -> [Name] -- ^ functions to include -> Q Exp genPyUDSRpcStubStr className constName names = liftString . render =<< genPyUDSRpcStub className constName names
317
genPyUDSRpcStubStr :: String -- ^ the name of the class to be generated -> String -- ^ the constant in @pathutils.py@ holding the socket path -> [Name] -- ^ functions to include -> Q Exp genPyUDSRpcStubStr className constName names = liftString . render =<< genPyUDSRpcStub className constName names
317
genPyUDSRpcStubStr className constName names = liftString . render =<< genPyUDSRpcStub className constName names
116
false
true
1
9
65
59
29
30
null
null
nh2/quickcheck
Test/QuickCheck/Property.hs
bsd-3-clause
reduceRose (IORose m) = m >>= reduceRose
40
reduceRose (IORose m) = m >>= reduceRose
40
reduceRose (IORose m) = m >>= reduceRose
40
false
false
0
7
6
19
9
10
null
null
DigitalBrains1/clash-lt24
Toolbox/ClockScale.hs
bsd-2-clause
{- - Scale a clock frequency as accurately as possible - - Outputs True once every "tick" of the desired frequency by counting and - scaling the system clock. - - Inputs: m - Multiplier for the system clock d - Divisor for the target clock - - The counter never goes to 0; it is most accurate when initialised to 1. - - Make sure the target clock is lower than the system clock, or you will miss - ticks. Not surprising, really :). - - Also, the degenerate case where the divisor is 1 (or equivalently, the - target clock is equal to the system clock) *will not stop* when given the - command Stop or Clear. Don't use this configuration; the following would - probably be more what you need: - - tick = (== ClockScale.Run) <$> cmd - - Note that it is designed to be instantiated with a static divisor and - multiplier. Changing them while running will cause glitching. -} avg :: (KnownNat n, KnownNat (n+1)) => Unsigned (n+1) -> (Unsigned n, Unsigned n, State) -> (Unsigned (n+1), Bool) avg s (m, d, cmd) = (s', o) where sinc = s + resize m wrap = s >= resize d s' = if cmd == Clear then 1 else if wrap then sinc - resize d else if cmd == Stop then s else sinc o = wrap {- Divide the clock by an integer ratio - - See `avg` for more documentation. -}
1,444
avg :: (KnownNat n, KnownNat (n+1)) => Unsigned (n+1) -> (Unsigned n, Unsigned n, State) -> (Unsigned (n+1), Bool) avg s (m, d, cmd) = (s', o) where sinc = s + resize m wrap = s >= resize d s' = if cmd == Clear then 1 else if wrap then sinc - resize d else if cmd == Stop then s else sinc o = wrap {- Divide the clock by an integer ratio - - See `avg` for more documentation. -}
548
avg s (m, d, cmd) = (s', o) where sinc = s + resize m wrap = s >= resize d s' = if cmd == Clear then 1 else if wrap then sinc - resize d else if cmd == Stop then s else sinc o = wrap {- Divide the clock by an integer ratio - - See `avg` for more documentation. -}
421
true
true
6
13
443
193
101
92
null
null
philopon/apiary-benchmark
src/yesod.hs
mit
handleNum13R :: Handler TypedContent; handleNum13R = returnBS "deep"
68
handleNum13R :: Handler TypedContent handleNum13R = returnBS "deep"
67
handleNum13R = returnBS "deep"
30
false
true
1
5
7
21
9
12
null
null
Ian-Stewart-Binks/courseography
dependencies/HaXml-1.25.3/src/Text/XML/HaXml/DtdToHaskell/TypeDef.hs
gpl-3.0
ppST :: StructType -> Doc ppST (Defaultable st _) = parens (text "Defaultable" <+> ppST st)
92
ppST :: StructType -> Doc ppST (Defaultable st _) = parens (text "Defaultable" <+> ppST st)
92
ppST (Defaultable st _) = parens (text "Defaultable" <+> ppST st)
66
false
true
0
8
16
42
20
22
null
null
kim/amazonka
amazonka-redshift/gen/Network/AWS/Redshift/CreateClusterSubnetGroup.hs
mpl-2.0
-- | An array of VPC subnet IDs. A maximum of 20 subnets can be modified in a -- single request. ccsgSubnetIds :: Lens' CreateClusterSubnetGroup [Text] ccsgSubnetIds = lens _ccsgSubnetIds (\s a -> s { _ccsgSubnetIds = a }) . _List
230
ccsgSubnetIds :: Lens' CreateClusterSubnetGroup [Text] ccsgSubnetIds = lens _ccsgSubnetIds (\s a -> s { _ccsgSubnetIds = a }) . _List
133
ccsgSubnetIds = lens _ccsgSubnetIds (\s a -> s { _ccsgSubnetIds = a }) . _List
78
true
true
0
10
40
48
27
21
null
null
fmthoma/ghc
compiler/main/GhcMake.hs
bsd-3-clause
depanal :: GhcMonad m => [ModuleName] -- ^ excluded modules -> Bool -- ^ allow duplicate roots -> m ModuleGraph depanal excluded_mods allow_dup_roots = do hsc_env <- getSession let dflags = hsc_dflags hsc_env targets = hsc_targets hsc_env old_graph = hsc_mod_graph hsc_env liftIO $ showPass dflags "Chasing dependencies" liftIO $ debugTraceMsg dflags 2 (hcat [ text "Chasing modules from: ", hcat (punctuate comma (map pprTarget targets))]) mod_graphE <- liftIO $ downsweep hsc_env old_graph excluded_mods allow_dup_roots mod_graph <- reportImportErrors mod_graphE modifySession $ \_ -> hsc_env { hsc_mod_graph = mod_graph } return mod_graph -- | Describes which modules of the module graph need to be loaded.
819
depanal :: GhcMonad m => [ModuleName] -- ^ excluded modules -> Bool -- ^ allow duplicate roots -> m ModuleGraph depanal excluded_mods allow_dup_roots = do hsc_env <- getSession let dflags = hsc_dflags hsc_env targets = hsc_targets hsc_env old_graph = hsc_mod_graph hsc_env liftIO $ showPass dflags "Chasing dependencies" liftIO $ debugTraceMsg dflags 2 (hcat [ text "Chasing modules from: ", hcat (punctuate comma (map pprTarget targets))]) mod_graphE <- liftIO $ downsweep hsc_env old_graph excluded_mods allow_dup_roots mod_graph <- reportImportErrors mod_graphE modifySession $ \_ -> hsc_env { hsc_mod_graph = mod_graph } return mod_graph -- | Describes which modules of the module graph need to be loaded.
819
depanal excluded_mods allow_dup_roots = do hsc_env <- getSession let dflags = hsc_dflags hsc_env targets = hsc_targets hsc_env old_graph = hsc_mod_graph hsc_env liftIO $ showPass dflags "Chasing dependencies" liftIO $ debugTraceMsg dflags 2 (hcat [ text "Chasing modules from: ", hcat (punctuate comma (map pprTarget targets))]) mod_graphE <- liftIO $ downsweep hsc_env old_graph excluded_mods allow_dup_roots mod_graph <- reportImportErrors mod_graphE modifySession $ \_ -> hsc_env { hsc_mod_graph = mod_graph } return mod_graph -- | Describes which modules of the module graph need to be loaded.
670
false
true
0
16
212
191
91
100
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F19.hs
bsd-3-clause
-- glObjectPtrLabel ------------------------------------------------------------ -- | Manual page for <https://www.opengl.org/sdk/docs/man4/html/glObjectPtrLabel.xhtml OpenGL 4.x>. glObjectPtrLabel :: MonadIO m => Ptr a -- ^ @ptr@. -> GLsizei -- ^ @length@. -> Ptr GLchar -- ^ @label@ pointing to @COMPSIZE(label,length)@ elements of type @GLchar@. -> m () glObjectPtrLabel v1 v2 v3 = liftIO $ dyn633 ptr_glObjectPtrLabel v1 v2 v3
441
glObjectPtrLabel :: MonadIO m => Ptr a -- ^ @ptr@. -> GLsizei -- ^ @length@. -> Ptr GLchar -- ^ @label@ pointing to @COMPSIZE(label,length)@ elements of type @GLchar@. -> m () glObjectPtrLabel v1 v2 v3 = liftIO $ dyn633 ptr_glObjectPtrLabel v1 v2 v3
259
glObjectPtrLabel v1 v2 v3 = liftIO $ dyn633 ptr_glObjectPtrLabel v1 v2 v3
73
true
true
0
11
64
70
34
36
null
null
databrary/databrary
src/Web/Generate.hs
agpl-3.0
whether :: Bool -> IO () -> IO Bool whether g = (g <$) . when g
63
whether :: Bool -> IO () -> IO Bool whether g = (g <$) . when g
63
whether g = (g <$) . when g
27
false
true
0
8
16
41
20
21
null
null
niswegmann/copilot-language
src/Copilot/Language/Operators/Boolean.hs
bsd-3-clause
(Const True) && y = y
22
(Const True) && y = y
22
(Const True) && y = y
22
false
false
0
7
6
18
8
10
null
null
markuspf/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
irts_c FAny x = x
17
irts_c FAny x = x
17
irts_c FAny x = x
17
false
false
1
5
4
16
5
11
null
null
gibiansky/bloomfilter
Data/BloomFilter/Util.hs
bsd-3-clause
nextPowerOfTwo n = let a = n - 1 b = a .|. (a `shiftR` 1) c = b .|. (b `shiftR` 2) d = c .|. (c `shiftR` 4) e = d .|. (d `shiftR` 8) f = e .|. (e `shiftR` 16) g = f .|. (f `shiftR` 32) -- in case we're on a 64-bit host !h = g + 1 in h
299
nextPowerOfTwo n = let a = n - 1 b = a .|. (a `shiftR` 1) c = b .|. (b `shiftR` 2) d = c .|. (c `shiftR` 4) e = d .|. (d `shiftR` 8) f = e .|. (e `shiftR` 16) g = f .|. (f `shiftR` 32) -- in case we're on a 64-bit host !h = g + 1 in h
299
nextPowerOfTwo n = let a = n - 1 b = a .|. (a `shiftR` 1) c = b .|. (b `shiftR` 2) d = c .|. (c `shiftR` 4) e = d .|. (d `shiftR` 8) f = e .|. (e `shiftR` 16) g = f .|. (f `shiftR` 32) -- in case we're on a 64-bit host !h = g + 1 in h
299
false
false
0
11
130
144
83
61
null
null
kumasento/accelerate
Data/Array/Accelerate/Interpreter.hs
bsd-3-clause
evalPrimConst :: PrimConst a -> a evalPrimConst (PrimMinBound ty) = evalMinBound ty
83
evalPrimConst :: PrimConst a -> a evalPrimConst (PrimMinBound ty) = evalMinBound ty
83
evalPrimConst (PrimMinBound ty) = evalMinBound ty
49
false
true
0
7
11
30
14
16
null
null
mikeplus64/plissken
src/Game.hs
gpl-3.0
toY = vec3 0 1 0
16
toY = vec3 0 1 0
16
toY = vec3 0 1 0
16
false
false
1
5
5
16
6
10
null
null
aelyasov/Haslog
src/Eu/Fittest/Logging/XML/LowEvent.hs
bsd-3-clause
exFELog1__ = concat . intersperse "\n" $ ["%<S -120:1318674228273 \"FE:recGcd:GCDplain\" ", "%<P %<{ \"target\":string }%> %>", "%<S \"args\" %<P %<{ \"arg0\":string }%> %> %>", "%>" ]
228
exFELog1__ = concat . intersperse "\n" $ ["%<S -120:1318674228273 \"FE:recGcd:GCDplain\" ", "%<P %<{ \"target\":string }%> %>", "%<S \"args\" %<P %<{ \"arg0\":string }%> %> %>", "%>" ]
228
exFELog1__ = concat . intersperse "\n" $ ["%<S -120:1318674228273 \"FE:recGcd:GCDplain\" ", "%<P %<{ \"target\":string }%> %>", "%<S \"args\" %<P %<{ \"arg0\":string }%> %> %>", "%>" ]
228
false
false
0
7
69
29
16
13
null
null
isovector/dependent-types
src/Codo.hs
bsd-3-clause
next :: (Bounded a, Enum a, Eq a) => a -> [a] next a = bool [] (pure $ succ a) $ a /= maxBound
94
next :: (Bounded a, Enum a, Eq a) => a -> [a] next a = bool [] (pure $ succ a) $ a /= maxBound
94
next a = bool [] (pure $ succ a) $ a /= maxBound
48
false
true
0
10
24
67
34
33
null
null
tphyahoo/haskoin
haskoin-core/Network/Haskoin/Script/Parser.hs
unlicense
isPayPK _ = False
17
isPayPK _ = False
17
isPayPK _ = False
17
false
false
0
5
3
9
4
5
null
null
nushio3/ghc
compiler/stgSyn/StgSyn.hs
bsd-3-clause
pp_binder_info SatCallsOnly = text "sat-only"
48
pp_binder_info SatCallsOnly = text "sat-only"
48
pp_binder_info SatCallsOnly = text "sat-only"
48
false
false
0
5
7
12
5
7
null
null
Fuuzetsu/stack
src/Stack/Setup.hs
bsd-3-clause
addIncludeLib :: ExtraDirs -> Config -> Config addIncludeLib (ExtraDirs _bins includes libs) config = config { configExtraIncludeDirs = Set.union (configExtraIncludeDirs config) (Set.fromList (map toFilePathNoTrailingSep includes)) , configExtraLibDirs = Set.union (configExtraLibDirs config) (Set.fromList (map toFilePathNoTrailingSep libs)) }
388
addIncludeLib :: ExtraDirs -> Config -> Config addIncludeLib (ExtraDirs _bins includes libs) config = config { configExtraIncludeDirs = Set.union (configExtraIncludeDirs config) (Set.fromList (map toFilePathNoTrailingSep includes)) , configExtraLibDirs = Set.union (configExtraLibDirs config) (Set.fromList (map toFilePathNoTrailingSep libs)) }
388
addIncludeLib (ExtraDirs _bins includes libs) config = config { configExtraIncludeDirs = Set.union (configExtraIncludeDirs config) (Set.fromList (map toFilePathNoTrailingSep includes)) , configExtraLibDirs = Set.union (configExtraLibDirs config) (Set.fromList (map toFilePathNoTrailingSep libs)) }
341
false
true
0
11
79
106
54
52
null
null
christiaanb/Idris-dev
src/Idris/ElabTerm.hs
bsd-3-clause
-- Using the elaborator, convert a term in raw syntax to a fully -- elaborated, typechecked term. -- -- If building a pattern match, we convert undeclared variables from -- holes to pattern bindings. -- Also find deferred names in the term and their types build :: IState -> ElabInfo -> Bool -> Name -> PTerm -> ElabD (Term, [(Name, Type)], [PDecl]) build ist info pattern fn tm = do elab ist info pattern False fn tm ivs <- get_instances hs <- get_holes ptm <- get_term -- Resolve remaining type classes. Two passes - first to get the -- default Num instances, second to clean up the rest when (not pattern) $ mapM_ (\n -> when (n `elem` hs) $ do focus n try (resolveTC 7 fn ist) (movelast n)) ivs ivs <- get_instances hs <- get_holes when (not pattern) $ mapM_ (\n -> when (n `elem` hs) $ do focus n resolveTC 7 fn ist) ivs probs <- get_probs tm <- get_term ctxt <- get_context case probs of [] -> return () ((_,_,_,e):es) -> lift (Error e) is <- getAux tt <- get_term let (tm, ds) = runState (collectDeferred tt) [] log <- getLog if (log /= "") then trace log $ return (tm, ds, is) else return (tm, ds, is) -- Build a term autogenerated as a typeclass method definition -- (Separate, so we don't go overboard resolving things that we don't -- know about yet on the LHS of a pattern def)
1,693
build :: IState -> ElabInfo -> Bool -> Name -> PTerm -> ElabD (Term, [(Name, Type)], [PDecl]) build ist info pattern fn tm = do elab ist info pattern False fn tm ivs <- get_instances hs <- get_holes ptm <- get_term -- Resolve remaining type classes. Two passes - first to get the -- default Num instances, second to clean up the rest when (not pattern) $ mapM_ (\n -> when (n `elem` hs) $ do focus n try (resolveTC 7 fn ist) (movelast n)) ivs ivs <- get_instances hs <- get_holes when (not pattern) $ mapM_ (\n -> when (n `elem` hs) $ do focus n resolveTC 7 fn ist) ivs probs <- get_probs tm <- get_term ctxt <- get_context case probs of [] -> return () ((_,_,_,e):es) -> lift (Error e) is <- getAux tt <- get_term let (tm, ds) = runState (collectDeferred tt) [] log <- getLog if (log /= "") then trace log $ return (tm, ds, is) else return (tm, ds, is) -- Build a term autogenerated as a typeclass method definition -- (Separate, so we don't go overboard resolving things that we don't -- know about yet on the LHS of a pattern def)
1,435
build ist info pattern fn tm = do elab ist info pattern False fn tm ivs <- get_instances hs <- get_holes ptm <- get_term -- Resolve remaining type classes. Two passes - first to get the -- default Num instances, second to clean up the rest when (not pattern) $ mapM_ (\n -> when (n `elem` hs) $ do focus n try (resolveTC 7 fn ist) (movelast n)) ivs ivs <- get_instances hs <- get_holes when (not pattern) $ mapM_ (\n -> when (n `elem` hs) $ do focus n resolveTC 7 fn ist) ivs probs <- get_probs tm <- get_term ctxt <- get_context case probs of [] -> return () ((_,_,_,e):es) -> lift (Error e) is <- getAux tt <- get_term let (tm, ds) = runState (collectDeferred tt) [] log <- getLog if (log /= "") then trace log $ return (tm, ds, is) else return (tm, ds, is) -- Build a term autogenerated as a typeclass method definition -- (Separate, so we don't go overboard resolving things that we don't -- know about yet on the LHS of a pattern def)
1,331
true
true
0
16
648
438
221
217
null
null
project-oak/silveroak
investigations/lava/Lava.hs
apache-2.0
delayGate :: Int -> State NetlistState Int delayGate i = do NetlistState o components <- get put (NetlistState (o+1) ((DELAY i o):components)) return o -- Now we can create an instance of Lava for netlist generation.
233
delayGate :: Int -> State NetlistState Int delayGate i = do NetlistState o components <- get put (NetlistState (o+1) ((DELAY i o):components)) return o -- Now we can create an instance of Lava for netlist generation.
233
delayGate i = do NetlistState o components <- get put (NetlistState (o+1) ((DELAY i o):components)) return o -- Now we can create an instance of Lava for netlist generation.
190
false
true
0
13
52
78
37
41
null
null
ZjMNZHgG5jMXw/privacy-option
Data/POL/Observable.hs
bsd-3-clause
(<=) :: (Label l, Monad m, Ord a) => ObservableT l m a -> ObservableT l m a -> ObservableT l m Bool m <= n = labeled (binary "<=" (label m) (label n)) (liftM2 (P.<=) m n)
196
(<=) :: (Label l, Monad m, Ord a) => ObservableT l m a -> ObservableT l m a -> ObservableT l m Bool m <= n = labeled (binary "<=" (label m) (label n)) (liftM2 (P.<=) m n)
196
m <= n = labeled (binary "<=" (label m) (label n)) (liftM2 (P.<=) m n)
83
false
true
0
10
63
110
55
55
null
null
krapsh/kraps-haskell
src/Spark/Core/Internal/Projections.hs
apache-2.0
projectDColDCol :: DynColumn -> DynamicColProjection -> DynColumn projectDColDCol c proj = do cd <- c projectColDynCol cd proj
128
projectDColDCol :: DynColumn -> DynamicColProjection -> DynColumn projectDColDCol c proj = do cd <- c projectColDynCol cd proj
128
projectDColDCol c proj = do cd <- c projectColDynCol cd proj
62
false
true
0
7
19
39
18
21
null
null
mgold/Elm
src/Parse/Helpers.hs
bsd-3-clause
located :: IParser a -> IParser (R.Position, a, R.Position) located parser = do start <- getMyPosition value <- parser end <- getMyPosition return (start, value, end)
187
located :: IParser a -> IParser (R.Position, a, R.Position) located parser = do start <- getMyPosition value <- parser end <- getMyPosition return (start, value, end)
187
located parser = do start <- getMyPosition value <- parser end <- getMyPosition return (start, value, end)
127
false
true
0
9
46
78
37
41
null
null
mettekou/ghc
compiler/types/Type.hs
bsd-3-clause
-- | Attempts to obtain the type variable underlying a 'Type', without -- any expansion repGetTyVar_maybe :: Type -> Maybe TyVar repGetTyVar_maybe (TyVarTy tv) = Just tv
169
repGetTyVar_maybe :: Type -> Maybe TyVar repGetTyVar_maybe (TyVarTy tv) = Just tv
81
repGetTyVar_maybe (TyVarTy tv) = Just tv
40
true
true
0
7
26
32
16
16
null
null
sfultong/stand-in-language
src/SIL/TypeChecker.hs
apache-2.0
annotate (Pair a b) = debugAnnotate (Pair a b) *> (PairTA <$> annotate a <*> annotate b)
88
annotate (Pair a b) = debugAnnotate (Pair a b) *> (PairTA <$> annotate a <*> annotate b)
88
annotate (Pair a b) = debugAnnotate (Pair a b) *> (PairTA <$> annotate a <*> annotate b)
88
false
false
0
9
16
50
23
27
null
null
CulpaBS/wbBach
src/Futhark/Analysis/HORepresentation/SOAC.hs
bsd-3-clause
varInput :: HasScope t f => VName -> f Input varInput v = withType <$> lookupType v where withType = Input (ArrayTransforms Seq.empty) v -- | Create a plain array variable input with no transformations, from an 'Ident'.
222
varInput :: HasScope t f => VName -> f Input varInput v = withType <$> lookupType v where withType = Input (ArrayTransforms Seq.empty) v -- | Create a plain array variable input with no transformations, from an 'Ident'.
222
varInput v = withType <$> lookupType v where withType = Input (ArrayTransforms Seq.empty) v -- | Create a plain array variable input with no transformations, from an 'Ident'.
177
false
true
0
8
40
59
28
31
null
null
pparkkin/eta
compiler/ETA/Prelude/PrelNames.hs
bsd-3-clause
csel2CoercionTyConKey = mkPreludeTyConUnique 100
66
csel2CoercionTyConKey = mkPreludeTyConUnique 100
66
csel2CoercionTyConKey = mkPreludeTyConUnique 100
66
false
false
0
5
21
9
4
5
null
null
geophf/1HaskellADay
exercises/HAD/Y2018/M05/D31/Exercise.hs
mit
fullTexts :: Connection -> [Index] -> IO [IxValue Str] fullTexts conn idxn = undefined
86
fullTexts :: Connection -> [Index] -> IO [IxValue Str] fullTexts conn idxn = undefined
86
fullTexts conn idxn = undefined
31
false
true
0
10
13
41
19
22
null
null
dmvianna/strict
src/fusion.hs
bsd-3-clause
main :: IO () main = defaultMain [ bench "vector map prefused" $ whnf testV 9998 , bench "vector map will be fused" $ whnf testV' 9998 ]
175
main :: IO () main = defaultMain [ bench "vector map prefused" $ whnf testV 9998 , bench "vector map will be fused" $ whnf testV' 9998 ]
175
main = defaultMain [ bench "vector map prefused" $ whnf testV 9998 , bench "vector map will be fused" $ whnf testV' 9998 ]
161
false
true
0
8
66
49
23
26
null
null
da-x/lamdu
test/InferCombinators.hs
gpl-3.0
-- TODO: Make this take a (TypeStream) (WHICH SHOULD BE NAMED TypeStream) -- and then make combinators to build type streams? holeWithInferredType :: TypeStream -> ExprWithResumptions holeWithInferredType = mkExprWithResumptions (V.BLeaf V.LHole)
246
holeWithInferredType :: TypeStream -> ExprWithResumptions holeWithInferredType = mkExprWithResumptions (V.BLeaf V.LHole)
120
holeWithInferredType = mkExprWithResumptions (V.BLeaf V.LHole)
62
true
true
0
8
30
30
16
14
null
null
rolph-recto/liquidhaskell
src/Language/Haskell/Liquid/RefType.hs
bsd-3-clause
tyClasses (RAllE _ _ t) = tyClasses t
39
tyClasses (RAllE _ _ t) = tyClasses t
39
tyClasses (RAllE _ _ t) = tyClasses t
39
false
false
0
7
9
22
10
12
null
null
AlexanderPankiv/ghc
compiler/hsSyn/HsTypes.hs
bsd-3-clause
mkHsAppTys :: OutputableBndr n => LHsType n -> [LHsType n] -> HsType n mkHsAppTys fun_ty [] = pprPanic "mkHsAppTys" (ppr fun_ty)
128
mkHsAppTys :: OutputableBndr n => LHsType n -> [LHsType n] -> HsType n mkHsAppTys fun_ty [] = pprPanic "mkHsAppTys" (ppr fun_ty)
128
mkHsAppTys fun_ty [] = pprPanic "mkHsAppTys" (ppr fun_ty)
57
false
true
0
9
20
56
26
30
null
null
ford-prefect/haskell-gi
lib/Data/GI/CodeGen/Code.hs
lgpl-2.1
transitiveModuleDeps :: ModuleInfo -> Deps transitiveModuleDeps minfo = Set.unions (moduleDeps minfo : map transitiveModuleDeps (M.elems $ submodules minfo))
176
transitiveModuleDeps :: ModuleInfo -> Deps transitiveModuleDeps minfo = Set.unions (moduleDeps minfo : map transitiveModuleDeps (M.elems $ submodules minfo))
176
transitiveModuleDeps minfo = Set.unions (moduleDeps minfo : map transitiveModuleDeps (M.elems $ submodules minfo))
133
false
true
0
11
36
50
24
26
null
null
Fuuzetsu/yi-haskell-utils
src/Yi/Mode/Haskell/Utils/Internal.hs
gpl-3.0
processType :: HDataType -> HType processType ('[':_, _) = HList
64
processType :: HDataType -> HType processType ('[':_, _) = HList
64
processType ('[':_, _) = HList
30
false
true
0
7
9
28
15
13
null
null
ababkin/qmuli
library/Qi/Options.hs
mit
cfCmd :: Mod CommandFields Command cfCmd = command "cf" $ info cfParser $ fullDesc <> progDesc "Perform operations on CloudFormation stack" where cfParser = hsubparser ( cfCreate <> cfDeploy <> cfDescribe <> cfUpdate <> cfDestroy <> cfCycle <> cfTemplate ) cfCreate :: Mod CommandFields Command cfCreate = command "create" $ info (pure CfCreate) $ fullDesc <> progDesc "Create a CloudFormation stack" cfDeploy :: Mod CommandFields Command cfDeploy = command "deploy" $ info (pure CfDeploy) $ fullDesc <> progDesc "Deploy a CloudFormation stack" cfDescribe :: Mod CommandFields Command cfDescribe = command "describe" $ info (pure CfDescribe) $ fullDesc <> progDesc "Describe a CloudFormation stack" cfUpdate :: Mod CommandFields Command cfUpdate = command "update" $ info (pure CfUpdate) $ fullDesc <> progDesc "Update a CloudFormation stack" cfDestroy :: Mod CommandFields Command cfDestroy = command "destroy" $ info (pure CfDestroy) $ fullDesc <> progDesc "Destroy a CloudFormation stack" cfCycle :: Mod CommandFields Command cfCycle = command "cycle" $ info (pure CfCycle) $ fullDesc <> progDesc "Destroy the CloudFormation stack, re-deploy the app then re-create a stack" cfTemplate :: Mod CommandFields Command cfTemplate = command "render" $ info (pure CfRenderTemplate) $ fullDesc <> progDesc "Renders the CloudFormation template"
1,746
cfCmd :: Mod CommandFields Command cfCmd = command "cf" $ info cfParser $ fullDesc <> progDesc "Perform operations on CloudFormation stack" where cfParser = hsubparser ( cfCreate <> cfDeploy <> cfDescribe <> cfUpdate <> cfDestroy <> cfCycle <> cfTemplate ) cfCreate :: Mod CommandFields Command cfCreate = command "create" $ info (pure CfCreate) $ fullDesc <> progDesc "Create a CloudFormation stack" cfDeploy :: Mod CommandFields Command cfDeploy = command "deploy" $ info (pure CfDeploy) $ fullDesc <> progDesc "Deploy a CloudFormation stack" cfDescribe :: Mod CommandFields Command cfDescribe = command "describe" $ info (pure CfDescribe) $ fullDesc <> progDesc "Describe a CloudFormation stack" cfUpdate :: Mod CommandFields Command cfUpdate = command "update" $ info (pure CfUpdate) $ fullDesc <> progDesc "Update a CloudFormation stack" cfDestroy :: Mod CommandFields Command cfDestroy = command "destroy" $ info (pure CfDestroy) $ fullDesc <> progDesc "Destroy a CloudFormation stack" cfCycle :: Mod CommandFields Command cfCycle = command "cycle" $ info (pure CfCycle) $ fullDesc <> progDesc "Destroy the CloudFormation stack, re-deploy the app then re-create a stack" cfTemplate :: Mod CommandFields Command cfTemplate = command "render" $ info (pure CfRenderTemplate) $ fullDesc <> progDesc "Renders the CloudFormation template"
1,746
cfCmd = command "cf" $ info cfParser $ fullDesc <> progDesc "Perform operations on CloudFormation stack" where cfParser = hsubparser ( cfCreate <> cfDeploy <> cfDescribe <> cfUpdate <> cfDestroy <> cfCycle <> cfTemplate ) cfCreate :: Mod CommandFields Command cfCreate = command "create" $ info (pure CfCreate) $ fullDesc <> progDesc "Create a CloudFormation stack" cfDeploy :: Mod CommandFields Command cfDeploy = command "deploy" $ info (pure CfDeploy) $ fullDesc <> progDesc "Deploy a CloudFormation stack" cfDescribe :: Mod CommandFields Command cfDescribe = command "describe" $ info (pure CfDescribe) $ fullDesc <> progDesc "Describe a CloudFormation stack" cfUpdate :: Mod CommandFields Command cfUpdate = command "update" $ info (pure CfUpdate) $ fullDesc <> progDesc "Update a CloudFormation stack" cfDestroy :: Mod CommandFields Command cfDestroy = command "destroy" $ info (pure CfDestroy) $ fullDesc <> progDesc "Destroy a CloudFormation stack" cfCycle :: Mod CommandFields Command cfCycle = command "cycle" $ info (pure CfCycle) $ fullDesc <> progDesc "Destroy the CloudFormation stack, re-deploy the app then re-create a stack" cfTemplate :: Mod CommandFields Command cfTemplate = command "render" $ info (pure CfRenderTemplate) $ fullDesc <> progDesc "Renders the CloudFormation template"
1,711
false
true
57
11
601
428
176
252
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 96237 = 3140
32
getValueFromProduct 96237 = 3140
32
getValueFromProduct 96237 = 3140
32
false
false
0
5
3
9
4
5
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
action_381 x = happyTcHack x happyFail
38
action_381 x = happyTcHack x happyFail
38
action_381 x = happyTcHack x happyFail
38
false
false
0
5
5
14
6
8
null
null
christiannolte/tip-toi-reveng
src/GMEWriter.hs
mit
putCommand :: Command ResReg -> SPut putCommand (ArithOp o r v) = do putWord16 r mapM_ putWord8 $ arithOpCode o putTVal v
133
putCommand :: Command ResReg -> SPut putCommand (ArithOp o r v) = do putWord16 r mapM_ putWord8 $ arithOpCode o putTVal v
133
putCommand (ArithOp o r v) = do putWord16 r mapM_ putWord8 $ arithOpCode o putTVal v
96
false
true
0
8
33
56
24
32
null
null
mgrabmueller/harpy
Harpy/X86Assembler.hs
bsd-3-clause
-- move string movsb = ensureBufferSize x86_max_instruction_bytes >> x86_movsb
79
movsb = ensureBufferSize x86_max_instruction_bytes >> x86_movsb
63
movsb = ensureBufferSize x86_max_instruction_bytes >> x86_movsb
63
true
false
1
6
9
18
7
11
null
null
alphalambda/k12math
prog/units-student.hs
mit
tbsp = 1/16 * cup
17
tbsp = 1/16 * cup
17
tbsp = 1/16 * cup
17
false
false
4
5
4
21
7
14
null
null
pparkkin/eta
compiler/ETA/BasicTypes/Var.hs
bsd-3-clause
idDetails :: Id -> IdDetails idDetails (Id { id_details = details }) = details
78
idDetails :: Id -> IdDetails idDetails (Id { id_details = details }) = details
78
idDetails (Id { id_details = details }) = details
49
false
true
0
9
13
30
16
14
null
null
ml9951/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
failMClassOpKey = mkPreludeMiscIdUnique 170
57
failMClassOpKey = mkPreludeMiscIdUnique 170
57
failMClassOpKey = mkPreludeMiscIdUnique 170
57
false
false
0
5
17
9
4
5
null
null
GaloisInc/halvm-ghc
compiler/utils/Util.hs
bsd-3-clause
splitAtList (_:xs) (y:ys) = (y:ys', ys'') where (ys', ys'') = splitAtList xs ys -- drop from the end of a list
121
splitAtList (_:xs) (y:ys) = (y:ys', ys'') where (ys', ys'') = splitAtList xs ys -- drop from the end of a list
121
splitAtList (_:xs) (y:ys) = (y:ys', ys'') where (ys', ys'') = splitAtList xs ys -- drop from the end of a list
121
false
false
0
7
31
55
30
25
null
null
miguelpagano/equ
Equ/Proof/Zipper.hs
gpl-3.0
goTop' pf = goTop' $ goUp' pf
29
goTop' pf = goTop' $ goUp' pf
29
goTop' pf = goTop' $ goUp' pf
29
false
false
0
6
6
16
7
9
null
null
merijn/GPU-benchmarks
benchmark-analysis/ingest-src/ProcessPool.hs
gpl-3.0
withProcessPool :: (MonadLoggerIO m, MonadResource m, MonadQuery m) => Int -> Platform -> (Pool Process -> m a) -> m a withProcessPool n Platform{platformName,platformFlags} f = do hostName <- liftIO getHostName logFun <- Log.askLoggerIO makeRunnerProc <- runnerCreator (releaseKey, pool) <- allocate (createProcessPool logFun hostName makeRunnerProc) destroyProcessPool f pool <* release releaseKey where createProcessPool :: LogFun -> String -> ([String] -> IO CreateProcess) -> IO (Pool Process) createProcessPool logFun hostName makeRunnerProc = Pool.createPool (unLog $ allocateProcess makeRunnerProc) (unLog . destroyProcess hostName) 1 3153600000 n where unLog act = Log.runLoggingT act logFun destroyProcessPool :: Pool Process -> IO () destroyProcessPool = liftIO . Pool.destroyAllResources customRunner :: Text -> [String] -> IO CreateProcess customRunner txtCmd args = return . Proc.proc cmd $ runnerArgs ++ args where cmd = T.unpack txtCmd runnerArgs = flags ++ ["--"] flags = map T.unpack $ case platformFlags of Nothing -> [platformName] Just t -> T.splitOn " " t defaultRunner :: [String] -> IO CreateProcess defaultRunner args = do timeout <- getJobTimeOut return . Proc.proc "srun" $ timeout ++ runnerArgs ++ args where runnerArgs = ["-Q", "--gres=gpu:1"] ++ flags ++ ["--"] flags = map T.unpack $ case platformFlags of Nothing -> ["-C", platformName] Just t -> T.splitOn " " t runnerCreator :: MonadQuery m => m ([String] -> IO CreateProcess) runnerCreator = do result <- getGlobalVar RunCommand case result of Just cmd -> return $ customRunner cmd Nothing -> return $ defaultRunner allocateProcess :: ([String] -> IO CreateProcess) -> LoggingT IO Process allocateProcess createRunnerProc = do exePath <- getKernelExecutable libPath <- getKernelLibPath proc@Process{procId,errHandle} <- liftIO $ do runnerProc <- createRunnerProc [exePath, "-L", libPath, "-W", "-S"] let p = runnerProc { std_in = CreatePipe , std_out = CreatePipe , std_err = CreatePipe } procToException = unexpectedTermination p (Just inHandle, Just outHandle, Just errHandle, procHandle) <- Proc.createProcess p System.hSetBuffering inHandle LineBuffering System.hSetBuffering outHandle LineBuffering System.hSetBuffering errHandle LineBuffering Just procId <- Proc.getPid procHandle return Process{..} nonBlockingLogHandle errHandle proc <$ logDebugNS "Process#Start" (showText procId) destroyProcess :: String -> Process -> LoggingT IO () destroyProcess hostName Process{..} = do uninterruptibleMask_ $ do err <- liftIO $ do Proc.getPid procHandle >>= mapM_ (signalProcess sigKILL) System.hClose inHandle System.hClose outHandle Proc.waitForProcess procHandle T.hGetContents errHandle <* System.hClose errHandle logDebugNS "Process#ExitError" err tryRemoveFile $ "kernel-runner.0" <.> show procId <.> hostName tryRemoveFile $ ".PRUN_ENVIRONMENT" <.> show procId <.> hostName logDebugNS "Process#End" $ showText procId tryRemoveFile :: MonadIO m => FilePath -> m () tryRemoveFile path = liftIO $ void (try $ removeFile path :: IO (Either SomeException ()))
3,830
withProcessPool :: (MonadLoggerIO m, MonadResource m, MonadQuery m) => Int -> Platform -> (Pool Process -> m a) -> m a withProcessPool n Platform{platformName,platformFlags} f = do hostName <- liftIO getHostName logFun <- Log.askLoggerIO makeRunnerProc <- runnerCreator (releaseKey, pool) <- allocate (createProcessPool logFun hostName makeRunnerProc) destroyProcessPool f pool <* release releaseKey where createProcessPool :: LogFun -> String -> ([String] -> IO CreateProcess) -> IO (Pool Process) createProcessPool logFun hostName makeRunnerProc = Pool.createPool (unLog $ allocateProcess makeRunnerProc) (unLog . destroyProcess hostName) 1 3153600000 n where unLog act = Log.runLoggingT act logFun destroyProcessPool :: Pool Process -> IO () destroyProcessPool = liftIO . Pool.destroyAllResources customRunner :: Text -> [String] -> IO CreateProcess customRunner txtCmd args = return . Proc.proc cmd $ runnerArgs ++ args where cmd = T.unpack txtCmd runnerArgs = flags ++ ["--"] flags = map T.unpack $ case platformFlags of Nothing -> [platformName] Just t -> T.splitOn " " t defaultRunner :: [String] -> IO CreateProcess defaultRunner args = do timeout <- getJobTimeOut return . Proc.proc "srun" $ timeout ++ runnerArgs ++ args where runnerArgs = ["-Q", "--gres=gpu:1"] ++ flags ++ ["--"] flags = map T.unpack $ case platformFlags of Nothing -> ["-C", platformName] Just t -> T.splitOn " " t runnerCreator :: MonadQuery m => m ([String] -> IO CreateProcess) runnerCreator = do result <- getGlobalVar RunCommand case result of Just cmd -> return $ customRunner cmd Nothing -> return $ defaultRunner allocateProcess :: ([String] -> IO CreateProcess) -> LoggingT IO Process allocateProcess createRunnerProc = do exePath <- getKernelExecutable libPath <- getKernelLibPath proc@Process{procId,errHandle} <- liftIO $ do runnerProc <- createRunnerProc [exePath, "-L", libPath, "-W", "-S"] let p = runnerProc { std_in = CreatePipe , std_out = CreatePipe , std_err = CreatePipe } procToException = unexpectedTermination p (Just inHandle, Just outHandle, Just errHandle, procHandle) <- Proc.createProcess p System.hSetBuffering inHandle LineBuffering System.hSetBuffering outHandle LineBuffering System.hSetBuffering errHandle LineBuffering Just procId <- Proc.getPid procHandle return Process{..} nonBlockingLogHandle errHandle proc <$ logDebugNS "Process#Start" (showText procId) destroyProcess :: String -> Process -> LoggingT IO () destroyProcess hostName Process{..} = do uninterruptibleMask_ $ do err <- liftIO $ do Proc.getPid procHandle >>= mapM_ (signalProcess sigKILL) System.hClose inHandle System.hClose outHandle Proc.waitForProcess procHandle T.hGetContents errHandle <* System.hClose errHandle logDebugNS "Process#ExitError" err tryRemoveFile $ "kernel-runner.0" <.> show procId <.> hostName tryRemoveFile $ ".PRUN_ENVIRONMENT" <.> show procId <.> hostName logDebugNS "Process#End" $ showText procId tryRemoveFile :: MonadIO m => FilePath -> m () tryRemoveFile path = liftIO $ void (try $ removeFile path :: IO (Either SomeException ()))
3,830
withProcessPool n Platform{platformName,platformFlags} f = do hostName <- liftIO getHostName logFun <- Log.askLoggerIO makeRunnerProc <- runnerCreator (releaseKey, pool) <- allocate (createProcessPool logFun hostName makeRunnerProc) destroyProcessPool f pool <* release releaseKey where createProcessPool :: LogFun -> String -> ([String] -> IO CreateProcess) -> IO (Pool Process) createProcessPool logFun hostName makeRunnerProc = Pool.createPool (unLog $ allocateProcess makeRunnerProc) (unLog . destroyProcess hostName) 1 3153600000 n where unLog act = Log.runLoggingT act logFun destroyProcessPool :: Pool Process -> IO () destroyProcessPool = liftIO . Pool.destroyAllResources customRunner :: Text -> [String] -> IO CreateProcess customRunner txtCmd args = return . Proc.proc cmd $ runnerArgs ++ args where cmd = T.unpack txtCmd runnerArgs = flags ++ ["--"] flags = map T.unpack $ case platformFlags of Nothing -> [platformName] Just t -> T.splitOn " " t defaultRunner :: [String] -> IO CreateProcess defaultRunner args = do timeout <- getJobTimeOut return . Proc.proc "srun" $ timeout ++ runnerArgs ++ args where runnerArgs = ["-Q", "--gres=gpu:1"] ++ flags ++ ["--"] flags = map T.unpack $ case platformFlags of Nothing -> ["-C", platformName] Just t -> T.splitOn " " t runnerCreator :: MonadQuery m => m ([String] -> IO CreateProcess) runnerCreator = do result <- getGlobalVar RunCommand case result of Just cmd -> return $ customRunner cmd Nothing -> return $ defaultRunner allocateProcess :: ([String] -> IO CreateProcess) -> LoggingT IO Process allocateProcess createRunnerProc = do exePath <- getKernelExecutable libPath <- getKernelLibPath proc@Process{procId,errHandle} <- liftIO $ do runnerProc <- createRunnerProc [exePath, "-L", libPath, "-W", "-S"] let p = runnerProc { std_in = CreatePipe , std_out = CreatePipe , std_err = CreatePipe } procToException = unexpectedTermination p (Just inHandle, Just outHandle, Just errHandle, procHandle) <- Proc.createProcess p System.hSetBuffering inHandle LineBuffering System.hSetBuffering outHandle LineBuffering System.hSetBuffering errHandle LineBuffering Just procId <- Proc.getPid procHandle return Process{..} nonBlockingLogHandle errHandle proc <$ logDebugNS "Process#Start" (showText procId) destroyProcess :: String -> Process -> LoggingT IO () destroyProcess hostName Process{..} = do uninterruptibleMask_ $ do err <- liftIO $ do Proc.getPid procHandle >>= mapM_ (signalProcess sigKILL) System.hClose inHandle System.hClose outHandle Proc.waitForProcess procHandle T.hGetContents errHandle <* System.hClose errHandle logDebugNS "Process#ExitError" err tryRemoveFile $ "kernel-runner.0" <.> show procId <.> hostName tryRemoveFile $ ".PRUN_ENVIRONMENT" <.> show procId <.> hostName logDebugNS "Process#End" $ showText procId tryRemoveFile :: MonadIO m => FilePath -> m () tryRemoveFile path = liftIO $ void (try $ removeFile path :: IO (Either SomeException ()))
3,703
false
true
0
17
1,192
1,073
515
558
null
null
pkamenarsky/typesafe-query-mongodb
src/Database/MongoDB/Query/Typesafe.hs
apache-2.0
tsQueryToSelector (QBin op (Entity fld) v) = [ fld =: [ (opText op) =: v ] ] where opText Eq = "$eq" opText Neq = "$ne" opText Gt = "$gt" opText Lt = "$lt" opText In = "$in"
195
tsQueryToSelector (QBin op (Entity fld) v) = [ fld =: [ (opText op) =: v ] ] where opText Eq = "$eq" opText Neq = "$ne" opText Gt = "$gt" opText Lt = "$lt" opText In = "$in"
195
tsQueryToSelector (QBin op (Entity fld) v) = [ fld =: [ (opText op) =: v ] ] where opText Eq = "$eq" opText Neq = "$ne" opText Gt = "$gt" opText Lt = "$lt" opText In = "$in"
195
false
false
5
10
59
105
44
61
null
null
tpsinnem/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
lookupCtxt :: Name -> Ctxt a -> [a] lookupCtxt n ctxt = map snd (lookupCtxtName n ctxt)
87
lookupCtxt :: Name -> Ctxt a -> [a] lookupCtxt n ctxt = map snd (lookupCtxtName n ctxt)
87
lookupCtxt n ctxt = map snd (lookupCtxtName n ctxt)
51
false
true
0
7
16
43
21
22
null
null
jeroennoels/exact-real
test/Main.hs
mit
run ["w"] = whiteBoxTest
24
run ["w"] = whiteBoxTest
24
run ["w"] = whiteBoxTest
24
false
false
0
6
3
12
6
6
null
null
VictorDenisov/openjdb
Main.hs
gpl-2.0
setupBreakpoint refType (BreakpointMethodCommand nm method) = do methods <- RT.methods refType let matchingMethods = filter ((method ==) . M.name) methods if null matchingMethods then liftIO . putStrLn $ "there is no method with name: " ++ method else do l <- M.location $ head matchingMethods let br = ER.createBreakpointRequest l void $ ER.enable br
415
setupBreakpoint refType (BreakpointMethodCommand nm method) = do methods <- RT.methods refType let matchingMethods = filter ((method ==) . M.name) methods if null matchingMethods then liftIO . putStrLn $ "there is no method with name: " ++ method else do l <- M.location $ head matchingMethods let br = ER.createBreakpointRequest l void $ ER.enable br
415
setupBreakpoint refType (BreakpointMethodCommand nm method) = do methods <- RT.methods refType let matchingMethods = filter ((method ==) . M.name) methods if null matchingMethods then liftIO . putStrLn $ "there is no method with name: " ++ method else do l <- M.location $ head matchingMethods let br = ER.createBreakpointRequest l void $ ER.enable br
415
false
false
0
14
117
126
59
67
null
null
nushio3/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
ppr_expr (ExplicitTuple exprs boxity) = tupleParens (boxityTupleSort boxity) (fcat (ppr_tup_args $ map unLoc exprs)) where ppr_tup_args [] = [] ppr_tup_args (Present e : es) = (ppr_lexpr e <> punc es) : ppr_tup_args es ppr_tup_args (Missing _ : es) = punc es : ppr_tup_args es punc (Present {} : _) = comma <> space punc (Missing {} : _) = comma punc [] = empty
418
ppr_expr (ExplicitTuple exprs boxity) = tupleParens (boxityTupleSort boxity) (fcat (ppr_tup_args $ map unLoc exprs)) where ppr_tup_args [] = [] ppr_tup_args (Present e : es) = (ppr_lexpr e <> punc es) : ppr_tup_args es ppr_tup_args (Missing _ : es) = punc es : ppr_tup_args es punc (Present {} : _) = comma <> space punc (Missing {} : _) = comma punc [] = empty
418
ppr_expr (ExplicitTuple exprs boxity) = tupleParens (boxityTupleSort boxity) (fcat (ppr_tup_args $ map unLoc exprs)) where ppr_tup_args [] = [] ppr_tup_args (Present e : es) = (ppr_lexpr e <> punc es) : ppr_tup_args es ppr_tup_args (Missing _ : es) = punc es : ppr_tup_args es punc (Present {} : _) = comma <> space punc (Missing {} : _) = comma punc [] = empty
418
false
false
0
10
120
179
87
92
null
null
authchir/SoSe17-FFP-haskell-http2-server
src/Handle/Headers.hs
gpl-3.0
sendContinuation [frag] sid = do let fPayload = Frame.PContinuation $ FContinuation.mkPayload frag fFlags = FContinuation.endHeadersF frame = Frame { fPayload, fFlags, fStreamId = sid } sendFrame frame
285
sendContinuation [frag] sid = do let fPayload = Frame.PContinuation $ FContinuation.mkPayload frag fFlags = FContinuation.endHeadersF frame = Frame { fPayload, fFlags, fStreamId = sid } sendFrame frame
285
sendContinuation [frag] sid = do let fPayload = Frame.PContinuation $ FContinuation.mkPayload frag fFlags = FContinuation.endHeadersF frame = Frame { fPayload, fFlags, fStreamId = sid } sendFrame frame
285
false
false
1
13
110
71
34
37
null
null
arybczak/happstack-server
src/Happstack/Server/SURI.hs
bsd-3-clause
-- | Retrieves the scheme component from the URI scheme :: SURI -> String scheme = URI.uriScheme . suri
104
scheme :: SURI -> String scheme = URI.uriScheme . suri
55
scheme = URI.uriScheme . suri
30
true
true
1
7
19
30
13
17
null
null
gereeter/bounded-intmap
src/Data/WordMap/Base.hs
mit
unions :: [WordMap a] -> WordMap a unions = Data.Foldable.foldl' union empty
76
unions :: [WordMap a] -> WordMap a unions = Data.Foldable.foldl' union empty
76
unions = Data.Foldable.foldl' union empty
41
false
true
0
7
11
32
16
16
null
null
LukeHoersten/hgrev
src/Development/HgRev.hs
mit
hgRev :: FilePath -- ^ Path anywhere within the repository -> IO (Maybe HgRev) -- ^ Nothing is returned if no repo or `hg` binary are found hgRev repo = join . fmap parse <$> runHg repo args where args = ["log", "-r.", "-Tjson"] parse = join . fmap listToMaybe . decode' . pack -- hg does not yet have a programmatic way to get dirty state of -- working dir so this separate call is needed. -- | Get the hg working directory state for a given repo.
478
hgRev :: FilePath -- ^ Path anywhere within the repository -> IO (Maybe HgRev) hgRev repo = join . fmap parse <$> runHg repo args where args = ["log", "-r.", "-Tjson"] parse = join . fmap listToMaybe . decode' . pack -- hg does not yet have a programmatic way to get dirty state of -- working dir so this separate call is needed. -- | Get the hg working directory state for a given repo.
417
hgRev repo = join . fmap parse <$> runHg repo args where args = ["log", "-r.", "-Tjson"] parse = join . fmap listToMaybe . decode' . pack -- hg does not yet have a programmatic way to get dirty state of -- working dir so this separate call is needed. -- | Get the hg working directory state for a given repo.
332
true
true
0
10
118
84
45
39
null
null
SKA-ScienceDataProcessor/RC
MS1/distributed-dot-product/Types.hs
apache-2.0
logMsg :: MasterProtocol -> String -> Process () logMsg (MasterProtocol ch _) = sendChan ch
91
logMsg :: MasterProtocol -> String -> Process () logMsg (MasterProtocol ch _) = sendChan ch
91
logMsg (MasterProtocol ch _) = sendChan ch
42
false
true
0
8
14
38
18
20
null
null
Alex-Diez/haskell-tdd-kata
old-katas/src/FruitShopKata/Day6.hs
bsd-3-clause
process :: [Product] -> [Money] process = map fst . tail . scanl addProduct (0, []) where addProduct :: Bill -> Product -> Bill addProduct (total, products) product = (total + findPrice product - discount product, product:products) where findPrice :: Product -> Money findPrice product | product == "Pommes" = 100 | product == "Cerises" = 75 | product == "Bananes" = 150 discount :: Product -> Money discount product = case lookup product specials of Just (discount, modul) -> ((applyDiscount discount) . (==0) . (`mod` modul) . length . filter ((==) product)) (product:products) Nothing -> 0 applyDiscount :: Money -> Bool -> Money applyDiscount discount True = discount applyDiscount _ _ = 0 specials = [("Cerises", (20, 2)), ("Bananes", (150, 2))]
1,095
process :: [Product] -> [Money] process = map fst . tail . scanl addProduct (0, []) where addProduct :: Bill -> Product -> Bill addProduct (total, products) product = (total + findPrice product - discount product, product:products) where findPrice :: Product -> Money findPrice product | product == "Pommes" = 100 | product == "Cerises" = 75 | product == "Bananes" = 150 discount :: Product -> Money discount product = case lookup product specials of Just (discount, modul) -> ((applyDiscount discount) . (==0) . (`mod` modul) . length . filter ((==) product)) (product:products) Nothing -> 0 applyDiscount :: Money -> Bool -> Money applyDiscount discount True = discount applyDiscount _ _ = 0 specials = [("Cerises", (20, 2)), ("Bananes", (150, 2))]
1,091
process = map fst . tail . scanl addProduct (0, []) where addProduct :: Bill -> Product -> Bill addProduct (total, products) product = (total + findPrice product - discount product, product:products) where findPrice :: Product -> Money findPrice product | product == "Pommes" = 100 | product == "Cerises" = 75 | product == "Bananes" = 150 discount :: Product -> Money discount product = case lookup product specials of Just (discount, modul) -> ((applyDiscount discount) . (==0) . (`mod` modul) . length . filter ((==) product)) (product:products) Nothing -> 0 applyDiscount :: Money -> Bool -> Money applyDiscount discount True = discount applyDiscount _ _ = 0 specials = [("Cerises", (20, 2)), ("Bananes", (150, 2))]
1,059
false
true
0
17
466
334
176
158
null
null
silver-lang/silver
src/Silver/Compiler/Semantics.hs
bsd-3-clause
-- | put a binding with constraints and the type putBinding :: (String,[TypeClassConstraint],Type) -> Semantics () putBinding (n,cs,t) = modify (over (env.ix 0) (Map.insert n (cs,t)))
183
putBinding :: (String,[TypeClassConstraint],Type) -> Semantics () putBinding (n,cs,t) = modify (over (env.ix 0) (Map.insert n (cs,t)))
134
putBinding (n,cs,t) = modify (over (env.ix 0) (Map.insert n (cs,t)))
68
true
true
0
10
25
80
44
36
null
null
ice1000/OI-codes
codewars/301-400/writing-applicative-parsers-from-scratch.hs
agpl-3.0
many :: Parser a -> Parser [a] many v = manyV where manyV = someV <|> pure [] someV = (:) <$> v <*> manyV -- -- | Succeed only when parsing the given character.
171
many :: Parser a -> Parser [a] many v = manyV where manyV = someV <|> pure [] someV = (:) <$> v <*> manyV -- -- | Succeed only when parsing the given character.
171
many v = manyV where manyV = someV <|> pure [] someV = (:) <$> v <*> manyV -- -- | Succeed only when parsing the given character.
140
false
true
1
9
45
62
32
30
null
null
markhibberd/cli
demo/hs/Main.hs
bsd-3-clause
flags = [ switch 'v' "verbose" "verbose ountput" verboseL ]
64
flags = [ switch 'v' "verbose" "verbose ountput" verboseL ]
64
flags = [ switch 'v' "verbose" "verbose ountput" verboseL ]
64
false
false
1
7
14
22
9
13
null
null
paulrzcz/takusen-oracle
Database/Oracle/OCIFunctions.hs
bsd-3-clause
llbackTrans :: ErrorHandle -> ConnHandle -> IO () rollbackTrans err conn = do rc <- ociTransRollback conn err oci_DEFAULT testForError rc "rollback" () -- --------------------------------------------------------------------------------- -- -- ** Issuing queries -- --------------------------------------------------------------------------------- -- |With the OCI you do queries with these steps: -- * prepare your statement (it's just a String) - no communication with DBMS -- * execute it (this sends it to the DBMS for parsing etc) -- * allocate result set buffers by calling 'defineByPos' for each column -- * call fetch for each row. -- * call 'handleFree' for the 'StmtHandle' -- (I assume this is the approved way of terminating the query; -- the OCI docs aren't explicit about this.)
838
rollbackTrans :: ErrorHandle -> ConnHandle -> IO () rollbackTrans err conn = do rc <- ociTransRollback conn err oci_DEFAULT testForError rc "rollback" () -- --------------------------------------------------------------------------------- -- -- ** Issuing queries -- --------------------------------------------------------------------------------- -- |With the OCI you do queries with these steps: -- * prepare your statement (it's just a String) - no communication with DBMS -- * execute it (this sends it to the DBMS for parsing etc) -- * allocate result set buffers by calling 'defineByPos' for each column -- * call fetch for each row. -- * call 'handleFree' for the 'StmtHandle' -- (I assume this is the approved way of terminating the query; -- the OCI docs aren't explicit about this.)
837
rollbackTrans err conn = do rc <- ociTransRollback conn err oci_DEFAULT testForError rc "rollback" () -- --------------------------------------------------------------------------------- -- -- ** Issuing queries -- --------------------------------------------------------------------------------- -- |With the OCI you do queries with these steps: -- * prepare your statement (it's just a String) - no communication with DBMS -- * execute it (this sends it to the DBMS for parsing etc) -- * allocate result set buffers by calling 'defineByPos' for each column -- * call fetch for each row. -- * call 'handleFree' for the 'StmtHandle' -- (I assume this is the approved way of terminating the query; -- the OCI docs aren't explicit about this.)
785
false
true
0
9
161
70
37
33
null
null
nightscape/platform
shared/src/Unison/Util/Logger.hs
mit
logHandleAt :: Logger -> Level -> Handle -> IO () logHandleAt logger lvl h | lvl > getLevel logger = pure () | otherwise = void . forkIO $ loop where loop = do line <- try (hGetLine h) case line of Left ioe | isEOFError ioe -> logAt (scope "logHandleAt" logger) 3 "EOF" | otherwise -> logAt (scope "logHandleAt" logger) 2 (show ioe) Right line -> logAt logger lvl line >> loop
434
logHandleAt :: Logger -> Level -> Handle -> IO () logHandleAt logger lvl h | lvl > getLevel logger = pure () | otherwise = void . forkIO $ loop where loop = do line <- try (hGetLine h) case line of Left ioe | isEOFError ioe -> logAt (scope "logHandleAt" logger) 3 "EOF" | otherwise -> logAt (scope "logHandleAt" logger) 2 (show ioe) Right line -> logAt logger lvl line >> loop
434
logHandleAt logger lvl h | lvl > getLevel logger = pure () | otherwise = void . forkIO $ loop where loop = do line <- try (hGetLine h) case line of Left ioe | isEOFError ioe -> logAt (scope "logHandleAt" logger) 3 "EOF" | otherwise -> logAt (scope "logHandleAt" logger) 2 (show ioe) Right line -> logAt logger lvl line >> loop
384
false
true
1
16
130
183
83
100
null
null
sleexyz/haskell-fun
StateManagementExploration.hs
bsd-3-clause
reducer2 ∷ ∀ state. state → (∀ b. (state → (state, b)) → (state, b)) reducer2 s = \setState -> setState s
106
reducer2 ∷ ∀ state. state → (∀ b. (state → (state, b)) → (state, b)) reducer2 s = \setState -> setState s
106
reducer2 s = \setState -> setState s
36
false
true
0
12
22
62
35
27
null
null
harendra-kumar/asyncly
src/Streamly/Memory/Ring.hs
bsd-3-clause
unsafeEqArray :: Ring a -> Ptr a -> A.Array a -> Bool unsafeEqArray Ring{..} rh A.Array{..} = let !res = A.unsafeInlineIO $ do let rs = unsafeForeignPtrToPtr ringStart let as = unsafeForeignPtrToPtr aStart assert (aBound `minusPtr` as >= ringBound `minusPtr` rs) (return ()) let len = ringBound `minusPtr` rh r1 <- A.memcmp (castPtr rh) (castPtr as) len r2 <- A.memcmp (castPtr rs) (castPtr (as `plusPtr` len)) (rh `minusPtr` rs) -- XXX enable these, check perf impact -- touchForeignPtr ringStart -- touchForeignPtr aStart return (r1 && r2) in res
722
unsafeEqArray :: Ring a -> Ptr a -> A.Array a -> Bool unsafeEqArray Ring{..} rh A.Array{..} = let !res = A.unsafeInlineIO $ do let rs = unsafeForeignPtrToPtr ringStart let as = unsafeForeignPtrToPtr aStart assert (aBound `minusPtr` as >= ringBound `minusPtr` rs) (return ()) let len = ringBound `minusPtr` rh r1 <- A.memcmp (castPtr rh) (castPtr as) len r2 <- A.memcmp (castPtr rs) (castPtr (as `plusPtr` len)) (rh `minusPtr` rs) -- XXX enable these, check perf impact -- touchForeignPtr ringStart -- touchForeignPtr aStart return (r1 && r2) in res
722
unsafeEqArray Ring{..} rh A.Array{..} = let !res = A.unsafeInlineIO $ do let rs = unsafeForeignPtrToPtr ringStart let as = unsafeForeignPtrToPtr aStart assert (aBound `minusPtr` as >= ringBound `minusPtr` rs) (return ()) let len = ringBound `minusPtr` rh r1 <- A.memcmp (castPtr rh) (castPtr as) len r2 <- A.memcmp (castPtr rs) (castPtr (as `plusPtr` len)) (rh `minusPtr` rs) -- XXX enable these, check perf impact -- touchForeignPtr ringStart -- touchForeignPtr aStart return (r1 && r2) in res
668
false
true
0
17
261
238
118
120
null
null
mzini/TcT
source/Tct/Encoding/Polynomial.hs
gpl-3.0
deleteCoeff v (Poly (Mono n w:ms)) | powsEq v w = Poly subresult | otherwise = Poly $ Mono n w:subresult where Poly subresult = deleteCoeff v $ Poly ms
189
deleteCoeff v (Poly (Mono n w:ms)) | powsEq v w = Poly subresult | otherwise = Poly $ Mono n w:subresult where Poly subresult = deleteCoeff v $ Poly ms
189
deleteCoeff v (Poly (Mono n w:ms)) | powsEq v w = Poly subresult | otherwise = Poly $ Mono n w:subresult where Poly subresult = deleteCoeff v $ Poly ms
189
false
false
0
10
67
85
38
47
null
null
mb21/qua-kit
libs/hs/luci-connect/examples/LuciTest.hs
mit
yieldInvalidMessageWrongNumbers1 :: Monad m => LuciMessage -> LuciConduitE e m yieldInvalidMessageWrongNumbers1 (msg, atts) = mapOutput ProcessedData $ do let mainpart = BSL.toStrict $ JSON.encode msg attSize = 8 * length atts + foldr (\a s -> s + BS.length a) 0 atts yieldInt64be (fromIntegral $ BS.length mainpart) yieldInt64be (fromIntegral attSize) yield mainpart yieldInt64be (fromIntegral $ length atts) mapM_ writeAtt atts where writeAtt bs = do yieldInt64be (fromIntegral $ BS.length bs) yield bs yieldInt64be = yield . BSL.toStrict . BSB.toLazyByteString . BSB.int64BE
672
yieldInvalidMessageWrongNumbers1 :: Monad m => LuciMessage -> LuciConduitE e m yieldInvalidMessageWrongNumbers1 (msg, atts) = mapOutput ProcessedData $ do let mainpart = BSL.toStrict $ JSON.encode msg attSize = 8 * length atts + foldr (\a s -> s + BS.length a) 0 atts yieldInt64be (fromIntegral $ BS.length mainpart) yieldInt64be (fromIntegral attSize) yield mainpart yieldInt64be (fromIntegral $ length atts) mapM_ writeAtt atts where writeAtt bs = do yieldInt64be (fromIntegral $ BS.length bs) yield bs yieldInt64be = yield . BSL.toStrict . BSB.toLazyByteString . BSB.int64BE
672
yieldInvalidMessageWrongNumbers1 (msg, atts) = mapOutput ProcessedData $ do let mainpart = BSL.toStrict $ JSON.encode msg attSize = 8 * length atts + foldr (\a s -> s + BS.length a) 0 atts yieldInt64be (fromIntegral $ BS.length mainpart) yieldInt64be (fromIntegral attSize) yield mainpart yieldInt64be (fromIntegral $ length atts) mapM_ writeAtt atts where writeAtt bs = do yieldInt64be (fromIntegral $ BS.length bs) yield bs yieldInt64be = yield . BSL.toStrict . BSB.toLazyByteString . BSB.int64BE
567
false
true
0
17
175
223
103
120
null
null
nzok/decimal
ScaledDecimalTest.hs
mit
prop_abs_of_negate_is_abs = forAll sdGen $ \x -> abs (negate x) == abs x
80
prop_abs_of_negate_is_abs = forAll sdGen $ \x -> abs (negate x) == abs x
80
prop_abs_of_negate_is_abs = forAll sdGen $ \x -> abs (negate x) == abs x
80
false
false
0
10
20
34
16
18
null
null
hdgarrood/herringbone-fay
test/Main.hs
mit
app :: Application app = toApplication hb
41
app :: Application app = toApplication hb
41
app = toApplication hb
22
false
true
0
5
6
14
7
7
null
null
cmahon/mvc-service
library/MVC/Socket.hs
bsd-3-clause
newConnection :: Socket -> IO Connection newConnection sock = Connection <$> newTVarIO (Just sock)
98
newConnection :: Socket -> IO Connection newConnection sock = Connection <$> newTVarIO (Just sock)
98
newConnection sock = Connection <$> newTVarIO (Just sock)
57
false
true
0
8
13
34
16
18
null
null
massysett/penny
penny/lib/Penny/Copper/Grammar.hs
bsd-3-clause
-- Fields openParen = terminal "OpenParen" (solo '(')
54
openParen = terminal "OpenParen" (solo '(')
43
openParen = terminal "OpenParen" (solo '(')
43
true
false
0
7
8
18
9
9
null
null
firegurafiku/ImplicitEMC
src/Physics/ImplicitEMC/NetCDF.hs
gpl-2.0
mkDimentionPair :: Dimention -> (String, NC.NcDim) mkDimentionPair dim = case dim of BoundedDimention name size -> (name, NC.NcDim name size False) UnboundedDimention name -> (name, NC.NcDim name 0 True)
225
mkDimentionPair :: Dimention -> (String, NC.NcDim) mkDimentionPair dim = case dim of BoundedDimention name size -> (name, NC.NcDim name size False) UnboundedDimention name -> (name, NC.NcDim name 0 True)
225
mkDimentionPair dim = case dim of BoundedDimention name size -> (name, NC.NcDim name size False) UnboundedDimention name -> (name, NC.NcDim name 0 True)
174
false
true
0
10
50
80
41
39
null
null
np/hlatex
Text/Align.hs
bsd-3-clause
-- currently wrong: should take the width in account number :: Width a => [[a]] -> [[Pos a]] number = zipWith numb [0..] --where numb row = zipWith (Pos row) <*> (cumSum . map width) where numb row x = zipWith (Pos row) (cumSum . map width $ x) x {- number :: (tok -> String) -> Row -> Col -> [tok] -> [Pos tok] number str r c [] = [] number str r c (t : ts) = Pos r c t : number str r' c' ts where (r', c') = count r c (str t) count :: Row -> Col -> String -> (Row, Col) count r c [] = (r, c) count r c (a : s) | a == '\n' = count (r + 1) 1 s | otherwise = count r (c + 1) s -}
735
number :: Width a => [[a]] -> [[Pos a]] number = zipWith numb [0..] --where numb row = zipWith (Pos row) <*> (cumSum . map width) where numb row x = zipWith (Pos row) (cumSum . map width $ x) x {- number :: (tok -> String) -> Row -> Col -> [tok] -> [Pos tok] number str r c [] = [] number str r c (t : ts) = Pos r c t : number str r' c' ts where (r', c') = count r c (str t) count :: Row -> Col -> String -> (Row, Col) count r c [] = (r, c) count r c (a : s) | a == '\n' = count (r + 1) 1 s | otherwise = count r (c + 1) s -}
682
number = zipWith numb [0..] --where numb row = zipWith (Pos row) <*> (cumSum . map width) where numb row x = zipWith (Pos row) (cumSum . map width $ x) x {- number :: (tok -> String) -> Row -> Col -> [tok] -> [Pos tok] number str r c [] = [] number str r c (t : ts) = Pos r c t : number str r' c' ts where (r', c') = count r c (str t) count :: Row -> Col -> String -> (Row, Col) count r c [] = (r, c) count r c (a : s) | a == '\n' = count (r + 1) 1 s | otherwise = count r (c + 1) s -}
642
true
true
0
9
299
87
46
41
null
null
fmapfmapfmap/amazonka
amazonka-opsworks/gen/Network/AWS/OpsWorks/Types/Product.hs
mpl-2.0
-- | The instance\'s AWS region. elbRegion :: Lens' ElasticLoadBalancer (Maybe Text) elbRegion = lens _elbRegion (\ s a -> s{_elbRegion = a})
141
elbRegion :: Lens' ElasticLoadBalancer (Maybe Text) elbRegion = lens _elbRegion (\ s a -> s{_elbRegion = a})
108
elbRegion = lens _elbRegion (\ s a -> s{_elbRegion = a})
56
true
true
0
9
22
46
25
21
null
null
diagrams/diagrams-input
src/Diagrams/SVG/Path.hs
bsd-3-clause
nextSegment :: (RealFloat n, Show n) => ((n,n), (n,n), ClosedTrail [Trail' Line V2 n]) -> PathCommand n -> ( (n,n), (n,n), ClosedTrail [Trail' Line V2 n]) nextSegment (ctrlPoint, startPoint, O trail) Z = (ctrlPoint, startPoint, Closed trail)
242
nextSegment :: (RealFloat n, Show n) => ((n,n), (n,n), ClosedTrail [Trail' Line V2 n]) -> PathCommand n -> ( (n,n), (n,n), ClosedTrail [Trail' Line V2 n]) nextSegment (ctrlPoint, startPoint, O trail) Z = (ctrlPoint, startPoint, Closed trail)
242
nextSegment (ctrlPoint, startPoint, O trail) Z = (ctrlPoint, startPoint, Closed trail)
87
false
true
0
13
37
140
76
64
null
null
d0kt0r0/estuary
common/src/Estuary/Types/Tempo.hs
gpl-3.0
firstCycleStartAfter :: Tempo -> UTCTime -> UTCTime firstCycleStartAfter x t = countToTime x $ fromIntegral $ ceiling $ timeToCount x t
135
firstCycleStartAfter :: Tempo -> UTCTime -> UTCTime firstCycleStartAfter x t = countToTime x $ fromIntegral $ ceiling $ timeToCount x t
135
firstCycleStartAfter x t = countToTime x $ fromIntegral $ ceiling $ timeToCount x t
83
false
true
0
8
20
44
21
23
null
null
annenkov/contracts
Coq/Extraction/contracts-haskell/src/Examples/BasePayoff.hs
mit
{- Semantics in Coq almost directly translates to a primitive "loopif" in Haskell Fixpoint loop_if_sem n t0 b e1 e2 : option ILVal:= b t0 >>= fun b' => match b' with | ILBVal true => e1 t0 | ILBVal false => match n with | O => e2 t0 | S n' => loop_if_sem n' (S t0) b e1 e2 end | _ => None end. -} loopif :: Int -> Int -> (Int -> Bool) -> (Int -> a) -> (Int -> a) -> a loopif n t0 b e1 e2 = let b' = b t0 in case b' of True -> e1 t0 False -> case n of 0 -> e2 t0 _ -> loopif (n-1) (t0+1) b e1 e2
854
loopif :: Int -> Int -> (Int -> Bool) -> (Int -> a) -> (Int -> a) -> a loopif n t0 b e1 e2 = let b' = b t0 in case b' of True -> e1 t0 False -> case n of 0 -> e2 t0 _ -> loopif (n-1) (t0+1) b e1 e2
337
loopif n t0 b e1 e2 = let b' = b t0 in case b' of True -> e1 t0 False -> case n of 0 -> e2 t0 _ -> loopif (n-1) (t0+1) b e1 e2
266
true
true
0
15
483
141
71
70
null
null
plcplc/hie
hie-js/src/Hie/Ui/Types.hs
agpl-3.0
uiGrid :: ListMember Grid uidomain => Term (Sum uidomain) uiGrid = undefined
76
uiGrid :: ListMember Grid uidomain => Term (Sum uidomain) uiGrid = undefined
76
uiGrid = undefined
18
false
true
0
8
11
29
14
15
null
null
Javran/misc
gaussian-elim/src/Lib.hs
mit
mainDemo :: IO () mainDemo = do let input :: [[Int]] input = [ [3, 4, 7, 2] , [4, 11, 2, 8] , [16, 7, 3, 3] ] [a, b, c] = [4, 15, 7 :: Int] 2 <- pure $ (a * 3 + b * 4 + c * 7) `rem` 17 8 <- pure $ (a * 4 + b * 11 + c * 2) `rem` 17 3 <- pure $ (a * 16 + b * 7 + c * 3) `rem` 17 putStrLn "input:" mapM_ print input case solveMat 17 input of Right sols -> putStrLn $ "Solution: " <> show sols Left (NoMultInv i) -> putStrLn $ "Cannot solve equations as " <> show i <> " does not have a multiplicative inverse." Left Underdetermined -> putStrLn "Cannot solve equations, underdetermined." Left (Todo err) -> error $ "TODO: " <> err Left (Gaussian err) -> putStrLn $ "Cannot solve equations, Gaussian error: " <> err
822
mainDemo :: IO () mainDemo = do let input :: [[Int]] input = [ [3, 4, 7, 2] , [4, 11, 2, 8] , [16, 7, 3, 3] ] [a, b, c] = [4, 15, 7 :: Int] 2 <- pure $ (a * 3 + b * 4 + c * 7) `rem` 17 8 <- pure $ (a * 4 + b * 11 + c * 2) `rem` 17 3 <- pure $ (a * 16 + b * 7 + c * 3) `rem` 17 putStrLn "input:" mapM_ print input case solveMat 17 input of Right sols -> putStrLn $ "Solution: " <> show sols Left (NoMultInv i) -> putStrLn $ "Cannot solve equations as " <> show i <> " does not have a multiplicative inverse." Left Underdetermined -> putStrLn "Cannot solve equations, underdetermined." Left (Todo err) -> error $ "TODO: " <> err Left (Gaussian err) -> putStrLn $ "Cannot solve equations, Gaussian error: " <> err
822
mainDemo = do let input :: [[Int]] input = [ [3, 4, 7, 2] , [4, 11, 2, 8] , [16, 7, 3, 3] ] [a, b, c] = [4, 15, 7 :: Int] 2 <- pure $ (a * 3 + b * 4 + c * 7) `rem` 17 8 <- pure $ (a * 4 + b * 11 + c * 2) `rem` 17 3 <- pure $ (a * 16 + b * 7 + c * 3) `rem` 17 putStrLn "input:" mapM_ print input case solveMat 17 input of Right sols -> putStrLn $ "Solution: " <> show sols Left (NoMultInv i) -> putStrLn $ "Cannot solve equations as " <> show i <> " does not have a multiplicative inverse." Left Underdetermined -> putStrLn "Cannot solve equations, underdetermined." Left (Todo err) -> error $ "TODO: " <> err Left (Gaussian err) -> putStrLn $ "Cannot solve equations, Gaussian error: " <> err
804
false
true
18
15
274
280
168
112
null
null
isturdy/permGen
src/BSPerm.hs
unlicense
idPerm :: Word8 -> Perm idPerm n = Perm $ B.pack [1..n]
55
idPerm :: Word8 -> Perm idPerm n = Perm $ B.pack [1..n]
55
idPerm n = Perm $ B.pack [1..n]
31
false
true
0
7
11
32
16
16
null
null
andrewthad/vinyl-vectors
src/Data/Vector/Vinyl/Default/NonEmpty/Monomorphic.hs
bsd-3-clause
-- | /O(1)/ Yield all but the first @n@ elements without copying. The vector may -- contain less than @n@ elements in which case an empty vector is returned. drop :: G.Vector Vector (Rec Identity rs) => Int -> Vector (Rec Identity rs) -> Vector (Rec Identity rs) drop = G.drop
278
drop :: G.Vector Vector (Rec Identity rs) => Int -> Vector (Rec Identity rs) -> Vector (Rec Identity rs) drop = G.drop
120
drop = G.drop
13
true
true
4
7
52
60
29
31
null
null
fpco/store
store-core/src/Data/Store/Core.hs
mit
-- | Decodes a value from a 'ByteString', potentially throwing -- exceptions, and taking a 'Peek' to run. It is an exception to not -- consume all input. decodeIOWith :: Peek a -> ByteString -> IO a decodeIOWith mypeek (BS.PS x s len) = withForeignPtr x $ \ptr0 -> let ptr = ptr0 `plusPtr` s in decodeIOWithFromPtr mypeek ptr len
349
decodeIOWith :: Peek a -> ByteString -> IO a decodeIOWith mypeek (BS.PS x s len) = withForeignPtr x $ \ptr0 -> let ptr = ptr0 `plusPtr` s in decodeIOWithFromPtr mypeek ptr len
195
decodeIOWith mypeek (BS.PS x s len) = withForeignPtr x $ \ptr0 -> let ptr = ptr0 `plusPtr` s in decodeIOWithFromPtr mypeek ptr len
150
true
true
0
11
79
81
41
40
null
null
sheyll/b9-vm-image-builder
src/lib/B9/B9Error.hs
mit
-- | 'SomeException' wrapped into 'Exc'ecption 'Eff'ects -- -- @since 0.5.64 throwB9Error_ :: Member ExcB9 e => String -> Eff e () throwB9Error_ = throwSomeException_ . MkB9Error
178
throwB9Error_ :: Member ExcB9 e => String -> Eff e () throwB9Error_ = throwSomeException_ . MkB9Error
101
throwB9Error_ = throwSomeException_ . MkB9Error
47
true
true
0
9
26
44
21
23
null
null
bgamari/text
tests/Tests/Properties.hs
bsd-2-clause
t_indices (NotEmpty s) = Slow.indices s `eq` indices s
55
t_indices (NotEmpty s) = Slow.indices s `eq` indices s
55
t_indices (NotEmpty s) = Slow.indices s `eq` indices s
55
false
false
0
7
9
29
14
15
null
null
GaloisInc/saw-script
crux-mir-comp/src/Mir/Compositional/Convert.hs
bsd-3-clause
shapeMirTy (TupleShape ty _ _) = ty
35
shapeMirTy (TupleShape ty _ _) = ty
35
shapeMirTy (TupleShape ty _ _) = ty
35
false
false
0
6
6
20
9
11
null
null
rueshyna/gogol
gogol-compute/gen/Network/Google/Resource/Compute/Disks/List.hs
mpl-2.0
-- | Specifies a page token to use. Set pageToken to the nextPageToken -- returned by a previous list request to get the next page of results. dlPageToken :: Lens' DisksList (Maybe Text) dlPageToken = lens _dlPageToken (\ s a -> s{_dlPageToken = a})
251
dlPageToken :: Lens' DisksList (Maybe Text) dlPageToken = lens _dlPageToken (\ s a -> s{_dlPageToken = a})
108
dlPageToken = lens _dlPageToken (\ s a -> s{_dlPageToken = a})
64
true
true
0
9
45
49
26
23
null
null
cshung/MiscLab
Haskell99/q37.hs
mit
phi :: Int -> Int phi x = case (tryPhi x) of Left result -> result Right message -> error message
126
phi :: Int -> Int phi x = case (tryPhi x) of Left result -> result Right message -> error message
126
phi x = case (tryPhi x) of Left result -> result Right message -> error message
108
false
true
0
8
49
54
24
30
null
null
channable/icepeak
client-haskell/src/Icepeak/Client.hs
bsd-3-clause
-- | Return the request path for an Icepeak path. requestPathForIcepeakPath :: [Text] -> [URI.QueryItem] -> ByteString requestPathForIcepeakPath pathSegments query = toStrictBS builder where toStrictBS = ByteString.Lazy.toStrict . Binary.Builder.toLazyByteString builder = URI.encodePathSegments pathSegments <> URI.renderQueryBuilder True query -- | Perform the HTTP request
386
requestPathForIcepeakPath :: [Text] -> [URI.QueryItem] -> ByteString requestPathForIcepeakPath pathSegments query = toStrictBS builder where toStrictBS = ByteString.Lazy.toStrict . Binary.Builder.toLazyByteString builder = URI.encodePathSegments pathSegments <> URI.renderQueryBuilder True query -- | Perform the HTTP request
336
requestPathForIcepeakPath pathSegments query = toStrictBS builder where toStrictBS = ByteString.Lazy.toStrict . Binary.Builder.toLazyByteString builder = URI.encodePathSegments pathSegments <> URI.renderQueryBuilder True query -- | Perform the HTTP request
267
true
true
2
8
53
86
41
45
null
null
mike-k-houghton/Builder
src/BF.hs
bsd-3-clause
parseInstruction :: Parser BFInstruction parseInstruction = do parseComment inst <- parseBack <|> parseForward <|> parseIncrement <|> parseDecrement <|> parseInput <|> parseOutput <|> parseLoop parseComment return inst
261
parseInstruction :: Parser BFInstruction parseInstruction = do parseComment inst <- parseBack <|> parseForward <|> parseIncrement <|> parseDecrement <|> parseInput <|> parseOutput <|> parseLoop parseComment return inst
261
parseInstruction = do parseComment inst <- parseBack <|> parseForward <|> parseIncrement <|> parseDecrement <|> parseInput <|> parseOutput <|> parseLoop parseComment return inst
220
false
true
0
13
68
57
26
31
null
null
Jiggins/Utils
Utils.hs
gpl-3.0
showDuplicates :: Ord a => [a] -> [a] showDuplicates = concat . filter ((> 1) . length) . group . sort
102
showDuplicates :: Ord a => [a] -> [a] showDuplicates = concat . filter ((> 1) . length) . group . sort
102
showDuplicates = concat . filter ((> 1) . length) . group . sort
64
false
true
0
11
20
54
29
25
null
null
edom/ptt
src/Parse/Haskell/Lex.hs
apache-2.0
{- Note for reservedIds and reservedOps: If x is a prefix of y, then x must come after y in the list. This is because <|> is not commutative; M.choice picks the first (not the longest) matching string. -} reservedIds = [ "case" , "class" , "data" , "default" , "deriving" , "do" , "else" , "foreign" , "if" , "import" , "infixl" , "infixr" , "infix" , "instance" , "in" , "let" , "module" , "newtype" , "of" , "then" , "type" , "where" , "_" ]
633
reservedIds = [ "case" , "class" , "data" , "default" , "deriving" , "do" , "else" , "foreign" , "if" , "import" , "infixl" , "infixr" , "infix" , "instance" , "in" , "let" , "module" , "newtype" , "of" , "then" , "type" , "where" , "_" ]
426
reservedIds = [ "case" , "class" , "data" , "default" , "deriving" , "do" , "else" , "foreign" , "if" , "import" , "infixl" , "infixr" , "infix" , "instance" , "in" , "let" , "module" , "newtype" , "of" , "then" , "type" , "where" , "_" ]
426
true
false
0
5
277
76
50
26
null
null
quantum-dan/tictactoe-ai
Algo.hs
mit
-- winPatternsWeight :: Board -> Player -> Int findAllMoves :: Board -> Player -> [Board] findAllMoves board player = [ setByPosition board coords place | coords <- clist, getByPosition board coords == E ] where clist = zip [1, 1, 1, 2, 2, 2, 3, 3, 3] [1, 2, 3, 1, 2, 3, 1, 2, 3] place = getPlace player
324
findAllMoves :: Board -> Player -> [Board] findAllMoves board player = [ setByPosition board coords place | coords <- clist, getByPosition board coords == E ] where clist = zip [1, 1, 1, 2, 2, 2, 3, 3, 3] [1, 2, 3, 1, 2, 3, 1, 2, 3] place = getPlace player
276
findAllMoves board player = [ setByPosition board coords place | coords <- clist, getByPosition board coords == E ] where clist = zip [1, 1, 1, 2, 2, 2, 3, 3, 3] [1, 2, 3, 1, 2, 3, 1, 2, 3] place = getPlace player
233
true
true
1
8
80
134
76
58
null
null
ambiata/delorean
src/Delorean/Local/Date.hs
bsd-3-clause
weekOfMonthFromInt :: Int -> Maybe WeekOfMonth weekOfMonthFromInt n = let months = zip [1 .. 5] [FirstWeek .. LastWeek] in snd <$> find ((== n) . fst) months
162
weekOfMonthFromInt :: Int -> Maybe WeekOfMonth weekOfMonthFromInt n = let months = zip [1 .. 5] [FirstWeek .. LastWeek] in snd <$> find ((== n) . fst) months
162
weekOfMonthFromInt n = let months = zip [1 .. 5] [FirstWeek .. LastWeek] in snd <$> find ((== n) . fst) months
115
false
true
0
11
32
69
36
33
null
null
et4te/zero
server/src/Zero/ResetToken/Handlers.hs
bsd-3-clause
resetAccount sid conn (Just (_, email)) (ResetSecretSealed s) = undefined
73
resetAccount sid conn (Just (_, email)) (ResetSecretSealed s) = undefined
73
resetAccount sid conn (Just (_, email)) (ResetSecretSealed s) = undefined
73
false
false
0
8
9
33
17
16
null
null
kevinjardine/gruzeSnaplet
src/Snap/Snaplet/Gruze/Handles.hs
gpl-2.0
getFileMetadataResult :: [[SqlValue]] -> Maybe ([GrzString],Int) getFileMetadataResult [[SqlNull,_,_,_]] = Nothing
114
getFileMetadataResult :: [[SqlValue]] -> Maybe ([GrzString],Int) getFileMetadataResult [[SqlNull,_,_,_]] = Nothing
114
getFileMetadataResult [[SqlNull,_,_,_]] = Nothing
49
false
true
0
8
9
51
30
21
null
null
eryx67/haskell-libtorrent
src/Network/Libtorrent/Session/AddTorrentParams.hs
bsd-3-clause
setFlags :: MonadIO m => AddTorrentParams -> BitFlags AddTorrentFlags -> m () setFlags atp flags = liftIO . withPtr atp $ \atPtr -> do let flags' = fromIntegral $ fromEnum flags [CU.exp| void { $(add_torrent_params * atPtr)->flags = $(uint64_t flags')} |]
262
setFlags :: MonadIO m => AddTorrentParams -> BitFlags AddTorrentFlags -> m () setFlags atp flags = liftIO . withPtr atp $ \atPtr -> do let flags' = fromIntegral $ fromEnum flags [CU.exp| void { $(add_torrent_params * atPtr)->flags = $(uint64_t flags')} |]
262
setFlags atp flags = liftIO . withPtr atp $ \atPtr -> do let flags' = fromIntegral $ fromEnum flags [CU.exp| void { $(add_torrent_params * atPtr)->flags = $(uint64_t flags')} |]
183
false
true
0
13
47
80
39
41
null
null