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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
vollmerm/accelerate-apart
|
Data/Array/Accelerate/Apart/Type.hs
|
bsd-3-clause
|
integralTypeToC (TypeWord16 _) = typename "word16"
| 51
|
integralTypeToC (TypeWord16 _) = typename "word16"
| 51
|
integralTypeToC (TypeWord16 _) = typename "word16"
| 51
| false
| false
| 0
| 6
| 6
| 19
| 8
| 11
| null | null |
omefire/lens
|
src/Control/Lens/Indexed.hs
|
bsd-3-clause
|
skip :: a -> ()
skip _ = ()
| 27
|
skip :: a -> ()
skip _ = ()
| 27
|
skip _ = ()
| 11
| false
| true
| 0
| 6
| 8
| 22
| 11
| 11
| null | null |
daherb/Haskell-Muste
|
muste-lib/Muste/Feat.hs
|
artistic-2.0
|
-- generate the i-th tree of a given size and type
featIth :: FEAT -> String -> Int -> Integer -> TTree
featIth f c n i = snd (f c n) i
| 135
|
featIth :: FEAT -> String -> Int -> Integer -> TTree
featIth f c n i = snd (f c n) i
| 84
|
featIth f c n i = snd (f c n) i
| 31
| true
| true
| 0
| 10
| 32
| 57
| 26
| 31
| null | null |
ABorgna/algebra1
|
clases/6.hs
|
gpl-2.0
|
longitud (_:_:_:xs) = 3 + longitud xs
| 37
|
longitud (_:_:_:xs) = 3 + longitud xs
| 37
|
longitud (_:_:_:xs) = 3 + longitud xs
| 37
| false
| false
| 0
| 9
| 6
| 31
| 15
| 16
| null | null |
asmodehn/selfy
|
neuron.hs
|
bsd-3-clause
|
-- | Our provided neuron types: id dot
idNeuron :: Neuron
idNeuron = Neuron id id "id"
| 86
|
idNeuron :: Neuron
idNeuron = Neuron id id "id"
| 47
|
idNeuron = Neuron id id "id"
| 28
| true
| true
| 0
| 5
| 16
| 19
| 10
| 9
| null | null |
kim/amazonka
|
amazonka-redshift/gen/Network/AWS/Redshift/Types.hs
|
mpl-2.0
|
-- | The number of days that automated snapshots are retained in the destination
-- region after they are copied from a source region.
cscsRetentionPeriod :: Lens' ClusterSnapshotCopyStatus (Maybe Integer)
cscsRetentionPeriod =
lens _cscsRetentionPeriod (\s a -> s { _cscsRetentionPeriod = a })
| 298
|
cscsRetentionPeriod :: Lens' ClusterSnapshotCopyStatus (Maybe Integer)
cscsRetentionPeriod =
lens _cscsRetentionPeriod (\s a -> s { _cscsRetentionPeriod = a })
| 163
|
cscsRetentionPeriod =
lens _cscsRetentionPeriod (\s a -> s { _cscsRetentionPeriod = a })
| 92
| true
| true
| 0
| 9
| 46
| 47
| 26
| 21
| null | null |
bruno-cadorette/AdventOfCode
|
Day 21/Types.hs
|
mit
|
armors = [(Armor 0 0), (Armor 1 13), (Armor 2 31), (Armor 3 53), (Armor 4 75), (Armor 5 102)]
| 93
|
armors = [(Armor 0 0), (Armor 1 13), (Armor 2 31), (Armor 3 53), (Armor 4 75), (Armor 5 102)]
| 93
|
armors = [(Armor 0 0), (Armor 1 13), (Armor 2 31), (Armor 3 53), (Armor 4 75), (Armor 5 102)]
| 93
| false
| false
| 0
| 7
| 19
| 72
| 39
| 33
| null | null |
mfpi/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/NV/RegisterCombiners.hs
|
bsd-3-clause
|
gl_COMBINER_BIAS :: GLenum
gl_COMBINER_BIAS = 0x8549
| 52
|
gl_COMBINER_BIAS :: GLenum
gl_COMBINER_BIAS = 0x8549
| 52
|
gl_COMBINER_BIAS = 0x8549
| 25
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
siddhanathan/yi
|
yi-core/src/Yi/Buffer/HighLevel.hs
|
gpl-2.0
|
testHexB :: BufferM Bool
testHexB = savingPointB $ do
untilB_ (not . isHexDigit <$> readB) (moveXorSol 1)
leftChar <- readB
moveXorSol 1
leftToLeftChar <- readB
if leftChar == 'x' && leftToLeftChar == '0'
then return True
else return False
-- | Move point down by @n@ lines
-- If line extends past width of window, count moving
-- a single line as moving width points to the right.
| 410
|
testHexB :: BufferM Bool
testHexB = savingPointB $ do
untilB_ (not . isHexDigit <$> readB) (moveXorSol 1)
leftChar <- readB
moveXorSol 1
leftToLeftChar <- readB
if leftChar == 'x' && leftToLeftChar == '0'
then return True
else return False
-- | Move point down by @n@ lines
-- If line extends past width of window, count moving
-- a single line as moving width points to the right.
| 410
|
testHexB = savingPointB $ do
untilB_ (not . isHexDigit <$> readB) (moveXorSol 1)
leftChar <- readB
moveXorSol 1
leftToLeftChar <- readB
if leftChar == 'x' && leftToLeftChar == '0'
then return True
else return False
-- | Move point down by @n@ lines
-- If line extends past width of window, count moving
-- a single line as moving width points to the right.
| 385
| false
| true
| 0
| 11
| 96
| 95
| 46
| 49
| null | null |
LeifW/rdf4h
|
testsuite/tests/W3C/Manifest.hs
|
bsd-3-clause
|
nextCollectionTriples :: TriplesGraph -> Node -> Triples
nextCollectionTriples rdf tip@(BNodeGen _) = query rdf (Just tip) Nothing Nothing
| 138
|
nextCollectionTriples :: TriplesGraph -> Node -> Triples
nextCollectionTriples rdf tip@(BNodeGen _) = query rdf (Just tip) Nothing Nothing
| 138
|
nextCollectionTriples rdf tip@(BNodeGen _) = query rdf (Just tip) Nothing Nothing
| 81
| false
| true
| 0
| 8
| 17
| 48
| 24
| 24
| null | null |
spwhitton/srem
|
src/Utility/CmdLineRem.hs
|
gpl-3.0
|
parseRelativeTime :: String -> Maybe (Hour, Minute)
parseRelativeTime exp =
case (split . oneOf) "mh" exp of
[h, "h", m, "m", ""] -> sequenceT (readMaybe h, readMaybe m)
[h, "h", ""] -> sequenceT (readMaybe h, Just 0)
[m, "m", ""] -> sequenceT (Just 0, readMaybe m)
[m] -> sequenceT (Just 0, readMaybe m)
_ -> Nothing
| 423
|
parseRelativeTime :: String -> Maybe (Hour, Minute)
parseRelativeTime exp =
case (split . oneOf) "mh" exp of
[h, "h", m, "m", ""] -> sequenceT (readMaybe h, readMaybe m)
[h, "h", ""] -> sequenceT (readMaybe h, Just 0)
[m, "m", ""] -> sequenceT (Just 0, readMaybe m)
[m] -> sequenceT (Just 0, readMaybe m)
_ -> Nothing
| 423
|
parseRelativeTime exp =
case (split . oneOf) "mh" exp of
[h, "h", m, "m", ""] -> sequenceT (readMaybe h, readMaybe m)
[h, "h", ""] -> sequenceT (readMaybe h, Just 0)
[m, "m", ""] -> sequenceT (Just 0, readMaybe m)
[m] -> sequenceT (Just 0, readMaybe m)
_ -> Nothing
| 371
| false
| true
| 6
| 8
| 161
| 172
| 89
| 83
| null | null |
m3mitsuppe/haskell
|
projecteuler/pr002.hs
|
unlicense
|
-- sumEvenFibs max = sum [fib x | x <- [1..], fib x < max, even (fib x)]
sumEvenFibs maxi = sum [fib x | x <- takeWhile check [1..], even (fib x)] where
= fib x < maxi
check2 :: Int -> Int -> Bool
check2 x maxi = fib x < maxi && even (fib x)
| 243
|
sumEvenFibs maxi = sum [fib x | x <- takeWhile check [1..], even (fib x)] where
= fib x < maxi
check2 :: Int -> Int -> Bool
check2 x maxi = fib x < maxi && even (fib x)
| 169
|
sumEvenFibs maxi = sum [fib x | x <- takeWhile check [1..], even (fib x)] where
= fib x < maxi
check2 :: Int -> Int -> Bool
check2 x maxi = fib x < maxi && even (fib x)
| 169
| true
| false
| 0
| 10
| 59
| 105
| 51
| 54
| null | null |
enolan/Idris-dev
|
src/Idris/Reflection.hs
|
bsd-3-clause
|
rawList :: Raw -> [Raw] -> Raw
rawList ty = foldr (rawCons ty) (rawNil ty)
| 74
|
rawList :: Raw -> [Raw] -> Raw
rawList ty = foldr (rawCons ty) (rawNil ty)
| 74
|
rawList ty = foldr (rawCons ty) (rawNil ty)
| 43
| false
| true
| 0
| 8
| 14
| 47
| 22
| 25
| null | null |
f1u77y/xmonad-contrib
|
XMonad/Util/Run.hs
|
bsd-3-clause
|
safeSpawnProg :: MonadIO m => FilePath -> m ()
safeSpawnProg = flip safeSpawn []
| 80
|
safeSpawnProg :: MonadIO m => FilePath -> m ()
safeSpawnProg = flip safeSpawn []
| 80
|
safeSpawnProg = flip safeSpawn []
| 33
| false
| true
| 0
| 8
| 13
| 34
| 16
| 18
| null | null |
adept/hledger
|
hledger-lib/Hledger/Data/Journal.hs
|
gpl-3.0
|
addTransaction :: Transaction -> Journal -> Journal
addTransaction t j = j { jtxns = t : jtxns j }
| 98
|
addTransaction :: Transaction -> Journal -> Journal
addTransaction t j = j { jtxns = t : jtxns j }
| 98
|
addTransaction t j = j { jtxns = t : jtxns j }
| 46
| false
| true
| 0
| 8
| 19
| 39
| 20
| 19
| null | null |
mpwillson/mal
|
haskell/step8_macros.hs
|
mpl-2.0
|
eval_ast :: MalVal -> Env -> IOThrows MalVal
eval_ast sym@(MalSymbol _) env = env_get env sym
| 93
|
eval_ast :: MalVal -> Env -> IOThrows MalVal
eval_ast sym@(MalSymbol _) env = env_get env sym
| 93
|
eval_ast sym@(MalSymbol _) env = env_get env sym
| 48
| false
| true
| 0
| 8
| 15
| 41
| 20
| 21
| null | null |
timtylin/scholdoc
|
src/Text/Pandoc/Writers/Man.hs
|
gpl-2.0
|
-- not supported
inlineToMan opts (Quoted SingleQuote lst) = do
contents <- inlineListToMan opts lst
return $ char '`' <> contents <> char '\''
| 147
|
inlineToMan opts (Quoted SingleQuote lst) = do
contents <- inlineListToMan opts lst
return $ char '`' <> contents <> char '\''
| 130
|
inlineToMan opts (Quoted SingleQuote lst) = do
contents <- inlineListToMan opts lst
return $ char '`' <> contents <> char '\''
| 130
| true
| false
| 0
| 10
| 27
| 53
| 24
| 29
| null | null |
urbanslug/ghc
|
compiler/types/Type.hs
|
bsd-3-clause
|
eqPredX :: RnEnv2 -> PredType -> PredType -> Bool
eqPredX env p1 p2 = isEqual $ cmpTypeX env p1 p2
| 98
|
eqPredX :: RnEnv2 -> PredType -> PredType -> Bool
eqPredX env p1 p2 = isEqual $ cmpTypeX env p1 p2
| 98
|
eqPredX env p1 p2 = isEqual $ cmpTypeX env p1 p2
| 48
| false
| true
| 0
| 9
| 19
| 46
| 21
| 25
| null | null |
myuon/aichan-lvlv
|
Lens.hs
|
mit
|
(&) :: a -> (a -> b) -> b
(&) = flip ($)
| 40
|
(&) :: a -> (a -> b) -> b
(&) = flip ($)
| 40
|
(&) = flip ($)
| 14
| false
| true
| 0
| 9
| 12
| 42
| 22
| 20
| null | null |
byorgey/Idris-dev
|
src/Idris/DSL.hs
|
bsd-3-clause
|
expandDo dsl t = t
| 18
|
expandDo dsl t = t
| 18
|
expandDo dsl t = t
| 18
| false
| false
| 1
| 5
| 4
| 16
| 5
| 11
| null | null |
substack/hs-disappoint
|
src/Language/Haskell/Pointfree/Common.hs
|
mit
|
scomb = Var Pref "ap"
| 22
|
scomb = Var Pref "ap"
| 22
|
scomb = Var Pref "ap"
| 22
| false
| false
| 0
| 5
| 5
| 11
| 5
| 6
| null | null |
alexeyzab/haskell-hangman
|
src/Hangman.hs
|
bsd-3-clause
|
renderPuzzleChar :: Maybe Char -> Char
renderPuzzleChar Nothing = '_'
| 69
|
renderPuzzleChar :: Maybe Char -> Char
renderPuzzleChar Nothing = '_'
| 69
|
renderPuzzleChar Nothing = '_'
| 30
| false
| true
| 0
| 7
| 9
| 27
| 11
| 16
| null | null |
vTurbine/ghc
|
compiler/hsSyn/HsUtils.hs
|
bsd-3-clause
|
mkBindStmt pat body = BindStmt pat body noSyntaxExpr noSyntaxExpr PlaceHolder
| 77
|
mkBindStmt pat body = BindStmt pat body noSyntaxExpr noSyntaxExpr PlaceHolder
| 77
|
mkBindStmt pat body = BindStmt pat body noSyntaxExpr noSyntaxExpr PlaceHolder
| 77
| false
| false
| 0
| 5
| 9
| 22
| 10
| 12
| null | null |
TomMD/ghc
|
libraries/template-haskell/Language/Haskell/TH/Ppr.hs
|
bsd-3-clause
|
pprTyApp :: (Type, [Type]) -> Doc
pprTyApp (ArrowT, [arg1,arg2]) = sep [pprFunArgType arg1 <+> text "->", ppr arg2]
| 115
|
pprTyApp :: (Type, [Type]) -> Doc
pprTyApp (ArrowT, [arg1,arg2]) = sep [pprFunArgType arg1 <+> text "->", ppr arg2]
| 115
|
pprTyApp (ArrowT, [arg1,arg2]) = sep [pprFunArgType arg1 <+> text "->", ppr arg2]
| 81
| false
| true
| 0
| 9
| 17
| 67
| 34
| 33
| null | null |
alphaHeavy/cabal
|
Cabal/Distribution/Simple/UHC.hs
|
bsd-3-clause
|
uhcTargetVariant = "plain"
| 26
|
uhcTargetVariant = "plain"
| 26
|
uhcTargetVariant = "plain"
| 26
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
flowbox-public/language-c-quote
|
Language/C/Quote/C.hs
|
bsd-3-clause
|
cstms = quasiquote exts typenames P.parseStms
| 48
|
cstms = quasiquote exts typenames P.parseStms
| 48
|
cstms = quasiquote exts typenames P.parseStms
| 48
| false
| false
| 0
| 6
| 8
| 15
| 7
| 8
| null | null |
rueshyna/gogol
|
gogol-dataflow/gen/Network/Google/Dataflow/Types/Product.hs
|
mpl-2.0
|
-- | The codec to use to decode data read from the source.
souCodec :: Lens' Source (Maybe SourceCodec)
souCodec = lens _souCodec (\ s a -> s{_souCodec = a})
| 157
|
souCodec :: Lens' Source (Maybe SourceCodec)
souCodec = lens _souCodec (\ s a -> s{_souCodec = a})
| 98
|
souCodec = lens _souCodec (\ s a -> s{_souCodec = a})
| 53
| true
| true
| 2
| 9
| 29
| 55
| 25
| 30
| null | null |
DestructHub/ProjectEuler
|
Problem009/Haskell/solution_1.hs
|
mit
|
main = print $ let (a, b, c) = triangulo in a * b * c
| 53
|
main = print $ let (a, b, c) = triangulo in a * b * c
| 53
|
main = print $ let (a, b, c) = triangulo in a * b * c
| 53
| false
| false
| 0
| 10
| 15
| 39
| 20
| 19
| null | null |
richardfergie/chart-distribution
|
Chart/Distribution.hs
|
bsd-3-clause
|
allBinCounts (b:bs) xs = c : (allBinCounts bs rest)
where (c,rest) = singleBinCount b xs
| 90
|
allBinCounts (b:bs) xs = c : (allBinCounts bs rest)
where (c,rest) = singleBinCount b xs
| 90
|
allBinCounts (b:bs) xs = c : (allBinCounts bs rest)
where (c,rest) = singleBinCount b xs
| 90
| false
| false
| 0
| 7
| 16
| 50
| 25
| 25
| null | null |
mcschroeder/ghc
|
compiler/basicTypes/OccName.hs
|
bsd-3-clause
|
unitOccEnv x y = A $ unitUFM x y
| 32
|
unitOccEnv x y = A $ unitUFM x y
| 32
|
unitOccEnv x y = A $ unitUFM x y
| 32
| false
| false
| 0
| 6
| 8
| 20
| 9
| 11
| null | null |
sellerlabs/haskell-workshop
|
src/Syntax.hs
|
bsd-3-clause
|
-- Uh oh! Haskell values are immutable, and we're only returning one new
-- PersonA. That means the old person still has all their power! The
-- Haskell solution is to return *two* parameters, using a *tuple*. Tuples
-- are a fixed length list of data types that can be of different types.
--
-- This function also introduces a *let expression*. We'll demonstrate the
-- record accessor functions that we made for the regular Person type.
absorbPower2 :: Person -> Person -> (Person, Person)
absorbPower2 person victim =
let absorbedPower = personPowerLevel person + personPowerLevel victim
newPerson = Person (personName person) absorbedPower
drainedVictim = Person (personName victim) 0
in (newPerson, drainedVictim)
| 742
|
absorbPower2 :: Person -> Person -> (Person, Person)
absorbPower2 person victim =
let absorbedPower = personPowerLevel person + personPowerLevel victim
newPerson = Person (personName person) absorbedPower
drainedVictim = Person (personName victim) 0
in (newPerson, drainedVictim)
| 303
|
absorbPower2 person victim =
let absorbedPower = personPowerLevel person + personPowerLevel victim
newPerson = Person (personName person) absorbedPower
drainedVictim = Person (personName victim) 0
in (newPerson, drainedVictim)
| 250
| true
| true
| 0
| 11
| 135
| 96
| 52
| 44
| null | null |
jhedev/hs-mesos
|
test/Main.hs
|
mit
|
qcIM :: (Show a, Eq a, CPPValue a) => String -> Gen a -> TestTree
qcIM n = testProperty n . prop_idempotentMarshalling
| 118
|
qcIM :: (Show a, Eq a, CPPValue a) => String -> Gen a -> TestTree
qcIM n = testProperty n . prop_idempotentMarshalling
| 118
|
qcIM n = testProperty n . prop_idempotentMarshalling
| 52
| false
| true
| 1
| 9
| 21
| 60
| 27
| 33
| null | null |
cirquit/genetic-tic-tac-toe
|
src/Player.hs
|
mit
|
comparePlayers xs ys = 0
| 31
|
comparePlayers xs ys = 0
| 31
|
comparePlayers xs ys = 0
| 31
| false
| false
| 0
| 5
| 11
| 11
| 5
| 6
| null | null |
ml9951/ghc
|
libraries/pastm/Control/Common/STM.hs
|
bsd-3-clause
|
newTVarIO :: a -> IO (TVar a)
newTVarIO x = IO $ \s -> case unsafeCoerce# newTVar# x s of
(# s', tv #) -> (# s', TVar tv #)
| 153
|
newTVarIO :: a -> IO (TVar a)
newTVarIO x = IO $ \s -> case unsafeCoerce# newTVar# x s of
(# s', tv #) -> (# s', TVar tv #)
| 153
|
newTVarIO x = IO $ \s -> case unsafeCoerce# newTVar# x s of
(# s', tv #) -> (# s', TVar tv #)
| 123
| false
| true
| 2
| 11
| 59
| 72
| 34
| 38
| null | null |
bkirwi/ethereum-haskell
|
src/Ethereum/Prelude.hs
|
mit
|
encodeInt :: Integral n => n -> ByteString
encodeInt = BS.reverse <$> BS.unfoldr nextByte
where
nextByte 0 = Nothing
nextByte n = Just (fromIntegral n, n `quot` 256)
| 175
|
encodeInt :: Integral n => n -> ByteString
encodeInt = BS.reverse <$> BS.unfoldr nextByte
where
nextByte 0 = Nothing
nextByte n = Just (fromIntegral n, n `quot` 256)
| 175
|
encodeInt = BS.reverse <$> BS.unfoldr nextByte
where
nextByte 0 = Nothing
nextByte n = Just (fromIntegral n, n `quot` 256)
| 132
| false
| true
| 0
| 7
| 37
| 70
| 35
| 35
| null | null |
bfraikin/RXtoFA
|
src/Main.hs
|
gpl-2.0
|
testParser = do result <- parseFromFile rx "test.txt"
case result of
Left msg -> print msg
Right x -> print x
| 166
|
testParser = do result <- parseFromFile rx "test.txt"
case result of
Left msg -> print msg
Right x -> print x
| 166
|
testParser = do result <- parseFromFile rx "test.txt"
case result of
Left msg -> print msg
Right x -> print x
| 166
| false
| false
| 0
| 10
| 77
| 49
| 21
| 28
| null | null |
sdroege/conduit-connection
|
tests/Tests.hs
|
bsd-3-clause
|
setupSocket :: IO (Socket, PortNumber)
setupSocket = do
let addr = SockAddrInet aNY_PORT iNADDR_ANY
s <- socket AF_INET Stream defaultProtocol
bind s addr
listen s 5
p <- socketPort s
return (s, p)
| 224
|
setupSocket :: IO (Socket, PortNumber)
setupSocket = do
let addr = SockAddrInet aNY_PORT iNADDR_ANY
s <- socket AF_INET Stream defaultProtocol
bind s addr
listen s 5
p <- socketPort s
return (s, p)
| 224
|
setupSocket = do
let addr = SockAddrInet aNY_PORT iNADDR_ANY
s <- socket AF_INET Stream defaultProtocol
bind s addr
listen s 5
p <- socketPort s
return (s, p)
| 185
| false
| true
| 1
| 11
| 59
| 90
| 39
| 51
| null | null |
GaloisInc/galua
|
galua-rts/src/Galua/Util/SmallVec.hs
|
mit
|
drop :: Int -> SmallVec a -> SmallVec a
drop n xs =
case xs of
Vec0 -> Vec0
Vec1 {} -> if n > 0 then Vec0 else xs
Vec2 x _ | n > 1 -> Vec0
| n > 0 -> vec1 x
| otherwise -> xs
VecMany v | n1 < 1 -> Vec0
| n1 == 1 -> Vec1 (Vector.unsafeLast v)
| n1 == 2 -> Vec2 (Vector.unsafeIndex v (l - 2))
(Vector.unsafeLast v)
| otherwise -> VecMany (Vector.drop n v)
where
l = Vector.length v
n1 = l - n
| 551
|
drop :: Int -> SmallVec a -> SmallVec a
drop n xs =
case xs of
Vec0 -> Vec0
Vec1 {} -> if n > 0 then Vec0 else xs
Vec2 x _ | n > 1 -> Vec0
| n > 0 -> vec1 x
| otherwise -> xs
VecMany v | n1 < 1 -> Vec0
| n1 == 1 -> Vec1 (Vector.unsafeLast v)
| n1 == 2 -> Vec2 (Vector.unsafeIndex v (l - 2))
(Vector.unsafeLast v)
| otherwise -> VecMany (Vector.drop n v)
where
l = Vector.length v
n1 = l - n
| 551
|
drop n xs =
case xs of
Vec0 -> Vec0
Vec1 {} -> if n > 0 then Vec0 else xs
Vec2 x _ | n > 1 -> Vec0
| n > 0 -> vec1 x
| otherwise -> xs
VecMany v | n1 < 1 -> Vec0
| n1 == 1 -> Vec1 (Vector.unsafeLast v)
| n1 == 2 -> Vec2 (Vector.unsafeIndex v (l - 2))
(Vector.unsafeLast v)
| otherwise -> VecMany (Vector.drop n v)
where
l = Vector.length v
n1 = l - n
| 511
| false
| true
| 10
| 9
| 256
| 210
| 101
| 109
| null | null |
spl/dlist
|
tests/Main.hs
|
bsd-3-clause
|
--------------------------------------------------------------------------------
main :: IO ()
main = do
DListProperties.test
-- CPP: GHC >= 8 for DNonEmpty
#if __GLASGOW_HASKELL__ >= 800
DNonEmptyProperties.test
#endif
OverloadedStrings.test
| 249
|
main :: IO ()
main = do
DListProperties.test
-- CPP: GHC >= 8 for DNonEmpty
#if __GLASGOW_HASKELL__ >= 800
DNonEmptyProperties.test
#endif
OverloadedStrings.test
| 167
|
main = do
DListProperties.test
-- CPP: GHC >= 8 for DNonEmpty
#if __GLASGOW_HASKELL__ >= 800
DNonEmptyProperties.test
#endif
OverloadedStrings.test
| 153
| true
| true
| 0
| 8
| 29
| 41
| 19
| 22
| null | null |
simonmichael/hledger
|
hledger-lib/Hledger/Data/Dates.hs
|
gpl-3.0
|
fixSmartDateStrEither'
:: Day -> Text -> Either (ParseErrorBundle Text CustomErr) Day
fixSmartDateStrEither' d s = case parsewith smartdateonly (T.toLower s) of
Right sd -> Right $ fixSmartDate d sd
Left e -> Left e
-- | Convert a SmartDate to an absolute date using the provided reference date.
--
-- ==== Examples:
-- >>> :set -XOverloadedStrings
-- >>> let t = fixSmartDateStr (fromGregorian 2008 11 26)
-- >>> t "0000-01-01"
-- "0000-01-01"
-- >>> t "1999-12-02"
-- "1999-12-02"
-- >>> t "1999.12.02"
-- "1999-12-02"
-- >>> t "1999/3/2"
-- "1999-03-02"
-- >>> t "19990302"
-- "1999-03-02"
-- >>> t "2008/2"
-- "2008-02-01"
-- >>> t "0020/2"
-- "0020-02-01"
-- >>> t "1000"
-- "1000-01-01"
-- >>> t "4/2"
-- "2008-04-02"
-- >>> t "2"
-- "2008-11-02"
-- >>> t "January"
-- "2008-01-01"
-- >>> t "feb"
-- "2008-02-01"
-- >>> t "today"
-- "2008-11-26"
-- >>> t "yesterday"
-- "2008-11-25"
-- >>> t "tomorrow"
-- "2008-11-27"
-- >>> t "this day"
-- "2008-11-26"
-- >>> t "last day"
-- "2008-11-25"
-- >>> t "next day"
-- "2008-11-27"
-- >>> t "this week" -- last monday
-- "2008-11-24"
-- >>> t "last week" -- previous monday
-- "2008-11-17"
-- >>> t "next week" -- next monday
-- "2008-12-01"
-- >>> t "this month"
-- "2008-11-01"
-- >>> t "last month"
-- "2008-10-01"
-- >>> t "next month"
-- "2008-12-01"
-- >>> t "this quarter"
-- "2008-10-01"
-- >>> t "last quarter"
-- "2008-07-01"
-- >>> t "next quarter"
-- "2009-01-01"
-- >>> t "this year"
-- "2008-01-01"
-- >>> t "last year"
-- "2007-01-01"
-- >>> t "next year"
-- "2009-01-01"
--
-- t "last wed"
-- "2008-11-19"
-- t "next friday"
-- "2008-11-28"
-- t "next january"
-- "2009-01-01"
--
-- >>> t "in 5 days"
-- "2008-12-01"
-- >>> t "in 7 months"
-- "2009-06-01"
-- >>> t "in -2 weeks"
-- "2008-11-10"
-- >>> t "1 quarter ago"
-- "2008-07-01"
-- >>> t "1 week ahead"
-- "2008-12-01"
| 1,910
|
fixSmartDateStrEither'
:: Day -> Text -> Either (ParseErrorBundle Text CustomErr) Day
fixSmartDateStrEither' d s = case parsewith smartdateonly (T.toLower s) of
Right sd -> Right $ fixSmartDate d sd
Left e -> Left e
-- | Convert a SmartDate to an absolute date using the provided reference date.
--
-- ==== Examples:
-- >>> :set -XOverloadedStrings
-- >>> let t = fixSmartDateStr (fromGregorian 2008 11 26)
-- >>> t "0000-01-01"
-- "0000-01-01"
-- >>> t "1999-12-02"
-- "1999-12-02"
-- >>> t "1999.12.02"
-- "1999-12-02"
-- >>> t "1999/3/2"
-- "1999-03-02"
-- >>> t "19990302"
-- "1999-03-02"
-- >>> t "2008/2"
-- "2008-02-01"
-- >>> t "0020/2"
-- "0020-02-01"
-- >>> t "1000"
-- "1000-01-01"
-- >>> t "4/2"
-- "2008-04-02"
-- >>> t "2"
-- "2008-11-02"
-- >>> t "January"
-- "2008-01-01"
-- >>> t "feb"
-- "2008-02-01"
-- >>> t "today"
-- "2008-11-26"
-- >>> t "yesterday"
-- "2008-11-25"
-- >>> t "tomorrow"
-- "2008-11-27"
-- >>> t "this day"
-- "2008-11-26"
-- >>> t "last day"
-- "2008-11-25"
-- >>> t "next day"
-- "2008-11-27"
-- >>> t "this week" -- last monday
-- "2008-11-24"
-- >>> t "last week" -- previous monday
-- "2008-11-17"
-- >>> t "next week" -- next monday
-- "2008-12-01"
-- >>> t "this month"
-- "2008-11-01"
-- >>> t "last month"
-- "2008-10-01"
-- >>> t "next month"
-- "2008-12-01"
-- >>> t "this quarter"
-- "2008-10-01"
-- >>> t "last quarter"
-- "2008-07-01"
-- >>> t "next quarter"
-- "2009-01-01"
-- >>> t "this year"
-- "2008-01-01"
-- >>> t "last year"
-- "2007-01-01"
-- >>> t "next year"
-- "2009-01-01"
--
-- t "last wed"
-- "2008-11-19"
-- t "next friday"
-- "2008-11-28"
-- t "next january"
-- "2009-01-01"
--
-- >>> t "in 5 days"
-- "2008-12-01"
-- >>> t "in 7 months"
-- "2009-06-01"
-- >>> t "in -2 weeks"
-- "2008-11-10"
-- >>> t "1 quarter ago"
-- "2008-07-01"
-- >>> t "1 week ahead"
-- "2008-12-01"
| 1,910
|
fixSmartDateStrEither' d s = case parsewith smartdateonly (T.toLower s) of
Right sd -> Right $ fixSmartDate d sd
Left e -> Left e
-- | Convert a SmartDate to an absolute date using the provided reference date.
--
-- ==== Examples:
-- >>> :set -XOverloadedStrings
-- >>> let t = fixSmartDateStr (fromGregorian 2008 11 26)
-- >>> t "0000-01-01"
-- "0000-01-01"
-- >>> t "1999-12-02"
-- "1999-12-02"
-- >>> t "1999.12.02"
-- "1999-12-02"
-- >>> t "1999/3/2"
-- "1999-03-02"
-- >>> t "19990302"
-- "1999-03-02"
-- >>> t "2008/2"
-- "2008-02-01"
-- >>> t "0020/2"
-- "0020-02-01"
-- >>> t "1000"
-- "1000-01-01"
-- >>> t "4/2"
-- "2008-04-02"
-- >>> t "2"
-- "2008-11-02"
-- >>> t "January"
-- "2008-01-01"
-- >>> t "feb"
-- "2008-02-01"
-- >>> t "today"
-- "2008-11-26"
-- >>> t "yesterday"
-- "2008-11-25"
-- >>> t "tomorrow"
-- "2008-11-27"
-- >>> t "this day"
-- "2008-11-26"
-- >>> t "last day"
-- "2008-11-25"
-- >>> t "next day"
-- "2008-11-27"
-- >>> t "this week" -- last monday
-- "2008-11-24"
-- >>> t "last week" -- previous monday
-- "2008-11-17"
-- >>> t "next week" -- next monday
-- "2008-12-01"
-- >>> t "this month"
-- "2008-11-01"
-- >>> t "last month"
-- "2008-10-01"
-- >>> t "next month"
-- "2008-12-01"
-- >>> t "this quarter"
-- "2008-10-01"
-- >>> t "last quarter"
-- "2008-07-01"
-- >>> t "next quarter"
-- "2009-01-01"
-- >>> t "this year"
-- "2008-01-01"
-- >>> t "last year"
-- "2007-01-01"
-- >>> t "next year"
-- "2009-01-01"
--
-- t "last wed"
-- "2008-11-19"
-- t "next friday"
-- "2008-11-28"
-- t "next january"
-- "2009-01-01"
--
-- >>> t "in 5 days"
-- "2008-12-01"
-- >>> t "in 7 months"
-- "2009-06-01"
-- >>> t "in -2 weeks"
-- "2008-11-10"
-- >>> t "1 quarter ago"
-- "2008-07-01"
-- >>> t "1 week ahead"
-- "2008-12-01"
| 1,822
| false
| true
| 0
| 9
| 397
| 170
| 123
| 47
| null | null |
wskplho/stack
|
src/Data/Aeson/Extended.hs
|
bsd-3-clause
|
-- | Handle warnings in a sub-object.
jsonSubWarnings :: WarningParser (a, [JSONWarning]) -> WarningParser a
jsonSubWarnings f = do
(result,warnings) <- f
tell
(mempty
{ wpmWarnings = warnings
})
return result
-- | Handle warnings in a @Traversable@ of sub-objects.
| 304
|
jsonSubWarnings :: WarningParser (a, [JSONWarning]) -> WarningParser a
jsonSubWarnings f = do
(result,warnings) <- f
tell
(mempty
{ wpmWarnings = warnings
})
return result
-- | Handle warnings in a @Traversable@ of sub-objects.
| 266
|
jsonSubWarnings f = do
(result,warnings) <- f
tell
(mempty
{ wpmWarnings = warnings
})
return result
-- | Handle warnings in a @Traversable@ of sub-objects.
| 195
| true
| true
| 0
| 10
| 78
| 71
| 37
| 34
| null | null |
mfpi/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/EXT/CoordinateFrame.hs
|
bsd-3-clause
|
gl_TANGENT_ARRAY_TYPE :: GLenum
gl_TANGENT_ARRAY_TYPE = 0x843E
| 62
|
gl_TANGENT_ARRAY_TYPE :: GLenum
gl_TANGENT_ARRAY_TYPE = 0x843E
| 62
|
gl_TANGENT_ARRAY_TYPE = 0x843E
| 30
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
gilith/opentheory
|
data/haskell/nth-prime/src/Heap.hs
|
mit
|
mkT :: a -> Node a -> Node a -> Node a
mkT a x y =
if rx <= ry
then T (rx + 1) a y x
else T (ry + 1) a x y
where
rx = rank x
ry = rank y
| 162
|
mkT :: a -> Node a -> Node a -> Node a
mkT a x y =
if rx <= ry
then T (rx + 1) a y x
else T (ry + 1) a x y
where
rx = rank x
ry = rank y
| 162
|
mkT a x y =
if rx <= ry
then T (rx + 1) a y x
else T (ry + 1) a x y
where
rx = rank x
ry = rank y
| 123
| false
| true
| 0
| 8
| 71
| 107
| 51
| 56
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/BasicTypes/Literal.hs
|
bsd-3-clause
|
mapLitValue _ _ l = pprPanic "mapLitValue" (ppr l)
| 70
|
mapLitValue _ _ l = pprPanic "mapLitValue" (ppr l)
| 70
|
mapLitValue _ _ l = pprPanic "mapLitValue" (ppr l)
| 70
| false
| false
| 0
| 7
| 28
| 24
| 11
| 13
| null | null |
spinda/liquidhaskell
|
src/Language/Haskell/Liquid/Spec/CoreToLogic.hs
|
bsd-3-clause
|
makesub (C.NonRec x e) = (symbol x,) <$> coreToLogic e
| 55
|
makesub (C.NonRec x e) = (symbol x,) <$> coreToLogic e
| 55
|
makesub (C.NonRec x e) = (symbol x,) <$> coreToLogic e
| 55
| false
| false
| 0
| 7
| 10
| 34
| 16
| 18
| null | null |
lukexi/game-pal
|
src/Graphics/VR/Pal/Hands.hs
|
bsd-3-clause
|
eButtonToHandButton :: EButton -> Maybe HandButton
eButtonToHandButton EButtonApplicationMenu = Just HandButtonStart
| 116
|
eButtonToHandButton :: EButton -> Maybe HandButton
eButtonToHandButton EButtonApplicationMenu = Just HandButtonStart
| 116
|
eButtonToHandButton EButtonApplicationMenu = Just HandButtonStart
| 65
| false
| true
| 0
| 7
| 10
| 28
| 12
| 16
| null | null |
nevrenato/Hets_Fork
|
THF/StaticAnalysisTHF.hs
|
gpl-2.0
|
thfBinaryTypeToKind :: THFBinaryType -> Maybe Kind
thfBinaryTypeToKind bt = case bt of
TBT_THF_Mapping_Type [] -> Nothing
TBT_THF_Mapping_Type (_ : []) -> Nothing
TBT_THF_Mapping_Type mt -> thfMappingTypeToKind mt
T0BT_THF_Binary_Type_Par btp -> fmap ParKind (thfBinaryTypeToKind btp)
_ -> Nothing
| 368
|
thfBinaryTypeToKind :: THFBinaryType -> Maybe Kind
thfBinaryTypeToKind bt = case bt of
TBT_THF_Mapping_Type [] -> Nothing
TBT_THF_Mapping_Type (_ : []) -> Nothing
TBT_THF_Mapping_Type mt -> thfMappingTypeToKind mt
T0BT_THF_Binary_Type_Par btp -> fmap ParKind (thfBinaryTypeToKind btp)
_ -> Nothing
| 368
|
thfBinaryTypeToKind bt = case bt of
TBT_THF_Mapping_Type [] -> Nothing
TBT_THF_Mapping_Type (_ : []) -> Nothing
TBT_THF_Mapping_Type mt -> thfMappingTypeToKind mt
T0BT_THF_Binary_Type_Par btp -> fmap ParKind (thfBinaryTypeToKind btp)
_ -> Nothing
| 317
| false
| true
| 7
| 8
| 107
| 87
| 43
| 44
| null | null |
fmapfmapfmap/amazonka
|
amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'ExportTask' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'etDescription'
--
-- * 'etExportTaskId'
--
-- * 'etExportToS3Task'
--
-- * 'etInstanceExportDetails'
--
-- * 'etState'
--
-- * 'etStatusMessage'
exportTask
:: Text -- ^ 'etDescription'
-> Text -- ^ 'etExportTaskId'
-> ExportToS3Task -- ^ 'etExportToS3Task'
-> InstanceExportDetails -- ^ 'etInstanceExportDetails'
-> ExportTaskState -- ^ 'etState'
-> Text -- ^ 'etStatusMessage'
-> ExportTask
exportTask pDescription_ pExportTaskId_ pExportToS3Task_ pInstanceExportDetails_ pState_ pStatusMessage_ =
ExportTask'
{ _etDescription = pDescription_
, _etExportTaskId = pExportTaskId_
, _etExportToS3Task = pExportToS3Task_
, _etInstanceExportDetails = pInstanceExportDetails_
, _etState = pState_
, _etStatusMessage = pStatusMessage_
}
| 961
|
exportTask
:: Text -- ^ 'etDescription'
-> Text -- ^ 'etExportTaskId'
-> ExportToS3Task -- ^ 'etExportToS3Task'
-> InstanceExportDetails -- ^ 'etInstanceExportDetails'
-> ExportTaskState -- ^ 'etState'
-> Text -- ^ 'etStatusMessage'
-> ExportTask
exportTask pDescription_ pExportTaskId_ pExportToS3Task_ pInstanceExportDetails_ pState_ pStatusMessage_ =
ExportTask'
{ _etDescription = pDescription_
, _etExportTaskId = pExportTaskId_
, _etExportToS3Task = pExportToS3Task_
, _etInstanceExportDetails = pInstanceExportDetails_
, _etState = pState_
, _etStatusMessage = pStatusMessage_
}
| 645
|
exportTask pDescription_ pExportTaskId_ pExportToS3Task_ pInstanceExportDetails_ pState_ pStatusMessage_ =
ExportTask'
{ _etDescription = pDescription_
, _etExportTaskId = pExportTaskId_
, _etExportToS3Task = pExportToS3Task_
, _etInstanceExportDetails = pInstanceExportDetails_
, _etState = pState_
, _etStatusMessage = pStatusMessage_
}
| 370
| true
| true
| 0
| 10
| 180
| 107
| 70
| 37
| null | null |
markus-git/imperative-edsl-vhdl
|
src/Language/Embedded/Hardware/Interface/AXI.hs
|
bsd-3-clause
|
identInputs (SSig _ _ sf) (ASig s arg) = identInputs (sf s) arg
| 66
|
identInputs (SSig _ _ sf) (ASig s arg) = identInputs (sf s) arg
| 66
|
identInputs (SSig _ _ sf) (ASig s arg) = identInputs (sf s) arg
| 66
| false
| false
| 0
| 7
| 15
| 40
| 19
| 21
| null | null |
yliu120/K3
|
src/Language/K3/Core/Expression.hs
|
apache-2.0
|
isEProperty :: Annotation Expression -> Bool
isEProperty (EProperty _) = True
| 77
|
isEProperty :: Annotation Expression -> Bool
isEProperty (EProperty _) = True
| 77
|
isEProperty (EProperty _) = True
| 32
| false
| true
| 0
| 7
| 10
| 27
| 13
| 14
| null | null |
capital-match/bake
|
src/Development/Bake/Server/Memory.hs
|
bsd-3-clause
|
notify :: Memory -> String -> [(Author, HTML)] -> IO (Memory -> Memory)
notify mem subject messages = do
messages <- return $ concat [(a,b) : map (,b) (admins mem) | (a,b) <- messages]
res <- try_ $ forM_ (groupSort messages) $ \(author, body) -> do
let nl = br_ <> str_ "\n" -- important to include lots of lines or Outlook gets upset
ovenNotify (oven mem) author subject $ renderHTML $ mconcat $ intersperse (nl <> nl) $ nubOrd body
return $ \mem -> mem{fatal = ["Notification failure: " ++ show e | Left e <- [res]] ++ fatal mem}
| 560
|
notify :: Memory -> String -> [(Author, HTML)] -> IO (Memory -> Memory)
notify mem subject messages = do
messages <- return $ concat [(a,b) : map (,b) (admins mem) | (a,b) <- messages]
res <- try_ $ forM_ (groupSort messages) $ \(author, body) -> do
let nl = br_ <> str_ "\n" -- important to include lots of lines or Outlook gets upset
ovenNotify (oven mem) author subject $ renderHTML $ mconcat $ intersperse (nl <> nl) $ nubOrd body
return $ \mem -> mem{fatal = ["Notification failure: " ++ show e | Left e <- [res]] ++ fatal mem}
| 560
|
notify mem subject messages = do
messages <- return $ concat [(a,b) : map (,b) (admins mem) | (a,b) <- messages]
res <- try_ $ forM_ (groupSort messages) $ \(author, body) -> do
let nl = br_ <> str_ "\n" -- important to include lots of lines or Outlook gets upset
ovenNotify (oven mem) author subject $ renderHTML $ mconcat $ intersperse (nl <> nl) $ nubOrd body
return $ \mem -> mem{fatal = ["Notification failure: " ++ show e | Left e <- [res]] ++ fatal mem}
| 488
| false
| true
| 0
| 18
| 128
| 253
| 129
| 124
| null | null |
databrary/databrary
|
src/Web/Uglify.hs
|
agpl-3.0
|
appWebJS :: IO [WebFilePath]
appWebJS = do
includes <- webIncludes
pre <- mapM makeWebFilePath pre'
filteredJS <- filter (\f -> not (isPrefixOf "lib/" (webFileRel f)) && f `notElem` pre) <$> findWebFiles ".js"
let webjs = mconcat [includes, tail pre, filteredJS]
coffee <- map (replaceWebExtension ".js") <$> findWebFiles ".coffee"
return $ union webjs coffee
where
pre' = ["debug.js", "app.js", "constants.js", "routes.js", "messages.js", "templates.js"]
| 473
|
appWebJS :: IO [WebFilePath]
appWebJS = do
includes <- webIncludes
pre <- mapM makeWebFilePath pre'
filteredJS <- filter (\f -> not (isPrefixOf "lib/" (webFileRel f)) && f `notElem` pre) <$> findWebFiles ".js"
let webjs = mconcat [includes, tail pre, filteredJS]
coffee <- map (replaceWebExtension ".js") <$> findWebFiles ".coffee"
return $ union webjs coffee
where
pre' = ["debug.js", "app.js", "constants.js", "routes.js", "messages.js", "templates.js"]
| 473
|
appWebJS = do
includes <- webIncludes
pre <- mapM makeWebFilePath pre'
filteredJS <- filter (\f -> not (isPrefixOf "lib/" (webFileRel f)) && f `notElem` pre) <$> findWebFiles ".js"
let webjs = mconcat [includes, tail pre, filteredJS]
coffee <- map (replaceWebExtension ".js") <$> findWebFiles ".coffee"
return $ union webjs coffee
where
pre' = ["debug.js", "app.js", "constants.js", "routes.js", "messages.js", "templates.js"]
| 444
| false
| true
| 0
| 18
| 79
| 173
| 86
| 87
| null | null |
jetaggart/te
|
src/Te.hs
|
gpl-3.0
|
run :: [Text] -> Sh ()
run args = run' =<< getTestRunner args
| 61
|
run :: [Text] -> Sh ()
run args = run' =<< getTestRunner args
| 61
|
run args = run' =<< getTestRunner args
| 38
| false
| true
| 0
| 7
| 12
| 33
| 16
| 17
| null | null |
sjakobi/brick
|
src/Brick/BorderMap.hs
|
bsd-3-clause
|
-- | Internal use only.
neighbors :: Edges a -> Edges (a, a)
neighbors (Edges vt vb vl vr) = Edges horiz horiz vert vert where
horiz = (vl, vr)
vert = (vt, vb)
-- Invariant: corner values are present on all the edges incident on that
-- corner. Widthless or heightless rectangles replicate the IMaps exactly on
-- the two coincident edges.
--
-- Practically speaking, this means for lookup you can look on any edge that
-- could contain the key you care about, while for insertion you must insert on
-- every edge that could contain the keys being inserted.
-- | A @BorderMap a@ is like a @Map Location a@, except that there is a
-- rectangle, and only 'Location's on the border of this rectangle are
-- retained. The 'BorderMap' can be queried for the position and size of the
-- rectangle. There are also efficient bulk query and bulk update operations
-- for adjacent positions on the border.
| 906
|
neighbors :: Edges a -> Edges (a, a)
neighbors (Edges vt vb vl vr) = Edges horiz horiz vert vert where
horiz = (vl, vr)
vert = (vt, vb)
-- Invariant: corner values are present on all the edges incident on that
-- corner. Widthless or heightless rectangles replicate the IMaps exactly on
-- the two coincident edges.
--
-- Practically speaking, this means for lookup you can look on any edge that
-- could contain the key you care about, while for insertion you must insert on
-- every edge that could contain the keys being inserted.
-- | A @BorderMap a@ is like a @Map Location a@, except that there is a
-- rectangle, and only 'Location's on the border of this rectangle are
-- retained. The 'BorderMap' can be queried for the position and size of the
-- rectangle. There are also efficient bulk query and bulk update operations
-- for adjacent positions on the border.
| 882
|
neighbors (Edges vt vb vl vr) = Edges horiz horiz vert vert where
horiz = (vl, vr)
vert = (vt, vb)
-- Invariant: corner values are present on all the edges incident on that
-- corner. Widthless or heightless rectangles replicate the IMaps exactly on
-- the two coincident edges.
--
-- Practically speaking, this means for lookup you can look on any edge that
-- could contain the key you care about, while for insertion you must insert on
-- every edge that could contain the keys being inserted.
-- | A @BorderMap a@ is like a @Map Location a@, except that there is a
-- rectangle, and only 'Location's on the border of this rectangle are
-- retained. The 'BorderMap' can be queried for the position and size of the
-- rectangle. There are also efficient bulk query and bulk update operations
-- for adjacent positions on the border.
| 845
| true
| true
| 0
| 7
| 174
| 88
| 53
| 35
| null | null |
andrewMacmurray/haskell-book-solutions
|
src/ch10/foldReview.hs
|
mit
|
squishAgain :: [[a]] -> [a]
squishAgain = squishMap id
| 54
|
squishAgain :: [[a]] -> [a]
squishAgain = squishMap id
| 54
|
squishAgain = squishMap id
| 26
| false
| true
| 0
| 8
| 8
| 34
| 16
| 18
| null | null |
Fuuzetsu/aeson-schema
|
src/Data/Aeson/Schema/Helpers.hs
|
mit
|
cleanPatterns :: Data a => a -> a
cleanPatterns = everywhere $ mkT replacePattern
where
replacePattern (ConP n []) | nameBase n == "[]" = ListP []
replacePattern p = p
-- | Extracts a list of used modules from a TH code tree.
| 236
|
cleanPatterns :: Data a => a -> a
cleanPatterns = everywhere $ mkT replacePattern
where
replacePattern (ConP n []) | nameBase n == "[]" = ListP []
replacePattern p = p
-- | Extracts a list of used modules from a TH code tree.
| 236
|
cleanPatterns = everywhere $ mkT replacePattern
where
replacePattern (ConP n []) | nameBase n == "[]" = ListP []
replacePattern p = p
-- | Extracts a list of used modules from a TH code tree.
| 202
| false
| true
| 0
| 9
| 54
| 77
| 36
| 41
| null | null |
urbanslug/ghc
|
testsuite/tests/rename/should_compile/timing003.hs
|
bsd-3-clause
|
a446 = []
| 9
|
a446 = []
| 9
|
a446 = []
| 9
| false
| false
| 1
| 6
| 2
| 12
| 4
| 8
| null | null |
BerndSchwarzenbacher/cis194-solutions
|
06-lazy/Fibonacci.hs
|
mit
|
fibo :: Integer -> Integer -> [Integer]
fibo a b = a : fibo b (a+b)
| 67
|
fibo :: Integer -> Integer -> [Integer]
fibo a b = a : fibo b (a+b)
| 67
|
fibo a b = a : fibo b (a+b)
| 27
| false
| true
| 0
| 8
| 15
| 47
| 23
| 24
| null | null |
JacquesCarette/literate-scientific-software
|
People/Dan/Presentations/CommitteeMeeting1/Example1.hs
|
bsd-2-clause
|
h_g_dep :: Dependency
h_g_dep = get_dep h_g_eq
| 46
|
h_g_dep :: Dependency
h_g_dep = get_dep h_g_eq
| 46
|
h_g_dep = get_dep h_g_eq
| 24
| false
| true
| 0
| 6
| 6
| 21
| 8
| 13
| null | null |
kittttttan/pe
|
haskell/pe2.hs
|
mit
|
pe2' :: Integer -> Integer
pe2' n = sum[x | x <- takeWhile (< n) fibs', even x]
| 79
|
pe2' :: Integer -> Integer
pe2' n = sum[x | x <- takeWhile (< n) fibs', even x]
| 79
|
pe2' n = sum[x | x <- takeWhile (< n) fibs', even x]
| 52
| false
| true
| 0
| 10
| 17
| 48
| 24
| 24
| null | null |
GaloisInc/ivory
|
ivory-model-check/src/Ivory/ModelCheck.hs
|
bsd-3-clause
|
initArgs :: Args
initArgs = Args
{ printQuery = True
, printEnv = True
, printLocs = True
, inlineCall = False
, callCVC4 = True
, cvc4Path = ""
, cvc4Args = ["--incremental", "--rewrite-divk"]
}
| 221
|
initArgs :: Args
initArgs = Args
{ printQuery = True
, printEnv = True
, printLocs = True
, inlineCall = False
, callCVC4 = True
, cvc4Path = ""
, cvc4Args = ["--incremental", "--rewrite-divk"]
}
| 221
|
initArgs = Args
{ printQuery = True
, printEnv = True
, printLocs = True
, inlineCall = False
, callCVC4 = True
, cvc4Path = ""
, cvc4Args = ["--incremental", "--rewrite-divk"]
}
| 204
| false
| true
| 0
| 8
| 61
| 65
| 40
| 25
| null | null |
raichoo/Idris-dev
|
src/Idris/AbsSyntaxTree.hs
|
bsd-3-clause
|
pairCon = sNS (sUN "MkPair") ["Builtins"]
| 43
|
pairCon = sNS (sUN "MkPair") ["Builtins"]
| 43
|
pairCon = sNS (sUN "MkPair") ["Builtins"]
| 43
| false
| false
| 0
| 7
| 7
| 20
| 10
| 10
| null | null |
eklavya/Idris-dev
|
src/Idris/Delaborate.hs
|
bsd-3-clause
|
pprintErr' i (UniqueKindError k n) = text "Constructor" <+> annName' n (showbasic n)
<+> text ("has a " ++ show k ++ ",")
<+> text "but the data type does not"
| 229
|
pprintErr' i (UniqueKindError k n) = text "Constructor" <+> annName' n (showbasic n)
<+> text ("has a " ++ show k ++ ",")
<+> text "but the data type does not"
| 229
|
pprintErr' i (UniqueKindError k n) = text "Constructor" <+> annName' n (showbasic n)
<+> text ("has a " ++ show k ++ ",")
<+> text "but the data type does not"
| 229
| false
| false
| 0
| 11
| 100
| 65
| 30
| 35
| null | null |
oldmanmike/haskellSDL2Examples
|
src/lesson14.hs
|
gpl-2.0
|
size :: ScreenSize
size = (640, 480)
| 36
|
size :: ScreenSize
size = (640, 480)
| 36
|
size = (640, 480)
| 17
| false
| true
| 0
| 6
| 6
| 24
| 11
| 13
| null | null |
phischu/pem-images
|
src/ImageProcessing.hs
|
bsd-3-clause
|
-- | Get the average of all pixels around the given point within a square
-- of the given *radius*.
averageAroundPoint :: (Num a,Integral a,Num b,Fractional b) => Int -> Int -> Int -> Image a -> b
averageAroundPoint x y r image = sum pixelvalues / (2 * fromIntegral r + 1)^two where
pixelvalues = do
dx <- [-r..r]
dy <- [-r..r]
return (fromIntegral (valueInPoint (x+dx) (y+dy) image))
two = 2 :: Int
-- | The average of all pixel values in the given image.
| 489
|
averageAroundPoint :: (Num a,Integral a,Num b,Fractional b) => Int -> Int -> Int -> Image a -> b
averageAroundPoint x y r image = sum pixelvalues / (2 * fromIntegral r + 1)^two where
pixelvalues = do
dx <- [-r..r]
dy <- [-r..r]
return (fromIntegral (valueInPoint (x+dx) (y+dy) image))
two = 2 :: Int
-- | The average of all pixel values in the given image.
| 389
|
averageAroundPoint x y r image = sum pixelvalues / (2 * fromIntegral r + 1)^two where
pixelvalues = do
dx <- [-r..r]
dy <- [-r..r]
return (fromIntegral (valueInPoint (x+dx) (y+dy) image))
two = 2 :: Int
-- | The average of all pixel values in the given image.
| 292
| true
| true
| 0
| 15
| 118
| 173
| 89
| 84
| null | null |
singingwolfboy/citeproc-hs
|
src/Text/CSL/Input/Json.hs
|
bsd-3-clause
|
readType :: (Data a) => JSValue -> Result a
readType (JSObject ob) = construct
where
construct = selectFields (fromJSObject ob) (constrFields con) >>=
evalStateT (fromConstrM f con) . zip (constrFields con)
resType :: Result a -> a
resType _ = error "resType"
typ = dataTypeOf $ resType construct
con = indexConstr typ 1
f :: (Data a) => StateT [(String,JSValue)] Result a
f = do js <- get
case js of
j':js' -> do put js'
lift $ readJSData (snd j')
[] -> lift $ Error ("construct: empty list")
| 635
|
readType :: (Data a) => JSValue -> Result a
readType (JSObject ob) = construct
where
construct = selectFields (fromJSObject ob) (constrFields con) >>=
evalStateT (fromConstrM f con) . zip (constrFields con)
resType :: Result a -> a
resType _ = error "resType"
typ = dataTypeOf $ resType construct
con = indexConstr typ 1
f :: (Data a) => StateT [(String,JSValue)] Result a
f = do js <- get
case js of
j':js' -> do put js'
lift $ readJSData (snd j')
[] -> lift $ Error ("construct: empty list")
| 635
|
readType (JSObject ob) = construct
where
construct = selectFields (fromJSObject ob) (constrFields con) >>=
evalStateT (fromConstrM f con) . zip (constrFields con)
resType :: Result a -> a
resType _ = error "resType"
typ = dataTypeOf $ resType construct
con = indexConstr typ 1
f :: (Data a) => StateT [(String,JSValue)] Result a
f = do js <- get
case js of
j':js' -> do put js'
lift $ readJSData (snd j')
[] -> lift $ Error ("construct: empty list")
| 591
| false
| true
| 4
| 16
| 230
| 255
| 117
| 138
| null | null |
marcinmrotek/hsqml-fork
|
src/Graphics/QML/Engine.hs
|
bsd-3-clause
|
statusException HsqmlEvloopNotRunning = Just EventLoopNotRunning
| 64
|
statusException HsqmlEvloopNotRunning = Just EventLoopNotRunning
| 64
|
statusException HsqmlEvloopNotRunning = Just EventLoopNotRunning
| 64
| false
| false
| 0
| 5
| 4
| 12
| 5
| 7
| null | null |
damoxc/ganeti
|
src/Ganeti/HTools/Program/Hspace.hs
|
gpl-2.0
|
formatResources :: a -> [(String, a->String)] -> String
formatResources res =
intercalate ", " . map (\(a, fn) -> a ++ " " ++ fn res)
| 137
|
formatResources :: a -> [(String, a->String)] -> String
formatResources res =
intercalate ", " . map (\(a, fn) -> a ++ " " ++ fn res)
| 137
|
formatResources res =
intercalate ", " . map (\(a, fn) -> a ++ " " ++ fn res)
| 81
| false
| true
| 0
| 10
| 29
| 70
| 37
| 33
| null | null |
phischu/fragnix
|
tests/packages/scotty/Data.Set.Internal.hs
|
bsd-3-clause
|
-- | /O(log n)/. Lookup the /index/ of an element, which is its zero-based index in
-- the sorted sequence of elements. The index is a number from /0/ up to, but not
-- including, the 'size' of the set.
--
-- > isJust (lookupIndex 2 (fromList [5,3])) == False
-- > fromJust (lookupIndex 3 (fromList [5,3])) == 0
-- > fromJust (lookupIndex 5 (fromList [5,3])) == 1
-- > isJust (lookupIndex 6 (fromList [5,3])) == False
-- See Note: Type of local 'go' function
lookupIndex :: Ord a => a -> Set a -> Maybe Int
lookupIndex = go 0
where
go :: Ord a => Int -> a -> Set a -> Maybe Int
go !_ !_ Tip = Nothing
go idx x (Bin _ kx l r) = case compare x kx of
LT -> go idx x l
GT -> go (idx + size l + 1) x r
EQ -> Just $! idx + size l
| 762
|
lookupIndex :: Ord a => a -> Set a -> Maybe Int
lookupIndex = go 0
where
go :: Ord a => Int -> a -> Set a -> Maybe Int
go !_ !_ Tip = Nothing
go idx x (Bin _ kx l r) = case compare x kx of
LT -> go idx x l
GT -> go (idx + size l + 1) x r
EQ -> Just $! idx + size l
| 298
|
lookupIndex = go 0
where
go :: Ord a => Int -> a -> Set a -> Maybe Int
go !_ !_ Tip = Nothing
go idx x (Bin _ kx l r) = case compare x kx of
LT -> go idx x l
GT -> go (idx + size l + 1) x r
EQ -> Just $! idx + size l
| 250
| true
| true
| 6
| 13
| 199
| 179
| 89
| 90
| null | null |
tjakway/ghcjvm
|
compiler/stgSyn/StgLint.hs
|
bsd-3-clause
|
lintStgExpr e@(StgConApp con args) = runMaybeT $ do
arg_tys <- mapM (MaybeT . lintStgArg) args
MaybeT $ checkFunApp con_ty arg_tys (mkFunAppMsg con_ty arg_tys e)
where
con_ty = dataConRepType con
| 209
|
lintStgExpr e@(StgConApp con args) = runMaybeT $ do
arg_tys <- mapM (MaybeT . lintStgArg) args
MaybeT $ checkFunApp con_ty arg_tys (mkFunAppMsg con_ty arg_tys e)
where
con_ty = dataConRepType con
| 209
|
lintStgExpr e@(StgConApp con args) = runMaybeT $ do
arg_tys <- mapM (MaybeT . lintStgArg) args
MaybeT $ checkFunApp con_ty arg_tys (mkFunAppMsg con_ty arg_tys e)
where
con_ty = dataConRepType con
| 209
| false
| false
| 0
| 11
| 42
| 78
| 37
| 41
| null | null |
fpco/ghcjs-from-typescript
|
src/Main.hs
|
bsd-3-clause
|
-- https://wiki.haskell.org/Keywords
keywords :: [String]
keywords =
[ "as"
, "case"
, "of"
, "class"
, "data"
, "default"
, "do"
, "forall"
, "foreign"
, "hiding"
, "if"
, "then"
, "else"
, "import"
, "infix"
, "infixl"
, "infixr"
, "instance"
, "let"
, "in"
, "mdo"
, "module"
, "newtype"
, "proc"
, "qualified"
, "rec"
, "type"
, "where"
]
| 400
|
keywords :: [String]
keywords =
[ "as"
, "case"
, "of"
, "class"
, "data"
, "default"
, "do"
, "forall"
, "foreign"
, "hiding"
, "if"
, "then"
, "else"
, "import"
, "infix"
, "infixl"
, "infixr"
, "instance"
, "let"
, "in"
, "mdo"
, "module"
, "newtype"
, "proc"
, "qualified"
, "rec"
, "type"
, "where"
]
| 363
|
keywords =
[ "as"
, "case"
, "of"
, "class"
, "data"
, "default"
, "do"
, "forall"
, "foreign"
, "hiding"
, "if"
, "then"
, "else"
, "import"
, "infix"
, "infixl"
, "infixr"
, "instance"
, "let"
, "in"
, "mdo"
, "module"
, "newtype"
, "proc"
, "qualified"
, "rec"
, "type"
, "where"
]
| 342
| true
| true
| 0
| 7
| 121
| 106
| 66
| 40
| null | null |
passy/latest-npm-version
|
Npm/Latest/Internal.hs
|
mit
|
extractVersion :: AsValue s => Either SomeException s -> Either SomeException T.Text
extractVersion json =
json >>= \j -> maybe
(Left $ toException GenericNpmException)
Right
(j ^? key "version" . _String)
| 233
|
extractVersion :: AsValue s => Either SomeException s -> Either SomeException T.Text
extractVersion json =
json >>= \j -> maybe
(Left $ toException GenericNpmException)
Right
(j ^? key "version" . _String)
| 233
|
extractVersion json =
json >>= \j -> maybe
(Left $ toException GenericNpmException)
Right
(j ^? key "version" . _String)
| 148
| false
| true
| 2
| 9
| 58
| 86
| 39
| 47
| null | null |
asilvestre/haskell-neo4j-rest-client
|
src/Database/Neo4j/Graph.hs
|
mit
|
intersection :: Graph -> Graph -> Graph
intersection ga gb = relationshipFilter relFilterFunc (nodeFilter nodeFilterFunc ga) {
nodeNames = newNodeNames, namedNodes = newNamedNodes, relNames = newRelNames, namedRels = newNamedRels}
where relFilterFunc r = hasRelationship r gb
nodeFilterFunc n = hasNode n gb
newNodeNames = nodeNames ga `M.intersection` nodeNames gb
newNamedNodes = namedNodes ga `M.intersection` namedNodes gb
newRelNames = relNames ga `M.intersection` relNames gb
newNamedRels = namedRels ga `M.intersection` namedRels gb
-- | Feed a cypher result (from the old API) into a graph (looks for nodes and relationships and inserts them)
| 713
|
intersection :: Graph -> Graph -> Graph
intersection ga gb = relationshipFilter relFilterFunc (nodeFilter nodeFilterFunc ga) {
nodeNames = newNodeNames, namedNodes = newNamedNodes, relNames = newRelNames, namedRels = newNamedRels}
where relFilterFunc r = hasRelationship r gb
nodeFilterFunc n = hasNode n gb
newNodeNames = nodeNames ga `M.intersection` nodeNames gb
newNamedNodes = namedNodes ga `M.intersection` namedNodes gb
newRelNames = relNames ga `M.intersection` relNames gb
newNamedRels = namedRels ga `M.intersection` namedRels gb
-- | Feed a cypher result (from the old API) into a graph (looks for nodes and relationships and inserts them)
| 713
|
intersection ga gb = relationshipFilter relFilterFunc (nodeFilter nodeFilterFunc ga) {
nodeNames = newNodeNames, namedNodes = newNamedNodes, relNames = newRelNames, namedRels = newNamedRels}
where relFilterFunc r = hasRelationship r gb
nodeFilterFunc n = hasNode n gb
newNodeNames = nodeNames ga `M.intersection` nodeNames gb
newNamedNodes = namedNodes ga `M.intersection` namedNodes gb
newRelNames = relNames ga `M.intersection` relNames gb
newNamedRels = namedRels ga `M.intersection` namedRels gb
-- | Feed a cypher result (from the old API) into a graph (looks for nodes and relationships and inserts them)
| 673
| false
| true
| 4
| 8
| 153
| 186
| 90
| 96
| null | null |
rueshyna/gogol
|
gogol-books/gen/Network/Google/Books/Types/Product.hs
|
mpl-2.0
|
-- | The total number of volume annotations found.
vTotalItems :: Lens' Volumeannotations (Maybe Int32)
vTotalItems
= lens _vTotalItems (\ s a -> s{_vTotalItems = a}) .
mapping _Coerce
| 192
|
vTotalItems :: Lens' Volumeannotations (Maybe Int32)
vTotalItems
= lens _vTotalItems (\ s a -> s{_vTotalItems = a}) .
mapping _Coerce
| 141
|
vTotalItems
= lens _vTotalItems (\ s a -> s{_vTotalItems = a}) .
mapping _Coerce
| 88
| true
| true
| 1
| 10
| 36
| 58
| 28
| 30
| null | null |
Rufflewind/sci-ratio
|
src/Data/SciRatio.hs
|
mit
|
intLog :: (Integral a, Integral b) => a -> a -> (a, b)
intLog = factorizeBase
| 77
|
intLog :: (Integral a, Integral b) => a -> a -> (a, b)
intLog = factorizeBase
| 77
|
intLog = factorizeBase
| 22
| false
| true
| 0
| 10
| 15
| 47
| 23
| 24
| null | null |
afcastano/cafe-duty
|
src/App/Roster/AppService.hs
|
bsd-3-clause
|
calculateNewDuty :: TeamDetails -> IO ()
calculateNewDuty team = do
roster <- getTeamRoster team
let currentDuty = current roster
let newTeam = increaseTimesOnDuty team currentDuty
let newRoster = increaseRosterIndex roster
saveRoster newRoster
saveTeam newTeam
| 369
|
calculateNewDuty :: TeamDetails -> IO ()
calculateNewDuty team = do
roster <- getTeamRoster team
let currentDuty = current roster
let newTeam = increaseTimesOnDuty team currentDuty
let newRoster = increaseRosterIndex roster
saveRoster newRoster
saveTeam newTeam
| 369
|
calculateNewDuty team = do
roster <- getTeamRoster team
let currentDuty = current roster
let newTeam = increaseTimesOnDuty team currentDuty
let newRoster = increaseRosterIndex roster
saveRoster newRoster
saveTeam newTeam
| 328
| false
| true
| 0
| 10
| 141
| 83
| 35
| 48
| null | null |
chpatrick/rethinkdb-typed
|
src/Database/RethinkDB/Typed.hs
|
mit
|
string :: Expr String -> Expr String
string = id
| 48
|
string :: Expr String -> Expr String
string = id
| 48
|
string = id
| 11
| false
| true
| 0
| 6
| 9
| 21
| 10
| 11
| null | null |
bgamari/pandoc
|
src/Text/Pandoc/Readers/Org.hs
|
gpl-2.0
|
inlinesTillNewline :: OrgParser (F Inlines)
inlinesTillNewline = trimInlinesF . mconcat <$> manyTill inline newline
| 115
|
inlinesTillNewline :: OrgParser (F Inlines)
inlinesTillNewline = trimInlinesF . mconcat <$> manyTill inline newline
| 115
|
inlinesTillNewline = trimInlinesF . mconcat <$> manyTill inline newline
| 71
| false
| true
| 0
| 7
| 13
| 33
| 16
| 17
| null | null |
fpco/cabal
|
cabal-install/Distribution/Client/Sandbox/PackageEnvironment.hs
|
bsd-3-clause
|
tryLoadSandboxPackageEnvironmentFile :: Verbosity -> FilePath -> (Flag FilePath)
-> IO (FilePath, PackageEnvironment)
tryLoadSandboxPackageEnvironmentFile verbosity pkgEnvFile configFileFlag = do
let pkgEnvDir = takeDirectory pkgEnvFile
minp <- readPackageEnvironmentFile mempty pkgEnvFile
pkgEnv <- handleParseResult verbosity pkgEnvFile minp
-- Get the saved sandbox directory.
-- TODO: Use substPathTemplate with compilerTemplateEnv ++ platformTemplateEnv.
let sandboxDir = fromFlagOrDefault defaultSandboxLocation
. fmap fromPathTemplate . prefix . savedUserInstallDirs
. pkgEnvSavedConfig $ pkgEnv
-- Do some sanity checks
dirExists <- doesDirectoryExist sandboxDir
-- TODO: Also check for an initialised package DB?
unless dirExists $
die ("No sandbox exists at " ++ sandboxDir)
info verbosity $ "Using a sandbox located at " ++ sandboxDir
let base = basePackageEnvironment
let common = commonPackageEnvironment sandboxDir
user <- userPackageEnvironment verbosity pkgEnvDir
inherited <- inheritedPackageEnvironment verbosity user
-- Layer the package environment settings over settings from ~/.cabal/config.
cabalConfig <- fmap unsetSymlinkBinDir $
loadConfig verbosity configFileFlag NoFlag
return (sandboxDir,
updateInstallDirs $
(base `mappend` (toPkgEnv cabalConfig) `mappend`
common `mappend` inherited `mappend` user)
`overrideSandboxSettings` pkgEnv)
where
toPkgEnv config = mempty { pkgEnvSavedConfig = config }
updateInstallDirs pkgEnv =
let config = pkgEnvSavedConfig pkgEnv
configureFlags = savedConfigureFlags config
installDirs = savedUserInstallDirs config
in pkgEnv {
pkgEnvSavedConfig = config {
savedConfigureFlags = configureFlags {
configInstallDirs = installDirs
}
}
}
-- We don't want to inherit the value of 'symlink-bindir' from
-- '~/.cabal/config'. See #1514.
unsetSymlinkBinDir config =
let installFlags = savedInstallFlags config
in config {
savedInstallFlags = installFlags {
installSymlinkBinDir = NoFlag
}
}
-- | Should the generated package environment file include comments?
| 2,444
|
tryLoadSandboxPackageEnvironmentFile :: Verbosity -> FilePath -> (Flag FilePath)
-> IO (FilePath, PackageEnvironment)
tryLoadSandboxPackageEnvironmentFile verbosity pkgEnvFile configFileFlag = do
let pkgEnvDir = takeDirectory pkgEnvFile
minp <- readPackageEnvironmentFile mempty pkgEnvFile
pkgEnv <- handleParseResult verbosity pkgEnvFile minp
-- Get the saved sandbox directory.
-- TODO: Use substPathTemplate with compilerTemplateEnv ++ platformTemplateEnv.
let sandboxDir = fromFlagOrDefault defaultSandboxLocation
. fmap fromPathTemplate . prefix . savedUserInstallDirs
. pkgEnvSavedConfig $ pkgEnv
-- Do some sanity checks
dirExists <- doesDirectoryExist sandboxDir
-- TODO: Also check for an initialised package DB?
unless dirExists $
die ("No sandbox exists at " ++ sandboxDir)
info verbosity $ "Using a sandbox located at " ++ sandboxDir
let base = basePackageEnvironment
let common = commonPackageEnvironment sandboxDir
user <- userPackageEnvironment verbosity pkgEnvDir
inherited <- inheritedPackageEnvironment verbosity user
-- Layer the package environment settings over settings from ~/.cabal/config.
cabalConfig <- fmap unsetSymlinkBinDir $
loadConfig verbosity configFileFlag NoFlag
return (sandboxDir,
updateInstallDirs $
(base `mappend` (toPkgEnv cabalConfig) `mappend`
common `mappend` inherited `mappend` user)
`overrideSandboxSettings` pkgEnv)
where
toPkgEnv config = mempty { pkgEnvSavedConfig = config }
updateInstallDirs pkgEnv =
let config = pkgEnvSavedConfig pkgEnv
configureFlags = savedConfigureFlags config
installDirs = savedUserInstallDirs config
in pkgEnv {
pkgEnvSavedConfig = config {
savedConfigureFlags = configureFlags {
configInstallDirs = installDirs
}
}
}
-- We don't want to inherit the value of 'symlink-bindir' from
-- '~/.cabal/config'. See #1514.
unsetSymlinkBinDir config =
let installFlags = savedInstallFlags config
in config {
savedInstallFlags = installFlags {
installSymlinkBinDir = NoFlag
}
}
-- | Should the generated package environment file include comments?
| 2,444
|
tryLoadSandboxPackageEnvironmentFile verbosity pkgEnvFile configFileFlag = do
let pkgEnvDir = takeDirectory pkgEnvFile
minp <- readPackageEnvironmentFile mempty pkgEnvFile
pkgEnv <- handleParseResult verbosity pkgEnvFile minp
-- Get the saved sandbox directory.
-- TODO: Use substPathTemplate with compilerTemplateEnv ++ platformTemplateEnv.
let sandboxDir = fromFlagOrDefault defaultSandboxLocation
. fmap fromPathTemplate . prefix . savedUserInstallDirs
. pkgEnvSavedConfig $ pkgEnv
-- Do some sanity checks
dirExists <- doesDirectoryExist sandboxDir
-- TODO: Also check for an initialised package DB?
unless dirExists $
die ("No sandbox exists at " ++ sandboxDir)
info verbosity $ "Using a sandbox located at " ++ sandboxDir
let base = basePackageEnvironment
let common = commonPackageEnvironment sandboxDir
user <- userPackageEnvironment verbosity pkgEnvDir
inherited <- inheritedPackageEnvironment verbosity user
-- Layer the package environment settings over settings from ~/.cabal/config.
cabalConfig <- fmap unsetSymlinkBinDir $
loadConfig verbosity configFileFlag NoFlag
return (sandboxDir,
updateInstallDirs $
(base `mappend` (toPkgEnv cabalConfig) `mappend`
common `mappend` inherited `mappend` user)
`overrideSandboxSettings` pkgEnv)
where
toPkgEnv config = mempty { pkgEnvSavedConfig = config }
updateInstallDirs pkgEnv =
let config = pkgEnvSavedConfig pkgEnv
configureFlags = savedConfigureFlags config
installDirs = savedUserInstallDirs config
in pkgEnv {
pkgEnvSavedConfig = config {
savedConfigureFlags = configureFlags {
configInstallDirs = installDirs
}
}
}
-- We don't want to inherit the value of 'symlink-bindir' from
-- '~/.cabal/config'. See #1514.
unsetSymlinkBinDir config =
let installFlags = savedInstallFlags config
in config {
savedInstallFlags = installFlags {
installSymlinkBinDir = NoFlag
}
}
-- | Should the generated package environment file include comments?
| 2,286
| false
| true
| 0
| 17
| 677
| 409
| 206
| 203
| null | null |
facebookincubator/duckling
|
Duckling/Time/PT/Rules.hs
|
bsd-3-clause
|
ruleEntreDatetimeEDatetimeInterval :: Rule
ruleEntreDatetimeEDatetimeInterval = Rule
{ name = "entre <datetime> e <datetime> (interval)"
, pattern =
[ regex "entre( [ao])?|desde|(a partir )?d[eo]"
, dimension Time
, regex "e|\\-|até( ao?)?|ao?"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) ->
Token Time <$> interval TTime.Closed td1 td2
_ -> Nothing
}
| 447
|
ruleEntreDatetimeEDatetimeInterval :: Rule
ruleEntreDatetimeEDatetimeInterval = Rule
{ name = "entre <datetime> e <datetime> (interval)"
, pattern =
[ regex "entre( [ao])?|desde|(a partir )?d[eo]"
, dimension Time
, regex "e|\\-|até( ao?)?|ao?"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) ->
Token Time <$> interval TTime.Closed td1 td2
_ -> Nothing
}
| 447
|
ruleEntreDatetimeEDatetimeInterval = Rule
{ name = "entre <datetime> e <datetime> (interval)"
, pattern =
[ regex "entre( [ao])?|desde|(a partir )?d[eo]"
, dimension Time
, regex "e|\\-|até( ao?)?|ao?"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) ->
Token Time <$> interval TTime.Closed td1 td2
_ -> Nothing
}
| 404
| false
| true
| 0
| 17
| 106
| 125
| 64
| 61
| null | null |
brownplt/ovid
|
src/Jsaz.hs
|
bsd-2-clause
|
getAnalysisFunction ((BuildRGA k):rest) = do
when (k < 0) $
fail "argument to --rga must be non-negative"
return (doRandomization k, rest)
| 146
|
getAnalysisFunction ((BuildRGA k):rest) = do
when (k < 0) $
fail "argument to --rga must be non-negative"
return (doRandomization k, rest)
| 146
|
getAnalysisFunction ((BuildRGA k):rest) = do
when (k < 0) $
fail "argument to --rga must be non-negative"
return (doRandomization k, rest)
| 146
| false
| false
| 0
| 10
| 28
| 57
| 27
| 30
| null | null |
icyfork/shellcheck
|
ShellCheck/Analytics.hs
|
gpl-3.0
|
prop_checkPrintfVar1 = verify checkPrintfVar "printf \"Lol: $s\""
| 65
|
prop_checkPrintfVar1 = verify checkPrintfVar "printf \"Lol: $s\""
| 65
|
prop_checkPrintfVar1 = verify checkPrintfVar "printf \"Lol: $s\""
| 65
| false
| false
| 1
| 5
| 6
| 15
| 5
| 10
| null | null |
mit-plv/riscv-semantics
|
src/Spec/CSRGetSet.hs
|
bsd-3-clause
|
getCSR MTVal = getCSRField Field.MTVal
| 38
|
getCSR MTVal = getCSRField Field.MTVal
| 38
|
getCSR MTVal = getCSRField Field.MTVal
| 38
| false
| false
| 0
| 6
| 4
| 14
| 6
| 8
| null | null |
perryleo/sicp
|
ch1/sicpc1e27.hs
|
mit
|
isPrime n
| n < 0 = isPrime (-n)
| n == 0 = False
| n == 1 = False
| otherwise = smallestDivisor n == n
| 121
|
isPrime n
| n < 0 = isPrime (-n)
| n == 0 = False
| n == 1 = False
| otherwise = smallestDivisor n == n
| 121
|
isPrime n
| n < 0 = isPrime (-n)
| n == 0 = False
| n == 1 = False
| otherwise = smallestDivisor n == n
| 121
| false
| false
| 0
| 8
| 45
| 79
| 35
| 44
| null | null |
Yuras/plist
|
src/Text/XML/Plist/Read.hs
|
bsd-3-clause
|
readDict' _ = none
| 18
|
readDict' _ = none
| 18
|
readDict' _ = none
| 18
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
kim/amazonka
|
amazonka-cloudwatch-logs/gen/Network/AWS/CloudWatchLogs/Types.hs
|
mpl-2.0
|
-- | 'OutputLogEvent' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'oleIngestionTime' @::@ 'Maybe' 'Natural'
--
-- * 'oleMessage' @::@ 'Maybe' 'Text'
--
-- * 'oleTimestamp' @::@ 'Maybe' 'Natural'
--
outputLogEvent :: OutputLogEvent
outputLogEvent = OutputLogEvent
{ _oleTimestamp = Nothing
, _oleMessage = Nothing
, _oleIngestionTime = Nothing
}
| 409
|
outputLogEvent :: OutputLogEvent
outputLogEvent = OutputLogEvent
{ _oleTimestamp = Nothing
, _oleMessage = Nothing
, _oleIngestionTime = Nothing
}
| 172
|
outputLogEvent = OutputLogEvent
{ _oleTimestamp = Nothing
, _oleMessage = Nothing
, _oleIngestionTime = Nothing
}
| 139
| true
| true
| 0
| 7
| 79
| 45
| 30
| 15
| null | null |
andrewsw/hLife
|
Life/Gloss.hs
|
gpl-3.0
|
square :: Float -> Picture
square = Polygon . squarePath
| 56
|
square :: Float -> Picture
square = Polygon . squarePath
| 56
|
square = Polygon . squarePath
| 29
| false
| true
| 0
| 5
| 9
| 19
| 10
| 9
| null | null |
phischu/fragnix
|
builtins/ghc-prim/GHC.Prim.hs
|
bsd-3-clause
|
-- | Reads vector; offset in bytes.
readWord16X16OffAddr# :: Addr# -> Int# -> State# s -> (# State# s,Word16X16# #)
readWord16X16OffAddr# = readWord16X16OffAddr#
| 163
|
readWord16X16OffAddr# :: Addr# -> Int# -> State# s -> (# State# s,Word16X16# #)
readWord16X16OffAddr# = readWord16X16OffAddr#
| 125
|
readWord16X16OffAddr# = readWord16X16OffAddr#
| 45
| true
| true
| 0
| 9
| 24
| 35
| 18
| 17
| null | null |
ambiata/highlighting-kate
|
Text/Highlighting/Kate/Syntax/Ruby.hs
|
gpl-2.0
|
regex_'40'5ba'2dzA'2dZ'5f0'2d9'5d'2b = compileRegex True "@[a-zA-Z_0-9]+"
| 73
|
regex_'40'5ba'2dzA'2dZ'5f0'2d9'5d'2b = compileRegex True "@[a-zA-Z_0-9]+"
| 73
|
regex_'40'5ba'2dzA'2dZ'5f0'2d9'5d'2b = compileRegex True "@[a-zA-Z_0-9]+"
| 73
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
ony/Yampa-core
|
src/FRP/Yampa/EventS.hs
|
bsd-3-clause
|
delayEvent :: Time -> SF (Event a) (Event a)
delayEvent q | q < 0 = usrErr "AFRP" "delayEvent" "Negative delay."
| q == 0 = identity
| otherwise = delayEventCat q >>> arr (fmap head)
| 215
|
delayEvent :: Time -> SF (Event a) (Event a)
delayEvent q | q < 0 = usrErr "AFRP" "delayEvent" "Negative delay."
| q == 0 = identity
| otherwise = delayEventCat q >>> arr (fmap head)
| 215
|
delayEvent q | q < 0 = usrErr "AFRP" "delayEvent" "Negative delay."
| q == 0 = identity
| otherwise = delayEventCat q >>> arr (fmap head)
| 170
| false
| true
| 0
| 9
| 68
| 90
| 41
| 49
| null | null |
gspia/reflex-dom-htmlea
|
lib/src/Reflex/Dom/HTML5/Elements/Elements.hs
|
bsd-3-clause
|
-- | A short-hand notion for @ elDynAttr \"ruby\" ... @
rubyD ∷ forall t m a. (DomBuilder t m, PostBuild t m) ⇒ Dynamic t Ruby → m a → m a
rubyD bm children = snd <$> rubyD' bm children
| 185
|
rubyD ∷ forall t m a. (DomBuilder t m, PostBuild t m) ⇒ Dynamic t Ruby → m a → m a
rubyD bm children = snd <$> rubyD' bm children
| 129
|
rubyD bm children = snd <$> rubyD' bm children
| 46
| true
| true
| 0
| 9
| 41
| 75
| 37
| 38
| null | null |
kmate/HaRe
|
old/testing/removeDef/ListCompIn2_TokOut.hs
|
bsd-3-clause
|
--A definition can be removed if it is not used by other declarations.
--Where a definition is removed, it's type signature should also be removed.
--In this Example: remove the defintion 'ys'. it looks a little bit ugly when removing
--the first or last declaration in the 'let' clause.
main = sum [x + 4 |
(x,y,z) <- zipthree [1,3..] ['h'..'o'] [False ..], x > 0]
| 392
|
main = sum [x + 4 |
(x,y,z) <- zipthree [1,3..] ['h'..'o'] [False ..], x > 0]
| 102
|
main = sum [x + 4 |
(x,y,z) <- zipthree [1,3..] ['h'..'o'] [False ..], x > 0]
| 102
| true
| false
| 0
| 10
| 92
| 67
| 39
| 28
| null | null |
wiggly/functional-pokering
|
src/Poker.hs
|
mit
|
groupByRuns :: [Card] -> [[Card]]
groupByRuns cards = groupByBreak 0 breaks uniqueRanks
where uniqueRanks = nubBy (\a b -> rank a == rank b) cards
breaks = runBreaks uniqueRanks
-- convert cards to ranks and find out where discontinuities exist
-- this shows us where to split the cards at
| 300
|
groupByRuns :: [Card] -> [[Card]]
groupByRuns cards = groupByBreak 0 breaks uniqueRanks
where uniqueRanks = nubBy (\a b -> rank a == rank b) cards
breaks = runBreaks uniqueRanks
-- convert cards to ranks and find out where discontinuities exist
-- this shows us where to split the cards at
| 300
|
groupByRuns cards = groupByBreak 0 breaks uniqueRanks
where uniqueRanks = nubBy (\a b -> rank a == rank b) cards
breaks = runBreaks uniqueRanks
-- convert cards to ranks and find out where discontinuities exist
-- this shows us where to split the cards at
| 266
| false
| true
| 2
| 9
| 60
| 91
| 41
| 50
| null | null |
mbakke/ganeti
|
src/Ganeti/THH/PyRPC.hs
|
bsd-2-clause
|
-- | The indentation step in generated Python files.
pythonIndentStep :: Int
pythonIndentStep = 2
| 97
|
pythonIndentStep :: Int
pythonIndentStep = 2
| 44
|
pythonIndentStep = 2
| 20
| true
| true
| 0
| 4
| 14
| 12
| 7
| 5
| null | null |
yiannist/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
htNicNe2kPci :: String
htNicNe2kPci = "ne2k_pci"
| 48
|
htNicNe2kPci :: String
htNicNe2kPci = "ne2k_pci"
| 48
|
htNicNe2kPci = "ne2k_pci"
| 25
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
rcobbe/language-tools
|
test/Latin/LetterGen.hs
|
apache-2.0
|
-- | @updateLetter updateProp values baseLetter@ is a generator that produces
-- @updateProp baseLetter val@ (with appropriate conversions between 'Letter'
-- and 'LetterProps'), where @val@ is a value selected from @values@ at
-- random, such that @val@ is a valid letter.
updateLetter :: (LetterProps -> a -> LetterProps) -> [a] -> Letter -> Gen Letter
updateLetter updateProp values baseLetter =
let baseProps = letterToProps baseLetter
newPropIsValid = validProps . (updateProp baseProps)
in do newProp <- elements values `suchThat` newPropIsValid
return (propsToLetter (updateProp baseProps newProp))
| 629
|
updateLetter :: (LetterProps -> a -> LetterProps) -> [a] -> Letter -> Gen Letter
updateLetter updateProp values baseLetter =
let baseProps = letterToProps baseLetter
newPropIsValid = validProps . (updateProp baseProps)
in do newProp <- elements values `suchThat` newPropIsValid
return (propsToLetter (updateProp baseProps newProp))
| 349
|
updateLetter updateProp values baseLetter =
let baseProps = letterToProps baseLetter
newPropIsValid = validProps . (updateProp baseProps)
in do newProp <- elements values `suchThat` newPropIsValid
return (propsToLetter (updateProp baseProps newProp))
| 268
| true
| true
| 0
| 13
| 107
| 116
| 59
| 57
| null | null |
mpickering/pandoc-lit
|
src/Text/Pandoc/Lit.hs
|
bsd-3-clause
|
readTemplate :: Config -> IO (Maybe String)
readTemplate Config{..} =
case configTemplate of
Just filename
-> return Just `ap` readFileOrGetContents filename
Nothing
-> if configStandalone
then return Just `ap` readDefaultTemplate
else return Nothing
| 295
|
readTemplate :: Config -> IO (Maybe String)
readTemplate Config{..} =
case configTemplate of
Just filename
-> return Just `ap` readFileOrGetContents filename
Nothing
-> if configStandalone
then return Just `ap` readDefaultTemplate
else return Nothing
| 295
|
readTemplate Config{..} =
case configTemplate of
Just filename
-> return Just `ap` readFileOrGetContents filename
Nothing
-> if configStandalone
then return Just `ap` readDefaultTemplate
else return Nothing
| 251
| false
| true
| 0
| 10
| 77
| 84
| 42
| 42
| null | null |
teleshoes/taffybar
|
src/System/Taffybar/Util.hs
|
bsd-3-clause
|
liftActionTaker
:: (Monad m)
=> ((a -> m a) -> m b) -> (a -> ReaderT c m a) -> ReaderT c m b
liftActionTaker actionTaker action = do
ctx <- ask
lift $ actionTaker $ flip runReaderT ctx . action
| 201
|
liftActionTaker
:: (Monad m)
=> ((a -> m a) -> m b) -> (a -> ReaderT c m a) -> ReaderT c m b
liftActionTaker actionTaker action = do
ctx <- ask
lift $ actionTaker $ flip runReaderT ctx . action
| 201
|
liftActionTaker actionTaker action = do
ctx <- ask
lift $ actionTaker $ flip runReaderT ctx . action
| 104
| false
| true
| 0
| 11
| 48
| 105
| 50
| 55
| null | null |
ml9951/ghc
|
compiler/coreSyn/CoreSyn.hs
|
bsd-3-clause
|
-- | As 'collectBinders' but for 'AnnExpr' rather than 'Expr'
collectAnnBndrs :: AnnExpr bndr annot -> ([bndr], AnnExpr bndr annot)
collectAnnBndrs e
= collect [] e
where
collect bs (_, AnnLam b body) = collect (b:bs) body
collect bs body = (reverse bs, body)
| 285
|
collectAnnBndrs :: AnnExpr bndr annot -> ([bndr], AnnExpr bndr annot)
collectAnnBndrs e
= collect [] e
where
collect bs (_, AnnLam b body) = collect (b:bs) body
collect bs body = (reverse bs, body)
| 223
|
collectAnnBndrs e
= collect [] e
where
collect bs (_, AnnLam b body) = collect (b:bs) body
collect bs body = (reverse bs, body)
| 153
| true
| true
| 0
| 9
| 69
| 110
| 52
| 58
| null | null |
tolysz/hs-tls
|
core/Tests/PubKey.hs
|
bsd-3-clause
|
dsaParams :: DSA.Params
dsaParams = DSA.Params
{ DSA.params_p = 0x009f356bbc4750645555b02aa3918e85d5e35bdccd56154bfaa3e1801d5fe0faf65355215148ea866d5732fd27eb2f4d222c975767d2eb573513e460eceae327c8ac5da1f4ce765c49a39cae4c904b4e5cc64554d97148f20a2655027a0cf8f70b2550cc1f0c9861ce3a316520ab0588407ea3189d20c78bd52df97e56cbe0bbeb
, DSA.params_q = 0x00f33a57b47de86ff836f9fe0bb060c54ab293133b
, DSA.params_g = 0x3bb973c4f6eee92d1530f250487735595d778c2e5c8147d67a46ebcba4e6444350d49da8e7da667f9b1dbb22d2108870b9fcfabc353cdfac5218d829f22f69130317cc3b0d724881e34c34b8a2571d411da6458ef4c718df9e826f73e16a035b1dcbc1c62cac7a6604adb3e7930be8257944c6dfdddd655004b98253185775ff
}
| 680
|
dsaParams :: DSA.Params
dsaParams = DSA.Params
{ DSA.params_p = 0x009f356bbc4750645555b02aa3918e85d5e35bdccd56154bfaa3e1801d5fe0faf65355215148ea866d5732fd27eb2f4d222c975767d2eb573513e460eceae327c8ac5da1f4ce765c49a39cae4c904b4e5cc64554d97148f20a2655027a0cf8f70b2550cc1f0c9861ce3a316520ab0588407ea3189d20c78bd52df97e56cbe0bbeb
, DSA.params_q = 0x00f33a57b47de86ff836f9fe0bb060c54ab293133b
, DSA.params_g = 0x3bb973c4f6eee92d1530f250487735595d778c2e5c8147d67a46ebcba4e6444350d49da8e7da667f9b1dbb22d2108870b9fcfabc353cdfac5218d829f22f69130317cc3b0d724881e34c34b8a2571d411da6458ef4c718df9e826f73e16a035b1dcbc1c62cac7a6604adb3e7930be8257944c6dfdddd655004b98253185775ff
}
| 680
|
dsaParams = DSA.Params
{ DSA.params_p = 0x009f356bbc4750645555b02aa3918e85d5e35bdccd56154bfaa3e1801d5fe0faf65355215148ea866d5732fd27eb2f4d222c975767d2eb573513e460eceae327c8ac5da1f4ce765c49a39cae4c904b4e5cc64554d97148f20a2655027a0cf8f70b2550cc1f0c9861ce3a316520ab0588407ea3189d20c78bd52df97e56cbe0bbeb
, DSA.params_q = 0x00f33a57b47de86ff836f9fe0bb060c54ab293133b
, DSA.params_g = 0x3bb973c4f6eee92d1530f250487735595d778c2e5c8147d67a46ebcba4e6444350d49da8e7da667f9b1dbb22d2108870b9fcfabc353cdfac5218d829f22f69130317cc3b0d724881e34c34b8a2571d411da6458ef4c718df9e826f73e16a035b1dcbc1c62cac7a6604adb3e7930be8257944c6dfdddd655004b98253185775ff
}
| 656
| false
| true
| 0
| 7
| 34
| 51
| 26
| 25
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.