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
m0ar/safe-streaming
src/Streaming/Prelude.hs
bsd-3-clause
-- {-| Interpolate a delay of n seconds between yields. -- -} -- delay :: MonadIO m => Double -> Stream (Of a) m r -> Stream (Of a) m r -- delay seconds = loop where -- pico = truncate (seconds * 1000000) -- loop str = do -- e <- lift $ next str -- case e of -- Left r -> Return r -- Right (a,rest) -> do -- yield a -- liftIO $ threadDelay pico -- loop rest -- {-#INLINABLE delay #-} {-| Where a transformer returns a stream, run the effects of the stream, keeping the return value. This is usually used at the type > drained :: Monad m => Stream (Of a) m (Stream (Of b) m r) -> Stream (Of a) m r > drained = join . fmap (lift . effects) Here, for example, we split a stream in two places and throw out the middle segment: >>> rest <- S.print $ S.drained $ S.splitAt 2 $ S.splitAt 5 $ each [1..7] 1 2 >>> S.print rest 6 7 In particular, we can define versions of @take@ and @takeWhile@ which retrieve the return value of the rest of the stream - and which can thus be used with 'maps': > take' n = S.drained . S.splitAt n > takeWhile' thus = S.drained . S.span thus -} drained :: (LMonad m, LMonad (t m), LFunctor (t m), LMonadTrans t) => t m (Stream (LOf a) m r) -> t m r drained = join . fmap (lift . effects)
1,292
drained :: (LMonad m, LMonad (t m), LFunctor (t m), LMonadTrans t) => t m (Stream (LOf a) m r) -> t m r drained = join . fmap (lift . effects)
150
drained = join . fmap (lift . effects)
38
true
true
0
11
337
109
62
47
null
null
grnet/snf-ganeti
src/Ganeti/HTools/Node.hs
bsd-2-clause
-- | Add multiple values. addTags :: (Ord k) => Map.Map k Int -> [k] -> Map.Map k Int addTags = foldl' addTag
109
addTags :: (Ord k) => Map.Map k Int -> [k] -> Map.Map k Int addTags = foldl' addTag
83
addTags = foldl' addTag
23
true
true
0
10
22
55
26
29
null
null
rolph-recto/liquid-fixpoint
src/Language/Fixpoint/Types/Config.hs
bsd-3-clause
multicore :: Config -> Bool multicore cfg = cores cfg /= Just 1
63
multicore :: Config -> Bool multicore cfg = cores cfg /= Just 1
63
multicore cfg = cores cfg /= Just 1
35
false
true
0
6
12
31
14
17
null
null
dmcclean/igrf
src/IGRF.hs
bsd-3-clause
fieldAtTime :: (Fractional a, Eq a) => MagneticModel a -- ^ Magnetic field model -> a -- ^ Time since model epoch (year) -> SphericalHarmonicModel a -- ^ Spherical harmonic model of magnetic field at specified time. Field in nT, reference radius in km fieldAtTime m t = (fieldAtEpoch m) ^+^ (t *^ secularVariation m)
340
fieldAtTime :: (Fractional a, Eq a) => MagneticModel a -- ^ Magnetic field model -> a -- ^ Time since model epoch (year) -> SphericalHarmonicModel a fieldAtTime m t = (fieldAtEpoch m) ^+^ (t *^ secularVariation m)
237
fieldAtTime m t = (fieldAtEpoch m) ^+^ (t *^ secularVariation m)
64
true
true
0
8
78
68
35
33
null
null
sdiehl/ghc
compiler/main/DriverPhases.hs
bsd-3-clause
isCishSuffix s = s `elem` cish_suffixes
49
isCishSuffix s = s `elem` cish_suffixes
49
isCishSuffix s = s `elem` cish_suffixes
49
false
false
0
5
15
15
8
7
null
null
olorin/amazonka
amazonka-redshift/gen/Network/AWS/Redshift/PurchaseReservedNodeOffering.hs
mpl-2.0
-- | The unique identifier of the reserved node offering you want to -- purchase. prnoReservedNodeOfferingId :: Lens' PurchaseReservedNodeOffering Text prnoReservedNodeOfferingId = lens _prnoReservedNodeOfferingId (\ s a -> s{_prnoReservedNodeOfferingId = a})
259
prnoReservedNodeOfferingId :: Lens' PurchaseReservedNodeOffering Text prnoReservedNodeOfferingId = lens _prnoReservedNodeOfferingId (\ s a -> s{_prnoReservedNodeOfferingId = a})
177
prnoReservedNodeOfferingId = lens _prnoReservedNodeOfferingId (\ s a -> s{_prnoReservedNodeOfferingId = a})
107
true
true
0
9
30
41
23
18
null
null
marcellussiegburg/autotool
collection/src/Polynomial/Task/Ideal.hs
gpl-2.0
roll_one conf = do fs <- replicateM (base_size conf) $ rpoly conf let (lo,hi) = buchberger_steps_range conf case result $ algorithm63s option0{max_steps=Just hi} fs of Just s | not $ Prelude.null $ trace s -> do i <- randomRIO (0, length (trace s) - 1) let (c,g) = trace s !! i return $ Just ( (negate c, nterms g, Prelude.sum $ fmap Prelude.abs $ coefficients g ) , (fmap (map fromInteger) fs, map fromInteger g)) _ -> return Nothing
474
roll_one conf = do fs <- replicateM (base_size conf) $ rpoly conf let (lo,hi) = buchberger_steps_range conf case result $ algorithm63s option0{max_steps=Just hi} fs of Just s | not $ Prelude.null $ trace s -> do i <- randomRIO (0, length (trace s) - 1) let (c,g) = trace s !! i return $ Just ( (negate c, nterms g, Prelude.sum $ fmap Prelude.abs $ coefficients g ) , (fmap (map fromInteger) fs, map fromInteger g)) _ -> return Nothing
474
roll_one conf = do fs <- replicateM (base_size conf) $ rpoly conf let (lo,hi) = buchberger_steps_range conf case result $ algorithm63s option0{max_steps=Just hi} fs of Just s | not $ Prelude.null $ trace s -> do i <- randomRIO (0, length (trace s) - 1) let (c,g) = trace s !! i return $ Just ( (negate c, nterms g, Prelude.sum $ fmap Prelude.abs $ coefficients g ) , (fmap (map fromInteger) fs, map fromInteger g)) _ -> return Nothing
474
false
false
0
20
119
238
112
126
null
null
keera-studios/pang-a-lambda
Experiments/splitballs/Display.hs
gpl-3.0
render :: Resources -> GameState -> IO() render resources shownState = do -- Obtain surface screen <- getVideoSurface let format = surfaceGetPixelFormat screen bgColor <- mapRGB format 0x37 0x16 0xB4 fillRect screen Nothing bgColor mapM_ (paintObject screen resources ) $ gameObjects shownState displayInfo screen resources (gameInfo shownState) -- Double buffering SDL.flip screen -- * Painting functions
428
render :: Resources -> GameState -> IO() render resources shownState = do -- Obtain surface screen <- getVideoSurface let format = surfaceGetPixelFormat screen bgColor <- mapRGB format 0x37 0x16 0xB4 fillRect screen Nothing bgColor mapM_ (paintObject screen resources ) $ gameObjects shownState displayInfo screen resources (gameInfo shownState) -- Double buffering SDL.flip screen -- * Painting functions
428
render resources shownState = do -- Obtain surface screen <- getVideoSurface let format = surfaceGetPixelFormat screen bgColor <- mapRGB format 0x37 0x16 0xB4 fillRect screen Nothing bgColor mapM_ (paintObject screen resources ) $ gameObjects shownState displayInfo screen resources (gameInfo shownState) -- Double buffering SDL.flip screen -- * Painting functions
387
false
true
0
10
78
122
55
67
null
null
peterokagey/haskellOEIS
test/KthDifferences/A327460Spec.hs
apache-2.0
spec :: Spec spec = describe "A327460" $ do it "correctly computes the first 10 elements" $ map a327460 [1..10] `shouldBe` [1, 3, 9, 5, 12, 10, 23, 8, 22, 17] it "knows that the 56th term differs from A327762" $ a327460 56 `shouldBe` 101
250
spec :: Spec spec = describe "A327460" $ do it "correctly computes the first 10 elements" $ map a327460 [1..10] `shouldBe` [1, 3, 9, 5, 12, 10, 23, 8, 22, 17] it "knows that the 56th term differs from A327762" $ a327460 56 `shouldBe` 101
250
spec = describe "A327460" $ do it "correctly computes the first 10 elements" $ map a327460 [1..10] `shouldBe` [1, 3, 9, 5, 12, 10, 23, 8, 22, 17] it "knows that the 56th term differs from A327762" $ a327460 56 `shouldBe` 101
237
false
true
0
11
57
100
52
48
null
null
mdibaiee/picedit
app/Main.hs
bsd-3-clause
parseArgs ("--rotate":n:rest) opts = parseArgs rest (opts { argRotate = read n })
81
parseArgs ("--rotate":n:rest) opts = parseArgs rest (opts { argRotate = read n })
81
parseArgs ("--rotate":n:rest) opts = parseArgs rest (opts { argRotate = read n })
81
false
false
0
9
12
41
21
20
null
null
RoboNickBot/interactive-tree-demos
src/Hyper/Canvas/Types.hs
bsd-2-clause
draws :: Int -> HyperForm -> [[Draw]] draws nf = L.transpose . fmap (mult nf) . fmap scalePrim' . prims nf
106
draws :: Int -> HyperForm -> [[Draw]] draws nf = L.transpose . fmap (mult nf) . fmap scalePrim' . prims nf
106
draws nf = L.transpose . fmap (mult nf) . fmap scalePrim' . prims nf
68
false
true
1
10
20
63
29
34
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/enumFromTo_2.hs
mit
primQuotInt (Neg x) (Neg (Succ y)) = Pos (primDivNatS x (Succ y))
65
primQuotInt (Neg x) (Neg (Succ y)) = Pos (primDivNatS x (Succ y))
65
primQuotInt (Neg x) (Neg (Succ y)) = Pos (primDivNatS x (Succ y))
65
false
false
0
9
11
46
22
24
null
null
ezyang/ghc
compiler/hsSyn/HsDecls.hs
bsd-3-clause
lvectDeclName (L _ (HsNoVect _ (L _ name))) = getName name
67
lvectDeclName (L _ (HsNoVect _ (L _ name))) = getName name
67
lvectDeclName (L _ (HsNoVect _ (L _ name))) = getName name
67
false
false
0
11
19
36
17
19
null
null
redfish64/IrcScanner
src/IrcScanner/IRCBot.hs
bsd-3-clause
nick = "tutbot"
17
nick = "tutbot"
17
nick = "tutbot"
17
false
false
1
5
4
10
3
7
null
null
ancientlanguage/haskell-analysis
prepare/src/Prepare/Decompose.hs
mit
decomposeChar '\x0135' = "\x006A\x0302"
39
decomposeChar '\x0135' = "\x006A\x0302"
39
decomposeChar '\x0135' = "\x006A\x0302"
39
false
false
1
5
3
13
4
9
null
null
eagletmt/ghc-mod
Browse.hs
bsd-3-clause
showThing _ (ATyCon t) = unwords . toList <$> tyType t where toList t' = t' : getOccString t : map getOccString (tyConTyVars t)
139
showThing _ (ATyCon t) = unwords . toList <$> tyType t where toList t' = t' : getOccString t : map getOccString (tyConTyVars t)
139
showThing _ (ATyCon t) = unwords . toList <$> tyType t where toList t' = t' : getOccString t : map getOccString (tyConTyVars t)
139
false
false
0
8
35
61
28
33
null
null
Murano/language-javascript
src/Language/JavaScript/Pretty/Printer.hs
bsd-3-clause
rn (NN (JSPropertyNameandValue n colon vs)) foo = rJS ([n,colon] ++ vs) foo
81
rn (NN (JSPropertyNameandValue n colon vs)) foo = rJS ([n,colon] ++ vs) foo
81
rn (NN (JSPropertyNameandValue n colon vs)) foo = rJS ([n,colon] ++ vs) foo
81
false
false
0
9
18
45
23
22
null
null
JoeyEremondi/elm-pattern-effects
src/Type/Effect/Solve.hs
bsd-3-clause
getRepr :: AnnVar -> SolverM' a (Maybe TypeAnnot) getRepr (AnnVar (pt, _)) = liftIO $ _annRepr <$> UF.descriptor pt
118
getRepr :: AnnVar -> SolverM' a (Maybe TypeAnnot) getRepr (AnnVar (pt, _)) = liftIO $ _annRepr <$> UF.descriptor pt
118
getRepr (AnnVar (pt, _)) = liftIO $ _annRepr <$> UF.descriptor pt
68
false
true
0
8
21
54
27
27
null
null
TOSPIO/syncron
src/Watcher.hs
bsd-3-clause
adjustINotify _ _ _ = return ()
31
adjustINotify _ _ _ = return ()
31
adjustINotify _ _ _ = return ()
31
false
false
1
6
6
18
7
11
null
null
micknelso/language-c
src/Language/CFamily/Data/InputStream.hs
bsd-3-clause
countLines = length . BSC.lines
43
countLines = length . BSC.lines
43
countLines = length . BSC.lines
43
false
false
0
6
16
12
6
6
null
null
ben-z/dotfiles
xmonad/.xmonad/xmonad.hs
mit
------------------------------------------------------------------------ -- Layouts -- You can specify and transform your layouts by modifying these values. -- If you change layout bindings be sure to use 'mod-shift-space' after -- restarting (with 'mod-q') to reset your layout state to the new -- defaults, as xmonad preserves your old layout settings by default. -- -- The available layouts. Note that each layout is separated by |||, -- which denotes layout choice. -- myLayout = avoidStruts ( ThreeColMid 1 (3/100) (1/2) ||| Tall 1 (3/100) (1/2) ||| Mirror (Tall 1 (3/100) (1/2)) ||| tabbed shrinkText tabConfig ||| Full ||| spiral (6/7))
668
myLayout = avoidStruts ( ThreeColMid 1 (3/100) (1/2) ||| Tall 1 (3/100) (1/2) ||| Mirror (Tall 1 (3/100) (1/2)) ||| tabbed shrinkText tabConfig ||| Full ||| spiral (6/7))
194
myLayout = avoidStruts ( ThreeColMid 1 (3/100) (1/2) ||| Tall 1 (3/100) (1/2) ||| Mirror (Tall 1 (3/100) (1/2)) ||| tabbed shrinkText tabConfig ||| Full ||| spiral (6/7))
194
true
false
0
15
121
126
69
57
null
null
satai/FrozenBeagle
Simulation/Lib/src/Simulation/Internal.hs
bsd-3-clause
almostAllTheSame :: (Ord a) => [a] -> Bool almostAllTheSame [] = True
69
almostAllTheSame :: (Ord a) => [a] -> Bool almostAllTheSame [] = True
69
almostAllTheSame [] = True
26
false
true
0
9
11
38
18
20
null
null
nh2/shake
Development/Shake/Core.hs
bsd-3-clause
putQuiet = putWhen Quiet
24
putQuiet = putWhen Quiet
24
putQuiet = putWhen Quiet
24
false
false
0
5
3
9
4
5
null
null
samscott89/tamarin-prover
lib/theory/src/Theory.hs
gpl-3.0
-- | Default diff theory defaultOpenDiffTheory :: Bool -> OpenDiffTheory defaultOpenDiffTheory flag = DiffTheory "default" (emptySignaturePure flag) [] [] [] [] []
163
defaultOpenDiffTheory :: Bool -> OpenDiffTheory defaultOpenDiffTheory flag = DiffTheory "default" (emptySignaturePure flag) [] [] [] [] []
138
defaultOpenDiffTheory flag = DiffTheory "default" (emptySignaturePure flag) [] [] [] [] []
90
true
true
0
7
21
50
25
25
null
null
robstewart57/hdph-rs
src/Control/Parallel/HdpH/Internal/IVar.hs
bsd-3-clause
slotGIVar :: GIVar m a -> Int slotGIVar = slot
46
slotGIVar :: GIVar m a -> Int slotGIVar = slot
46
slotGIVar = slot
16
false
true
0
6
9
20
10
10
null
null
harendra-kumar/stack
src/Stack/Build/Cache.hs
bsd-3-clause
writeBuildCache :: (MonadIO m, MonadReader env m, HasConfig env, MonadThrow m, MonadLogger m, HasEnvConfig env) => Path Abs Dir -> Map FilePath FileCacheInfo -> m () writeBuildCache dir times = writeCache dir buildCacheFile BuildCache { buildCacheTimes = times }
324
writeBuildCache :: (MonadIO m, MonadReader env m, HasConfig env, MonadThrow m, MonadLogger m, HasEnvConfig env) => Path Abs Dir -> Map FilePath FileCacheInfo -> m () writeBuildCache dir times = writeCache dir buildCacheFile BuildCache { buildCacheTimes = times }
324
writeBuildCache dir times = writeCache dir buildCacheFile BuildCache { buildCacheTimes = times }
142
false
true
0
9
100
100
48
52
null
null
AndreasPK/stack
src/Stack/Dot.hs
bsd-3-clause
-- | Print a node with no dependencies printLeaf :: MonadIO m => PackageName -> m () printLeaf package = liftIO . Text.putStrLn . Text.concat $ if isWiredIn package then ["{rank=max; ", nodeName package, " [shape=box]; };"] else ["{rank=max; ", nodeName package, "; };"]
280
printLeaf :: MonadIO m => PackageName -> m () printLeaf package = liftIO . Text.putStrLn . Text.concat $ if isWiredIn package then ["{rank=max; ", nodeName package, " [shape=box]; };"] else ["{rank=max; ", nodeName package, "; };"]
241
printLeaf package = liftIO . Text.putStrLn . Text.concat $ if isWiredIn package then ["{rank=max; ", nodeName package, " [shape=box]; };"] else ["{rank=max; ", nodeName package, "; };"]
195
true
true
1
9
53
88
44
44
null
null
Purlox/InfLength
Source/Data/List/InfLength.hs
mit
-- | Checks if the length of the list is equal to the number (~==) :: (Integral i) => [a] -> i -> Bool list ~== n = infLength list == integralToNat n
149
(~==) :: (Integral i) => [a] -> i -> Bool list ~== n = infLength list == integralToNat n
88
list ~== n = infLength list == integralToNat n
46
true
true
0
10
32
54
27
27
null
null
andyarvanitis/Idris-dev
src/Idris/IBC.hs
bsd-3-clause
pErrRev :: [(Term, Term)] -> Idris () pErrRev ts = mapM_ addErrRev ts
69
pErrRev :: [(Term, Term)] -> Idris () pErrRev ts = mapM_ addErrRev ts
69
pErrRev ts = mapM_ addErrRev ts
31
false
true
0
8
12
43
20
23
null
null
DougBurke/swish
tests/N3ParserTest.hs
lgpl-2.1
t1113 = arc v3 p1 v4
20
t1113 = arc v3 p1 v4
20
t1113 = arc v3 p1 v4
20
false
false
1
5
5
19
6
13
null
null
fmthoma/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
returnM_RDR = nameRdrName returnMName
49
returnM_RDR = nameRdrName returnMName
49
returnM_RDR = nameRdrName returnMName
49
false
false
0
5
15
9
4
5
null
null
WraithM/prosper
src/Prosper/Internal/CSV.hs
bsd-3-clause
csvGet :: User -- ^ The user name and password for the prosper user -> ByteString -- ^ The name of the API service, relative to the API url -> IO ByteString -- ^ Raw CSV response csvGet userInfo url = issueRequest userInfo url GET "text/csv" concatHandler []
270
csvGet :: User -- ^ The user name and password for the prosper user -> ByteString -- ^ The name of the API service, relative to the API url -> IO ByteString csvGet userInfo url = issueRequest userInfo url GET "text/csv" concatHandler []
248
csvGet userInfo url = issueRequest userInfo url GET "text/csv" concatHandler []
79
true
true
0
8
59
49
24
25
null
null
drhodes/jade2hdl
jade-decode/test/TestSig.hs
bsd-3-clause
-------------------------------------------------------------------------------- testSigWidth :: Monad m => Sig -> Integer -> m TestState testSigWidth sig expectedWidth = do let w = Sig.width sig if w == expectedWidth then return Pass else return (Fail (fmt "expected {0}, got {1}, sig: {2}" (expectedWidth, w, sig)))
329
testSigWidth :: Monad m => Sig -> Integer -> m TestState testSigWidth sig expectedWidth = do let w = Sig.width sig if w == expectedWidth then return Pass else return (Fail (fmt "expected {0}, got {1}, sig: {2}" (expectedWidth, w, sig)))
248
testSigWidth sig expectedWidth = do let w = Sig.width sig if w == expectedWidth then return Pass else return (Fail (fmt "expected {0}, got {1}, sig: {2}" (expectedWidth, w, sig)))
191
true
true
0
13
53
93
46
47
null
null
adamschoenemann/simple-frp
app/Main.hs
mit
selfapp :: (a -> a) -> [()] -> Mu (Fun [()] a) -> a selfapp f us v = let u : us' = us x = v in f (let w = unFun . out $ x u' : us'' = us' y = Into (Fun w) in w us' y)
224
selfapp :: (a -> a) -> [()] -> Mu (Fun [()] a) -> a selfapp f us v = let u : us' = us x = v in f (let w = unFun . out $ x u' : us'' = us' y = Into (Fun w) in w us' y)
224
selfapp f us v = let u : us' = us x = v in f (let w = unFun . out $ x u' : us'' = us' y = Into (Fun w) in w us' y)
172
false
true
0
15
109
133
66
67
null
null
adjoint-io/datetime
src/Datetime.hs
apache-2.0
------------------------------------------------------------------------------- -- United States ( NYSE ) ------------------------------------------------------------------------------- -- | United States NYSE Stock Exchange Holidays -- <https://www.nyse.com/markets/hours-calendars> nyseHolidays :: HolidayGen nyseHolidays year = [ independenceDay, christmasDay, memorialDay, newYearsDay, martinlutherDay, laborDay, presidentsDay, thanksgivingDay, goodFriday year ]
503
nyseHolidays :: HolidayGen nyseHolidays year = [ independenceDay, christmasDay, memorialDay, newYearsDay, martinlutherDay, laborDay, presidentsDay, thanksgivingDay, goodFriday year ]
218
nyseHolidays year = [ independenceDay, christmasDay, memorialDay, newYearsDay, martinlutherDay, laborDay, presidentsDay, thanksgivingDay, goodFriday year ]
191
true
true
0
7
72
55
32
23
null
null
DaMSL/K3
src/Language/K3/Interpreter/Builtins.hs
apache-2.0
-- hash :: forall a . a -> int genBuiltin "hash" _ = vfun $ \v -> valueHash v
77
genBuiltin "hash" _ = vfun $ \v -> valueHash v
46
genBuiltin "hash" _ = vfun $ \v -> valueHash v
46
true
false
0
7
18
24
12
12
null
null
CloudI/CloudI
src/api/haskell/external/bytestring-0.10.10.0/Data/ByteString/Char8.hs
mit
-- | 'scanl' is similar to 'foldl', but returns a list of successive -- reduced values from the left: -- -- > scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...] -- -- Note that -- -- > last (scanl f z xs) == foldl f z xs. scanl :: (Char -> Char -> Char) -> Char -> ByteString -> ByteString scanl f z = B.scanl (\a b -> c2w (f (w2c a) (w2c b))) (c2w z)
365
scanl :: (Char -> Char -> Char) -> Char -> ByteString -> ByteString scanl f z = B.scanl (\a b -> c2w (f (w2c a) (w2c b))) (c2w z)
129
scanl f z = B.scanl (\a b -> c2w (f (w2c a) (w2c b))) (c2w z)
61
true
true
0
12
84
93
51
42
null
null
BartAdv/Idris-dev
src/Idris/Core/Elaborate.hs
bsd-3-clause
runElab :: aux -> Elab' aux a -> ProofState -> TC (a, ElabState aux) runElab a e ps = runStateT e (ES (ps, a) "" Nothing)
121
runElab :: aux -> Elab' aux a -> ProofState -> TC (a, ElabState aux) runElab a e ps = runStateT e (ES (ps, a) "" Nothing)
121
runElab a e ps = runStateT e (ES (ps, a) "" Nothing)
52
false
true
0
11
25
72
35
37
null
null
geocurnoff/nikki
src/Physics/Chipmunk/Types.hs
lgpl-3.0
position2vector :: Qt.Position Double -> Vector position2vector (Qt.Position x y) = Vector (realToFrac x) (realToFrac y)
120
position2vector :: Qt.Position Double -> Vector position2vector (Qt.Position x y) = Vector (realToFrac x) (realToFrac y)
120
position2vector (Qt.Position x y) = Vector (realToFrac x) (realToFrac y)
72
false
true
0
7
15
54
25
29
null
null
databrary/databrary
src/Controller/CSV.hs
agpl-3.0
dataRow _ _ = []
16
dataRow _ _ = []
16
dataRow _ _ = []
16
false
false
1
6
4
14
6
8
null
null
machine-intelligence/Botworld
Botworld/TextBlock.hs
bsd-3-clause
-- |Squares up a matrix of maybe text blocks, filling the missing ones with -- appropriately many ╳ characters. squareUp' :: [[Maybe TextBlock]] -> [[TextBlock]] squareUp' rows = map normalizeRow paddedRows where paddedRows = map (pad Nothing $ maxlen rows) rows pad x n xs = xs ++ replicate (n - length xs) x cellheight = foldr max 0 . mapMaybe (fmap length) maxlen = foldr (max . length) 0 normalizeRow row = zipWith normalizeCell [0..] row where normalizeCell :: Int -> Maybe [String] -> [String] normalizeCell i Nothing = padStrings '╳' i $ replicate (cellheight row) "" normalizeCell i (Just strs) = padStrings ' ' i $ pad "" (cellheight row) strs padStrings c i = map $ pad c (colwidth i) colwidth i = foldr max 0 $ catMaybes [maxlen <$> row !! i | row <- paddedRows] -- |Renders a matrix of textblocks into a single textblock. -- [[ ["A", "B"], ["C", "D"] ],[ ["E"], ["F"] ]] -- renders as: AC -- BD -- EF
965
squareUp' :: [[Maybe TextBlock]] -> [[TextBlock]] squareUp' rows = map normalizeRow paddedRows where paddedRows = map (pad Nothing $ maxlen rows) rows pad x n xs = xs ++ replicate (n - length xs) x cellheight = foldr max 0 . mapMaybe (fmap length) maxlen = foldr (max . length) 0 normalizeRow row = zipWith normalizeCell [0..] row where normalizeCell :: Int -> Maybe [String] -> [String] normalizeCell i Nothing = padStrings '╳' i $ replicate (cellheight row) "" normalizeCell i (Just strs) = padStrings ' ' i $ pad "" (cellheight row) strs padStrings c i = map $ pad c (colwidth i) colwidth i = foldr max 0 $ catMaybes [maxlen <$> row !! i | row <- paddedRows] -- |Renders a matrix of textblocks into a single textblock. -- [[ ["A", "B"], ["C", "D"] ],[ ["E"], ["F"] ]] -- renders as: AC -- BD -- EF
853
squareUp' rows = map normalizeRow paddedRows where paddedRows = map (pad Nothing $ maxlen rows) rows pad x n xs = xs ++ replicate (n - length xs) x cellheight = foldr max 0 . mapMaybe (fmap length) maxlen = foldr (max . length) 0 normalizeRow row = zipWith normalizeCell [0..] row where normalizeCell :: Int -> Maybe [String] -> [String] normalizeCell i Nothing = padStrings '╳' i $ replicate (cellheight row) "" normalizeCell i (Just strs) = padStrings ' ' i $ pad "" (cellheight row) strs padStrings c i = map $ pad c (colwidth i) colwidth i = foldr max 0 $ catMaybes [maxlen <$> row !! i | row <- paddedRows] -- |Renders a matrix of textblocks into a single textblock. -- [[ ["A", "B"], ["C", "D"] ],[ ["E"], ["F"] ]] -- renders as: AC -- BD -- EF
803
true
true
12
10
220
349
161
188
null
null
haskellGardener/yusic
src/Yusic.hs
mit
toOctave A3 = 3
19
toOctave A3 = 3
19
toOctave A3 = 3
19
false
false
0
5
7
9
4
5
null
null
squest/Zenx-trainer-training
haskell/teta.hs
epl-1.0
getName = do line <- getLine return line
44
getName = do line <- getLine return line
44
getName = do line <- getLine return line
44
false
false
1
8
11
23
8
15
null
null
mariefarrell/Hets
CASL_DL/AS_CASL_DL.der.hs
gpl-2.0
-- TODO: Erweiterung ueber maybe caslDLCardTypes :: [CardType] caslDLCardTypes = [CExact, CMin, CMax]
102
caslDLCardTypes :: [CardType] caslDLCardTypes = [CExact, CMin, CMax]
68
caslDLCardTypes = [CExact, CMin, CMax]
38
true
true
0
5
13
24
15
9
null
null
csic-hs-dsl/hs-skel
src-test/QuickCheck.hs
bsd-3-clause
appendResult :: String -> Result -> ResultMonad () appendResult n r = modify (\s -> s ++ [(n, r)])
98
appendResult :: String -> Result -> ResultMonad () appendResult n r = modify (\s -> s ++ [(n, r)])
98
appendResult n r = modify (\s -> s ++ [(n, r)])
47
false
true
0
10
18
53
28
25
null
null
christiaanb/ghc
compiler/simplCore/CoreMonad.hs
bsd-3-clause
getRuleBase :: CoreM RuleBase getRuleBase = read cr_rule_base
61
getRuleBase :: CoreM RuleBase getRuleBase = read cr_rule_base
61
getRuleBase = read cr_rule_base
31
false
true
1
5
7
20
8
12
null
null
Megaleo/Minehack
src/Entity/Mob.hs
bsd-3-clause
-- | Adds to the mob's Maximum HP. addMobMaxHP :: MobData -> Int -> MobData addMobMaxHP (MobData n a h mh i s) maxHp = MobData n a h (mh + maxHp) i s
149
addMobMaxHP :: MobData -> Int -> MobData addMobMaxHP (MobData n a h mh i s) maxHp = MobData n a h (mh + maxHp) i s
114
addMobMaxHP (MobData n a h mh i s) maxHp = MobData n a h (mh + maxHp) i s
73
true
true
0
7
33
61
31
30
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/types/FamInstEnv.hs
bsd-3-clause
emptyFamInstEnvs :: (FamInstEnv, FamInstEnv) emptyFamInstEnvs = (emptyFamInstEnv, emptyFamInstEnv)
98
emptyFamInstEnvs :: (FamInstEnv, FamInstEnv) emptyFamInstEnvs = (emptyFamInstEnv, emptyFamInstEnv)
98
emptyFamInstEnvs = (emptyFamInstEnv, emptyFamInstEnv)
53
false
true
0
5
7
23
14
9
null
null
fffej/haskellprojects
ants/AntsVis.hs
bsd-2-clause
displayFunc :: World -> DisplayCallback displayFunc world = do clear [ColorBuffer] let h = fromIntegral homeOff * gridSize g = gridSize + gridSize * fromIntegral nantsSqrt renderPrimitive Quads $ do colorVertex (Color4 0 0 1 0.1) (Vertex2 h h) colorVertex (Color4 0 0 1 0.1) (Vertex2 (h+g) h) colorVertex (Color4 0 0 1 0.1) (Vertex2 (h+g) (h+g)) colorVertex (Color4 0 0 1 0.1) (Vertex2 h (h+g)) forM_ [0..dim*dim] (\x -> let pos = (x `div` dim, x `mod` dim) in drawPlace pos (world V.! x)) swapBuffers
591
displayFunc :: World -> DisplayCallback displayFunc world = do clear [ColorBuffer] let h = fromIntegral homeOff * gridSize g = gridSize + gridSize * fromIntegral nantsSqrt renderPrimitive Quads $ do colorVertex (Color4 0 0 1 0.1) (Vertex2 h h) colorVertex (Color4 0 0 1 0.1) (Vertex2 (h+g) h) colorVertex (Color4 0 0 1 0.1) (Vertex2 (h+g) (h+g)) colorVertex (Color4 0 0 1 0.1) (Vertex2 h (h+g)) forM_ [0..dim*dim] (\x -> let pos = (x `div` dim, x `mod` dim) in drawPlace pos (world V.! x)) swapBuffers
591
displayFunc world = do clear [ColorBuffer] let h = fromIntegral homeOff * gridSize g = gridSize + gridSize * fromIntegral nantsSqrt renderPrimitive Quads $ do colorVertex (Color4 0 0 1 0.1) (Vertex2 h h) colorVertex (Color4 0 0 1 0.1) (Vertex2 (h+g) h) colorVertex (Color4 0 0 1 0.1) (Vertex2 (h+g) (h+g)) colorVertex (Color4 0 0 1 0.1) (Vertex2 h (h+g)) forM_ [0..dim*dim] (\x -> let pos = (x `div` dim, x `mod` dim) in drawPlace pos (world V.! x)) swapBuffers
551
false
true
0
15
175
286
139
147
null
null
notogawa/fluent-logger-haskell
src/Network/Fluent/Logger.hs
apache-2.0
runSender :: FluentLoggerSender -> IO () runSender logger = forever $ filterException $ bracket (connectFluent logger) close handleSocket where passAsyncException :: AsyncException -> IO a passAsyncException e = throwIO e dropOtherExceptions :: SomeException -> IO () dropOtherExceptions _ = return () filterException :: IO () -> IO () filterException action = catches action [Handler passAsyncException, Handler dropOtherExceptions] handleSocket sock = do flag <- newEmptyTMVarIO bracket (forkIOUnmasked $ setFlagWhenClose sock flag) killThread (const $ sendFluent logger sock flag)
605
runSender :: FluentLoggerSender -> IO () runSender logger = forever $ filterException $ bracket (connectFluent logger) close handleSocket where passAsyncException :: AsyncException -> IO a passAsyncException e = throwIO e dropOtherExceptions :: SomeException -> IO () dropOtherExceptions _ = return () filterException :: IO () -> IO () filterException action = catches action [Handler passAsyncException, Handler dropOtherExceptions] handleSocket sock = do flag <- newEmptyTMVarIO bracket (forkIOUnmasked $ setFlagWhenClose sock flag) killThread (const $ sendFluent logger sock flag)
605
runSender logger = forever $ filterException $ bracket (connectFluent logger) close handleSocket where passAsyncException :: AsyncException -> IO a passAsyncException e = throwIO e dropOtherExceptions :: SomeException -> IO () dropOtherExceptions _ = return () filterException :: IO () -> IO () filterException action = catches action [Handler passAsyncException, Handler dropOtherExceptions] handleSocket sock = do flag <- newEmptyTMVarIO bracket (forkIOUnmasked $ setFlagWhenClose sock flag) killThread (const $ sendFluent logger sock flag)
564
false
true
0
12
98
191
91
100
null
null
statusfailed/snaplet-job-board
src/Snap/Snaplet/JobBoard/Util.hs
agpl-3.0
-- | Terminate the connection by modifying response, finishing with -- message & HTTP status code. finishWithStatus :: MonadSnap m => (Response -> Response) -> ByteString -> Int -> m a finishWithStatus f s c = getsResponse (setResponseStatus c s . f) >>= finishWith
270
finishWithStatus :: MonadSnap m => (Response -> Response) -> ByteString -> Int -> m a finishWithStatus f s c = getsResponse (setResponseStatus c s . f) >>= finishWith
170
finishWithStatus f s c = getsResponse (setResponseStatus c s . f) >>= finishWith
82
true
true
0
9
48
68
34
34
null
null
hamishmack/haskell-gi
lib/Data/GI/CodeGen/Conversions.hs
lgpl-2.1
fObjectToH :: Type -> TypeRep -> Transfer -> ExcCodeGen Constructor fObjectToH t hType transfer = do let constructor = T.pack . tyConName . typeRepTyCon $ hType isGO <- isGObject t case transfer of TransferEverything -> if isGO then return $ M $ parenthesize $ "wrapObject " <> constructor else badIntroError "Got a transfer of something not a GObject" _ -> if isGO then return $ M $ parenthesize $ "newObject " <> constructor else badIntroError "Wrapping not a GObject with no copy..."
548
fObjectToH :: Type -> TypeRep -> Transfer -> ExcCodeGen Constructor fObjectToH t hType transfer = do let constructor = T.pack . tyConName . typeRepTyCon $ hType isGO <- isGObject t case transfer of TransferEverything -> if isGO then return $ M $ parenthesize $ "wrapObject " <> constructor else badIntroError "Got a transfer of something not a GObject" _ -> if isGO then return $ M $ parenthesize $ "newObject " <> constructor else badIntroError "Wrapping not a GObject with no copy..."
548
fObjectToH t hType transfer = do let constructor = T.pack . tyConName . typeRepTyCon $ hType isGO <- isGObject t case transfer of TransferEverything -> if isGO then return $ M $ parenthesize $ "wrapObject " <> constructor else badIntroError "Got a transfer of something not a GObject" _ -> if isGO then return $ M $ parenthesize $ "newObject " <> constructor else badIntroError "Wrapping not a GObject with no copy..."
480
false
true
2
14
143
139
68
71
null
null
GaloisInc/saw-script
src/SAWScript/MGU.hs
bsd-3-clause
patternBindings :: Pattern -> [(Located Name, Maybe Type)] patternBindings pat = case pat of PWild _mt -> [] PVar x mt -> [(x, mt)] PTuple ps -> concatMap patternBindings ps LPattern _ pat' -> patternBindings pat'
231
patternBindings :: Pattern -> [(Located Name, Maybe Type)] patternBindings pat = case pat of PWild _mt -> [] PVar x mt -> [(x, mt)] PTuple ps -> concatMap patternBindings ps LPattern _ pat' -> patternBindings pat'
231
patternBindings pat = case pat of PWild _mt -> [] PVar x mt -> [(x, mt)] PTuple ps -> concatMap patternBindings ps LPattern _ pat' -> patternBindings pat'
172
false
true
0
9
53
96
47
49
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F08.hs
bsd-3-clause
ptr_glFrustumxOES :: FunPtr (GLfixed -> GLfixed -> GLfixed -> GLfixed -> GLfixed -> GLfixed -> IO ()) ptr_glFrustumxOES = unsafePerformIO $ getCommand "glFrustumxOES"
166
ptr_glFrustumxOES :: FunPtr (GLfixed -> GLfixed -> GLfixed -> GLfixed -> GLfixed -> GLfixed -> IO ()) ptr_glFrustumxOES = unsafePerformIO $ getCommand "glFrustumxOES"
166
ptr_glFrustumxOES = unsafePerformIO $ getCommand "glFrustumxOES"
64
false
true
2
15
22
59
27
32
null
null
jutaro/rdf4h
testsuite/tests/Data/RDF/GraphTestUtils.hs
bsd-3-clause
sameObj :: Triple -> Triple -> Bool sameObj t1 t2 = objectOf t1 == objectOf t2
79
sameObj :: Triple -> Triple -> Bool sameObj t1 t2 = objectOf t1 == objectOf t2
79
sameObj t1 t2 = objectOf t1 == objectOf t2
43
false
true
1
8
16
40
17
23
null
null
Noeda/caramia-sdl2
src/Caramia/Events.hs
mit
handleOurEvents :: [SDL.Event] -> IO [SDL.Event] handleOurEvents events = return events <* (for_ events $ \case WindowEvent { windowEventEvent = wevent , windowEventData1 = w , windowEventData2 = h } | wevent == windowEventResized -> glViewport 0 0 (fromIntegral w) (fromIntegral h) _ -> return ())
358
handleOurEvents :: [SDL.Event] -> IO [SDL.Event] handleOurEvents events = return events <* (for_ events $ \case WindowEvent { windowEventEvent = wevent , windowEventData1 = w , windowEventData2 = h } | wevent == windowEventResized -> glViewport 0 0 (fromIntegral w) (fromIntegral h) _ -> return ())
358
handleOurEvents events = return events <* (for_ events $ \case WindowEvent { windowEventEvent = wevent , windowEventData1 = w , windowEventData2 = h } | wevent == windowEventResized -> glViewport 0 0 (fromIntegral w) (fromIntegral h) _ -> return ())
309
false
true
0
14
105
119
60
59
null
null
dreamersdw/fusion
Main.hs
mit
main = play (InWindow "Game of 2048" (800, 600) (100, 100)) (htmlColor "#F9F6EB") 0 (createGameOfSize size) render keyhandler step
143
main = play (InWindow "Game of 2048" (800, 600) (100, 100)) (htmlColor "#F9F6EB") 0 (createGameOfSize size) render keyhandler step
143
main = play (InWindow "Game of 2048" (800, 600) (100, 100)) (htmlColor "#F9F6EB") 0 (createGameOfSize size) render keyhandler step
143
false
false
1
8
31
58
29
29
null
null
Rathcke/uni
ap/advanced programming/exam/src/subs/SimpleParse.hs
gpl-3.0
-- Lexical combinators: ---------------------------------------------- space :: Parser Char space = satisfy isSpace
137
space :: Parser Char space = satisfy isSpace
65
space = satisfy isSpace
34
true
true
0
5
33
18
9
9
null
null
matthieu/witty
haskell/src/types.hs
apache-2.0
showWy (WyLambda ss ast env) = return $ "lambda(" ++ (show ss) ++ ", " ++ (show ast) ++ ")"
91
showWy (WyLambda ss ast env) = return $ "lambda(" ++ (show ss) ++ ", " ++ (show ast) ++ ")"
91
showWy (WyLambda ss ast env) = return $ "lambda(" ++ (show ss) ++ ", " ++ (show ast) ++ ")"
91
false
false
0
10
19
52
25
27
null
null
karamellpelle/grid
source/Game/Font.hs
gpl-3.0
-- | draw FontObject at 3D-pos. fontDrawObject3D :: FontShade -> FontObject -> Float -> Float -> Float -> IO () fontDrawObject3D sh fo x y z = do -- stencil glActiveTexture gl_TEXTURE0 glBindTexture gl_TEXTURE_2D $ fontobjectStencil fo -- size glUniform2f (fontShadeUniCharSize sh) (rTF $ fontobjectCharSizeX fo) (rTF $ fontobjectCharSizeY fo) -- color case fontobjectColor fo of FontColor r g b a -> glUniform4f (fontShadeUniCharSize sh) r g b a -- translate glUniform2f (fontShadeUniTranslate sh) 0.0 0.0 fontDrawObject3D' sh fo x y z -- | draw FontObject at 3D-pos.
677
fontDrawObject3D :: FontShade -> FontObject -> Float -> Float -> Float -> IO () fontDrawObject3D sh fo x y z = do -- stencil glActiveTexture gl_TEXTURE0 glBindTexture gl_TEXTURE_2D $ fontobjectStencil fo -- size glUniform2f (fontShadeUniCharSize sh) (rTF $ fontobjectCharSizeX fo) (rTF $ fontobjectCharSizeY fo) -- color case fontobjectColor fo of FontColor r g b a -> glUniform4f (fontShadeUniCharSize sh) r g b a -- translate glUniform2f (fontShadeUniTranslate sh) 0.0 0.0 fontDrawObject3D' sh fo x y z -- | draw FontObject at 3D-pos.
645
fontDrawObject3D sh fo x y z = do -- stencil glActiveTexture gl_TEXTURE0 glBindTexture gl_TEXTURE_2D $ fontobjectStencil fo -- size glUniform2f (fontShadeUniCharSize sh) (rTF $ fontobjectCharSizeX fo) (rTF $ fontobjectCharSizeY fo) -- color case fontobjectColor fo of FontColor r g b a -> glUniform4f (fontShadeUniCharSize sh) r g b a -- translate glUniform2f (fontShadeUniTranslate sh) 0.0 0.0 fontDrawObject3D' sh fo x y z -- | draw FontObject at 3D-pos.
565
true
true
0
12
196
180
85
95
null
null
green-haskell/ghc
compiler/coreSyn/CoreUnfold.hs
bsd-3-clause
mkInlinableUnfolding :: DynFlags -> CoreExpr -> Unfolding mkInlinableUnfolding dflags expr = mkUnfolding dflags InlineStable True is_bot expr' where expr' = simpleOptExpr expr is_bot = isJust (exprBotStrictness_maybe expr')
235
mkInlinableUnfolding :: DynFlags -> CoreExpr -> Unfolding mkInlinableUnfolding dflags expr = mkUnfolding dflags InlineStable True is_bot expr' where expr' = simpleOptExpr expr is_bot = isJust (exprBotStrictness_maybe expr')
235
mkInlinableUnfolding dflags expr = mkUnfolding dflags InlineStable True is_bot expr' where expr' = simpleOptExpr expr is_bot = isJust (exprBotStrictness_maybe expr')
177
false
true
1
7
38
62
29
33
null
null
NCrashed/hjass
src/library/Language/Jass/CAPI/JIT/Module.hs
mit
insertIntoJITModuleTable :: MonadIO m => JITModule -> m CJITModule insertIntoJITModuleTable module' = do (i, tbl) <- liftIO $ readIORef jitModuleTable liftIO $ writeIORef jitModuleTable (i+1, HM.insert i module' tbl) return i
231
insertIntoJITModuleTable :: MonadIO m => JITModule -> m CJITModule insertIntoJITModuleTable module' = do (i, tbl) <- liftIO $ readIORef jitModuleTable liftIO $ writeIORef jitModuleTable (i+1, HM.insert i module' tbl) return i
231
insertIntoJITModuleTable module' = do (i, tbl) <- liftIO $ readIORef jitModuleTable liftIO $ writeIORef jitModuleTable (i+1, HM.insert i module' tbl) return i
164
false
true
0
11
36
85
40
45
null
null
raboof/xmobar
src/Plugins/Monitors/Common.hs
bsd-3-clause
skipTillString :: String -> Parser String skipTillString s = manyTill skipRestOfLine $ string s
99
skipTillString :: String -> Parser String skipTillString s = manyTill skipRestOfLine $ string s
99
skipTillString s = manyTill skipRestOfLine $ string s
57
false
true
0
7
17
35
15
20
null
null
Thhethssmuz/ppp
src/Filter/Attr.hs
mit
inline :: Inline -> Inline inline (Code a x) = Code (simplify a) x
66
inline :: Inline -> Inline inline (Code a x) = Code (simplify a) x
66
inline (Code a x) = Code (simplify a) x
39
false
true
0
7
13
41
19
22
null
null
rueshyna/gogol
gogol-books/gen/Network/Google/Resource/Books/Volumes/List.hs
mpl-2.0
-- | Restrict and brand results for partner ID. vlPartner :: Lens' VolumesList (Maybe Text) vlPartner = lens _vlPartner (\ s a -> s{_vlPartner = a})
150
vlPartner :: Lens' VolumesList (Maybe Text) vlPartner = lens _vlPartner (\ s a -> s{_vlPartner = a})
102
vlPartner = lens _vlPartner (\ s a -> s{_vlPartner = a})
58
true
true
0
9
27
48
25
23
null
null
jbearer/hspl
src/Control/Hspl/Internal/Logic.hs
mit
-- | Analagous to 'runAllLogicT'. runAllLogic :: SplittableState s => Logic s a -> s -> [(a, s)] runAllLogic m s = runIdentity $ runAllLogicT m s
145
runAllLogic :: SplittableState s => Logic s a -> s -> [(a, s)] runAllLogic m s = runIdentity $ runAllLogicT m s
111
runAllLogic m s = runIdentity $ runAllLogicT m s
48
true
true
0
11
26
60
29
31
null
null
mcschroeder/ghc
compiler/hsSyn/HsBinds.hs
bsd-3-clause
hasSpecPrags IsDefaultMethod = False
36
hasSpecPrags IsDefaultMethod = False
36
hasSpecPrags IsDefaultMethod = False
36
false
false
0
4
3
10
4
6
null
null
ninjazoete/learnmehaskell
Collatz.hs
bsd-3-clause
collatz :: (Integral a) => a -> [a] collatz 1 = [1]
51
collatz :: (Integral a) => a -> [a] collatz 1 = [1]
51
collatz 1 = [1]
15
false
true
0
9
11
39
19
20
null
null
johnyhlee/media-tracker
src/Main.hs
gpl-2.0
performAction :: String -> IO String performAction "cap" = trackCap
67
performAction :: String -> IO String performAction "cap" = trackCap
67
performAction "cap" = trackCap
30
false
true
0
6
9
21
10
11
null
null
mumuki/mulang
src/Language/Mulang/Signature.hs
gpl-3.0
signatureOf (Clause name args _) = Just $ AritySignature name (length args)
92
signatureOf (Clause name args _) = Just $ AritySignature name (length args)
92
signatureOf (Clause name args _) = Just $ AritySignature name (length args)
92
false
false
0
8
28
35
16
19
null
null
taksuyu/game-of-ur
tests/Test/Game/Ur.hs
bsd-3-clause
newUrBoard :: IO UrBoard newUrBoard = UrBoard <$> join (newIORef <$> newBoard)
78
newUrBoard :: IO UrBoard newUrBoard = UrBoard <$> join (newIORef <$> newBoard)
78
newUrBoard = UrBoard <$> join (newIORef <$> newBoard)
53
false
true
0
8
11
28
14
14
null
null
olsner/ghc
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
isVecExpr _ = False
50
isVecExpr _ = False
50
isVecExpr _ = False
50
false
false
0
4
34
10
4
6
null
null
diesys/config
XMonad/xmonad.hs
gpl-3.0
-- Width of the window border in pixels. -- myBorderWidth = 2
63
myBorderWidth = 2
19
myBorderWidth = 2
19
true
false
1
5
13
12
5
7
null
null
hucal/SCMinHS
Scheme/Eval.hs
bsd-3-clause
makeVarargs :: LispVal -> Env -> [LispVal] -> [LispVal] -> ThrowsErrorIO LispVal makeVarargs = makeFunc . Just
110
makeVarargs :: LispVal -> Env -> [LispVal] -> [LispVal] -> ThrowsErrorIO LispVal makeVarargs = makeFunc . Just
110
makeVarargs = makeFunc . Just
29
false
true
0
9
16
40
21
19
null
null
michaelgwelch/bacnet
test/BACnet/WriterSpec.hs
mit
spec :: Spec spec = do describe "writeNullAP" $ it "writes [0x00]" $ writeNullAP `shouldWrite` [0x00] describe "writeNullCS" $ it "writeNullCS 254 should write [0xF8, 0xFE]" $ writeNullCS 254 `shouldWrite` [0xF8, 0xFE] describe "writeBoolAP" $ do it "writes [0x10] for Bool input False" $ writeBoolAP False `shouldWrite` [0x10] it "writes [0x11] for Bool input True" $ writeBoolAP True `shouldWrite` [0x11] describe "writeUnsignedAP" $ do it "writes [0x21, 0x00] for input 0" $ writeUnsignedAP 0 `shouldWrite` [0x21, 0x00] it "writes [0x21, 0xFF] for input 255" $ writeUnsignedAP 255 `shouldWrite` [0x21, 0xFF] it "writes [0x22, 0x01, 0x00] for input 256" $ writeUnsignedAP 256 `shouldWrite` [0x22, 0x01, 0x00] it "writes [0x22, 0xFF, 0xFF] for input 65535" $ writeUnsignedAP 65535 `shouldWrite` [0x22, 0xFF, 0xFF] it "writes [0x23, 0x01, 0x00, 0x00] for input 65536" $ writeUnsignedAP 65536 `shouldWrite` [0x23, 0x01, 0x00, 0x00] it "writes [0x23, 0xFF, 0xFF, 0xFF] for input 16777215" $ writeUnsignedAP 16777215 `shouldWrite` [0x23, 0xFF, 0xFF, 0xFF] it "writes [0x24, 0x01, 0x00, 0x00, 0x00] for input 16777216" $ writeUnsignedAP 16777216 `shouldWrite` [0x24, 0x01, 0x00, 0x00, 0x00] describe "writeSignedAP" $ do it "writes [0x31, 0x00] for input 0" $ writeSignedAP 0 `shouldWrite` [0x31, 0x00] it "writes [0x31, 0x7F] for input 127" $ writeSignedAP 127 `shouldWrite` [0x31, 0x7F] it "writes [0x32, 0x00, 0x80] for input 128" $ writeSignedAP 128 `shouldWrite` [0x32, 0x00, 0x80] it "writes [0x32, 0x7F, 0xFF] for input 32767" $ writeSignedAP 32767 `shouldWrite` [0x32, 0x7F, 0xFF] it "writes [0x31, 0xFF] for input -1" $ writeSignedAP (-1) `shouldWrite` [0x31, 0xFF] it "writes [0x31, 0x80] for input -128" $ writeSignedAP (-128) `shouldWrite` [0x31, 0x80] it "writes [0x32, 0xFF, 0x7F] for input -129" $ writeSignedAP (-129) `shouldWrite` [0x32, 0xFF, 0x7F] it "writes [0x32, 0x80, 0x00] for input -32768" $ writeSignedAP (-32768) `shouldWrite` [0x32, 0x80, 0x00] it "writes [0x33, 0xFF, 0x7F, 0xFF] for input -32769" $ writeSignedAP (-32769) `shouldWrite` [0x33, 0xFF, 0x7F, 0xFF] it "writes [0x33, 0x80, 0x00, 0x00] for input -8388608" $ writeSignedAP (-8388608) `shouldWrite` [0x33, 0x80, 0x00, 0x00] it "writes [0x34, 0xFF, 0x7F, 0xFf, 0xFF] for input -8388609" $ writeSignedAP (-8388609) `shouldWrite` [0x34, 0xFF, 0x7F, 0xFF, 0xFF] it "writes [0x34, 0x80, 0x00, 0x00, 0x00] for input -2147483648" $ writeSignedAP (minBound :: Int32) `shouldWrite` [0x34, 0x80, 0x00, 0x00, 0x00] describe "writeRealAP" $ do it "writes [0x44, 0x00, 0x00, 0x00, 0x01] for input 1.4e-45" $ writeRealAP 1.4e-45 `shouldWrite` [0x44, 0x00, 0x00, 0x00, 0x01] it "writes [0x44, 0x7F, 0x7F, 0xFF, 0xFF] for input 3.4028235E38" $ writeRealAP 3.4028235E38 `shouldWrite` [0x44, 0x7F, 0x7F, 0xFF, 0xFF] it "writes [0x44, 0xFF, 0x80, 0x00, 0x00] for input -infinity" $ writeRealAP (-1.0/0.0) `shouldWrite` [0x44, 0xFF, 0x80, 0x00, 0x00] describe "writeDoubleAP" $ do it "writes [0x55, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01] for input 4.9E-324" $ writeDoubleAP 4.9E-324 `shouldWrite` [0x55, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01] it "writes [0x55, 0x08, 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] for infinity" $ writeDoubleAP (1.0/0.0) `shouldWrite` [0x55, 0x08, 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] describe "writeOctetStringAP" $ do it "writes [0x60] for empty Octet string" $ writeOctetStringAP [] `shouldWrite` [0x60] it "writes [0x61, 0xAA] for singleton string [0xAA]" $ writeOctetStringAP [0xAA] `shouldWrite` [0x61, 0xAA] it "writes [0x65, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06] for string [0x01, 0x02, 0x03, 0x04, 0x05, 0x06]" $ writeOctetStringAP [0x01, 0x02, 0x03, 0x04, 0x05, 0x06] `shouldWrite` [0x65, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06] it "writes [0x65, 0xFD] ++ bs for input bs where bs is a string of length 253" $ writeOctetStringAP (replicate 253 17) `shouldWrite` ([0x65, 0xFD] ++ replicate 253 17) it "writes [0x65, 0xFE, 0x00, 0xFE] ++ bs for input bs where bs is a string of length 254" $ writeOctetStringAP (replicate 254 18) `shouldWrite` ([0x65, 0xFE, 0x00, 0xFE] ++ replicate 254 18) it "writes [0x65, 0xFF, 0x00, 0x01, 0x00, 0x00] as the tag for a string of length 65536" $ writeOctetStringAP (replicate 65536 19) `shouldWrite` ([0x65, 0xFF, 0x00, 0x01, 0x00, 0x00] ++ replicate 65536 19) describe "writeStringAP" $ do it "writes [0x71, 0x00] for empty string" $ writeStringAP "" `shouldWrite` [0x71, 0x00] it "writes [0x73, 0x00, 0x48, 0x49] for \"HI\"" $ writeStringAP "HI" `shouldWrite` [0x73, 0x00, 0x48, 0x49] describe "writeBitStringAP" $ do it "writes [0x81, 0x00] for empty bit string" $ writeBitStringAP bitStringEmpty `shouldWrite` [0x81, 0x00] it "writes [0x85, 0x05, 0x03, 0x01, 0x02, 0x03, 0xF0] for input BitString 3 [0x01, 0x02, 0x03, 0xF0]" $ writeBitStringAP (fromJust $ bitString 3 [0x01, 0x02, 0x03, 0xF0]) `shouldWrite` [0x85, 0x05, 0x03, 0x01, 0x02, 0x03, 0xF0] describe "writeEnumeratedAP" $ it "writes [0x91, 0x00] for 0" $ writeEnumeratedAP (Enumerated 0) `shouldWrite` [0x91, 0x00] describe "writeDateAP" $ it "writes [0xA4, 0x72, 0x04, 0x06, 0xFF] for Date 114 4 6 255" $ writeDateAP (Date 114 4 6 255) `shouldWrite` [0xA4, 0x72, 0x04, 0x06, 0xFF] describe "writeTimeAP" $ it "writes [0xB4, 0x09, 0x1A, 0x13, 0xFF] for Time 9 26 19 255" $ writeTimeAP (Time 9 26 19 255) `shouldWrite` [0xB4, 0x09, 0x1A, 0x13, 0xFF] describe "writeObjectIdentifierAP" $ it "writes [0xC4, 0x01, 0x00, 0x00, 0xFF] for ObjectIdentifier 4 255" $ writeObjectIdentifierAP (fromJust $ objectIdentifier 4 255) `shouldWrite` [0xC4, 0x01, 0x00, 0x00, 0xFF] describe "writeAnyAP" $ do it "writes Null" $ writeAnyAP NullAP `shouldWrite` [0x00] it "writes Bool" $ writeAnyAP (BooleanAP True) `shouldWrite` [0x11] it "writes Unsigned" $ writeAnyAP (UnsignedAP 0x1234) `shouldWrite` [0x22, 0x12, 0x34] it "writes Signed" $ writeAnyAP (SignedAP 0x7764) `shouldWrite` [0x32, 0x77, 0x64] it "writes Real" $ writeAnyAP (RealAP 2.138e19) `shouldWrite` [68,95,148,90,130] it "writes Double" $ writeAnyAP (DoubleAP 3.123e245) `shouldWrite` [85,8,114,230,222,113,2,8,2,207] it "writes OctetString" $ writeAnyAP (OctetStringAP [0x23, 0xFF]) `shouldWrite` [0x62,0x23,0xFF] it "writes String" $ writeAnyAP (CharacterStringAP "HI") `shouldWrite` [0x73,0,72,73] it "writes BitString" $ writeAnyAP (BitStringAP . fromJust $ bitString 3 [0x99,0x34]) `shouldWrite` [0x83,0x03,0x99,0x34] it "writes Enumerated" $ writeAnyAP (EnumeratedAP $ Enumerated 0xFF8345) `shouldWrite` [0x93,0xFF,0x83,0x45] it "writes Date" $ writeAnyAP (DateAP $ Date 7 9 10 11) `shouldWrite` [0xa4,7,9,10,11] it "writes Time" $ writeAnyAP (TimeAP $ Time 1 5 7 12) `shouldWrite` [0xb4,1,5,7,12] it "writes ObjectIdentifier" $ writeAnyAP (ObjectIdentifierAP . fromJust $ objectIdentifier 3 12) `shouldWrite` [0xc4, 0x00, 0xC0, 0x00, 0x0C] describe "Writer" $ context "Is a Monoid" $ do it "obeys the law mempty <> writer = writer" $ property $ \w -> mempty <> w == (w :: Writer) it "obeys the law writer <> mempty = writer" $ property $ \w -> w <> mempty == (w :: Writer) it "is associative" $ property $ \x y z -> (x <> y) <> (z :: Writer) == x <> (y <> z) -- Orphan instance since I don't want to be dependent on -- Arbitrary in my core library when it's only useful in tests.
8,339
spec :: Spec spec = do describe "writeNullAP" $ it "writes [0x00]" $ writeNullAP `shouldWrite` [0x00] describe "writeNullCS" $ it "writeNullCS 254 should write [0xF8, 0xFE]" $ writeNullCS 254 `shouldWrite` [0xF8, 0xFE] describe "writeBoolAP" $ do it "writes [0x10] for Bool input False" $ writeBoolAP False `shouldWrite` [0x10] it "writes [0x11] for Bool input True" $ writeBoolAP True `shouldWrite` [0x11] describe "writeUnsignedAP" $ do it "writes [0x21, 0x00] for input 0" $ writeUnsignedAP 0 `shouldWrite` [0x21, 0x00] it "writes [0x21, 0xFF] for input 255" $ writeUnsignedAP 255 `shouldWrite` [0x21, 0xFF] it "writes [0x22, 0x01, 0x00] for input 256" $ writeUnsignedAP 256 `shouldWrite` [0x22, 0x01, 0x00] it "writes [0x22, 0xFF, 0xFF] for input 65535" $ writeUnsignedAP 65535 `shouldWrite` [0x22, 0xFF, 0xFF] it "writes [0x23, 0x01, 0x00, 0x00] for input 65536" $ writeUnsignedAP 65536 `shouldWrite` [0x23, 0x01, 0x00, 0x00] it "writes [0x23, 0xFF, 0xFF, 0xFF] for input 16777215" $ writeUnsignedAP 16777215 `shouldWrite` [0x23, 0xFF, 0xFF, 0xFF] it "writes [0x24, 0x01, 0x00, 0x00, 0x00] for input 16777216" $ writeUnsignedAP 16777216 `shouldWrite` [0x24, 0x01, 0x00, 0x00, 0x00] describe "writeSignedAP" $ do it "writes [0x31, 0x00] for input 0" $ writeSignedAP 0 `shouldWrite` [0x31, 0x00] it "writes [0x31, 0x7F] for input 127" $ writeSignedAP 127 `shouldWrite` [0x31, 0x7F] it "writes [0x32, 0x00, 0x80] for input 128" $ writeSignedAP 128 `shouldWrite` [0x32, 0x00, 0x80] it "writes [0x32, 0x7F, 0xFF] for input 32767" $ writeSignedAP 32767 `shouldWrite` [0x32, 0x7F, 0xFF] it "writes [0x31, 0xFF] for input -1" $ writeSignedAP (-1) `shouldWrite` [0x31, 0xFF] it "writes [0x31, 0x80] for input -128" $ writeSignedAP (-128) `shouldWrite` [0x31, 0x80] it "writes [0x32, 0xFF, 0x7F] for input -129" $ writeSignedAP (-129) `shouldWrite` [0x32, 0xFF, 0x7F] it "writes [0x32, 0x80, 0x00] for input -32768" $ writeSignedAP (-32768) `shouldWrite` [0x32, 0x80, 0x00] it "writes [0x33, 0xFF, 0x7F, 0xFF] for input -32769" $ writeSignedAP (-32769) `shouldWrite` [0x33, 0xFF, 0x7F, 0xFF] it "writes [0x33, 0x80, 0x00, 0x00] for input -8388608" $ writeSignedAP (-8388608) `shouldWrite` [0x33, 0x80, 0x00, 0x00] it "writes [0x34, 0xFF, 0x7F, 0xFf, 0xFF] for input -8388609" $ writeSignedAP (-8388609) `shouldWrite` [0x34, 0xFF, 0x7F, 0xFF, 0xFF] it "writes [0x34, 0x80, 0x00, 0x00, 0x00] for input -2147483648" $ writeSignedAP (minBound :: Int32) `shouldWrite` [0x34, 0x80, 0x00, 0x00, 0x00] describe "writeRealAP" $ do it "writes [0x44, 0x00, 0x00, 0x00, 0x01] for input 1.4e-45" $ writeRealAP 1.4e-45 `shouldWrite` [0x44, 0x00, 0x00, 0x00, 0x01] it "writes [0x44, 0x7F, 0x7F, 0xFF, 0xFF] for input 3.4028235E38" $ writeRealAP 3.4028235E38 `shouldWrite` [0x44, 0x7F, 0x7F, 0xFF, 0xFF] it "writes [0x44, 0xFF, 0x80, 0x00, 0x00] for input -infinity" $ writeRealAP (-1.0/0.0) `shouldWrite` [0x44, 0xFF, 0x80, 0x00, 0x00] describe "writeDoubleAP" $ do it "writes [0x55, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01] for input 4.9E-324" $ writeDoubleAP 4.9E-324 `shouldWrite` [0x55, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01] it "writes [0x55, 0x08, 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] for infinity" $ writeDoubleAP (1.0/0.0) `shouldWrite` [0x55, 0x08, 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] describe "writeOctetStringAP" $ do it "writes [0x60] for empty Octet string" $ writeOctetStringAP [] `shouldWrite` [0x60] it "writes [0x61, 0xAA] for singleton string [0xAA]" $ writeOctetStringAP [0xAA] `shouldWrite` [0x61, 0xAA] it "writes [0x65, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06] for string [0x01, 0x02, 0x03, 0x04, 0x05, 0x06]" $ writeOctetStringAP [0x01, 0x02, 0x03, 0x04, 0x05, 0x06] `shouldWrite` [0x65, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06] it "writes [0x65, 0xFD] ++ bs for input bs where bs is a string of length 253" $ writeOctetStringAP (replicate 253 17) `shouldWrite` ([0x65, 0xFD] ++ replicate 253 17) it "writes [0x65, 0xFE, 0x00, 0xFE] ++ bs for input bs where bs is a string of length 254" $ writeOctetStringAP (replicate 254 18) `shouldWrite` ([0x65, 0xFE, 0x00, 0xFE] ++ replicate 254 18) it "writes [0x65, 0xFF, 0x00, 0x01, 0x00, 0x00] as the tag for a string of length 65536" $ writeOctetStringAP (replicate 65536 19) `shouldWrite` ([0x65, 0xFF, 0x00, 0x01, 0x00, 0x00] ++ replicate 65536 19) describe "writeStringAP" $ do it "writes [0x71, 0x00] for empty string" $ writeStringAP "" `shouldWrite` [0x71, 0x00] it "writes [0x73, 0x00, 0x48, 0x49] for \"HI\"" $ writeStringAP "HI" `shouldWrite` [0x73, 0x00, 0x48, 0x49] describe "writeBitStringAP" $ do it "writes [0x81, 0x00] for empty bit string" $ writeBitStringAP bitStringEmpty `shouldWrite` [0x81, 0x00] it "writes [0x85, 0x05, 0x03, 0x01, 0x02, 0x03, 0xF0] for input BitString 3 [0x01, 0x02, 0x03, 0xF0]" $ writeBitStringAP (fromJust $ bitString 3 [0x01, 0x02, 0x03, 0xF0]) `shouldWrite` [0x85, 0x05, 0x03, 0x01, 0x02, 0x03, 0xF0] describe "writeEnumeratedAP" $ it "writes [0x91, 0x00] for 0" $ writeEnumeratedAP (Enumerated 0) `shouldWrite` [0x91, 0x00] describe "writeDateAP" $ it "writes [0xA4, 0x72, 0x04, 0x06, 0xFF] for Date 114 4 6 255" $ writeDateAP (Date 114 4 6 255) `shouldWrite` [0xA4, 0x72, 0x04, 0x06, 0xFF] describe "writeTimeAP" $ it "writes [0xB4, 0x09, 0x1A, 0x13, 0xFF] for Time 9 26 19 255" $ writeTimeAP (Time 9 26 19 255) `shouldWrite` [0xB4, 0x09, 0x1A, 0x13, 0xFF] describe "writeObjectIdentifierAP" $ it "writes [0xC4, 0x01, 0x00, 0x00, 0xFF] for ObjectIdentifier 4 255" $ writeObjectIdentifierAP (fromJust $ objectIdentifier 4 255) `shouldWrite` [0xC4, 0x01, 0x00, 0x00, 0xFF] describe "writeAnyAP" $ do it "writes Null" $ writeAnyAP NullAP `shouldWrite` [0x00] it "writes Bool" $ writeAnyAP (BooleanAP True) `shouldWrite` [0x11] it "writes Unsigned" $ writeAnyAP (UnsignedAP 0x1234) `shouldWrite` [0x22, 0x12, 0x34] it "writes Signed" $ writeAnyAP (SignedAP 0x7764) `shouldWrite` [0x32, 0x77, 0x64] it "writes Real" $ writeAnyAP (RealAP 2.138e19) `shouldWrite` [68,95,148,90,130] it "writes Double" $ writeAnyAP (DoubleAP 3.123e245) `shouldWrite` [85,8,114,230,222,113,2,8,2,207] it "writes OctetString" $ writeAnyAP (OctetStringAP [0x23, 0xFF]) `shouldWrite` [0x62,0x23,0xFF] it "writes String" $ writeAnyAP (CharacterStringAP "HI") `shouldWrite` [0x73,0,72,73] it "writes BitString" $ writeAnyAP (BitStringAP . fromJust $ bitString 3 [0x99,0x34]) `shouldWrite` [0x83,0x03,0x99,0x34] it "writes Enumerated" $ writeAnyAP (EnumeratedAP $ Enumerated 0xFF8345) `shouldWrite` [0x93,0xFF,0x83,0x45] it "writes Date" $ writeAnyAP (DateAP $ Date 7 9 10 11) `shouldWrite` [0xa4,7,9,10,11] it "writes Time" $ writeAnyAP (TimeAP $ Time 1 5 7 12) `shouldWrite` [0xb4,1,5,7,12] it "writes ObjectIdentifier" $ writeAnyAP (ObjectIdentifierAP . fromJust $ objectIdentifier 3 12) `shouldWrite` [0xc4, 0x00, 0xC0, 0x00, 0x0C] describe "Writer" $ context "Is a Monoid" $ do it "obeys the law mempty <> writer = writer" $ property $ \w -> mempty <> w == (w :: Writer) it "obeys the law writer <> mempty = writer" $ property $ \w -> w <> mempty == (w :: Writer) it "is associative" $ property $ \x y z -> (x <> y) <> (z :: Writer) == x <> (y <> z) -- Orphan instance since I don't want to be dependent on -- Arbitrary in my core library when it's only useful in tests.
8,339
spec = do describe "writeNullAP" $ it "writes [0x00]" $ writeNullAP `shouldWrite` [0x00] describe "writeNullCS" $ it "writeNullCS 254 should write [0xF8, 0xFE]" $ writeNullCS 254 `shouldWrite` [0xF8, 0xFE] describe "writeBoolAP" $ do it "writes [0x10] for Bool input False" $ writeBoolAP False `shouldWrite` [0x10] it "writes [0x11] for Bool input True" $ writeBoolAP True `shouldWrite` [0x11] describe "writeUnsignedAP" $ do it "writes [0x21, 0x00] for input 0" $ writeUnsignedAP 0 `shouldWrite` [0x21, 0x00] it "writes [0x21, 0xFF] for input 255" $ writeUnsignedAP 255 `shouldWrite` [0x21, 0xFF] it "writes [0x22, 0x01, 0x00] for input 256" $ writeUnsignedAP 256 `shouldWrite` [0x22, 0x01, 0x00] it "writes [0x22, 0xFF, 0xFF] for input 65535" $ writeUnsignedAP 65535 `shouldWrite` [0x22, 0xFF, 0xFF] it "writes [0x23, 0x01, 0x00, 0x00] for input 65536" $ writeUnsignedAP 65536 `shouldWrite` [0x23, 0x01, 0x00, 0x00] it "writes [0x23, 0xFF, 0xFF, 0xFF] for input 16777215" $ writeUnsignedAP 16777215 `shouldWrite` [0x23, 0xFF, 0xFF, 0xFF] it "writes [0x24, 0x01, 0x00, 0x00, 0x00] for input 16777216" $ writeUnsignedAP 16777216 `shouldWrite` [0x24, 0x01, 0x00, 0x00, 0x00] describe "writeSignedAP" $ do it "writes [0x31, 0x00] for input 0" $ writeSignedAP 0 `shouldWrite` [0x31, 0x00] it "writes [0x31, 0x7F] for input 127" $ writeSignedAP 127 `shouldWrite` [0x31, 0x7F] it "writes [0x32, 0x00, 0x80] for input 128" $ writeSignedAP 128 `shouldWrite` [0x32, 0x00, 0x80] it "writes [0x32, 0x7F, 0xFF] for input 32767" $ writeSignedAP 32767 `shouldWrite` [0x32, 0x7F, 0xFF] it "writes [0x31, 0xFF] for input -1" $ writeSignedAP (-1) `shouldWrite` [0x31, 0xFF] it "writes [0x31, 0x80] for input -128" $ writeSignedAP (-128) `shouldWrite` [0x31, 0x80] it "writes [0x32, 0xFF, 0x7F] for input -129" $ writeSignedAP (-129) `shouldWrite` [0x32, 0xFF, 0x7F] it "writes [0x32, 0x80, 0x00] for input -32768" $ writeSignedAP (-32768) `shouldWrite` [0x32, 0x80, 0x00] it "writes [0x33, 0xFF, 0x7F, 0xFF] for input -32769" $ writeSignedAP (-32769) `shouldWrite` [0x33, 0xFF, 0x7F, 0xFF] it "writes [0x33, 0x80, 0x00, 0x00] for input -8388608" $ writeSignedAP (-8388608) `shouldWrite` [0x33, 0x80, 0x00, 0x00] it "writes [0x34, 0xFF, 0x7F, 0xFf, 0xFF] for input -8388609" $ writeSignedAP (-8388609) `shouldWrite` [0x34, 0xFF, 0x7F, 0xFF, 0xFF] it "writes [0x34, 0x80, 0x00, 0x00, 0x00] for input -2147483648" $ writeSignedAP (minBound :: Int32) `shouldWrite` [0x34, 0x80, 0x00, 0x00, 0x00] describe "writeRealAP" $ do it "writes [0x44, 0x00, 0x00, 0x00, 0x01] for input 1.4e-45" $ writeRealAP 1.4e-45 `shouldWrite` [0x44, 0x00, 0x00, 0x00, 0x01] it "writes [0x44, 0x7F, 0x7F, 0xFF, 0xFF] for input 3.4028235E38" $ writeRealAP 3.4028235E38 `shouldWrite` [0x44, 0x7F, 0x7F, 0xFF, 0xFF] it "writes [0x44, 0xFF, 0x80, 0x00, 0x00] for input -infinity" $ writeRealAP (-1.0/0.0) `shouldWrite` [0x44, 0xFF, 0x80, 0x00, 0x00] describe "writeDoubleAP" $ do it "writes [0x55, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01] for input 4.9E-324" $ writeDoubleAP 4.9E-324 `shouldWrite` [0x55, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01] it "writes [0x55, 0x08, 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] for infinity" $ writeDoubleAP (1.0/0.0) `shouldWrite` [0x55, 0x08, 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] describe "writeOctetStringAP" $ do it "writes [0x60] for empty Octet string" $ writeOctetStringAP [] `shouldWrite` [0x60] it "writes [0x61, 0xAA] for singleton string [0xAA]" $ writeOctetStringAP [0xAA] `shouldWrite` [0x61, 0xAA] it "writes [0x65, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06] for string [0x01, 0x02, 0x03, 0x04, 0x05, 0x06]" $ writeOctetStringAP [0x01, 0x02, 0x03, 0x04, 0x05, 0x06] `shouldWrite` [0x65, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06] it "writes [0x65, 0xFD] ++ bs for input bs where bs is a string of length 253" $ writeOctetStringAP (replicate 253 17) `shouldWrite` ([0x65, 0xFD] ++ replicate 253 17) it "writes [0x65, 0xFE, 0x00, 0xFE] ++ bs for input bs where bs is a string of length 254" $ writeOctetStringAP (replicate 254 18) `shouldWrite` ([0x65, 0xFE, 0x00, 0xFE] ++ replicate 254 18) it "writes [0x65, 0xFF, 0x00, 0x01, 0x00, 0x00] as the tag for a string of length 65536" $ writeOctetStringAP (replicate 65536 19) `shouldWrite` ([0x65, 0xFF, 0x00, 0x01, 0x00, 0x00] ++ replicate 65536 19) describe "writeStringAP" $ do it "writes [0x71, 0x00] for empty string" $ writeStringAP "" `shouldWrite` [0x71, 0x00] it "writes [0x73, 0x00, 0x48, 0x49] for \"HI\"" $ writeStringAP "HI" `shouldWrite` [0x73, 0x00, 0x48, 0x49] describe "writeBitStringAP" $ do it "writes [0x81, 0x00] for empty bit string" $ writeBitStringAP bitStringEmpty `shouldWrite` [0x81, 0x00] it "writes [0x85, 0x05, 0x03, 0x01, 0x02, 0x03, 0xF0] for input BitString 3 [0x01, 0x02, 0x03, 0xF0]" $ writeBitStringAP (fromJust $ bitString 3 [0x01, 0x02, 0x03, 0xF0]) `shouldWrite` [0x85, 0x05, 0x03, 0x01, 0x02, 0x03, 0xF0] describe "writeEnumeratedAP" $ it "writes [0x91, 0x00] for 0" $ writeEnumeratedAP (Enumerated 0) `shouldWrite` [0x91, 0x00] describe "writeDateAP" $ it "writes [0xA4, 0x72, 0x04, 0x06, 0xFF] for Date 114 4 6 255" $ writeDateAP (Date 114 4 6 255) `shouldWrite` [0xA4, 0x72, 0x04, 0x06, 0xFF] describe "writeTimeAP" $ it "writes [0xB4, 0x09, 0x1A, 0x13, 0xFF] for Time 9 26 19 255" $ writeTimeAP (Time 9 26 19 255) `shouldWrite` [0xB4, 0x09, 0x1A, 0x13, 0xFF] describe "writeObjectIdentifierAP" $ it "writes [0xC4, 0x01, 0x00, 0x00, 0xFF] for ObjectIdentifier 4 255" $ writeObjectIdentifierAP (fromJust $ objectIdentifier 4 255) `shouldWrite` [0xC4, 0x01, 0x00, 0x00, 0xFF] describe "writeAnyAP" $ do it "writes Null" $ writeAnyAP NullAP `shouldWrite` [0x00] it "writes Bool" $ writeAnyAP (BooleanAP True) `shouldWrite` [0x11] it "writes Unsigned" $ writeAnyAP (UnsignedAP 0x1234) `shouldWrite` [0x22, 0x12, 0x34] it "writes Signed" $ writeAnyAP (SignedAP 0x7764) `shouldWrite` [0x32, 0x77, 0x64] it "writes Real" $ writeAnyAP (RealAP 2.138e19) `shouldWrite` [68,95,148,90,130] it "writes Double" $ writeAnyAP (DoubleAP 3.123e245) `shouldWrite` [85,8,114,230,222,113,2,8,2,207] it "writes OctetString" $ writeAnyAP (OctetStringAP [0x23, 0xFF]) `shouldWrite` [0x62,0x23,0xFF] it "writes String" $ writeAnyAP (CharacterStringAP "HI") `shouldWrite` [0x73,0,72,73] it "writes BitString" $ writeAnyAP (BitStringAP . fromJust $ bitString 3 [0x99,0x34]) `shouldWrite` [0x83,0x03,0x99,0x34] it "writes Enumerated" $ writeAnyAP (EnumeratedAP $ Enumerated 0xFF8345) `shouldWrite` [0x93,0xFF,0x83,0x45] it "writes Date" $ writeAnyAP (DateAP $ Date 7 9 10 11) `shouldWrite` [0xa4,7,9,10,11] it "writes Time" $ writeAnyAP (TimeAP $ Time 1 5 7 12) `shouldWrite` [0xb4,1,5,7,12] it "writes ObjectIdentifier" $ writeAnyAP (ObjectIdentifierAP . fromJust $ objectIdentifier 3 12) `shouldWrite` [0xc4, 0x00, 0xC0, 0x00, 0x0C] describe "Writer" $ context "Is a Monoid" $ do it "obeys the law mempty <> writer = writer" $ property $ \w -> mempty <> w == (w :: Writer) it "obeys the law writer <> mempty = writer" $ property $ \w -> w <> mempty == (w :: Writer) it "is associative" $ property $ \x y z -> (x <> y) <> (z :: Writer) == x <> (y <> z) -- Orphan instance since I don't want to be dependent on -- Arbitrary in my core library when it's only useful in tests.
8,326
false
true
0
16
2,129
2,293
1,225
1,068
null
null
karamellpelle/MEnv
source/Font.hs
bsd-2-clause
fontDraw3D :: FontShade -> FontData -> Float -> Float -> Float -> String -> IO () fontDraw3D sh fd x y z str = do -- translate glUniform2f (fontShadeUniTranslate sh) 0.0 0.0 fontDraw3D' sh fd x y z str -- | note: undefined behaviour if (valueFontMaxCharacters < length str), probably crash!
306
fontDraw3D :: FontShade -> FontData -> Float -> Float -> Float -> String -> IO () fontDraw3D sh fd x y z str = do -- translate glUniform2f (fontShadeUniTranslate sh) 0.0 0.0 fontDraw3D' sh fd x y z str -- | note: undefined behaviour if (valueFontMaxCharacters < length str), probably crash!
306
fontDraw3D sh fd x y z str = do -- translate glUniform2f (fontShadeUniTranslate sh) 0.0 0.0 fontDraw3D' sh fd x y z str -- | note: undefined behaviour if (valueFontMaxCharacters < length str), probably crash!
224
false
true
0
12
66
87
42
45
null
null
brendanhay/gogol
gogol-adexchange-buyer/gen/Network/Google/AdExchangeBuyer/Types/Product.hs
mpl-2.0
-- | The list of matching proposals. gorProposals :: Lens' GetOrdersResponse [Proposal] gorProposals = lens _gorProposals (\ s a -> s{_gorProposals = a}) . _Default . _Coerce
188
gorProposals :: Lens' GetOrdersResponse [Proposal] gorProposals = lens _gorProposals (\ s a -> s{_gorProposals = a}) . _Default . _Coerce
151
gorProposals = lens _gorProposals (\ s a -> s{_gorProposals = a}) . _Default . _Coerce
100
true
true
3
8
40
59
28
31
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F02.hs
bsd-3-clause
ptr_glBlendEquationSeparateiOES :: FunPtr (GLuint -> GLenum -> GLenum -> IO ()) ptr_glBlendEquationSeparateiOES = unsafePerformIO $ getCommand "glBlendEquationSeparateiOES"
172
ptr_glBlendEquationSeparateiOES :: FunPtr (GLuint -> GLenum -> GLenum -> IO ()) ptr_glBlendEquationSeparateiOES = unsafePerformIO $ getCommand "glBlendEquationSeparateiOES"
172
ptr_glBlendEquationSeparateiOES = unsafePerformIO $ getCommand "glBlendEquationSeparateiOES"
92
false
true
0
11
16
41
20
21
null
null
maximilianhuber/softwareProjekt
src/GalFld/Core/FiniteFields.hs
bsd-3-clause
listFFElem m = map (`FFElem` m)
31
listFFElem m = map (`FFElem` m)
31
listFFElem m = map (`FFElem` m)
31
false
false
1
6
5
22
10
12
null
null
hasufell/CGA
Algebra/Vector.hs
gpl-2.0
-- |Give the point which is at the coordinates the vector -- points to from the origin. vec2Pt :: V2 Double -> P2 Double vec2Pt = p2 . unr2
139
vec2Pt :: V2 Double -> P2 Double vec2Pt = p2 . unr2
51
vec2Pt = p2 . unr2
18
true
true
0
6
28
27
14
13
null
null
ivanperez-keera/SpaceInvaders
src/RenderLandscape.hs
bsd-3-clause
-- Points defining the distant mountain chain. dmPoints :: [HGL.Point] dmPoints = map relativeToGPoint [ (0.00, 0.00), (0.00, 0.62), (0.11, 0.20), (0.42, 0.33), (0.51, 0.24), (0.60, 0.37), (0.68, 0.17), (0.81, 0.26), (0.94, 0.39), (1.00, 0.50), (1.00, 0.00) ]
459
dmPoints :: [HGL.Point] dmPoints = map relativeToGPoint [ (0.00, 0.00), (0.00, 0.62), (0.11, 0.20), (0.42, 0.33), (0.51, 0.24), (0.60, 0.37), (0.68, 0.17), (0.81, 0.26), (0.94, 0.39), (1.00, 0.50), (1.00, 0.00) ]
412
dmPoints = map relativeToGPoint [ (0.00, 0.00), (0.00, 0.62), (0.11, 0.20), (0.42, 0.33), (0.51, 0.24), (0.60, 0.37), (0.68, 0.17), (0.81, 0.26), (0.94, 0.39), (1.00, 0.50), (1.00, 0.00) ]
388
true
true
0
7
237
121
78
43
null
null
elieux/ghc
compiler/main/HscMain.hs
bsd-3-clause
-- | Compile a stmt all the way to an HValue, but don't run it -- -- We return Nothing to indicate an empty statement (or comment only), not a -- parse error. hscStmtWithLocation :: HscEnv -> String -- ^ The statement -> String -- ^ The source -> Int -- ^ Starting line -> IO (Maybe ([Id], IO [HValue], FixityEnv)) hscStmtWithLocation hsc_env0 stmt source linenumber = runInteractiveHsc hsc_env0 $ do maybe_stmt <- hscParseStmtWithLocation source linenumber stmt case maybe_stmt of Nothing -> return Nothing Just parsed_stmt -> do hsc_env <- getHscEnv liftIO $ hscParsedStmt hsc_env parsed_stmt
716
hscStmtWithLocation :: HscEnv -> String -- ^ The statement -> String -- ^ The source -> Int -- ^ Starting line -> IO (Maybe ([Id], IO [HValue], FixityEnv)) hscStmtWithLocation hsc_env0 stmt source linenumber = runInteractiveHsc hsc_env0 $ do maybe_stmt <- hscParseStmtWithLocation source linenumber stmt case maybe_stmt of Nothing -> return Nothing Just parsed_stmt -> do hsc_env <- getHscEnv liftIO $ hscParsedStmt hsc_env parsed_stmt
557
hscStmtWithLocation hsc_env0 stmt source linenumber = runInteractiveHsc hsc_env0 $ do maybe_stmt <- hscParseStmtWithLocation source linenumber stmt case maybe_stmt of Nothing -> return Nothing Just parsed_stmt -> do hsc_env <- getHscEnv liftIO $ hscParsedStmt hsc_env parsed_stmt
318
true
true
0
14
217
135
68
67
null
null
acowley/ghc
compiler/prelude/THNames.hs
bsd-3-clause
tupEIdKey = mkPreludeMiscIdUnique 280
45
tupEIdKey = mkPreludeMiscIdUnique 280
45
tupEIdKey = mkPreludeMiscIdUnique 280
45
false
false
0
5
11
9
4
5
null
null
chrisdone/haskell-trace
src/Language/Haskell/Trace.hs
bsd-3-clause
-------------------------------------------------------------------------------- -- Constants -- | Log file path. Outputs in the current directory for simplicity. logPath :: FilePath logPath = "haskell-trace.log"
213
logPath :: FilePath logPath = "haskell-trace.log"
49
logPath = "haskell-trace.log"
29
true
true
0
6
21
21
10
11
null
null
davidyu/Slowpoke
hs/src/Math/vec.hs
mit
-- Haskell idioms vmap :: (a -> b) -> Vec n a -> Vec n b vmap f (Vec xs) = Vec $ V.map f xs
91
vmap :: (a -> b) -> Vec n a -> Vec n b vmap f (Vec xs) = Vec $ V.map f xs
73
vmap f (Vec xs) = Vec $ V.map f xs
34
true
true
2
10
25
64
30
34
null
null
cernat-catalin/haskellGame
src/GLogger/Client.hs
bsd-3-clause
logDebug :: String -> IO () logDebug string = when enableLogging $ do SL.debugM loggerName string
99
logDebug :: String -> IO () logDebug string = when enableLogging $ do SL.debugM loggerName string
99
logDebug string = when enableLogging $ do SL.debugM loggerName string
71
false
true
0
10
17
45
19
26
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/RTCPeerConnection.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/webkitRTCPeerConnection.onicecandidate Mozilla webkitRTCPeerConnection.onicecandidate documentation> iceCandidate :: EventName RTCPeerConnection RTCIceCandidateEvent iceCandidate = unsafeEventName (toJSString "icecandidate")
280
iceCandidate :: EventName RTCPeerConnection RTCIceCandidateEvent iceCandidate = unsafeEventName (toJSString "icecandidate")
123
iceCandidate = unsafeEventName (toJSString "icecandidate")
58
true
true
0
7
16
26
13
13
null
null
vaibhav276/scheme-compiler
src/Parser.hs
mit
showVal (DottedList head tail) = "(" ++ unwordsList head ++ "." ++ showVal tail ++ ")"
91
showVal (DottedList head tail) = "(" ++ unwordsList head ++ "." ++ showVal tail ++ ")"
91
showVal (DottedList head tail) = "(" ++ unwordsList head ++ "." ++ showVal tail ++ ")"
91
false
false
2
7
20
41
18
23
null
null
zachsully/hakaru
haskell/Language/Hakaru/Types/HClasses.hs
bsd-3-clause
sing_HOrd (HOrd_Array a) = SArray (sing_HOrd a)
51
sing_HOrd (HOrd_Array a) = SArray (sing_HOrd a)
51
sing_HOrd (HOrd_Array a) = SArray (sing_HOrd a)
51
false
false
0
7
10
24
11
13
null
null
jparyani/capnproto-boostpython
compiler/src/BoostPythonGenerator.hs
bsd-2-clause
defaultMask (Int32Desc i) = show i
36
defaultMask (Int32Desc i) = show i
36
defaultMask (Int32Desc i) = show i
36
false
false
0
6
7
19
8
11
null
null
andrewthad/persistent
persistent-mysql/Database/Persist/MySQL.hs
mit
-- Null getGetter MySQLBase.Null = \_ _ -> PersistNull
60
getGetter MySQLBase.Null = \_ _ -> PersistNull
52
getGetter MySQLBase.Null = \_ _ -> PersistNull
52
true
false
0
6
14
19
10
9
null
null
pawel-n/fingertree-tf
Data/FingerTree.hs
bsd-3-clause
-- | Traverse the tree with a function that also takes the -- measure of the prefix of the tree to the left of the element. traverseWithPos :: (Measured a, Measured b, Applicative f) => (Measure a -> a -> f b) -> FingerTree a -> f (FingerTree b) traverseWithPos f = traverseWPTree f mempty
306
traverseWithPos :: (Measured a, Measured b, Applicative f) => (Measure a -> a -> f b) -> FingerTree a -> f (FingerTree b) traverseWithPos f = traverseWPTree f mempty
182
traverseWithPos f = traverseWPTree f mempty
43
true
true
0
10
71
79
39
40
null
null
kcharter/spdy-base
test/BuildParseTests.hs
bsd-3-clause
prop_buildParseDataLength :: DataLength -> Bool prop_buildParseDataLength = prop_buildParse toBuilder parseDataLength
117
prop_buildParseDataLength :: DataLength -> Bool prop_buildParseDataLength = prop_buildParse toBuilder parseDataLength
117
prop_buildParseDataLength = prop_buildParse toBuilder parseDataLength
69
false
true
0
5
9
20
10
10
null
null
et4te/zero
src/Zero/Token.hs
bsd-3-clause
decryptKeyFetchResetBundle :: MonadWidget t m => Event t (BitArray, BitArray, Text) -> m (Event t (Either Text TokenPair)) decryptKeyFetchResetBundle e = do performEvent $ ffor e $ \(key, salt, bundleHex) -> liftIO $ do decryptBundlePair key bundleHex (BundlePairSpec salt "account/reset" "keyfetch/token" "reset/token") -- | Decrypts a ResetToken+PasswordForgotToken bundle.
384
decryptKeyFetchResetBundle :: MonadWidget t m => Event t (BitArray, BitArray, Text) -> m (Event t (Either Text TokenPair)) decryptKeyFetchResetBundle e = do performEvent $ ffor e $ \(key, salt, bundleHex) -> liftIO $ do decryptBundlePair key bundleHex (BundlePairSpec salt "account/reset" "keyfetch/token" "reset/token") -- | Decrypts a ResetToken+PasswordForgotToken bundle.
384
decryptKeyFetchResetBundle e = do performEvent $ ffor e $ \(key, salt, bundleHex) -> liftIO $ do decryptBundlePair key bundleHex (BundlePairSpec salt "account/reset" "keyfetch/token" "reset/token") -- | Decrypts a ResetToken+PasswordForgotToken bundle.
259
false
true
0
14
56
116
58
58
null
null
opentower/carnap
Carnap/src/Carnap/Calculi/NaturalDeduction/Syntax.hs
gpl-3.0
depth (PartialLine _ _ dpth) = dpth
35
depth (PartialLine _ _ dpth) = dpth
35
depth (PartialLine _ _ dpth) = dpth
35
false
false
0
6
6
20
9
11
null
null
mcschroeder/ghc
compiler/coreSyn/PprCore.hs
bsd-3-clause
ppr_expr add_par (Let bind expr) = add_par $ sep [hang (ptext keyword) 2 (ppr_bind noAnn bind <+> text "} in"), pprCoreExpr expr] where keyword = case bind of Rec _ -> (sLit "letrec {") NonRec _ _ -> (sLit "let {")
272
ppr_expr add_par (Let bind expr) = add_par $ sep [hang (ptext keyword) 2 (ppr_bind noAnn bind <+> text "} in"), pprCoreExpr expr] where keyword = case bind of Rec _ -> (sLit "letrec {") NonRec _ _ -> (sLit "let {")
272
ppr_expr add_par (Let bind expr) = add_par $ sep [hang (ptext keyword) 2 (ppr_bind noAnn bind <+> text "} in"), pprCoreExpr expr] where keyword = case bind of Rec _ -> (sLit "letrec {") NonRec _ _ -> (sLit "let {")
272
false
false
0
11
98
107
51
56
null
null
tamarin-prover/tamarin-prover
lib/utils/src/Utils/Misc.hs
gpl-3.0
-- | @fst3 (x, y, z)@ returns the first element @x@ of the triple fst3 :: (a, b, c) -> a fst3 (x, _, _) = x
107
fst3 :: (a, b, c) -> a fst3 (x, _, _) = x
41
fst3 (x, _, _) = x
18
true
true
0
8
26
43
23
20
null
null
bflyblue/eventsource
src/Eventstore/PostgreSQL/Internal/Types.hs
bsd-3-clause
-- TODO: find a better home for these emptyPgState :: PgState emptyPgState = PgState DataCache.empty Map.empty Set.empty
120
emptyPgState :: PgState emptyPgState = PgState DataCache.empty Map.empty Set.empty
82
emptyPgState = PgState DataCache.empty Map.empty Set.empty
58
true
true
0
6
16
25
13
12
null
null
blamario/grampa
grammatical-parsers/examples/Lambda.hs
bsd-2-clause
reduceNormallyP _ x@LambdaP{} = x
33
reduceNormallyP _ x@LambdaP{} = x
33
reduceNormallyP _ x@LambdaP{} = x
33
false
false
0
7
4
22
10
12
null
null
colinba/tip-toi-reveng
src/GMEWriter.hs
mit
putWord8 :: Word8 -> SPut putWord8 w = SPutM (tell (Br.singleton w) >> modify (+1))
83
putWord8 :: Word8 -> SPut putWord8 w = SPutM (tell (Br.singleton w) >> modify (+1))
83
putWord8 w = SPutM (tell (Br.singleton w) >> modify (+1))
57
false
true
0
11
14
46
23
23
null
null