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
mitchellwrosen/kerchief
src/Utils.hs
bsd-3-clause
showNumbered :: (Show a, Foldable t) => t a -> [String] showNumbered = showNumberedWith show
92
showNumbered :: (Show a, Foldable t) => t a -> [String] showNumbered = showNumberedWith show
92
showNumbered = showNumberedWith show
36
false
true
0
9
14
45
21
24
null
null
Philonous/hs-stun
source/Network/Stun/Base.hs
mit
showBits :: Bits a => a -> [Char] showBits a = reverse [if testBit a i then '1' else '0' | i <- [0.. bitSize a - 1]]
116
showBits :: Bits a => a -> [Char] showBits a = reverse [if testBit a i then '1' else '0' | i <- [0.. bitSize a - 1]]
116
showBits a = reverse [if testBit a i then '1' else '0' | i <- [0.. bitSize a - 1]]
82
false
true
0
11
27
67
34
33
null
null
sdiehl/ghc
testsuite/tests/rename/should_fail/T15957_Fail.hs
bsd-3-clause
g3 P{x=a, y=b, ..} = a + b
26
g3 P{x=a, y=b, ..} = a + b
26
g3 P{x=a, y=b, ..} = a + b
26
false
false
1
6
7
37
18
19
null
null
bruno-cadorette/TheLambdaReactor
src/Backend/Reactive.hs
mit
testEventNetwork :: Event (Socket, ApiExample) -> MomentIO () testEventNetwork e = do (ev', n) <- eventnetwork e reactimateSocket (\(_,n)-> broadcastAll "numberConnected" $ trace (show n) $ n) $ f2 ev' n {- Create an Event from an 'on' EventHandler -}
282
testEventNetwork :: Event (Socket, ApiExample) -> MomentIO () testEventNetwork e = do (ev', n) <- eventnetwork e reactimateSocket (\(_,n)-> broadcastAll "numberConnected" $ trace (show n) $ n) $ f2 ev' n {- Create an Event from an 'on' EventHandler -}
282
testEventNetwork e = do (ev', n) <- eventnetwork e reactimateSocket (\(_,n)-> broadcastAll "numberConnected" $ trace (show n) $ n) $ f2 ev' n {- Create an Event from an 'on' EventHandler -}
220
false
true
0
15
70
98
49
49
null
null
AlexeyRaga/eta
compiler/ETA/CodeGen/Types.hs
bsd-3-clause
isLFThunk _ = False
28
isLFThunk _ = False
28
isLFThunk _ = False
28
false
false
0
5
12
9
4
5
null
null
nomicflux/threals
src/Threal/ThrealM.hs
gpl-2.0
nubComps :: Comps -> [Threal] -> [Threal] nubComps c ts = nubBy eqC ts where eqC t s = (redComp c) t s && (greenComp c) t s && (blueComp c) t s
145
nubComps :: Comps -> [Threal] -> [Threal] nubComps c ts = nubBy eqC ts where eqC t s = (redComp c) t s && (greenComp c) t s && (blueComp c) t s
145
nubComps c ts = nubBy eqC ts where eqC t s = (redComp c) t s && (greenComp c) t s && (blueComp c) t s
103
false
true
0
9
34
88
43
45
null
null
Chobbes/Juicy.Pixels
src/Codec/Picture/ColorQuant.hs
bsd-3-clause
medianMeanCutQuantization :: PaletteOptions -> Image PixelRGB8 -> (Image Pixel8, Palette) medianMeanCutQuantization opts img | isBelow = (pixelMap okPaletteIndex img, vecToPalette okPaletteVec) | enableImageDithering opts = (pixelMap paletteIndex dImg, palette) | otherwise = (pixelMap paletteIndex img, palette) where maxColorCount = paletteColorCount opts (okPalette, isBelow) = isColorCountBelow maxColorCount img okPaletteVec = V.fromList $ Set.toList okPalette okPaletteIndex p = nearestColorIdx p okPaletteVec palette = vecToPalette paletteVec paletteIndex p = nearestColorIdx p paletteVec paletteVec = mkPaletteVec cs cs = Set.toList . clusters maxColorCount $ img dImg = pixelMapXY dither img -- | A naive one pass Color Quantiation algorithm - Uniform Quantization. -- Simply take the most significant bits. The maxCols parameter is rounded -- down to the nearest power of 2, and the bits are divided among the three -- color channels with priority order green, red, blue. Returns an -- image of `Pixel8` that acts as a matrix of indices into the `Palette`.
1,145
medianMeanCutQuantization :: PaletteOptions -> Image PixelRGB8 -> (Image Pixel8, Palette) medianMeanCutQuantization opts img | isBelow = (pixelMap okPaletteIndex img, vecToPalette okPaletteVec) | enableImageDithering opts = (pixelMap paletteIndex dImg, palette) | otherwise = (pixelMap paletteIndex img, palette) where maxColorCount = paletteColorCount opts (okPalette, isBelow) = isColorCountBelow maxColorCount img okPaletteVec = V.fromList $ Set.toList okPalette okPaletteIndex p = nearestColorIdx p okPaletteVec palette = vecToPalette paletteVec paletteIndex p = nearestColorIdx p paletteVec paletteVec = mkPaletteVec cs cs = Set.toList . clusters maxColorCount $ img dImg = pixelMapXY dither img -- | A naive one pass Color Quantiation algorithm - Uniform Quantization. -- Simply take the most significant bits. The maxCols parameter is rounded -- down to the nearest power of 2, and the bits are divided among the three -- color channels with priority order green, red, blue. Returns an -- image of `Pixel8` that acts as a matrix of indices into the `Palette`.
1,145
medianMeanCutQuantization opts img | isBelow = (pixelMap okPaletteIndex img, vecToPalette okPaletteVec) | enableImageDithering opts = (pixelMap paletteIndex dImg, palette) | otherwise = (pixelMap paletteIndex img, palette) where maxColorCount = paletteColorCount opts (okPalette, isBelow) = isColorCountBelow maxColorCount img okPaletteVec = V.fromList $ Set.toList okPalette okPaletteIndex p = nearestColorIdx p okPaletteVec palette = vecToPalette paletteVec paletteIndex p = nearestColorIdx p paletteVec paletteVec = mkPaletteVec cs cs = Set.toList . clusters maxColorCount $ img dImg = pixelMapXY dither img -- | A naive one pass Color Quantiation algorithm - Uniform Quantization. -- Simply take the most significant bits. The maxCols parameter is rounded -- down to the nearest power of 2, and the bits are divided among the three -- color channels with priority order green, red, blue. Returns an -- image of `Pixel8` that acts as a matrix of indices into the `Palette`.
1,029
false
true
2
8
229
214
109
105
null
null
micknelso/language-c
examples/ComputeSize.hs
bsd-3-clause
-- [starting point for exporting SemRep to AST] main :: IO () main = do let usage = error "Example Usage: ./ScanFile 'pattern' -I/usr/include my_file.c" args <- getArgs when (length args < 2) usage let (pat,args') = (head &&& tail) args let (opts,c_file) = (init &&& last) args' let compiler = newGCC "gcc" ast <- parseCFile compiler Nothing opts c_file >>= checkResult "[parsing]" (globals,warnings) <- (runTrav_ >>> checkResult "[analysis]") $ analyseAST ast mapM (hPutStrLn stderr . show) warnings putStrLn "#include <stdio.h>" print $ pretty (generateSizeTests pat globals) where checkResult :: (Show a) => String -> (Either a b) -> IO b checkResult label = either (error . (label++) . show) return
768
main :: IO () main = do let usage = error "Example Usage: ./ScanFile 'pattern' -I/usr/include my_file.c" args <- getArgs when (length args < 2) usage let (pat,args') = (head &&& tail) args let (opts,c_file) = (init &&& last) args' let compiler = newGCC "gcc" ast <- parseCFile compiler Nothing opts c_file >>= checkResult "[parsing]" (globals,warnings) <- (runTrav_ >>> checkResult "[analysis]") $ analyseAST ast mapM (hPutStrLn stderr . show) warnings putStrLn "#include <stdio.h>" print $ pretty (generateSizeTests pat globals) where checkResult :: (Show a) => String -> (Either a b) -> IO b checkResult label = either (error . (label++) . show) return
719
main = do let usage = error "Example Usage: ./ScanFile 'pattern' -I/usr/include my_file.c" args <- getArgs when (length args < 2) usage let (pat,args') = (head &&& tail) args let (opts,c_file) = (init &&& last) args' let compiler = newGCC "gcc" ast <- parseCFile compiler Nothing opts c_file >>= checkResult "[parsing]" (globals,warnings) <- (runTrav_ >>> checkResult "[analysis]") $ analyseAST ast mapM (hPutStrLn stderr . show) warnings putStrLn "#include <stdio.h>" print $ pretty (generateSizeTests pat globals) where checkResult :: (Show a) => String -> (Either a b) -> IO b checkResult label = either (error . (label++) . show) return
705
true
true
0
12
176
285
134
151
null
null
simhu/cubical
Eval.hs
mit
inhrec b p phi v = VInhRec b p phi v
36
inhrec b p phi v = VInhRec b p phi v
36
inhrec b p phi v = VInhRec b p phi v
36
false
false
1
5
10
34
11
23
null
null
vTurbine/ghc
libraries/base/Data/List/NonEmpty.hs
bsd-3-clause
head :: NonEmpty a -> a head ~(a :| _) = a
42
head :: NonEmpty a -> a head ~(a :| _) = a
42
head ~(a :| _) = a
18
false
true
0
9
11
36
16
20
null
null
switchface/helm
src/Helm/Engine/SDL/Keyboard.hs
mit
mapKey Codes.KeycodeKPDblAmpersand = KeypadDblAmpersandKey
58
mapKey Codes.KeycodeKPDblAmpersand = KeypadDblAmpersandKey
58
mapKey Codes.KeycodeKPDblAmpersand = KeypadDblAmpersandKey
58
false
false
0
6
3
11
5
6
null
null
pparkkin/eta
compiler/ETA/Prelude/TysWiredIn.hs
bsd-3-clause
unboxedTupleArr = listArray (0,mAX_TUPLE_SIZE) [mk_tuple UnboxedTuple i | i <- [0..mAX_TUPLE_SIZE]]
99
unboxedTupleArr = listArray (0,mAX_TUPLE_SIZE) [mk_tuple UnboxedTuple i | i <- [0..mAX_TUPLE_SIZE]]
99
unboxedTupleArr = listArray (0,mAX_TUPLE_SIZE) [mk_tuple UnboxedTuple i | i <- [0..mAX_TUPLE_SIZE]]
99
false
false
0
9
10
38
20
18
null
null
triplepointfive/cereal
tests/Benchmark.hs
bsd-3-clause
getWord64N16Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop s 0 = return s loop s n = do s0 <- getWord64host s1 <- getWord64host s2 <- getWord64host s3 <- getWord64host s4 <- getWord64host s5 <- getWord64host s6 <- getWord64host s7 <- getWord64host s8 <- getWord64host s9 <- getWord64host s10 <- getWord64host s11 <- getWord64host s12 <- getWord64host s13 <- getWord64host s14 <- getWord64host s15 <- getWord64host loop (s+s0+s1+s2+s3+s4+s5+s6+s7+s9+s10+s11+s12+s13+s14+s15) (n-16)
691
getWord64N16Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop s 0 = return s loop s n = do s0 <- getWord64host s1 <- getWord64host s2 <- getWord64host s3 <- getWord64host s4 <- getWord64host s5 <- getWord64host s6 <- getWord64host s7 <- getWord64host s8 <- getWord64host s9 <- getWord64host s10 <- getWord64host s11 <- getWord64host s12 <- getWord64host s13 <- getWord64host s14 <- getWord64host s15 <- getWord64host loop (s+s0+s1+s2+s3+s4+s5+s6+s7+s9+s10+s11+s12+s13+s14+s15) (n-16)
691
getWord64N16Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop s 0 = return s loop s n = do s0 <- getWord64host s1 <- getWord64host s2 <- getWord64host s3 <- getWord64host s4 <- getWord64host s5 <- getWord64host s6 <- getWord64host s7 <- getWord64host s8 <- getWord64host s9 <- getWord64host s10 <- getWord64host s11 <- getWord64host s12 <- getWord64host s13 <- getWord64host s14 <- getWord64host s15 <- getWord64host loop (s+s0+s1+s2+s3+s4+s5+s6+s7+s9+s10+s11+s12+s13+s14+s15) (n-16)
691
false
false
2
24
265
263
119
144
null
null
danidiaz/plan-applicative
lib/Control/Plan/Core.hs
mit
foldSteps' :: (Seq (w,s,Mandatoriness,r) -> w -> r) -> Steps s w -> r foldSteps' f = go where go (Steps steps w) = f (fmap (\(w',e',mandatoriness',substeps) -> (w',e',mandatoriness',go substeps)) steps) w -- | Adapt the 'Step' value inside a 'Plan' without extracting it.
289
foldSteps' :: (Seq (w,s,Mandatoriness,r) -> w -> r) -> Steps s w -> r foldSteps' f = go where go (Steps steps w) = f (fmap (\(w',e',mandatoriness',substeps) -> (w',e',mandatoriness',go substeps)) steps) w -- | Adapt the 'Step' value inside a 'Plan' without extracting it.
289
foldSteps' f = go where go (Steps steps w) = f (fmap (\(w',e',mandatoriness',substeps) -> (w',e',mandatoriness',go substeps)) steps) w -- | Adapt the 'Step' value inside a 'Plan' without extracting it.
219
false
true
0
11
61
128
67
61
null
null
siddhanathan/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
size_type ty | Just exp_ty <- tcView ty = size_type exp_ty
58
size_type ty | Just exp_ty <- tcView ty = size_type exp_ty
58
size_type ty | Just exp_ty <- tcView ty = size_type exp_ty
58
false
false
0
9
10
31
12
19
null
null
zachsully/hakaru
haskell/Tests/TestTools.hs
bsd-3-clause
handleException :: String -> SomeException -> IO a handleException t e = throw (TestSimplifyException t e)
106
handleException :: String -> SomeException -> IO a handleException t e = throw (TestSimplifyException t e)
106
handleException t e = throw (TestSimplifyException t e)
55
false
true
0
7
15
38
18
20
null
null
grwlf/cake3
src/Development/Cake3/Writer.hs
bsd-3-clause
fresh :: MakeLL File fresh = do (f:fs,rs) <- get put (fs,rs) return f
75
fresh :: MakeLL File fresh = do (f:fs,rs) <- get put (fs,rs) return f
75
fresh = do (f:fs,rs) <- get put (fs,rs) return f
54
false
true
0
9
19
49
24
25
null
null
yokto/Updater
Updater/List.hs
apache-2.0
insertBefore :: a -> Node a -> IO (Node a) insertBefore v node = do left <- readIORef $ nodePrev node if left == node && isJust (nodeValue node) then error "LinkedList.insertBefore: node removed from list" else insertBetween v left node -- | /O(1)/. Insert an item after the given node.
311
insertBefore :: a -> Node a -> IO (Node a) insertBefore v node = do left <- readIORef $ nodePrev node if left == node && isJust (nodeValue node) then error "LinkedList.insertBefore: node removed from list" else insertBetween v left node -- | /O(1)/. Insert an item after the given node.
311
insertBefore v node = do left <- readIORef $ nodePrev node if left == node && isJust (nodeValue node) then error "LinkedList.insertBefore: node removed from list" else insertBetween v left node -- | /O(1)/. Insert an item after the given node.
268
false
true
0
12
75
94
43
51
null
null
badi/super-user-spark
test/Compiler/TestUtils.hs
mit
filePathClean :: FilePath -> IO () filePathClean fp = fp `shouldSatisfy` cleanBy cleanFilePath
94
filePathClean :: FilePath -> IO () filePathClean fp = fp `shouldSatisfy` cleanBy cleanFilePath
94
filePathClean fp = fp `shouldSatisfy` cleanBy cleanFilePath
59
false
true
0
7
12
32
16
16
null
null
kawamuray/ganeti
src/Ganeti/Locking/Locks.hs
gpl-2.0
-- | Obtain the ClientID from its JSON representation. clientIdFromJSON :: J.JSValue -> J.Result ClientId clientIdFromJSON (J.JSArray [clienttp, J.JSString lf, pid]) = ClientId <$> J.readJSON clienttp <*> pure (J.fromJSString lf) <*> liftM fromIntegral (J.readJSON pid :: J.Result Integer)
302
clientIdFromJSON :: J.JSValue -> J.Result ClientId clientIdFromJSON (J.JSArray [clienttp, J.JSString lf, pid]) = ClientId <$> J.readJSON clienttp <*> pure (J.fromJSString lf) <*> liftM fromIntegral (J.readJSON pid :: J.Result Integer)
247
clientIdFromJSON (J.JSArray [clienttp, J.JSString lf, pid]) = ClientId <$> J.readJSON clienttp <*> pure (J.fromJSString lf) <*> liftM fromIntegral (J.readJSON pid :: J.Result Integer)
196
true
true
8
12
50
110
53
57
null
null
GinBaby/applicatives
acc/src/Main.hs
gpl-3.0
maybeWord :: String -> AccValidation [String] String maybeWord xs = case null xs of True -> AccFailure ["Empty string."] -- notice this isn't just a String, but a list of String False -> do case (all isAlpha xs) of False -> AccFailure ["This is not a word."] True -> AccSuccess xs
346
maybeWord :: String -> AccValidation [String] String maybeWord xs = case null xs of True -> AccFailure ["Empty string."] -- notice this isn't just a String, but a list of String False -> do case (all isAlpha xs) of False -> AccFailure ["This is not a word."] True -> AccSuccess xs
346
maybeWord xs = case null xs of True -> AccFailure ["Empty string."] -- notice this isn't just a String, but a list of String False -> do case (all isAlpha xs) of False -> AccFailure ["This is not a word."] True -> AccSuccess xs
293
false
true
0
15
116
93
44
49
null
null
cblp/tasknight-dashboard
dashboard/src/Tasknight/Providers/Gmail.hs
gpl-3.0
foldFor :: (Traversable t, Applicative f, Monoid b) => t a -> (a -> f b) -> f b foldFor xs f = fold <$> traverse f xs
117
foldFor :: (Traversable t, Applicative f, Monoid b) => t a -> (a -> f b) -> f b foldFor xs f = fold <$> traverse f xs
117
foldFor xs f = fold <$> traverse f xs
37
false
true
0
10
27
70
34
36
null
null
talw/quoridor-hs
src/Quoridor/Cmdline/Network/Server.hs
bsd-3-clause
handleClientInput :: GameChan -> PChans -> Color -> Socket -> IO () handleClientInput gameChan playerChans col sock = go where go = do msg <- recvMsg sock atomically $ case msg of chatMsg@(ChatMsg _ _) -> readTVar playerChans >>= broadcast chatMsg TurnMsg turn -> writeTChan gameChan (col, turn) _ -> error "handleClientInput - unexpected Message" go
392
handleClientInput :: GameChan -> PChans -> Color -> Socket -> IO () handleClientInput gameChan playerChans col sock = go where go = do msg <- recvMsg sock atomically $ case msg of chatMsg@(ChatMsg _ _) -> readTVar playerChans >>= broadcast chatMsg TurnMsg turn -> writeTChan gameChan (col, turn) _ -> error "handleClientInput - unexpected Message" go
392
handleClientInput gameChan playerChans col sock = go where go = do msg <- recvMsg sock atomically $ case msg of chatMsg@(ChatMsg _ _) -> readTVar playerChans >>= broadcast chatMsg TurnMsg turn -> writeTChan gameChan (col, turn) _ -> error "handleClientInput - unexpected Message" go
324
false
true
1
13
97
137
62
75
null
null
bgamari/criterion
Criterion/Analysis.hs
bsd-2-clause
scale :: Double -- ^ Value to multiply by. -> SampleAnalysis -> SampleAnalysis scale f s@SampleAnalysis{..} = s { anMean = B.scale f anMean , anStdDev = B.scale f anStdDev }
290
scale :: Double -- ^ Value to multiply by. -> SampleAnalysis -> SampleAnalysis scale f s@SampleAnalysis{..} = s { anMean = B.scale f anMean , anStdDev = B.scale f anStdDev }
290
scale f s@SampleAnalysis{..} = s { anMean = B.scale f anMean , anStdDev = B.scale f anStdDev }
189
false
true
8
5
147
58
32
26
null
null
rahulmutt/ghcvm
compiler/Eta/Rename/RnTypes.hs
bsd-3-clause
rnHsTyKi :: Bool -> HsDocContext -> HsType RdrName -> RnM (HsType Name, FreeVars) rnHsTyKi isType doc ty@HsForAllTy{} = rnHsTyKiForAll isType doc (flattenTopLevelHsForAllTy ty)
179
rnHsTyKi :: Bool -> HsDocContext -> HsType RdrName -> RnM (HsType Name, FreeVars) rnHsTyKi isType doc ty@HsForAllTy{} = rnHsTyKiForAll isType doc (flattenTopLevelHsForAllTy ty)
178
rnHsTyKi isType doc ty@HsForAllTy{} = rnHsTyKiForAll isType doc (flattenTopLevelHsForAllTy ty)
96
false
true
3
7
25
64
33
31
null
null
cantora/cycle-roll
test/Data/CycleRoll/Internal/RSequence/NodeTest.hs
gpl-3.0
sl = DSeq.fromList
18
sl = DSeq.fromList
18
sl = DSeq.fromList
18
false
false
1
6
2
12
4
8
null
null
Concelo/concelo
src/Database/Concelo/Control.hs
bsd-3-clause
updateThenGet :: S.MonadState s m => L.Lens' s a -> (a -> a) -> m a updateThenGet lens update = S.state $ \s -> let v = update $ L.view lens s in (v, L.set lens v s)
167
updateThenGet :: S.MonadState s m => L.Lens' s a -> (a -> a) -> m a updateThenGet lens update = S.state $ \s -> let v = update $ L.view lens s in (v, L.set lens v s)
167
updateThenGet lens update = S.state $ \s -> let v = update $ L.view lens s in (v, L.set lens v s)
99
false
true
2
12
39
106
50
56
null
null
travitch/dalvik
src/Dalvik/LEB128.hs
bsd-3-clause
getULEB128p1 :: Get Int32 getULEB128p1 = (pred . fromIntegral) <$> getULEB128
77
getULEB128p1 :: Get Int32 getULEB128p1 = (pred . fromIntegral) <$> getULEB128
77
getULEB128p1 = (pred . fromIntegral) <$> getULEB128
51
false
true
0
7
10
25
13
12
null
null
Deewiant/haschoo
Haschoo/Utils.hs
bsd-3-clause
fromRights :: [Either a b] -> Maybe [b] fromRights [] = Just []
75
fromRights :: [Either a b] -> Maybe [b] fromRights [] = Just []
75
fromRights [] = Just []
35
false
true
0
7
24
39
19
20
null
null
OS2World/DEV-UTIL-HUGS
libraries/Graphics/Rendering/OpenGL/GLU/Tessellation.hs
bsd-3-clause
getProperty :: Storable v => Ptr (Ptr (AnnotatedVertex v)) -> Int -> IO v getProperty propertyPtrs n = do AnnotatedVertex _ v <- peek =<< peekElemOff propertyPtrs n return v
179
getProperty :: Storable v => Ptr (Ptr (AnnotatedVertex v)) -> Int -> IO v getProperty propertyPtrs n = do AnnotatedVertex _ v <- peek =<< peekElemOff propertyPtrs n return v
179
getProperty propertyPtrs n = do AnnotatedVertex _ v <- peek =<< peekElemOff propertyPtrs n return v
105
false
true
0
11
35
76
34
42
null
null
cliaw/HChess
Board.hs
gpl-2.0
onBoard :: Location -> Bool onBoard (x,y) = x `elem` [1..boardsize] && y `elem` [1..boardsize]
107
onBoard :: Location -> Bool onBoard (x,y) = x `elem` [1..boardsize] && y `elem` [1..boardsize]
107
onBoard (x,y) = x `elem` [1..boardsize] && y `elem` [1..boardsize]
79
false
true
0
8
27
50
29
21
null
null
dylanmc/cryptol
src/Cryptol/Parser/AST.hs
bsd-3-clause
ppNamed :: PP a => String -> Named a -> Doc ppNamed s x = ppL (name x) <+> text s <+> pp (value x)
98
ppNamed :: PP a => String -> Named a -> Doc ppNamed s x = ppL (name x) <+> text s <+> pp (value x)
98
ppNamed s x = ppL (name x) <+> text s <+> pp (value x)
54
false
true
0
9
24
68
30
38
null
null
Purview/purview
src/Graphics/Forensics/Algorithms/FFTW.hs
gpl-3.0
idct1d :: Array F DIM1 Double -> Array F DIM1 Double idct1d = liftC r2c1d $ FFTW.dct3N [0]
90
idct1d :: Array F DIM1 Double -> Array F DIM1 Double idct1d = liftC r2c1d $ FFTW.dct3N [0]
90
idct1d = liftC r2c1d $ FFTW.dct3N [0]
37
false
true
0
7
17
44
21
23
null
null
eklavya/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
defined (PInterface _ _ _ _ n _ _ _ _ ms cn _) = n : (map fst (maybeToList cn) ++ concatMap defined ms)
110
defined (PInterface _ _ _ _ n _ _ _ _ ms cn _) = n : (map fst (maybeToList cn) ++ concatMap defined ms)
110
defined (PInterface _ _ _ _ n _ _ _ _ ms cn _) = n : (map fst (maybeToList cn) ++ concatMap defined ms)
110
false
false
0
10
31
64
31
33
null
null
tolysz/prepare-ghcjs
spec-lts8/cabal/Cabal/Distribution/Compat/Semigroup.hs
bsd-3-clause
gmappend :: (Generic a, GSemigroup (Rep a)) => a -> a -> a gmappend x y = to (gmappend' (from x) (from y))
106
gmappend :: (Generic a, GSemigroup (Rep a)) => a -> a -> a gmappend x y = to (gmappend' (from x) (from y))
106
gmappend x y = to (gmappend' (from x) (from y))
47
false
true
0
9
22
74
35
39
null
null
et4te/zero
src/Reflex/Dom/SemanticUI/Common.hs
bsd-3-clause
olive = uiSetColor UiOlive
26
olive = uiSetColor UiOlive
26
olive = uiSetColor UiOlive
26
false
false
0
5
3
9
4
5
null
null
L3n41c/qrar
src/Lib.hs
bsd-3-clause
filelistToLatex ∷ (Monad m) ⇒ [(FilePath, Text)] → LaTeXT_ m filelistToLatex filelist = do thePreamble document $ theBody filelist
134
filelistToLatex ∷ (Monad m) ⇒ [(FilePath, Text)] → LaTeXT_ m filelistToLatex filelist = do thePreamble document $ theBody filelist
134
filelistToLatex filelist = do thePreamble document $ theBody filelist
73
false
true
0
8
22
52
26
26
null
null
purcell/adventofcode2016
src/Day17.hs
bsd-3-clause
partB :: String -> Int partB = length . last . solutions
56
partB :: String -> Int partB = length . last . solutions
56
partB = length . last . solutions
33
false
true
0
6
11
23
12
11
null
null
li-zhirui/EoplLangs
src/CheckedLang/Evaluator.hs
bsd-3-clause
exprToDeno (ExprBool b) = DenoBool b
36
exprToDeno (ExprBool b) = DenoBool b
36
exprToDeno (ExprBool b) = DenoBool b
36
false
false
0
7
5
18
8
10
null
null
robeverest/accelerate
Data/Array/Accelerate/Trafo/Fusion.hs
bsd-3-clause
arrayShape :: (Shape sh, Elt e) => Idx aenv (Array sh e) -> Exp aenv sh arrayShape = Shape . OpenAcc . Avar
107
arrayShape :: (Shape sh, Elt e) => Idx aenv (Array sh e) -> Exp aenv sh arrayShape = Shape . OpenAcc . Avar
107
arrayShape = Shape . OpenAcc . Avar
35
false
true
0
9
22
56
28
28
null
null
bredelings/BAli-Phy
haskell/SModel.hs
gpl-2.0
mixMM fs ms = MixtureModel $ mix fs [m | MixtureModel m <- ms]
62
mixMM fs ms = MixtureModel $ mix fs [m | MixtureModel m <- ms]
62
mixMM fs ms = MixtureModel $ mix fs [m | MixtureModel m <- ms]
62
false
false
1
10
13
38
16
22
null
null
GOGEN/rsa
app/CustomCodes.hs
bsd-3-clause
customChr 44 = 'Ь'
18
customChr 44 = 'Ь'
18
customChr 44 = 'Ь'
18
false
false
0
5
3
9
4
5
null
null
ml9951/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
integerToWordIdKey = mkPreludeMiscIdUnique 62
56
integerToWordIdKey = mkPreludeMiscIdUnique 62
56
integerToWordIdKey = mkPreludeMiscIdUnique 62
56
false
false
0
5
14
9
4
5
null
null
fmapfmapfmap/amazonka
amazonka-cloudfront/gen/Network/AWS/CloudFront/Types/Product.hs
mpl-2.0
-- | The identifier for the invalidation request. For example: -- IDFDVBD632BHDS5. iId :: Lens' Invalidation Text iId = lens _iId (\ s a -> s{_iId = a})
152
iId :: Lens' Invalidation Text iId = lens _iId (\ s a -> s{_iId = a})
69
iId = lens _iId (\ s a -> s{_iId = a})
38
true
true
1
9
27
44
23
21
null
null
rrnewton/unix-bytestring_MIRROR
src/System/Posix/IO/ByteString/Lazy.hs
bsd-3-clause
fdWrites :: Fd -> BL.ByteString -- ^ The string to write. -> IO (ByteCount, BL.ByteString) -- ^ How many bytes were actually written, and the remaining -- (unwritten) string. fdWrites fd = go 0 where -- We want to do a left fold in order to avoid stack overflows, -- but we need to have an early exit for incomplete writes -- (which normally requires a right fold). Hence this recursion. go acc BLI.Empty = return (acc, BL.empty) go acc (BLI.Chunk c cs) = do rc <- PosixBS.fdWrite fd c let acc' = acc+rc in acc' `seq` do let rcInt = fromIntegral rc in rcInt `seq` do if rcInt == BS.length c then go acc' cs else return (acc', BLI.Chunk (BSU.unsafeDrop rcInt c) cs) {- Using 'BSU.unsafeDrop' above is safe, assuming that 'System.Posix.IO.fdWriteBuf' never returns (rc < 0 || rc > BS.length c). If we are paranoid about that then we should do the following instead: go acc ccs = case ccs of BLI.Empty -> return (acc, ccs) BLI.Chunk c cs -> do rc <- PosixBS.fdWrite fd c let acc' = acc+rc in acc' `seq` do let rcInt = fromIntegral rc in rcInt `seq` do case BS.length c of len | rcInt == len -> go acc' cs | rcInt > len -> error _impossibleByteCount | rcInt < 0 -> error _negtiveByteCount | rcInt == 0 -> return (acc', ccs) -- trivial optimizing | otherwise -> return (acc', BLI.Chunk (BSU.unsafeDrop rcInt c) cs) _negtiveByteCount = "System.Posix.IO.fdWriteBuf: returned a negative byte count" _impossibleByteCount = "System.Posix.IO.fdWriteBuf: returned a byte count greater than the length it was given" -} ---------------------------------------------------------------- -- | Write a 'BL.ByteString' to an 'Fd'. This function makes a -- single @writev(2)@ system call, as per 'PosixBS.fdWritev'.
2,038
fdWrites :: Fd -> BL.ByteString -- ^ The string to write. -> IO (ByteCount, BL.ByteString) fdWrites fd = go 0 where -- We want to do a left fold in order to avoid stack overflows, -- but we need to have an early exit for incomplete writes -- (which normally requires a right fold). Hence this recursion. go acc BLI.Empty = return (acc, BL.empty) go acc (BLI.Chunk c cs) = do rc <- PosixBS.fdWrite fd c let acc' = acc+rc in acc' `seq` do let rcInt = fromIntegral rc in rcInt `seq` do if rcInt == BS.length c then go acc' cs else return (acc', BLI.Chunk (BSU.unsafeDrop rcInt c) cs) {- Using 'BSU.unsafeDrop' above is safe, assuming that 'System.Posix.IO.fdWriteBuf' never returns (rc < 0 || rc > BS.length c). If we are paranoid about that then we should do the following instead: go acc ccs = case ccs of BLI.Empty -> return (acc, ccs) BLI.Chunk c cs -> do rc <- PosixBS.fdWrite fd c let acc' = acc+rc in acc' `seq` do let rcInt = fromIntegral rc in rcInt `seq` do case BS.length c of len | rcInt == len -> go acc' cs | rcInt > len -> error _impossibleByteCount | rcInt < 0 -> error _negtiveByteCount | rcInt == 0 -> return (acc', ccs) -- trivial optimizing | otherwise -> return (acc', BLI.Chunk (BSU.unsafeDrop rcInt c) cs) _negtiveByteCount = "System.Posix.IO.fdWriteBuf: returned a negative byte count" _impossibleByteCount = "System.Posix.IO.fdWriteBuf: returned a byte count greater than the length it was given" -} ---------------------------------------------------------------- -- | Write a 'BL.ByteString' to an 'Fd'. This function makes a -- single @writev(2)@ system call, as per 'PosixBS.fdWritev'.
1,938
fdWrites fd = go 0 where -- We want to do a left fold in order to avoid stack overflows, -- but we need to have an early exit for incomplete writes -- (which normally requires a right fold). Hence this recursion. go acc BLI.Empty = return (acc, BL.empty) go acc (BLI.Chunk c cs) = do rc <- PosixBS.fdWrite fd c let acc' = acc+rc in acc' `seq` do let rcInt = fromIntegral rc in rcInt `seq` do if rcInt == BS.length c then go acc' cs else return (acc', BLI.Chunk (BSU.unsafeDrop rcInt c) cs) {- Using 'BSU.unsafeDrop' above is safe, assuming that 'System.Posix.IO.fdWriteBuf' never returns (rc < 0 || rc > BS.length c). If we are paranoid about that then we should do the following instead: go acc ccs = case ccs of BLI.Empty -> return (acc, ccs) BLI.Chunk c cs -> do rc <- PosixBS.fdWrite fd c let acc' = acc+rc in acc' `seq` do let rcInt = fromIntegral rc in rcInt `seq` do case BS.length c of len | rcInt == len -> go acc' cs | rcInt > len -> error _impossibleByteCount | rcInt < 0 -> error _negtiveByteCount | rcInt == 0 -> return (acc', ccs) -- trivial optimizing | otherwise -> return (acc', BLI.Chunk (BSU.unsafeDrop rcInt c) cs) _negtiveByteCount = "System.Posix.IO.fdWriteBuf: returned a negative byte count" _impossibleByteCount = "System.Posix.IO.fdWriteBuf: returned a byte count greater than the length it was given" -} ---------------------------------------------------------------- -- | Write a 'BL.ByteString' to an 'Fd'. This function makes a -- single @writev(2)@ system call, as per 'PosixBS.fdWritev'.
1,827
true
true
0
23
629
211
107
104
null
null
profan/mal
haskell/Core.hs
mpl-2.0
-- General functions equal_Q [a, b] = return $ if a == b then MalTrue else MalFalse
84
equal_Q [a, b] = return $ if a == b then MalTrue else MalFalse
62
equal_Q [a, b] = return $ if a == b then MalTrue else MalFalse
62
true
false
0
7
17
32
18
14
null
null
waterlink/hgo
Parser.hs
mit
literalValue :: Parser S.LiteralValue literalValue = try $ do elements <- L.braces $ L.commaSep element return $ S.LiteralValue elements where element = try $ do key <- option Nothing withKey value <- elementValue <|> elementExpr return $ S.LiteralElement key value elementValue = try $ do value <- literalValue return $ S.ValueLiteralValue value elementExpr = try $ do value <- expression return $ S.ValueExpr value withKey = fieldKey <|> literalKey <|> exprKey fieldKey = try $ do key <- L.identifier L.operator ":" return $ Just (S.FieldName key) literalKey = try $ do key <- literalValue L.operator ":" return $ Just (S.KeyLiteralValue key) exprKey = try $ do key <- expression L.operator ":" return $ Just (S.KeyExpr key)
862
literalValue :: Parser S.LiteralValue literalValue = try $ do elements <- L.braces $ L.commaSep element return $ S.LiteralValue elements where element = try $ do key <- option Nothing withKey value <- elementValue <|> elementExpr return $ S.LiteralElement key value elementValue = try $ do value <- literalValue return $ S.ValueLiteralValue value elementExpr = try $ do value <- expression return $ S.ValueExpr value withKey = fieldKey <|> literalKey <|> exprKey fieldKey = try $ do key <- L.identifier L.operator ":" return $ Just (S.FieldName key) literalKey = try $ do key <- literalValue L.operator ":" return $ Just (S.KeyLiteralValue key) exprKey = try $ do key <- expression L.operator ":" return $ Just (S.KeyExpr key)
862
literalValue = try $ do elements <- L.braces $ L.commaSep element return $ S.LiteralValue elements where element = try $ do key <- option Nothing withKey value <- elementValue <|> elementExpr return $ S.LiteralElement key value elementValue = try $ do value <- literalValue return $ S.ValueLiteralValue value elementExpr = try $ do value <- expression return $ S.ValueExpr value withKey = fieldKey <|> literalKey <|> exprKey fieldKey = try $ do key <- L.identifier L.operator ":" return $ Just (S.FieldName key) literalKey = try $ do key <- literalValue L.operator ":" return $ Just (S.KeyLiteralValue key) exprKey = try $ do key <- expression L.operator ":" return $ Just (S.KeyExpr key)
824
false
true
24
12
251
333
139
194
null
null
IreneKnapp/larp-base-two
Haskell/Larpbase/Migrate.hs
mit
createSeries :: SQL.Database -> UUID.UUID -> IO () createSeries database seriesID = do statement <- SQL.prepare database "INSERT INTO series (series_id) VALUES (?)" SQL.bindBlob statement 1 (BS.concat $ LBS.toChunks $ Binary.encode seriesID) let loop = do result <- SQL.step statement case result of SQL.Row -> loop SQL.Done -> return () loop SQL.finalize statement
415
createSeries :: SQL.Database -> UUID.UUID -> IO () createSeries database seriesID = do statement <- SQL.prepare database "INSERT INTO series (series_id) VALUES (?)" SQL.bindBlob statement 1 (BS.concat $ LBS.toChunks $ Binary.encode seriesID) let loop = do result <- SQL.step statement case result of SQL.Row -> loop SQL.Done -> return () loop SQL.finalize statement
415
createSeries database seriesID = do statement <- SQL.prepare database "INSERT INTO series (series_id) VALUES (?)" SQL.bindBlob statement 1 (BS.concat $ LBS.toChunks $ Binary.encode seriesID) let loop = do result <- SQL.step statement case result of SQL.Row -> loop SQL.Done -> return () loop SQL.finalize statement
364
false
true
0
16
102
139
63
76
null
null
romanb/amazonka
amazonka-lambda/gen/Network/AWS/Lambda/UpdateEventSourceMapping.hs
mpl-2.0
-- | The Lambda function to which you want the stream records sent. -- -- You can specify an unqualified function name (for example, "Thumbnail") or -- you can specify Amazon Resource Name (ARN) of the function (for example, -- "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also -- allows you to specify only the account ID qualifier (for example, -- "account-id:Thumbnail"). Note that the length constraint applies only to the -- ARN. If you specify only the function name, it is limited to 64 character in -- length. uesmFunctionName :: Lens' UpdateEventSourceMapping (Maybe Text) uesmFunctionName = lens _uesmFunctionName (\s a -> s { _uesmFunctionName = a })
686
uesmFunctionName :: Lens' UpdateEventSourceMapping (Maybe Text) uesmFunctionName = lens _uesmFunctionName (\s a -> s { _uesmFunctionName = a })
143
uesmFunctionName = lens _uesmFunctionName (\s a -> s { _uesmFunctionName = a })
79
true
true
0
9
103
54
33
21
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/GT_5.hs
mit
primCmpNat (Succ x) (Succ y) = primCmpNat x y
45
primCmpNat (Succ x) (Succ y) = primCmpNat x y
45
primCmpNat (Succ x) (Succ y) = primCmpNat x y
45
false
false
0
6
8
30
13
17
null
null
ltcmelo/psychec
formalism/muC.hs
bsd-3-clause
isScaTy _ = error $ "expected scalar type"
42
isScaTy _ = error $ "expected scalar type"
42
isScaTy _ = error $ "expected scalar type"
42
false
false
0
5
7
13
6
7
null
null
kelnage/tamarin-prover
lib/term/src/Term/Builtin/Convenience.hs
gpl-3.0
px2 = pubVar "px" 2
20
px2 = pubVar "px" 2
20
px2 = pubVar "px" 2
20
false
false
1
5
5
14
5
9
null
null
ezyang/ghc
compiler/basicTypes/MkId.hs
bsd-3-clause
realWorldPrimId :: Id -- :: State# RealWorld realWorldPrimId = pcMiscPrelId realWorldName realWorldStatePrimTy (noCafIdInfo `setUnfoldingInfo` evaldUnfolding -- Note [evaldUnfoldings] `setOneShotInfo` stateHackOneShot `setNeverLevPoly` realWorldStatePrimTy)
351
realWorldPrimId :: Id realWorldPrimId = pcMiscPrelId realWorldName realWorldStatePrimTy (noCafIdInfo `setUnfoldingInfo` evaldUnfolding -- Note [evaldUnfoldings] `setOneShotInfo` stateHackOneShot `setNeverLevPoly` realWorldStatePrimTy)
326
realWorldPrimId = pcMiscPrelId realWorldName realWorldStatePrimTy (noCafIdInfo `setUnfoldingInfo` evaldUnfolding -- Note [evaldUnfoldings] `setOneShotInfo` stateHackOneShot `setNeverLevPoly` realWorldStatePrimTy)
304
true
true
0
9
115
41
25
16
null
null
mankyKitty/leesp
src/Main.hs
mit
eval env (List (Atom "lambda" : varargs@(Atom _) : body)) = makeVarargs varargs env [] body
93
eval env (List (Atom "lambda" : varargs@(Atom _) : body)) = makeVarargs varargs env [] body
93
eval env (List (Atom "lambda" : varargs@(Atom _) : body)) = makeVarargs varargs env [] body
93
false
false
0
12
17
56
25
31
null
null
jvanburen/slither
app/Main.hs
bsd-3-clause
checkadjlines gs box = do putStr "Box: " print box let Adj{up, down, left, right} = Slither.boxIncidentLines box putStr $ show up ++ ": " print $ (Slither.lines gs) M.! up putStr $ show down ++ ": " print $ (Slither.lines gs) M.! down putStr $ show left ++ ": " print $ (Slither.lines gs) M.! left putStr $ show right ++ ": " print $ (Slither.lines gs) M.! right
406
checkadjlines gs box = do putStr "Box: " print box let Adj{up, down, left, right} = Slither.boxIncidentLines box putStr $ show up ++ ": " print $ (Slither.lines gs) M.! up putStr $ show down ++ ": " print $ (Slither.lines gs) M.! down putStr $ show left ++ ": " print $ (Slither.lines gs) M.! left putStr $ show right ++ ": " print $ (Slither.lines gs) M.! right
406
checkadjlines gs box = do putStr "Box: " print box let Adj{up, down, left, right} = Slither.boxIncidentLines box putStr $ show up ++ ": " print $ (Slither.lines gs) M.! up putStr $ show down ++ ": " print $ (Slither.lines gs) M.! down putStr $ show left ++ ": " print $ (Slither.lines gs) M.! left putStr $ show right ++ ": " print $ (Slither.lines gs) M.! right
406
false
false
0
11
113
193
88
105
null
null
jsnajder/clustering
src/Clustering/Hierarchical.hs
bsd-3-clause
initDistM :: Monad m => Clusters a -> DistMeasureM m a -> m Distances initDistM cs dm = do dl <- mapM calcDist [(i,j) | i <- [1..n-1], j <- [0..i-1]] return $ sortBy (comparing snd) dl where n = M.size cs calcDist ij@(i,j) = do let Just (_, Item ei) = M.lookup i cs Just (_, Item ej) = M.lookup j cs d <- dm ei ej return (ij,d) -- | Returns the size of a specified cluster.
432
initDistM :: Monad m => Clusters a -> DistMeasureM m a -> m Distances initDistM cs dm = do dl <- mapM calcDist [(i,j) | i <- [1..n-1], j <- [0..i-1]] return $ sortBy (comparing snd) dl where n = M.size cs calcDist ij@(i,j) = do let Just (_, Item ei) = M.lookup i cs Just (_, Item ej) = M.lookup j cs d <- dm ei ej return (ij,d) -- | Returns the size of a specified cluster.
432
initDistM cs dm = do dl <- mapM calcDist [(i,j) | i <- [1..n-1], j <- [0..i-1]] return $ sortBy (comparing snd) dl where n = M.size cs calcDist ij@(i,j) = do let Just (_, Item ei) = M.lookup i cs Just (_, Item ej) = M.lookup j cs d <- dm ei ej return (ij,d) -- | Returns the size of a specified cluster.
362
false
true
1
13
137
225
109
116
null
null
k0001/reflex
src/Reflex/Dynamic.hs
bsd-3-clause
count :: (Reflex t, MonadHold t m, MonadFix m, Num b) => Event t a -> m (Dynamic t b) count e = holdDyn 0 =<< zipListWithEvent const (iterate (+1) 1) e
151
count :: (Reflex t, MonadHold t m, MonadFix m, Num b) => Event t a -> m (Dynamic t b) count e = holdDyn 0 =<< zipListWithEvent const (iterate (+1) 1) e
151
count e = holdDyn 0 =<< zipListWithEvent const (iterate (+1) 1) e
65
false
true
0
9
31
89
44
45
null
null
divipp/lgtk
lgtkdemo/LGtk/ADTEditor.hs
bsd-3-clause
adtEditor :: (ADTLens a) => Ref a -> RefCreator Widget adtEditor = memoise . editor where editor r = do q <- extendRef r k (0, ls) es <- mkEditors ls $ _2 `lensMap` q horizontally [ combobox (map fst ss) $ _1 `lensMap` q , cell (readRef q <&> fst) $ \i -> vertically [es !! j | j <- snd $ ss !! i] ] where (ss, ls, Lens_ k) = adtLens mkEditors :: Elems xs -> Ref (Elems xs) -> RefCreator [Widget] mkEditors ElemsNil _ = pure [] mkEditors (ElemsCons _ xs) r = do i <- adtEditor $ lHead `lensMap` r is <- mkEditors xs $ lTail `lensMap` r pure $ i : is where lHead :: Lens' (Elems (Cons x xs)) x lHead = lens get set where get :: Elems (Cons x xs) -> x get (ElemsCons a _) = a set :: Elems (Cons x xs) -> x -> Elems (Cons x xs) set (ElemsCons _ as) a = ElemsCons a as lTail :: Lens' (Elems (Cons x xs)) (Elems xs) lTail = lens get set where get :: Elems (Cons x xs) -> Elems xs get (ElemsCons _ as) = as set :: Elems (Cons x xs) -> Elems xs -> Elems (Cons x xs) set (ElemsCons a _) as = ElemsCons a as
1,250
adtEditor :: (ADTLens a) => Ref a -> RefCreator Widget adtEditor = memoise . editor where editor r = do q <- extendRef r k (0, ls) es <- mkEditors ls $ _2 `lensMap` q horizontally [ combobox (map fst ss) $ _1 `lensMap` q , cell (readRef q <&> fst) $ \i -> vertically [es !! j | j <- snd $ ss !! i] ] where (ss, ls, Lens_ k) = adtLens mkEditors :: Elems xs -> Ref (Elems xs) -> RefCreator [Widget] mkEditors ElemsNil _ = pure [] mkEditors (ElemsCons _ xs) r = do i <- adtEditor $ lHead `lensMap` r is <- mkEditors xs $ lTail `lensMap` r pure $ i : is where lHead :: Lens' (Elems (Cons x xs)) x lHead = lens get set where get :: Elems (Cons x xs) -> x get (ElemsCons a _) = a set :: Elems (Cons x xs) -> x -> Elems (Cons x xs) set (ElemsCons _ as) a = ElemsCons a as lTail :: Lens' (Elems (Cons x xs)) (Elems xs) lTail = lens get set where get :: Elems (Cons x xs) -> Elems xs get (ElemsCons _ as) = as set :: Elems (Cons x xs) -> Elems xs -> Elems (Cons x xs) set (ElemsCons a _) as = ElemsCons a as
1,250
adtEditor = memoise . editor where editor r = do q <- extendRef r k (0, ls) es <- mkEditors ls $ _2 `lensMap` q horizontally [ combobox (map fst ss) $ _1 `lensMap` q , cell (readRef q <&> fst) $ \i -> vertically [es !! j | j <- snd $ ss !! i] ] where (ss, ls, Lens_ k) = adtLens mkEditors :: Elems xs -> Ref (Elems xs) -> RefCreator [Widget] mkEditors ElemsNil _ = pure [] mkEditors (ElemsCons _ xs) r = do i <- adtEditor $ lHead `lensMap` r is <- mkEditors xs $ lTail `lensMap` r pure $ i : is where lHead :: Lens' (Elems (Cons x xs)) x lHead = lens get set where get :: Elems (Cons x xs) -> x get (ElemsCons a _) = a set :: Elems (Cons x xs) -> x -> Elems (Cons x xs) set (ElemsCons _ as) a = ElemsCons a as lTail :: Lens' (Elems (Cons x xs)) (Elems xs) lTail = lens get set where get :: Elems (Cons x xs) -> Elems xs get (ElemsCons _ as) = as set :: Elems (Cons x xs) -> Elems xs -> Elems (Cons x xs) set (ElemsCons a _) as = ElemsCons a as
1,195
false
true
4
16
473
607
289
318
null
null
ksaveljev/hake-2
src/Constants.hs
bsd-3-clause
psMVelocity = 1 `shiftL` 2 :: Int
36
psMVelocity = 1 `shiftL` 2 :: Int
36
psMVelocity = 1 `shiftL` 2 :: Int
36
false
false
0
5
9
15
9
6
null
null
JoeLoser/CS4450-Principles-of-Programming
homeworks/hw5/hw5_sdk/ImpInterp.hs
mit
bool (IsLTE e1 e2) r s = exp e1 r s <= exp e2 r s
49
bool (IsLTE e1 e2) r s = exp e1 r s <= exp e2 r s
49
bool (IsLTE e1 e2) r s = exp e1 r s <= exp e2 r s
49
false
false
1
8
15
41
18
23
null
null
karianna/jdk8_tl
jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
gpl-2.0
ffitype _ Nushort = UINT16
26
ffitype _ Nushort = UINT16
26
ffitype _ Nushort = UINT16
26
false
false
1
5
4
13
5
8
null
null
Fuuzetsu/yi-emacs-colours
src/Yi/Style/EmacsColours.hs
gpl-2.0
-- | Names: @["pink2"]@ -- -- R238 G169 B184, 0xeea9b8 pink2 :: Color pink2 = RGB 238 169 184
93
pink2 :: Color pink2 = RGB 238 169 184
38
pink2 = RGB 238 169 184
23
true
true
0
6
18
27
13
14
null
null
rueshyna/gogol
gogol-compute/gen/Network/Google/Resource/Compute/InstanceTemplates/List.hs
mpl-2.0
-- | Project ID for this request. itlProject :: Lens' InstanceTemplatesList Text itlProject = lens _itlProject (\ s a -> s{_itlProject = a})
142
itlProject :: Lens' InstanceTemplatesList Text itlProject = lens _itlProject (\ s a -> s{_itlProject = a})
108
itlProject = lens _itlProject (\ s a -> s{_itlProject = a})
61
true
true
0
9
24
42
22
20
null
null
fumieval/combinator-interactive
Data/Combinator.hs
bsd-3-clause
apply (K :$ x) y = x
20
apply (K :$ x) y = x
20
apply (K :$ x) y = x
20
false
false
1
6
6
23
9
14
null
null
phylake/avm3
util/Misc.hs
mit
t53 (_,_,a,_,_) = a
19
t53 (_,_,a,_,_) = a
19
t53 (_,_,a,_,_) = a
19
false
false
0
6
3
24
14
10
null
null
owst/Penrose
mtbdd/src/MTBDD/IntIntMap.hs
bsd-3-clause
insert :: (Int, Int) -> v -> IntIntMap v -> IntIntMap v insert (i, j) v (IntIntMap mm) = case M.lookup i mm of Nothing -> IntIntMap $ M.insert i (M.singleton j v) mm Just m -> IntIntMap $ M.insert i (M.insert j v m) mm
226
insert :: (Int, Int) -> v -> IntIntMap v -> IntIntMap v insert (i, j) v (IntIntMap mm) = case M.lookup i mm of Nothing -> IntIntMap $ M.insert i (M.singleton j v) mm Just m -> IntIntMap $ M.insert i (M.insert j v m) mm
226
insert (i, j) v (IntIntMap mm) = case M.lookup i mm of Nothing -> IntIntMap $ M.insert i (M.singleton j v) mm Just m -> IntIntMap $ M.insert i (M.insert j v m) mm
170
false
true
0
12
53
132
64
68
null
null
keithodulaigh/Hets
Static/CheckGlobalContext.hs
gpl-2.0
checkG_theory :: G_theory -> DGraph -> State Statistics () checkG_theory g@(G_theory _ _ _ si _ ti) dgraph = do if si == startSigId then modify incrZeroSign else case lookupSigMapDG si dgraph of Nothing -> error "checkG_theory: Sign" Just signErg -> modify $ if signOf g /= signErg then incrWrongSign else incrRightSign if ti == startThId then modify incrZeroG_theory else case lookupThMapDG ti dgraph of Nothing -> error "checkG_theory: Theory" Just thErg -> modify $ if g /= thErg then incrWrongG_theory else incrRightG_theory
640
checkG_theory :: G_theory -> DGraph -> State Statistics () checkG_theory g@(G_theory _ _ _ si _ ti) dgraph = do if si == startSigId then modify incrZeroSign else case lookupSigMapDG si dgraph of Nothing -> error "checkG_theory: Sign" Just signErg -> modify $ if signOf g /= signErg then incrWrongSign else incrRightSign if ti == startThId then modify incrZeroG_theory else case lookupThMapDG ti dgraph of Nothing -> error "checkG_theory: Theory" Just thErg -> modify $ if g /= thErg then incrWrongG_theory else incrRightG_theory
640
checkG_theory g@(G_theory _ _ _ si _ ti) dgraph = do if si == startSigId then modify incrZeroSign else case lookupSigMapDG si dgraph of Nothing -> error "checkG_theory: Sign" Just signErg -> modify $ if signOf g /= signErg then incrWrongSign else incrRightSign if ti == startThId then modify incrZeroG_theory else case lookupThMapDG ti dgraph of Nothing -> error "checkG_theory: Theory" Just thErg -> modify $ if g /= thErg then incrWrongG_theory else incrRightG_theory
581
false
true
1
15
194
184
87
97
null
null
da-x/lamdu
Lamdu/Expr/IRef.hs
gpl-3.0
defI :: V.Var -> DefI m defI (V.Var (Identifier bs)) = IRef.unsafeFromUUID $ UUIDUtils.fromSBS16 bs
99
defI :: V.Var -> DefI m defI (V.Var (Identifier bs)) = IRef.unsafeFromUUID $ UUIDUtils.fromSBS16 bs
99
defI (V.Var (Identifier bs)) = IRef.unsafeFromUUID $ UUIDUtils.fromSBS16 bs
75
false
true
0
8
14
52
24
28
null
null
fmapfmapfmap/amazonka
amazonka-ec2/test/Test/AWS/Gen/EC2.hs
mpl-2.0
testRebootInstances :: RebootInstances -> TestTree testRebootInstances = req "RebootInstances" "fixture/RebootInstances.yaml"
133
testRebootInstances :: RebootInstances -> TestTree testRebootInstances = req "RebootInstances" "fixture/RebootInstances.yaml"
133
testRebootInstances = req "RebootInstances" "fixture/RebootInstances.yaml"
82
false
true
0
5
17
20
10
10
null
null
banacorn/mini-pascal
src/Compiler/Semantics.hs
mit
-------------------------------------------------------------------------------- -- Type Checking typeCheck :: ABT -> [TypeError] typeCheck abt = extractSecond abt >>= typeCheckStatement
187
typeCheck :: ABT -> [TypeError] typeCheck abt = extractSecond abt >>= typeCheckStatement
88
typeCheck abt = extractSecond abt >>= typeCheckStatement
56
true
true
0
8
16
36
17
19
null
null
Shimuuar/protobuf
Data/Protobuf/Serialize/Protobuf.hs
bsd-3-clause
putPbString :: Text -> Put putPbString str = do let bs = encodeUtf8 str putVarInt (BS.length bs) putByteString bs -- | Get PB encoded bytestring
151
putPbString :: Text -> Put putPbString str = do let bs = encodeUtf8 str putVarInt (BS.length bs) putByteString bs -- | Get PB encoded bytestring
151
putPbString str = do let bs = encodeUtf8 str putVarInt (BS.length bs) putByteString bs -- | Get PB encoded bytestring
124
false
true
0
11
31
57
24
33
null
null
Concelo/concelo
src/Database/Concelo/Rules.hs
bsd-3-clause
contextDependencies = L.lens getContextDependencies (\x v -> x { getContextDependencies = v })
96
contextDependencies = L.lens getContextDependencies (\x v -> x { getContextDependencies = v })
96
contextDependencies = L.lens getContextDependencies (\x v -> x { getContextDependencies = v })
96
false
false
0
9
14
31
17
14
null
null
ozgurakgun/Idris-dev
src/IRTS/System.hs
bsd-3-clause
extraLib = ["-L/usr/local/lib"]
31
extraLib = ["-L/usr/local/lib"]
31
extraLib = ["-L/usr/local/lib"]
31
false
false
1
5
2
12
5
7
null
null
dorchard/camfort
src/Camfort/Specification/Stencils/Model.hs
apache-2.0
approxInterv IntervInfiniteArbitrary = Exact IntervInfinite
59
approxInterv IntervInfiniteArbitrary = Exact IntervInfinite
59
approxInterv IntervInfiniteArbitrary = Exact IntervInfinite
59
false
false
0
5
4
12
5
7
null
null
olsner/ghc
compiler/ghci/ByteCodeAsm.hs
bsd-3-clause
runAsm :: DynFlags -> Bool -> LabelEnv -> Assembler a -> StateT AsmState IO a runAsm dflags long_jumps e = go where go (NullAsm x) = return x go (AllocPtr p_io k) = do p <- lift p_io w <- state $ \(st_i0,st_l0,st_p0) -> let st_p1 = addToSS st_p0 p in (sizeSS st_p0, (st_i0,st_l0,st_p1)) go $ k w go (AllocLit lits k) = do w <- state $ \(st_i0,st_l0,st_p0) -> let st_l1 = addListToSS st_l0 lits in (sizeSS st_l0, (st_i0,st_l1,st_p0)) go $ k w go (AllocLabel _ k) = go k go (Emit w ops k) = do let largeOps = any (largeOp long_jumps) ops opcode | largeOps = largeArgInstr w | otherwise = w words = concatMap expand ops expand (SmallOp w) = [w] expand (LabelOp w) = expand (Op (e w)) expand (Op w) = if largeOps then largeArg dflags w else [fromIntegral w] -- expand (LargeOp w) = largeArg dflags w state $ \(st_i0,st_l0,st_p0) -> let st_i1 = addListToSS st_i0 (opcode : words) in ((), (st_i1,st_l0,st_p0)) go k
1,107
runAsm :: DynFlags -> Bool -> LabelEnv -> Assembler a -> StateT AsmState IO a runAsm dflags long_jumps e = go where go (NullAsm x) = return x go (AllocPtr p_io k) = do p <- lift p_io w <- state $ \(st_i0,st_l0,st_p0) -> let st_p1 = addToSS st_p0 p in (sizeSS st_p0, (st_i0,st_l0,st_p1)) go $ k w go (AllocLit lits k) = do w <- state $ \(st_i0,st_l0,st_p0) -> let st_l1 = addListToSS st_l0 lits in (sizeSS st_l0, (st_i0,st_l1,st_p0)) go $ k w go (AllocLabel _ k) = go k go (Emit w ops k) = do let largeOps = any (largeOp long_jumps) ops opcode | largeOps = largeArgInstr w | otherwise = w words = concatMap expand ops expand (SmallOp w) = [w] expand (LabelOp w) = expand (Op (e w)) expand (Op w) = if largeOps then largeArg dflags w else [fromIntegral w] -- expand (LargeOp w) = largeArg dflags w state $ \(st_i0,st_l0,st_p0) -> let st_i1 = addListToSS st_i0 (opcode : words) in ((), (st_i1,st_l0,st_p0)) go k
1,107
runAsm dflags long_jumps e = go where go (NullAsm x) = return x go (AllocPtr p_io k) = do p <- lift p_io w <- state $ \(st_i0,st_l0,st_p0) -> let st_p1 = addToSS st_p0 p in (sizeSS st_p0, (st_i0,st_l0,st_p1)) go $ k w go (AllocLit lits k) = do w <- state $ \(st_i0,st_l0,st_p0) -> let st_l1 = addListToSS st_l0 lits in (sizeSS st_l0, (st_i0,st_l1,st_p0)) go $ k w go (AllocLabel _ k) = go k go (Emit w ops k) = do let largeOps = any (largeOp long_jumps) ops opcode | largeOps = largeArgInstr w | otherwise = w words = concatMap expand ops expand (SmallOp w) = [w] expand (LabelOp w) = expand (Op (e w)) expand (Op w) = if largeOps then largeArg dflags w else [fromIntegral w] -- expand (LargeOp w) = largeArg dflags w state $ \(st_i0,st_l0,st_p0) -> let st_i1 = addListToSS st_i0 (opcode : words) in ((), (st_i1,st_l0,st_p0)) go k
1,029
false
true
4
34
369
478
241
237
null
null
oqc/hqt
Quran/QLines.hs
gpl-3.0
defaultBrkToText :: Int -> Text defaultBrkToText brk = case brk of 0 -> " " 1 -> "\\br " 2 -> "\\bbr " _ -> "\\bbr " -- | Enrich a QTF text with refs and QPF-specified paragraphing into a QLF (LaTeX'ish) output
316
defaultBrkToText :: Int -> Text defaultBrkToText brk = case brk of 0 -> " " 1 -> "\\br " 2 -> "\\bbr " _ -> "\\bbr " -- | Enrich a QTF text with refs and QPF-specified paragraphing into a QLF (LaTeX'ish) output
316
defaultBrkToText brk = case brk of 0 -> " " 1 -> "\\br " 2 -> "\\bbr " _ -> "\\bbr " -- | Enrich a QTF text with refs and QPF-specified paragraphing into a QLF (LaTeX'ish) output
284
false
true
0
8
148
53
25
28
null
null
DavidRutqvist/ParserOperators-D7012E-Lab2
src/Parser.hs
bsd-3-clause
number' :: Integer -> Parser Integer number' n = digitVal #> (\ d -> number' (10*n+d)) ! return n
107
number' :: Integer -> Parser Integer number' n = digitVal #> (\ d -> number' (10*n+d)) ! return n
107
number' n = digitVal #> (\ d -> number' (10*n+d)) ! return n
70
false
true
0
12
28
54
27
27
null
null
ceefour/atomspace
examples/haskell/example_multithreading.hs
agpl-3.0
loop :: Int -> AtomSpace () loop idNum = do liftIO $ putStrLn $ "Thread " ++ show idNum waitRandom concept1 <- randomConcept 6 remove concept1 concept2 <- randomConcept 6 insert concept2 concept3 <- randomConcept 6 get concept3 waitRandom list1 <- randomList 3 6 res <- get list1 case res of Nothing -> liftIO $ putStrLn "Got: Nothing" Just l -> liftIO $ putStrLn "Got:" >> printAtom l list2 <- randomList 3 6 insert list2 list3 <- randomList 3 6 remove list3 if idNum == 1 then do liftIO $ threadDelay 5000000 liftIO $ putStrLn $ replicate 70 '#' debug else return () loop idNum where waitRandom :: AtomSpace () waitRandom = do n <- liftIO $ randomRIO (0,100000) liftIO $ threadDelay n
848
loop :: Int -> AtomSpace () loop idNum = do liftIO $ putStrLn $ "Thread " ++ show idNum waitRandom concept1 <- randomConcept 6 remove concept1 concept2 <- randomConcept 6 insert concept2 concept3 <- randomConcept 6 get concept3 waitRandom list1 <- randomList 3 6 res <- get list1 case res of Nothing -> liftIO $ putStrLn "Got: Nothing" Just l -> liftIO $ putStrLn "Got:" >> printAtom l list2 <- randomList 3 6 insert list2 list3 <- randomList 3 6 remove list3 if idNum == 1 then do liftIO $ threadDelay 5000000 liftIO $ putStrLn $ replicate 70 '#' debug else return () loop idNum where waitRandom :: AtomSpace () waitRandom = do n <- liftIO $ randomRIO (0,100000) liftIO $ threadDelay n
848
loop idNum = do liftIO $ putStrLn $ "Thread " ++ show idNum waitRandom concept1 <- randomConcept 6 remove concept1 concept2 <- randomConcept 6 insert concept2 concept3 <- randomConcept 6 get concept3 waitRandom list1 <- randomList 3 6 res <- get list1 case res of Nothing -> liftIO $ putStrLn "Got: Nothing" Just l -> liftIO $ putStrLn "Got:" >> printAtom l list2 <- randomList 3 6 insert list2 list3 <- randomList 3 6 remove list3 if idNum == 1 then do liftIO $ threadDelay 5000000 liftIO $ putStrLn $ replicate 70 '#' debug else return () loop idNum where waitRandom :: AtomSpace () waitRandom = do n <- liftIO $ randomRIO (0,100000) liftIO $ threadDelay n
820
false
true
0
12
284
300
128
172
null
null
brendanhay/gogol
gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs
mpl-2.0
-- | The requested values with the list of data filters that matched them. bgvbdfrValueRanges :: Lens' BatchGetValuesByDataFilterResponse [MatchedValueRange] bgvbdfrValueRanges = lens _bgvbdfrValueRanges (\ s a -> s{_bgvbdfrValueRanges = a}) . _Default . _Coerce
282
bgvbdfrValueRanges :: Lens' BatchGetValuesByDataFilterResponse [MatchedValueRange] bgvbdfrValueRanges = lens _bgvbdfrValueRanges (\ s a -> s{_bgvbdfrValueRanges = a}) . _Default . _Coerce
207
bgvbdfrValueRanges = lens _bgvbdfrValueRanges (\ s a -> s{_bgvbdfrValueRanges = a}) . _Default . _Coerce
124
true
true
3
8
53
59
28
31
null
null
termite2/tsl
Frontend/NS.hs
bsd-3-clause
lookupTypeDecl s@(ScopeTemplate _) [n] = case lookupTypeLocal s n of Nothing -> fmap (,ScopeTop) $ lookupTypeLocal ScopeTop n Just t -> Just (t, s)
240
lookupTypeDecl s@(ScopeTemplate _) [n] = case lookupTypeLocal s n of Nothing -> fmap (,ScopeTop) $ lookupTypeLocal ScopeTop n Just t -> Just (t, s)
240
lookupTypeDecl s@(ScopeTemplate _) [n] = case lookupTypeLocal s n of Nothing -> fmap (,ScopeTop) $ lookupTypeLocal ScopeTop n Just t -> Just (t, s)
240
false
false
0
10
116
72
36
36
null
null
zakharvoit/haskell-homework
Base.hs
gpl-3.0
piFloat :: Float piFloat = P.pi
31
piFloat :: Float piFloat = P.pi
31
piFloat = P.pi
14
false
true
0
6
5
20
8
12
null
null
kawu/crf-chain2-tiers
src/Data/CRF/Chain2/Tiers/DAG/Inference.hs
bsd-2-clause
--------------------------------------------- -- NEW STUFF --------------------------------------------- -- | A version of `tag` which should be, roughly, twice as efficient, since it -- only performs one `forward` and no `backward` computation. The downside is -- that probabilities cannot be retrieved. fastTag :: Md.Model -> DAG a X -> DAG a (Maybe CbIx) fastTag crf dag = DAG.mapE label dag where label edgeID _ = M.lookup edgeID selSet alpha = forward' argmax crf dag selSet = rewind' alpha -- | Similar to `fastTag` but directly returns complex labels and not just -- their `CbIx` indexes.
616
fastTag :: Md.Model -> DAG a X -> DAG a (Maybe CbIx) fastTag crf dag = DAG.mapE label dag where label edgeID _ = M.lookup edgeID selSet alpha = forward' argmax crf dag selSet = rewind' alpha -- | Similar to `fastTag` but directly returns complex labels and not just -- their `CbIx` indexes.
308
fastTag crf dag = DAG.mapE label dag where label edgeID _ = M.lookup edgeID selSet alpha = forward' argmax crf dag selSet = rewind' alpha -- | Similar to `fastTag` but directly returns complex labels and not just -- their `CbIx` indexes.
255
true
true
1
10
112
110
51
59
null
null
yakovs83/Hakerrank-problems
src/Palindrome.hs
mit
main = do arg<-getLine if arg == "" then return () else do print . recP3 $ arg print . recP2 $ arg print . recP $ arg
186
main = do arg<-getLine if arg == "" then return () else do print . recP3 $ arg print . recP2 $ arg print . recP $ arg
186
main = do arg<-getLine if arg == "" then return () else do print . recP3 $ arg print . recP2 $ arg print . recP $ arg
186
false
false
1
11
96
70
31
39
null
null
apyrgio/ganeti
test/hs/Test/Ganeti/OpCodes.hs
bsd-2-clause
-- | Generates list of disk indices. genDiskIndices :: Gen [DiskIndex] genDiskIndices = do cnt <- choose (0, C.maxDisks) genUniquesList cnt arbitrary -- | Generates a list of node names.
191
genDiskIndices :: Gen [DiskIndex] genDiskIndices = do cnt <- choose (0, C.maxDisks) genUniquesList cnt arbitrary -- | Generates a list of node names.
154
genDiskIndices = do cnt <- choose (0, C.maxDisks) genUniquesList cnt arbitrary -- | Generates a list of node names.
120
true
true
0
10
34
45
23
22
null
null
ksaveljev/hake-2
src/Game/Monsters/MTank.hs
bsd-3-clause
tankWalk :: EntThink tankWalk = GenericEntThink "tank_walk" $ \selfRef -> do modifyRef selfRef (\v -> v & eMonsterInfo.miCurrentMove .~ Just tankMoveWalk) return True
176
tankWalk :: EntThink tankWalk = GenericEntThink "tank_walk" $ \selfRef -> do modifyRef selfRef (\v -> v & eMonsterInfo.miCurrentMove .~ Just tankMoveWalk) return True
176
tankWalk = GenericEntThink "tank_walk" $ \selfRef -> do modifyRef selfRef (\v -> v & eMonsterInfo.miCurrentMove .~ Just tankMoveWalk) return True
155
false
true
0
14
32
58
28
30
null
null
rahulmutt/ghcvm
compiler/Eta/Utils/UniqFM.hs
bsd-3-clause
anyUFM :: (elt -> Bool) -> UniqFM elt -> Bool anyUFM p (UFM m) = M.foldr ((||) . p) False m
91
anyUFM :: (elt -> Bool) -> UniqFM elt -> Bool anyUFM p (UFM m) = M.foldr ((||) . p) False m
91
anyUFM p (UFM m) = M.foldr ((||) . p) False m
45
false
true
0
7
20
63
31
32
null
null
giorgidze/HCodecs
src/Codec/ByteString/Builder.hs
bsd-3-clause
putWord32be :: Word32 -> Builder putWord32be w = writeN 4 $ \p -> do poke p (fromIntegral (shiftR w 24) :: Word8) poke (p `plusPtr` 1) (fromIntegral (shiftR w 16) :: Word8) poke (p `plusPtr` 2) (fromIntegral (shiftR w 8) :: Word8) poke (p `plusPtr` 3) (fromIntegral (w) :: Word8) -- -- a data type to tag Put/Check. writes construct these which are then -- inlined and flattened. matching Checks will be more robust with rules. -- -- | Write a Word32 in little endian format
517
putWord32be :: Word32 -> Builder putWord32be w = writeN 4 $ \p -> do poke p (fromIntegral (shiftR w 24) :: Word8) poke (p `plusPtr` 1) (fromIntegral (shiftR w 16) :: Word8) poke (p `plusPtr` 2) (fromIntegral (shiftR w 8) :: Word8) poke (p `plusPtr` 3) (fromIntegral (w) :: Word8) -- -- a data type to tag Put/Check. writes construct these which are then -- inlined and flattened. matching Checks will be more robust with rules. -- -- | Write a Word32 in little endian format
517
putWord32be w = writeN 4 $ \p -> do poke p (fromIntegral (shiftR w 24) :: Word8) poke (p `plusPtr` 1) (fromIntegral (shiftR w 16) :: Word8) poke (p `plusPtr` 2) (fromIntegral (shiftR w 8) :: Word8) poke (p `plusPtr` 3) (fromIntegral (w) :: Word8) -- -- a data type to tag Put/Check. writes construct these which are then -- inlined and flattened. matching Checks will be more robust with rules. -- -- | Write a Word32 in little endian format
484
false
true
0
14
128
163
85
78
null
null
frontrowed/wai
warp/Network/Wai/Handler/Warp/Counter.hs
mit
newCounter :: IO Counter newCounter = Counter <$> newTVarIO 0
61
newCounter :: IO Counter newCounter = Counter <$> newTVarIO 0
61
newCounter = Counter <$> newTVarIO 0
36
false
true
0
6
9
21
10
11
null
null
rbermani/ib-api
src/IB/Client/Parser.hs
gpl-3.0
pTickString :: Int -> Int -> Parser IBMessage pTickString _ _ = TickString <$> pStrInt <*> pStrInt <*> pStr <?> "Tick String"
146
pTickString :: Int -> Int -> Parser IBMessage pTickString _ _ = TickString <$> pStrInt <*> pStrInt <*> pStr <?> "Tick String"
145
pTickString _ _ = TickString <$> pStrInt <*> pStrInt <*> pStr <?> "Tick String"
99
false
true
8
8
42
55
26
29
null
null
poxu/pandoc
src/Text/Pandoc/Readers/Docx.hs
gpl-2.0
makeHeaderAnchor' :: Block -> DocxContext Block -- If there is an anchor already there (an anchor span in the header, -- to be exact), we rename and associate the new id with the old one. makeHeaderAnchor' (Header n (_, classes, kvs) ils) | (c:cs) <- filter isAnchorSpan ils , (Span (ident, ["anchor"], _) _) <- c = do hdrIDMap <- gets docxAnchorMap let newIdent = uniqueIdent ils (M.elems hdrIDMap) modify $ \s -> s {docxAnchorMap = M.insert ident newIdent hdrIDMap} return $ Header n (newIdent, classes, kvs) (ils \\ (c:cs)) -- Otherwise we just give it a name, and register that name (associate -- it with itself.)
637
makeHeaderAnchor' :: Block -> DocxContext Block makeHeaderAnchor' (Header n (_, classes, kvs) ils) | (c:cs) <- filter isAnchorSpan ils , (Span (ident, ["anchor"], _) _) <- c = do hdrIDMap <- gets docxAnchorMap let newIdent = uniqueIdent ils (M.elems hdrIDMap) modify $ \s -> s {docxAnchorMap = M.insert ident newIdent hdrIDMap} return $ Header n (newIdent, classes, kvs) (ils \\ (c:cs)) -- Otherwise we just give it a name, and register that name (associate -- it with itself.)
497
makeHeaderAnchor' (Header n (_, classes, kvs) ils) | (c:cs) <- filter isAnchorSpan ils , (Span (ident, ["anchor"], _) _) <- c = do hdrIDMap <- gets docxAnchorMap let newIdent = uniqueIdent ils (M.elems hdrIDMap) modify $ \s -> s {docxAnchorMap = M.insert ident newIdent hdrIDMap} return $ Header n (newIdent, classes, kvs) (ils \\ (c:cs)) -- Otherwise we just give it a name, and register that name (associate -- it with itself.)
449
true
true
0
14
126
192
100
92
null
null
mk12/luminosity
src/Luminosity/Vector.hs
mit
-- | Vector subtraction. Subtract one vector from another component-wise. (<->) :: Num a => VectorT a -> VectorT a -> VectorT a (<->) = (<*>) . fmap (-)
152
(<->) :: Num a => VectorT a -> VectorT a -> VectorT a (<->) = (<*>) . fmap (-)
78
(<->) = (<*>) . fmap (-)
24
true
true
0
8
28
51
28
23
null
null
Axure/Earley
examples/Mixfix.hs
bsd-3-clause
pretty (App e es) = "(" ++ pretty e ++ " " ++ unwords (map pretty es) ++ ")"
76
pretty (App e es) = "(" ++ pretty e ++ " " ++ unwords (map pretty es) ++ ")"
76
pretty (App e es) = "(" ++ pretty e ++ " " ++ unwords (map pretty es) ++ ")"
76
false
false
0
9
18
47
22
25
null
null
dimara/ganeti
src/Ganeti/Utils.hs
bsd-2-clause
setOwnerAndGroupFromNames :: FilePath -> GanetiDaemon -> GanetiGroup -> IO () setOwnerAndGroupFromNames filename daemon dGroup = do -- TODO: it would be nice to rework this (or getEnts) so that runtimeEnts -- is read only once per daemon startup, and then cached for further usage. runtimeEnts <- runResultT getEnts ents <- exitIfBad "Can't find required user/groups" runtimeEnts -- note: we use directly ! as lookup failures shouldn't happen, due -- to the map construction let uid = reUserToUid ents M.! daemon let gid = reGroupToGid ents M.! dGroup setOwnerAndGroup filename uid gid -- | Resets permissions so that the owner can read/write and the group only -- read. All other permissions are cleared.
724
setOwnerAndGroupFromNames :: FilePath -> GanetiDaemon -> GanetiGroup -> IO () setOwnerAndGroupFromNames filename daemon dGroup = do -- TODO: it would be nice to rework this (or getEnts) so that runtimeEnts -- is read only once per daemon startup, and then cached for further usage. runtimeEnts <- runResultT getEnts ents <- exitIfBad "Can't find required user/groups" runtimeEnts -- note: we use directly ! as lookup failures shouldn't happen, due -- to the map construction let uid = reUserToUid ents M.! daemon let gid = reGroupToGid ents M.! dGroup setOwnerAndGroup filename uid gid -- | Resets permissions so that the owner can read/write and the group only -- read. All other permissions are cleared.
724
setOwnerAndGroupFromNames filename daemon dGroup = do -- TODO: it would be nice to rework this (or getEnts) so that runtimeEnts -- is read only once per daemon startup, and then cached for further usage. runtimeEnts <- runResultT getEnts ents <- exitIfBad "Can't find required user/groups" runtimeEnts -- note: we use directly ! as lookup failures shouldn't happen, due -- to the map construction let uid = reUserToUid ents M.! daemon let gid = reGroupToGid ents M.! dGroup setOwnerAndGroup filename uid gid -- | Resets permissions so that the owner can read/write and the group only -- read. All other permissions are cleared.
646
false
true
0
11
130
109
52
57
null
null
pharaun/MegaHAL
src/MegaHAL.hs
gpl-2.0
initialize :: FilePath -> FilePath -> FilePath -> IO MegaHal initialize brainDir errorFile statusFile = do -- Setup the logfile and brain and register the CString to be dealloc err <- newCString errorFile st <- newCString statusFile dir <- newCString brainDir -- Actually init megahal cxt <- m_initialize err st dir return $ MegaHal cxt [err, st, dir] -- TODO: uncertain if we need to free the returned string or what
449
initialize :: FilePath -> FilePath -> FilePath -> IO MegaHal initialize brainDir errorFile statusFile = do -- Setup the logfile and brain and register the CString to be dealloc err <- newCString errorFile st <- newCString statusFile dir <- newCString brainDir -- Actually init megahal cxt <- m_initialize err st dir return $ MegaHal cxt [err, st, dir] -- TODO: uncertain if we need to free the returned string or what
449
initialize brainDir errorFile statusFile = do -- Setup the logfile and brain and register the CString to be dealloc err <- newCString errorFile st <- newCString statusFile dir <- newCString brainDir -- Actually init megahal cxt <- m_initialize err st dir return $ MegaHal cxt [err, st, dir] -- TODO: uncertain if we need to free the returned string or what
388
false
true
0
9
102
101
48
53
null
null
nh2/WashNGo
WASH/HTML/HTMLPrelude.hs
bsd-3-clause
dd f elt = elt `add` f (make DD)
32
dd f elt = elt `add` f (make DD)
32
dd f elt = elt `add` f (make DD)
32
false
false
0
8
8
26
13
13
null
null
solidsnack/cassava
Data/Csv/Parser.hs
bsd-3-clause
removeBlankLines :: [Record] -> [Record] removeBlankLines = filter (not . blankLine) where blankLine v = V.length v == 1 && (S.null (V.head v)) -- | Parse a record, not including the terminating line separator. The -- terminating line separate is not included as the last record in a -- CSV file is allowed to not have a terminating line separator. You -- most likely want to use the 'endOfLine' parser in combination with -- this parser.
441
removeBlankLines :: [Record] -> [Record] removeBlankLines = filter (not . blankLine) where blankLine v = V.length v == 1 && (S.null (V.head v)) -- | Parse a record, not including the terminating line separator. The -- terminating line separate is not included as the last record in a -- CSV file is allowed to not have a terminating line separator. You -- most likely want to use the 'endOfLine' parser in combination with -- this parser.
441
removeBlankLines = filter (not . blankLine) where blankLine v = V.length v == 1 && (S.null (V.head v)) -- | Parse a record, not including the terminating line separator. The -- terminating line separate is not included as the last record in a -- CSV file is allowed to not have a terminating line separator. You -- most likely want to use the 'endOfLine' parser in combination with -- this parser.
400
false
true
0
10
78
75
41
34
null
null
polarina/sdl2
Graphics/UI/SDL/Event.hs
bsd-3-clause
gameControllerGetJoystick :: MonadIO m => GameController -> m Joystick gameControllerGetJoystick v1 = liftIO $ gameControllerGetJoystick' v1
140
gameControllerGetJoystick :: MonadIO m => GameController -> m Joystick gameControllerGetJoystick v1 = liftIO $ gameControllerGetJoystick' v1
140
gameControllerGetJoystick v1 = liftIO $ gameControllerGetJoystick' v1
69
false
true
0
7
15
35
16
19
null
null
UCSD-PL/nano-js
Language/Nano/Errors.hs
bsd-3-clause
errorWriteImmutable x = printf "Cannot write immutable: %s" (ppshow x)
72
errorWriteImmutable x = printf "Cannot write immutable: %s" (ppshow x)
72
errorWriteImmutable x = printf "Cannot write immutable: %s" (ppshow x)
72
false
false
0
7
11
20
9
11
null
null
rfranek/duckling
Duckling/Numeral/DE/Rules.hs
bsd-3-clause
ruleNumeralsSuffixesKMG :: Rule ruleNumeralsSuffixesKMG = Rule { name = "numbers suffixes (K, M, G)" , pattern = [ dimension Numeral , regex "([kmg])(?=[\\W\\$\x20ac]|$)" ] , prod = \tokens -> case tokens of (Token Numeral (NumeralData {TNumeral.value = v}): Token RegexMatch (GroupMatch (match:_)): _) -> case Text.toLower match of "k" -> double $ v * 1e3 "m" -> double $ v * 1e6 "g" -> double $ v * 1e9 _ -> Nothing _ -> Nothing }
514
ruleNumeralsSuffixesKMG :: Rule ruleNumeralsSuffixesKMG = Rule { name = "numbers suffixes (K, M, G)" , pattern = [ dimension Numeral , regex "([kmg])(?=[\\W\\$\x20ac]|$)" ] , prod = \tokens -> case tokens of (Token Numeral (NumeralData {TNumeral.value = v}): Token RegexMatch (GroupMatch (match:_)): _) -> case Text.toLower match of "k" -> double $ v * 1e3 "m" -> double $ v * 1e6 "g" -> double $ v * 1e9 _ -> Nothing _ -> Nothing }
514
ruleNumeralsSuffixesKMG = Rule { name = "numbers suffixes (K, M, G)" , pattern = [ dimension Numeral , regex "([kmg])(?=[\\W\\$\x20ac]|$)" ] , prod = \tokens -> case tokens of (Token Numeral (NumeralData {TNumeral.value = v}): Token RegexMatch (GroupMatch (match:_)): _) -> case Text.toLower match of "k" -> double $ v * 1e3 "m" -> double $ v * 1e6 "g" -> double $ v * 1e9 _ -> Nothing _ -> Nothing }
482
false
true
0
19
157
173
90
83
null
null
databrary/databrary
src/View/Form.hs
agpl-3.0
field :: T.Text -> Field -> FormHtml f field k sub = k .:> do ref <- pathId err <- formViewErrors val <- value lift $ H.label $ do H.toHtml k sub ref val errorList err H.br
196
field :: T.Text -> Field -> FormHtml f field k sub = k .:> do ref <- pathId err <- formViewErrors val <- value lift $ H.label $ do H.toHtml k sub ref val errorList err H.br
196
field k sub = k .:> do ref <- pathId err <- formViewErrors val <- value lift $ H.label $ do H.toHtml k sub ref val errorList err H.br
157
false
true
2
11
60
101
43
58
null
null