Search is not available for this dataset
repo_name
string | path
string | license
string | full_code
string | full_size
int64 | uncommented_code
string | uncommented_size
int64 | function_only_code
string | function_only_size
int64 | is_commented
bool | is_signatured
bool | n_ast_errors
int64 | ast_max_depth
int64 | n_whitespaces
int64 | n_ast_nodes
int64 | n_ast_terminals
int64 | n_ast_nonterminals
int64 | loc
int64 | cycloplexity
int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rueshyna/gogol
|
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'ProductStatusDataQualityIssue' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'psdqiLocation'
--
-- * 'psdqiFetchStatus'
--
-- * 'psdqiSeverity'
--
-- * 'psdqiValueProvided'
--
-- * 'psdqiId'
--
-- * 'psdqiValueOnLandingPage'
--
-- * 'psdqiTimestamp'
--
-- * 'psdqiDetail'
productStatusDataQualityIssue
:: ProductStatusDataQualityIssue
productStatusDataQualityIssue =
ProductStatusDataQualityIssue'
{ _psdqiLocation = Nothing
, _psdqiFetchStatus = Nothing
, _psdqiSeverity = Nothing
, _psdqiValueProvided = Nothing
, _psdqiId = Nothing
, _psdqiValueOnLandingPage = Nothing
, _psdqiTimestamp = Nothing
, _psdqiDetail = Nothing
}
| 782
|
productStatusDataQualityIssue
:: ProductStatusDataQualityIssue
productStatusDataQualityIssue =
ProductStatusDataQualityIssue'
{ _psdqiLocation = Nothing
, _psdqiFetchStatus = Nothing
, _psdqiSeverity = Nothing
, _psdqiValueProvided = Nothing
, _psdqiId = Nothing
, _psdqiValueOnLandingPage = Nothing
, _psdqiTimestamp = Nothing
, _psdqiDetail = Nothing
}
| 398
|
productStatusDataQualityIssue =
ProductStatusDataQualityIssue'
{ _psdqiLocation = Nothing
, _psdqiFetchStatus = Nothing
, _psdqiSeverity = Nothing
, _psdqiValueProvided = Nothing
, _psdqiId = Nothing
, _psdqiValueOnLandingPage = Nothing
, _psdqiTimestamp = Nothing
, _psdqiDetail = Nothing
}
| 331
| true
| true
| 1
| 7
| 144
| 87
| 59
| 28
| null | null |
phischu/fragnix
|
tests/packages/scotty/Data.Time.Calendar.Days.hs
|
bsd-3-clause
|
addDays :: Integer -> Day -> Day
addDays n (ModifiedJulianDay a) = ModifiedJulianDay (a + n)
| 92
|
addDays :: Integer -> Day -> Day
addDays n (ModifiedJulianDay a) = ModifiedJulianDay (a + n)
| 92
|
addDays n (ModifiedJulianDay a) = ModifiedJulianDay (a + n)
| 59
| false
| true
| 0
| 7
| 15
| 44
| 21
| 23
| null | null |
psibi/persistent
|
persistent/Database/Persist/Class/PersistEntity.hs
|
mit
|
entityIdFromJSON :: (PersistEntity record, FromJSON record, FromJSON (Key record)) => Value -> Parser (Entity record)
entityIdFromJSON value@(Object o) = Entity <$> o .: "id" <*> parseJSON value
| 194
|
entityIdFromJSON :: (PersistEntity record, FromJSON record, FromJSON (Key record)) => Value -> Parser (Entity record)
entityIdFromJSON value@(Object o) = Entity <$> o .: "id" <*> parseJSON value
| 194
|
entityIdFromJSON value@(Object o) = Entity <$> o .: "id" <*> parseJSON value
| 76
| false
| true
| 0
| 9
| 26
| 78
| 39
| 39
| null | null |
prophet-on-that/hslogger-reader
|
src/System/Log/Reader.hs
|
bsd-3-clause
|
buildParser
:: Parser T.Text -- ^ LoggerName parser
-> Parser ZonedTime
-> [Instruction]
-> Parser LogMessage
buildParser loggerNameParser zonedTimeParser
= foldlM helper $ LogMessage Nothing Nothing Nothing Nothing Nothing Nothing
where
helper :: LogMessage -> Instruction -> Parser LogMessage
helper lm (Noise noise) = do
_ <- string noise
return lm
helper lm Message = do
msg <- takeTill isEndOfLine
return $ lm { message = Just msg }
helper lm LoggerName = do
name <- loggerNameParser
return $ lm { loggerName = Just name }
helper lm Priority = do
prio <- parsePriority
return $ lm { priority = Just prio }
where
parsePriority :: Parser Priority
parsePriority
= ("DEBUG" >> return DEBUG) <|>
("INFO" >> return INFO) <|>
("NOTICE" >> return NOTICE) <|>
("WARNING" >> return WARNING) <|>
("ERROR" >> return ERROR) <|>
("CRITICAL" >> return CRITICAL) <|>
("ALERT" >> return ALERT) <|>
("EMERGENCY" >> return EMERGENCY) <|>
(fail "Priority not recognised")
helper lm ThreadId = do
tid <- decimal
return $ lm { threadId = Just tid }
helper lm ProcessId = do
pid <- decimal
return $ lm { processId = Just pid }
helper lm Time = do
time' <- zonedTimeParser
return $ lm { timestamp = Just time' }
helper lm TimeUTC = do
time' <- zonedTimeParser
return $ lm { timestamp = Just time' }
-- | Build a parser for a 'LogMessage' from a format string, as
-- described by the hslogger package.
| 1,660
|
buildParser
:: Parser T.Text -- ^ LoggerName parser
-> Parser ZonedTime
-> [Instruction]
-> Parser LogMessage
buildParser loggerNameParser zonedTimeParser
= foldlM helper $ LogMessage Nothing Nothing Nothing Nothing Nothing Nothing
where
helper :: LogMessage -> Instruction -> Parser LogMessage
helper lm (Noise noise) = do
_ <- string noise
return lm
helper lm Message = do
msg <- takeTill isEndOfLine
return $ lm { message = Just msg }
helper lm LoggerName = do
name <- loggerNameParser
return $ lm { loggerName = Just name }
helper lm Priority = do
prio <- parsePriority
return $ lm { priority = Just prio }
where
parsePriority :: Parser Priority
parsePriority
= ("DEBUG" >> return DEBUG) <|>
("INFO" >> return INFO) <|>
("NOTICE" >> return NOTICE) <|>
("WARNING" >> return WARNING) <|>
("ERROR" >> return ERROR) <|>
("CRITICAL" >> return CRITICAL) <|>
("ALERT" >> return ALERT) <|>
("EMERGENCY" >> return EMERGENCY) <|>
(fail "Priority not recognised")
helper lm ThreadId = do
tid <- decimal
return $ lm { threadId = Just tid }
helper lm ProcessId = do
pid <- decimal
return $ lm { processId = Just pid }
helper lm Time = do
time' <- zonedTimeParser
return $ lm { timestamp = Just time' }
helper lm TimeUTC = do
time' <- zonedTimeParser
return $ lm { timestamp = Just time' }
-- | Build a parser for a 'LogMessage' from a format string, as
-- described by the hslogger package.
| 1,660
|
buildParser loggerNameParser zonedTimeParser
= foldlM helper $ LogMessage Nothing Nothing Nothing Nothing Nothing Nothing
where
helper :: LogMessage -> Instruction -> Parser LogMessage
helper lm (Noise noise) = do
_ <- string noise
return lm
helper lm Message = do
msg <- takeTill isEndOfLine
return $ lm { message = Just msg }
helper lm LoggerName = do
name <- loggerNameParser
return $ lm { loggerName = Just name }
helper lm Priority = do
prio <- parsePriority
return $ lm { priority = Just prio }
where
parsePriority :: Parser Priority
parsePriority
= ("DEBUG" >> return DEBUG) <|>
("INFO" >> return INFO) <|>
("NOTICE" >> return NOTICE) <|>
("WARNING" >> return WARNING) <|>
("ERROR" >> return ERROR) <|>
("CRITICAL" >> return CRITICAL) <|>
("ALERT" >> return ALERT) <|>
("EMERGENCY" >> return EMERGENCY) <|>
(fail "Priority not recognised")
helper lm ThreadId = do
tid <- decimal
return $ lm { threadId = Just tid }
helper lm ProcessId = do
pid <- decimal
return $ lm { processId = Just pid }
helper lm Time = do
time' <- zonedTimeParser
return $ lm { timestamp = Just time' }
helper lm TimeUTC = do
time' <- zonedTimeParser
return $ lm { timestamp = Just time' }
-- | Build a parser for a 'LogMessage' from a format string, as
-- described by the hslogger package.
| 1,542
| false
| true
| 35
| 11
| 519
| 565
| 257
| 308
| null | null |
phischu/gtk2hs
|
gtk/demo/inputmethod/Layout.hs
|
lgpl-3.0
|
updateArea :: DrawingArea -> PangoLayout -> EventM EExpose Bool
updateArea area lay = do
win <- eventWindow
liftIO $ do
renderWithDrawable win $ do
moveTo 0 0
showLayout lay
return True
| 202
|
updateArea :: DrawingArea -> PangoLayout -> EventM EExpose Bool
updateArea area lay = do
win <- eventWindow
liftIO $ do
renderWithDrawable win $ do
moveTo 0 0
showLayout lay
return True
| 202
|
updateArea area lay = do
win <- eventWindow
liftIO $ do
renderWithDrawable win $ do
moveTo 0 0
showLayout lay
return True
| 138
| false
| true
| 0
| 13
| 47
| 73
| 31
| 42
| null | null |
KenseiMaedhros/Haskell-Invaders
|
app/World.hs
|
bsd-3-clause
|
gameOver :: World -> Bool
gameOver world = shipHit world || invadersGone world
| 78
|
gameOver :: World -> Bool
gameOver world = shipHit world || invadersGone world
| 78
|
gameOver world = shipHit world || invadersGone world
| 52
| false
| true
| 0
| 6
| 12
| 28
| 13
| 15
| null | null |
xmonad/xmonad-contrib
|
XMonad/Util/Themes.hs
|
bsd-3-clause
|
-- | Lake (blue/green) colours, by Kathryn Andersen
kavonLakeTheme :: ThemeInfo
kavonLakeTheme =
newTheme { themeName = "kavonLakeTheme"
, themeAuthor = "Kathryn Andersen"
, themeDescription = "Lake (blue/green) colours"
, theme = def { activeColor = "#001166"
, activeBorderColor = "#1f3999"
, activeTextColor = "white"
, inactiveColor = "#09592a"
, inactiveBorderColor = "#198044"
, inactiveTextColor = "#73e6a3"
}
}
| 747
|
kavonLakeTheme :: ThemeInfo
kavonLakeTheme =
newTheme { themeName = "kavonLakeTheme"
, themeAuthor = "Kathryn Andersen"
, themeDescription = "Lake (blue/green) colours"
, theme = def { activeColor = "#001166"
, activeBorderColor = "#1f3999"
, activeTextColor = "white"
, inactiveColor = "#09592a"
, inactiveBorderColor = "#198044"
, inactiveTextColor = "#73e6a3"
}
}
| 695
|
kavonLakeTheme =
newTheme { themeName = "kavonLakeTheme"
, themeAuthor = "Kathryn Andersen"
, themeDescription = "Lake (blue/green) colours"
, theme = def { activeColor = "#001166"
, activeBorderColor = "#1f3999"
, activeTextColor = "white"
, inactiveColor = "#09592a"
, inactiveBorderColor = "#198044"
, inactiveTextColor = "#73e6a3"
}
}
| 667
| true
| true
| 0
| 9
| 387
| 86
| 51
| 35
| null | null |
sdiehl/ghc
|
compiler/basicTypes/VarEnv.hs
|
bsd-3-clause
|
rnEtaR :: RnEnv2 -> Var -> (RnEnv2, Var)
-- ^ Similar to 'rnBndr2' but used for eta expansion
-- See Note [Eta expansion]
rnEtaR (RV2 { envL = envL, envR = envR, in_scope = in_scope }) bR
= (RV2 { envL = extendVarEnv envL new_b new_b -- Note [Eta expansion]
, envR = extendVarEnv envR bR new_b
, in_scope = extendInScopeSet in_scope new_b }, new_b)
where
new_b = uniqAway in_scope bR
| 421
|
rnEtaR :: RnEnv2 -> Var -> (RnEnv2, Var)
rnEtaR (RV2 { envL = envL, envR = envR, in_scope = in_scope }) bR
= (RV2 { envL = extendVarEnv envL new_b new_b -- Note [Eta expansion]
, envR = extendVarEnv envR bR new_b
, in_scope = extendInScopeSet in_scope new_b }, new_b)
where
new_b = uniqAway in_scope bR
| 340
|
rnEtaR (RV2 { envL = envL, envR = envR, in_scope = in_scope }) bR
= (RV2 { envL = extendVarEnv envL new_b new_b -- Note [Eta expansion]
, envR = extendVarEnv envR bR new_b
, in_scope = extendInScopeSet in_scope new_b }, new_b)
where
new_b = uniqAway in_scope bR
| 299
| true
| true
| 0
| 9
| 108
| 115
| 65
| 50
| null | null |
yiannist/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
opcodeReasonSrcRlib2 :: String
opcodeReasonSrcRlib2 = "gnt:library:rlib2"
| 73
|
opcodeReasonSrcRlib2 :: String
opcodeReasonSrcRlib2 = "gnt:library:rlib2"
| 73
|
opcodeReasonSrcRlib2 = "gnt:library:rlib2"
| 42
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
micknelso/language-c
|
src/Language/CFamily/C/Analysis/Export.hs
|
bsd-3-clause
|
-- |Export Declarator
--
-- Synopsis: @exportDeclr other_specs type attributes variable-name@
exportDeclr :: [CDeclSpec] -> Type -> Attributes -> VarName -> ([CDeclSpec],CDeclr)
exportDeclr other_specs ty attrs name =
(other_specs ++ specs, CDeclr ident derived asmname (exportAttrs attrs) ni)
where
(specs,derived) = exportType ty
(ident,asmname) = case name of (VarName vident asmname_opt) -> (Just vident, asmname_opt)
_ -> (Nothing,Nothing)
| 496
|
exportDeclr :: [CDeclSpec] -> Type -> Attributes -> VarName -> ([CDeclSpec],CDeclr)
exportDeclr other_specs ty attrs name =
(other_specs ++ specs, CDeclr ident derived asmname (exportAttrs attrs) ni)
where
(specs,derived) = exportType ty
(ident,asmname) = case name of (VarName vident asmname_opt) -> (Just vident, asmname_opt)
_ -> (Nothing,Nothing)
| 401
|
exportDeclr other_specs ty attrs name =
(other_specs ++ specs, CDeclr ident derived asmname (exportAttrs attrs) ni)
where
(specs,derived) = exportType ty
(ident,asmname) = case name of (VarName vident asmname_opt) -> (Just vident, asmname_opt)
_ -> (Nothing,Nothing)
| 317
| true
| true
| 0
| 11
| 109
| 146
| 80
| 66
| null | null |
olsner/ghc
|
testsuite/tests/programs/andy_cherry/DataTypes.hs
|
bsd-3-clause
|
mkResult _ = Unknown
| 28
|
mkResult _ = Unknown
| 28
|
mkResult _ = Unknown
| 28
| false
| false
| 0
| 5
| 11
| 9
| 4
| 5
| null | null |
AlexanderPankiv/ghc
|
compiler/codeGen/StgCmmUtils.hs
|
bsd-3-clause
|
-------------------------------------------------------------------------
--
-- Literals
--
-------------------------------------------------------------------------
cgLit :: Literal -> FCode CmmLit
cgLit (MachStr s) = newByteStringCLit (BS.unpack s)
| 256
|
cgLit :: Literal -> FCode CmmLit
cgLit (MachStr s) = newByteStringCLit (BS.unpack s)
| 84
|
cgLit (MachStr s) = newByteStringCLit (BS.unpack s)
| 51
| true
| true
| 0
| 8
| 24
| 43
| 23
| 20
| null | null |
ml9951/ghc
|
utils/deriveConstants/DeriveConstants.hs
|
bsd-3-clause
|
closurePayloadMacro :: Name -> Wanteds
closurePayloadMacro nameBase = [(C, ClosurePayloadMacro nameBase)]
| 105
|
closurePayloadMacro :: Name -> Wanteds
closurePayloadMacro nameBase = [(C, ClosurePayloadMacro nameBase)]
| 105
|
closurePayloadMacro nameBase = [(C, ClosurePayloadMacro nameBase)]
| 66
| false
| true
| 0
| 7
| 10
| 30
| 16
| 14
| null | null |
phi16/Lambia
|
src/Lambia/Index.hs
|
gpl-3.0
|
ini :: Store s => Status s
ini = Status prim prim
| 49
|
ini :: Store s => Status s
ini = Status prim prim
| 49
|
ini = Status prim prim
| 22
| false
| true
| 0
| 7
| 11
| 33
| 13
| 20
| null | null |
fehrenbach/rechts
|
app/Pretty.hs
|
gpl-3.0
|
prettyType (FunT a b) = parens $ prettyType a <+> "->" <+> prettyType b
| 71
|
prettyType (FunT a b) = parens $ prettyType a <+> "->" <+> prettyType b
| 71
|
prettyType (FunT a b) = parens $ prettyType a <+> "->" <+> prettyType b
| 71
| false
| false
| 0
| 8
| 13
| 35
| 16
| 19
| null | null |
enobayram/heksek
|
src/Control/Monad/Seksek.hs
|
bsd-3-clause
|
responseOrInitial :: BS.ByteString -> Maybe (Value, SeksekContinuation [Value])
responseOrInitial body = case decodeStrict' body of
Nothing -> Nothing
Just value -> case maybeFromJSON value of
Just (SeksekResponse resp cont) -> Just (resp, cont)
Nothing -> Just (value, SeksekContinuation 0 [])
| 306
|
responseOrInitial :: BS.ByteString -> Maybe (Value, SeksekContinuation [Value])
responseOrInitial body = case decodeStrict' body of
Nothing -> Nothing
Just value -> case maybeFromJSON value of
Just (SeksekResponse resp cont) -> Just (resp, cont)
Nothing -> Just (value, SeksekContinuation 0 [])
| 306
|
responseOrInitial body = case decodeStrict' body of
Nothing -> Nothing
Just value -> case maybeFromJSON value of
Just (SeksekResponse resp cont) -> Just (resp, cont)
Nothing -> Just (value, SeksekContinuation 0 [])
| 226
| false
| true
| 0
| 14
| 51
| 115
| 56
| 59
| null | null |
bjorsig/Kennitala
|
hsKennitala/testKennitala.hs
|
bsd-2-clause
|
main :: IO ()
main = hspec $ do
describe "fmap show . kennitala" $
it "Athugar hvort kennitala sé lögleg og bætir við bandstriki ef vantar." $ do
(fmap show . kennitala) "211295-2019" `shouldBe` Right "211295-2019"
(fmap show . kennitala) "2112952019" `shouldBe` Right "211295-2019"
(fmap show . kennitala) "0101012049" `shouldBe` Right "010101-2049"
(fmap show . kennitala) "1001012119" `shouldBe` Right "100101-2119"
(fmap show . kennitala) "1110571849" `shouldBe` Right "111057-1849"
(fmap show . kennitala) "0209581979" `shouldBe` Right "020958-1979"
(fmap show . kennitala) "0102560039" `shouldBe` Right "010256-0039"
describe "gildKennitala" $ do
it "Man að ap-jún-sept-nóv þrjátíu hver," $ do
gildKennitala "0404042019" `shouldBe` True
gildKennitala "3104042099" `shouldBe` False
gildKennitala "1111112009" `shouldBe` True
gildKennitala "3111112059" `shouldBe` False
it "en einn til hinir taka sér." $ do
gildKennitala "1010102019" `shouldBe` True
gildKennitala "3110102049" `shouldBe` True
it "Veit að hlaupársdagur er ekki nema á fjögurra ára fresti." $ do
gildKennitala "290201-2099" `shouldBe` False
it "Staðfestir að mánaðardagur sé mest 31." $ do
gildKennitala "7201002079" `shouldBe` False
gildKennitala "7112102109" `shouldBe` True
gildKennitala "7010810569" `shouldBe` True
gildKennitala "3201002089" `shouldBe` False
it "Staðfestir að mánaðardagur sé minnst 1." $ do
gildKennitala "0012002599" `shouldBe` False
gildKennitala "-012002579" `shouldBe` False
gildKennitala "-912002509" `shouldBe` False
it "Staðfestir að mánuður sé mest 12." $ do
gildKennitala "010122-009" `shouldBe` False
it "Staðfestir að mánuður sé minnst 1." $ do
gildKennitala "0100122019" `shouldBe` False
it "Passar að kennitala innihaldi einungis tölustafi." $ do
gildKennitala "21129b-2019" `shouldBe` False
gildKennitala "bókstaflega" `shouldBe` False
gildKennitala "211295-29-9" `shouldBe` False
gildKennitala "211295-291-" `shouldBe` False
it "Leyfir bandstrik, en einungis á réttum stað." $ do
gildKennitala "211295-2019" `shouldBe` True
gildKennitala "2112-952919" `shouldBe` False
it "Samþykkir venjulega kennitölu einstaklings." $ do
gildKennitala "0108982509" `shouldBe` True
gildKennitala "1201603389" `shouldBe` True
gildKennitala "1010132009" `shouldBe` True
it "Hafnar kennitölu af rangri lengd." $ do
gildKennitala "123456789" `shouldBe` False
gildKennitala "12345678911" `shouldBe` False
it "Samþykkir kennitölu með lága raðtölu." $ do
gildKennitala "1110571849" `shouldBe` True
gildKennitala "0209581979" `shouldBe` True
gildKennitala "0102560039" `shouldBe` True
describe "vartölu" $ do
it "Reiknar út vartölu (sem bókstaf) útfrá fyrstu 8 tölustöfunum (sem streng)." $ do
vartölu "12016033" `shouldBe` (Right $ Just '8')
it "Skilar Right Nothing ef vartalan kemst ekki fyrir í einum tölustaf (bókstaf)." $
vartölu "10101309" `shouldBe` Right Nothing
describe "fmap kennitöluHafi . kennitala" $
it "Ákvarðar hvort kennitala myndi tilheyra einstaklingi eða lögaðila." $ do
(fmap kennitöluHafi . kennitala) "1709715079" `shouldBe` Right Einstaklingur
(fmap kennitöluHafi . kennitala) "211295-2019" `shouldBe` Right Einstaklingur
(fmap kennitöluHafi . kennitala) "4403044350" `shouldBe` Right Lögaðili
(fmap kennitöluHafi . kennitala) "440304-4350" `shouldBe` Right Lögaðili
| 3,970
|
main :: IO ()
main = hspec $ do
describe "fmap show . kennitala" $
it "Athugar hvort kennitala sé lögleg og bætir við bandstriki ef vantar." $ do
(fmap show . kennitala) "211295-2019" `shouldBe` Right "211295-2019"
(fmap show . kennitala) "2112952019" `shouldBe` Right "211295-2019"
(fmap show . kennitala) "0101012049" `shouldBe` Right "010101-2049"
(fmap show . kennitala) "1001012119" `shouldBe` Right "100101-2119"
(fmap show . kennitala) "1110571849" `shouldBe` Right "111057-1849"
(fmap show . kennitala) "0209581979" `shouldBe` Right "020958-1979"
(fmap show . kennitala) "0102560039" `shouldBe` Right "010256-0039"
describe "gildKennitala" $ do
it "Man að ap-jún-sept-nóv þrjátíu hver," $ do
gildKennitala "0404042019" `shouldBe` True
gildKennitala "3104042099" `shouldBe` False
gildKennitala "1111112009" `shouldBe` True
gildKennitala "3111112059" `shouldBe` False
it "en einn til hinir taka sér." $ do
gildKennitala "1010102019" `shouldBe` True
gildKennitala "3110102049" `shouldBe` True
it "Veit að hlaupársdagur er ekki nema á fjögurra ára fresti." $ do
gildKennitala "290201-2099" `shouldBe` False
it "Staðfestir að mánaðardagur sé mest 31." $ do
gildKennitala "7201002079" `shouldBe` False
gildKennitala "7112102109" `shouldBe` True
gildKennitala "7010810569" `shouldBe` True
gildKennitala "3201002089" `shouldBe` False
it "Staðfestir að mánaðardagur sé minnst 1." $ do
gildKennitala "0012002599" `shouldBe` False
gildKennitala "-012002579" `shouldBe` False
gildKennitala "-912002509" `shouldBe` False
it "Staðfestir að mánuður sé mest 12." $ do
gildKennitala "010122-009" `shouldBe` False
it "Staðfestir að mánuður sé minnst 1." $ do
gildKennitala "0100122019" `shouldBe` False
it "Passar að kennitala innihaldi einungis tölustafi." $ do
gildKennitala "21129b-2019" `shouldBe` False
gildKennitala "bókstaflega" `shouldBe` False
gildKennitala "211295-29-9" `shouldBe` False
gildKennitala "211295-291-" `shouldBe` False
it "Leyfir bandstrik, en einungis á réttum stað." $ do
gildKennitala "211295-2019" `shouldBe` True
gildKennitala "2112-952919" `shouldBe` False
it "Samþykkir venjulega kennitölu einstaklings." $ do
gildKennitala "0108982509" `shouldBe` True
gildKennitala "1201603389" `shouldBe` True
gildKennitala "1010132009" `shouldBe` True
it "Hafnar kennitölu af rangri lengd." $ do
gildKennitala "123456789" `shouldBe` False
gildKennitala "12345678911" `shouldBe` False
it "Samþykkir kennitölu með lága raðtölu." $ do
gildKennitala "1110571849" `shouldBe` True
gildKennitala "0209581979" `shouldBe` True
gildKennitala "0102560039" `shouldBe` True
describe "vartölu" $ do
it "Reiknar út vartölu (sem bókstaf) útfrá fyrstu 8 tölustöfunum (sem streng)." $ do
vartölu "12016033" `shouldBe` (Right $ Just '8')
it "Skilar Right Nothing ef vartalan kemst ekki fyrir í einum tölustaf (bókstaf)." $
vartölu "10101309" `shouldBe` Right Nothing
describe "fmap kennitöluHafi . kennitala" $
it "Ákvarðar hvort kennitala myndi tilheyra einstaklingi eða lögaðila." $ do
(fmap kennitöluHafi . kennitala) "1709715079" `shouldBe` Right Einstaklingur
(fmap kennitöluHafi . kennitala) "211295-2019" `shouldBe` Right Einstaklingur
(fmap kennitöluHafi . kennitala) "4403044350" `shouldBe` Right Lögaðili
(fmap kennitöluHafi . kennitala) "440304-4350" `shouldBe` Right Lögaðili
| 3,970
|
main = hspec $ do
describe "fmap show . kennitala" $
it "Athugar hvort kennitala sé lögleg og bætir við bandstriki ef vantar." $ do
(fmap show . kennitala) "211295-2019" `shouldBe` Right "211295-2019"
(fmap show . kennitala) "2112952019" `shouldBe` Right "211295-2019"
(fmap show . kennitala) "0101012049" `shouldBe` Right "010101-2049"
(fmap show . kennitala) "1001012119" `shouldBe` Right "100101-2119"
(fmap show . kennitala) "1110571849" `shouldBe` Right "111057-1849"
(fmap show . kennitala) "0209581979" `shouldBe` Right "020958-1979"
(fmap show . kennitala) "0102560039" `shouldBe` Right "010256-0039"
describe "gildKennitala" $ do
it "Man að ap-jún-sept-nóv þrjátíu hver," $ do
gildKennitala "0404042019" `shouldBe` True
gildKennitala "3104042099" `shouldBe` False
gildKennitala "1111112009" `shouldBe` True
gildKennitala "3111112059" `shouldBe` False
it "en einn til hinir taka sér." $ do
gildKennitala "1010102019" `shouldBe` True
gildKennitala "3110102049" `shouldBe` True
it "Veit að hlaupársdagur er ekki nema á fjögurra ára fresti." $ do
gildKennitala "290201-2099" `shouldBe` False
it "Staðfestir að mánaðardagur sé mest 31." $ do
gildKennitala "7201002079" `shouldBe` False
gildKennitala "7112102109" `shouldBe` True
gildKennitala "7010810569" `shouldBe` True
gildKennitala "3201002089" `shouldBe` False
it "Staðfestir að mánaðardagur sé minnst 1." $ do
gildKennitala "0012002599" `shouldBe` False
gildKennitala "-012002579" `shouldBe` False
gildKennitala "-912002509" `shouldBe` False
it "Staðfestir að mánuður sé mest 12." $ do
gildKennitala "010122-009" `shouldBe` False
it "Staðfestir að mánuður sé minnst 1." $ do
gildKennitala "0100122019" `shouldBe` False
it "Passar að kennitala innihaldi einungis tölustafi." $ do
gildKennitala "21129b-2019" `shouldBe` False
gildKennitala "bókstaflega" `shouldBe` False
gildKennitala "211295-29-9" `shouldBe` False
gildKennitala "211295-291-" `shouldBe` False
it "Leyfir bandstrik, en einungis á réttum stað." $ do
gildKennitala "211295-2019" `shouldBe` True
gildKennitala "2112-952919" `shouldBe` False
it "Samþykkir venjulega kennitölu einstaklings." $ do
gildKennitala "0108982509" `shouldBe` True
gildKennitala "1201603389" `shouldBe` True
gildKennitala "1010132009" `shouldBe` True
it "Hafnar kennitölu af rangri lengd." $ do
gildKennitala "123456789" `shouldBe` False
gildKennitala "12345678911" `shouldBe` False
it "Samþykkir kennitölu með lága raðtölu." $ do
gildKennitala "1110571849" `shouldBe` True
gildKennitala "0209581979" `shouldBe` True
gildKennitala "0102560039" `shouldBe` True
describe "vartölu" $ do
it "Reiknar út vartölu (sem bókstaf) útfrá fyrstu 8 tölustöfunum (sem streng)." $ do
vartölu "12016033" `shouldBe` (Right $ Just '8')
it "Skilar Right Nothing ef vartalan kemst ekki fyrir í einum tölustaf (bókstaf)." $
vartölu "10101309" `shouldBe` Right Nothing
describe "fmap kennitöluHafi . kennitala" $
it "Ákvarðar hvort kennitala myndi tilheyra einstaklingi eða lögaðila." $ do
(fmap kennitöluHafi . kennitala) "1709715079" `shouldBe` Right Einstaklingur
(fmap kennitöluHafi . kennitala) "211295-2019" `shouldBe` Right Einstaklingur
(fmap kennitöluHafi . kennitala) "4403044350" `shouldBe` Right Lögaðili
(fmap kennitöluHafi . kennitala) "440304-4350" `shouldBe` Right Lögaðili
| 3,956
| false
| true
| 2
| 16
| 1,103
| 910
| 428
| 482
| null | null |
rudymatela/llcheck
|
src/Test/LeanCheck/Utils/Types.hs
|
bsd-3-clause
|
oInt2 ::(Int->Int->Int)->(Int2->Int2->Int2) ; oInt2 = oNewtype int2 unInt2
| 79
|
oInt2 ::(Int->Int->Int)->(Int2->Int2->Int2)
oInt2 = oNewtype int2 unInt2
| 75
|
oInt2 = oNewtype int2 unInt2
| 30
| false
| true
| 0
| 8
| 12
| 46
| 24
| 22
| null | null |
HJvT/hdirect
|
src/Parser.hs
|
bsd-3-clause
|
happyReduce_111 = happySpecReduce_2 33# happyReduction_111
| 58
|
happyReduce_111 = happySpecReduce_2 33# happyReduction_111
| 58
|
happyReduce_111 = happySpecReduce_2 33# happyReduction_111
| 58
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
leskiw77/Checkers
|
src/Input.hs
|
bsd-3-clause
|
parseFrom :: Board -> [Char] -> Player -> (Int, Int)
parseFrom board line player = do
let result = takeCoordinates line
if colorMatch board (mapPlayerToPiece player) result
then result
else throw MkMyException
| 223
|
parseFrom :: Board -> [Char] -> Player -> (Int, Int)
parseFrom board line player = do
let result = takeCoordinates line
if colorMatch board (mapPlayerToPiece player) result
then result
else throw MkMyException
| 223
|
parseFrom board line player = do
let result = takeCoordinates line
if colorMatch board (mapPlayerToPiece player) result
then result
else throw MkMyException
| 170
| false
| true
| 0
| 10
| 45
| 78
| 39
| 39
| null | null |
haskell-compat/base-compat
|
base-compat/src/Data/Either/Compat.hs
|
mit
|
isLeft (Right _) = False
| 24
|
isLeft (Right _) = False
| 24
|
isLeft (Right _) = False
| 24
| false
| false
| 0
| 7
| 4
| 15
| 7
| 8
| null | null |
brendanhay/gogol
|
gogol-cloudsearch/gen/Network/Google/Resource/CloudSearch/Stats/GetSession.hs
|
mpl-2.0
|
-- | Day of month. Must be from 1 to 31 and valid for the year and month.
sgsToDateDay :: Lens' StatsGetSession (Maybe Int32)
sgsToDateDay
= lens _sgsToDateDay (\ s a -> s{_sgsToDateDay = a})
. mapping _Coerce
| 217
|
sgsToDateDay :: Lens' StatsGetSession (Maybe Int32)
sgsToDateDay
= lens _sgsToDateDay (\ s a -> s{_sgsToDateDay = a})
. mapping _Coerce
| 143
|
sgsToDateDay
= lens _sgsToDateDay (\ s a -> s{_sgsToDateDay = a})
. mapping _Coerce
| 91
| true
| true
| 0
| 10
| 45
| 55
| 28
| 27
| null | null |
ghc-android/ghc
|
libraries/template-haskell/Language/Haskell/TH/Lib.hs
|
bsd-3-clause
|
tupleK :: Int -> Kind
tupleK = TupleT
| 37
|
tupleK :: Int -> Kind
tupleK = TupleT
| 37
|
tupleK = TupleT
| 15
| false
| true
| 0
| 7
| 7
| 22
| 9
| 13
| null | null |
FranklinChen/hugs98-plus-Sep2006
|
packages/HaXml/src/Text/XML/HaXml/DtdToHaskell/TypeDef.hs
|
bsd-3-clause
|
notPrelude "FilePath"= "AFilePath"
| 34
|
notPrelude "FilePath"= "AFilePath"
| 34
|
notPrelude "FilePath"= "AFilePath"
| 34
| false
| false
| 1
| 5
| 2
| 14
| 4
| 10
| null | null |
edofic/effect-handlers
|
src/Control/Effects/Search.hs
|
mit
|
asT :: a -> T a -> a
asT a T = a
| 32
|
asT :: a -> T a -> a
asT a T = a
| 32
|
asT a T = a
| 11
| false
| true
| 0
| 8
| 12
| 33
| 14
| 19
| null | null |
bergmark/purescript
|
src/Language/PureScript/Constants.hs
|
mit
|
-- Modules
prim :: String
prim = "Prim"
| 40
|
prim :: String
prim = "Prim"
| 28
|
prim = "Prim"
| 13
| true
| true
| 0
| 4
| 8
| 12
| 7
| 5
| null | null |
bjpop/haskell-mpi
|
src/Control/Parallel/MPI/Simple.hs
|
bsd-3-clause
|
-- | Serializes the supplied value and sends to specified process as the array of 'byte's using 'Internal.rsend'.
--
-- This call expects the matching receive already to be posted, otherwise error will occur.
--
-- Due to the difference between OpenMPI and MPICH2 (tested on v.1.2.1.1) size of messages posted with @rsend@
-- could not be 'probe'd, which breaks
-- all variants of point-to-point receving code in this module. Therefore, when liked with MPICH2, this function
-- will use 'Internal.send' internally.
rsend :: Serialize msg => Comm -> Rank -> Tag -> msg -> IO ()
rsend c r t m = sendBSwith impl c r t $ encode m
where impl = if Internal.getImplementation == Internal.MPICH2 then Internal.send else Internal.rsend
-- | Sends ByteString to specified process as the array of 'byte's using 'Internal.send'.
| 824
|
rsend :: Serialize msg => Comm -> Rank -> Tag -> msg -> IO ()
rsend c r t m = sendBSwith impl c r t $ encode m
where impl = if Internal.getImplementation == Internal.MPICH2 then Internal.send else Internal.rsend
-- | Sends ByteString to specified process as the array of 'byte's using 'Internal.send'.
| 304
|
rsend c r t m = sendBSwith impl c r t $ encode m
where impl = if Internal.getImplementation == Internal.MPICH2 then Internal.send else Internal.rsend
-- | Sends ByteString to specified process as the array of 'byte's using 'Internal.send'.
| 242
| true
| true
| 0
| 11
| 143
| 101
| 54
| 47
| null | null |
trskop/microservices
|
src/Control/Microservices/Internal/Stack.hs
|
bsd-3-clause
|
peekSvcName
:: ServiceStack r m (name ': names) (params ': paramss)
-> Proxy name
peekSvcName _ = Proxy
| 111
|
peekSvcName
:: ServiceStack r m (name ': names) (params ': paramss)
-> Proxy name
peekSvcName _ = Proxy
| 111
|
peekSvcName _ = Proxy
| 21
| false
| true
| 0
| 9
| 25
| 53
| 25
| 28
| null | null |
GaloisInc/halvm-ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
gHC_GENERICS = mkBaseModule (fsLit "GHC.Generics")
| 53
|
gHC_GENERICS = mkBaseModule (fsLit "GHC.Generics")
| 53
|
gHC_GENERICS = mkBaseModule (fsLit "GHC.Generics")
| 53
| false
| false
| 1
| 7
| 7
| 18
| 7
| 11
| null | null |
ghcjs/jsaddle-dom
|
src/JSDOM/Generated/XMLHttpRequestEventTarget.hs
|
mit
|
-- | <https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequestEventTarget.onprogress Mozilla XMLHttpRequestEventTarget.onprogress documentation>
progress ::
(IsXMLHttpRequestEventTarget self, IsEventTarget self) =>
EventName self XMLHttpRequestProgressEvent
progress = unsafeEventNameAsync (toJSString "progress")
| 341
|
progress ::
(IsXMLHttpRequestEventTarget self, IsEventTarget self) =>
EventName self XMLHttpRequestProgressEvent
progress = unsafeEventNameAsync (toJSString "progress")
| 188
|
progress = unsafeEventNameAsync (toJSString "progress")
| 55
| true
| true
| 0
| 7
| 41
| 41
| 21
| 20
| null | null |
andrewthad/yesod
|
yesod-core/Yesod/Core/Handler.hs
|
mit
|
setUltDestCurrent :: MonadHandler m => m ()
setUltDestCurrent = do
route <- getCurrentRoute
case route of
Nothing -> return ()
Just r -> do
gets' <- reqGetParams `liftM` getRequest
setUltDest (r, gets')
-- | Sets the ultimate destination to the referer request header, if present.
--
-- This function will not overwrite an existing ultdest.
| 389
|
setUltDestCurrent :: MonadHandler m => m ()
setUltDestCurrent = do
route <- getCurrentRoute
case route of
Nothing -> return ()
Just r -> do
gets' <- reqGetParams `liftM` getRequest
setUltDest (r, gets')
-- | Sets the ultimate destination to the referer request header, if present.
--
-- This function will not overwrite an existing ultdest.
| 389
|
setUltDestCurrent = do
route <- getCurrentRoute
case route of
Nothing -> return ()
Just r -> do
gets' <- reqGetParams `liftM` getRequest
setUltDest (r, gets')
-- | Sets the ultimate destination to the referer request header, if present.
--
-- This function will not overwrite an existing ultdest.
| 345
| false
| true
| 0
| 13
| 103
| 85
| 42
| 43
| null | null |
leichunfeng/learnyouahaskell
|
todo.hs
|
mit
|
main = do
(command:args) <- getArgs
let (Just action) = lookup command dispatch
action args
| 103
|
main = do
(command:args) <- getArgs
let (Just action) = lookup command dispatch
action args
| 103
|
main = do
(command:args) <- getArgs
let (Just action) = lookup command dispatch
action args
| 103
| false
| false
| 0
| 11
| 26
| 47
| 21
| 26
| null | null |
shockkolate/containers
|
Data/Set/Base.hs
|
bsd-3-clause
|
{--------------------------------------------------------------------
Query
--------------------------------------------------------------------}
-- | /O(1)/. Is this the empty set?
null :: Set a -> Bool
null Tip = True
| 226
|
null :: Set a -> Bool
null Tip = True
| 42
|
null Tip = True
| 20
| true
| true
| 0
| 6
| 27
| 23
| 12
| 11
| null | null |
imalsogreg/arte-ephys
|
tetrode-ephys/src/Data/Ephys/OldMWL/ParsePFile.hs
|
gpl-3.0
|
runningPosition :: (Monad m) =>
(Double,Double) ->
Double ->
Double ->
Position -> Pipe MWLPos Position m r
runningPosition (pX0, pY0) pixPerMeter height =
loop
where
loop p0 = do
mwlP <- await
let p = mwlToArtePos (pX0,pY0) pixPerMeter height mwlP p0 :: Position
yield p
loop p
| 398
|
runningPosition :: (Monad m) =>
(Double,Double) ->
Double ->
Double ->
Position -> Pipe MWLPos Position m r
runningPosition (pX0, pY0) pixPerMeter height =
loop
where
loop p0 = do
mwlP <- await
let p = mwlToArtePos (pX0,pY0) pixPerMeter height mwlP p0 :: Position
yield p
loop p
| 398
|
runningPosition (pX0, pY0) pixPerMeter height =
loop
where
loop p0 = do
mwlP <- await
let p = mwlToArtePos (pX0,pY0) pixPerMeter height mwlP p0 :: Position
yield p
loop p
| 216
| false
| true
| 0
| 11
| 167
| 122
| 61
| 61
| null | null |
bitc/omegagb
|
src/Cpu.hs
|
gpl-2.0
|
mctiCB 0xF8 = (SET Bit7 B, 8)
| 29
|
mctiCB 0xF8 = (SET Bit7 B, 8)
| 29
|
mctiCB 0xF8 = (SET Bit7 B, 8)
| 29
| false
| false
| 1
| 6
| 6
| 23
| 10
| 13
| null | null |
tadeuzagallo/verve-lang
|
src/Typing/Decl.hs
|
mit
|
c_decl (meta :< Let (var, ty) expr) = do
expr' <-
case ty of
Nothing -> do
(expr', exprTy) <- i_expr expr
insertValue var exprTy
return expr'
Just ty -> do
ty' <- resolveType ty
insertValue var ty'
_ <- valueOccursCheck var expr
(expr', exprTy) <- i_expr expr
exprTy <:! ty'
return expr'
return $ meta :< Let (var, ty) expr'
| 416
|
c_decl (meta :< Let (var, ty) expr) = do
expr' <-
case ty of
Nothing -> do
(expr', exprTy) <- i_expr expr
insertValue var exprTy
return expr'
Just ty -> do
ty' <- resolveType ty
insertValue var ty'
_ <- valueOccursCheck var expr
(expr', exprTy) <- i_expr expr
exprTy <:! ty'
return expr'
return $ meta :< Let (var, ty) expr'
| 416
|
c_decl (meta :< Let (var, ty) expr) = do
expr' <-
case ty of
Nothing -> do
(expr', exprTy) <- i_expr expr
insertValue var exprTy
return expr'
Just ty -> do
ty' <- resolveType ty
insertValue var ty'
_ <- valueOccursCheck var expr
(expr', exprTy) <- i_expr expr
exprTy <:! ty'
return expr'
return $ meta :< Let (var, ty) expr'
| 416
| false
| false
| 0
| 14
| 152
| 165
| 75
| 90
| null | null |
energyflowanalysis/efa-2.1
|
examples/advanced/vehicle/src/Modules/Signals.hs
|
bsd-3-clause
|
etaEngineGenerator ::
(XIdx.Position Node, XIdx.Position Node, XIdx.Position Node)
etaEngineGenerator =
(XIdx.ppos Tank ConBattery,
XIdx.ppos ConBattery Tank,
XIdx.ppos ConBattery Tank)
| 199
|
etaEngineGenerator ::
(XIdx.Position Node, XIdx.Position Node, XIdx.Position Node)
etaEngineGenerator =
(XIdx.ppos Tank ConBattery,
XIdx.ppos ConBattery Tank,
XIdx.ppos ConBattery Tank)
| 199
|
etaEngineGenerator =
(XIdx.ppos Tank ConBattery,
XIdx.ppos ConBattery Tank,
XIdx.ppos ConBattery Tank)
| 113
| false
| true
| 0
| 7
| 32
| 65
| 33
| 32
| null | null |
keithodulaigh/Hets
|
CASL/Freeness.hs
|
gpl-2.0
|
{- | applies the second order quantification to the formula for the given
sort -}
quantifyPredsSort :: SORT -> CASLFORMULA -> CASLFORMULA
quantifyPredsSort = uncurry QuantPred . freePredNameAndType
| 197
|
quantifyPredsSort :: SORT -> CASLFORMULA -> CASLFORMULA
quantifyPredsSort = uncurry QuantPred . freePredNameAndType
| 115
|
quantifyPredsSort = uncurry QuantPred . freePredNameAndType
| 59
| true
| true
| 0
| 6
| 27
| 27
| 14
| 13
| null | null |
JohnLato/scryptic
|
src/Scryptic/Language/LayoutScrypt.hs
|
gpl-3.0
|
-- | Get the position immediately to the right of the given token.
nextPos :: Token -> Position
nextPos t = Pn (g + s) l (c + s + 1)
where Pn g l c = position t
s = tokenLength t
-- | Add to the global and column positions of a token.
-- The column position is only changed if the token is on
-- the same line as the given position.
| 349
|
nextPos :: Token -> Position
nextPos t = Pn (g + s) l (c + s + 1)
where Pn g l c = position t
s = tokenLength t
-- | Add to the global and column positions of a token.
-- The column position is only changed if the token is on
-- the same line as the given position.
| 281
|
nextPos t = Pn (g + s) l (c + s + 1)
where Pn g l c = position t
s = tokenLength t
-- | Add to the global and column positions of a token.
-- The column position is only changed if the token is on
-- the same line as the given position.
| 252
| true
| true
| 1
| 8
| 91
| 72
| 38
| 34
| null | null |
cpichard/aritools
|
src/Codec/Picture/Ari/Header/RID.hs
|
mit
|
decodeAriHeaderRID :: Get AriHeaderRID
decodeAriHeaderRID =
--TODO use do instead of applicative
AriHeaderRID
<$> getByteString 4 -- ariMagic MagicNum 0x0000-0x0003
<*> readEndianness -- ariByteOrder ByteOrder 0x0004-0x0007
<*> liftM fromIntegral getWord32le -- ariHeaderSize HeaderSize 0x0008-0x000B
<*> liftM fromIntegral getWord32le
| 485
|
decodeAriHeaderRID :: Get AriHeaderRID
decodeAriHeaderRID =
--TODO use do instead of applicative
AriHeaderRID
<$> getByteString 4 -- ariMagic MagicNum 0x0000-0x0003
<*> readEndianness -- ariByteOrder ByteOrder 0x0004-0x0007
<*> liftM fromIntegral getWord32le -- ariHeaderSize HeaderSize 0x0008-0x000B
<*> liftM fromIntegral getWord32le
| 485
|
decodeAriHeaderRID =
--TODO use do instead of applicative
AriHeaderRID
<$> getByteString 4 -- ariMagic MagicNum 0x0000-0x0003
<*> readEndianness -- ariByteOrder ByteOrder 0x0004-0x0007
<*> liftM fromIntegral getWord32le -- ariHeaderSize HeaderSize 0x0008-0x000B
<*> liftM fromIntegral getWord32le
| 446
| false
| true
| 11
| 6
| 187
| 65
| 31
| 34
| null | null |
jochu/image-bin-packing
|
src/RectBinPacker/Image.hs
|
mit
|
----------------------------------------------------------------------------------------------------
-- | Rotates an image into it's original rotation
upright :: Image -> Image
upright img
| view imageOrientation img /= Upright = rotate img
| otherwise = img
| 266
|
upright :: Image -> Image
upright img
| view imageOrientation img /= Upright = rotate img
| otherwise = img
| 115
|
upright img
| view imageOrientation img /= Upright = rotate img
| otherwise = img
| 89
| true
| true
| 0
| 9
| 37
| 55
| 24
| 31
| null | null |
kadena-io/pact
|
src/Pact/Types/KeySet.hs
|
bsd-3-clause
|
-- | Lower-case hex numbers.
isHexDigitLower :: Char -> Bool
isHexDigitLower c =
-- adapted from GHC.Unicode#isHexDigit
isDigit c || (fromIntegral (ord c - ord 'a')::Word) <= 5
| 180
|
isHexDigitLower :: Char -> Bool
isHexDigitLower c =
-- adapted from GHC.Unicode#isHexDigit
isDigit c || (fromIntegral (ord c - ord 'a')::Word) <= 5
| 151
|
isHexDigitLower c =
-- adapted from GHC.Unicode#isHexDigit
isDigit c || (fromIntegral (ord c - ord 'a')::Word) <= 5
| 119
| true
| true
| 0
| 11
| 31
| 53
| 27
| 26
| null | null |
jtapolczai/Hephaestos
|
Crawling/Hephaestos/Crawlers/Templates.hs
|
apache-2.0
|
allElementsWhere :: [(T.Text, T.Text)]
-- ^The list of tag/attribute pairs which are to be
-- gathered. E.g. @[("a","href"), ("img", "src")]@.
-> (URL -> Bool)
-- ^The predicate which gathered elements have
-- to pass.
-> Successor SomeException Void Void
allElementsWhere tags pred = htmlSuccessor mempty allWhere'
where
allWhere' uri doc _ = return $ concatMap getRes tags
where
-- puts (TAG,ATTR) into an xpath-expression of the form
-- "//TAG/@ATTR/@text()"
-- and runs it against the given predicate
getRes (tag, attr) =
map (voidNode . makeLink uri blob)
$ L.nub
$ filter (\x -> not ("#" `T.isPrefixOf` x) && pred x)
$ mapMaybe getText
$ getXPath
("//" `append` tag `append` "/@" `append` attr `append` "")
doc
-- |Variant of 'allElementsWhere', but instead of a predicate,
-- all list of acceptable file extensions for the collected URLs
-- (e.g. @[".jpg", ".png"]@) is passed.
| 1,178
|
allElementsWhere :: [(T.Text, T.Text)]
-- ^The list of tag/attribute pairs which are to be
-- gathered. E.g. @[("a","href"), ("img", "src")]@.
-> (URL -> Bool)
-- ^The predicate which gathered elements have
-- to pass.
-> Successor SomeException Void Void
allElementsWhere tags pred = htmlSuccessor mempty allWhere'
where
allWhere' uri doc _ = return $ concatMap getRes tags
where
-- puts (TAG,ATTR) into an xpath-expression of the form
-- "//TAG/@ATTR/@text()"
-- and runs it against the given predicate
getRes (tag, attr) =
map (voidNode . makeLink uri blob)
$ L.nub
$ filter (\x -> not ("#" `T.isPrefixOf` x) && pred x)
$ mapMaybe getText
$ getXPath
("//" `append` tag `append` "/@" `append` attr `append` "")
doc
-- |Variant of 'allElementsWhere', but instead of a predicate,
-- all list of acceptable file extensions for the collected URLs
-- (e.g. @[".jpg", ".png"]@) is passed.
| 1,178
|
allElementsWhere tags pred = htmlSuccessor mempty allWhere'
where
allWhere' uri doc _ = return $ concatMap getRes tags
where
-- puts (TAG,ATTR) into an xpath-expression of the form
-- "//TAG/@ATTR/@text()"
-- and runs it against the given predicate
getRes (tag, attr) =
map (voidNode . makeLink uri blob)
$ L.nub
$ filter (\x -> not ("#" `T.isPrefixOf` x) && pred x)
$ mapMaybe getText
$ getXPath
("//" `append` tag `append` "/@" `append` attr `append` "")
doc
-- |Variant of 'allElementsWhere', but instead of a predicate,
-- all list of acceptable file extensions for the collected URLs
-- (e.g. @[".jpg", ".png"]@) is passed.
| 806
| false
| true
| 0
| 16
| 434
| 205
| 113
| 92
| null | null |
xmonad/xmonad-contrib
|
XMonad/Layout/Stoppable.hs
|
bsd-3-clause
|
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad
-- > import XMonad.Layout.Stoppable
-- >
-- > main = xmonad def
-- > { layoutHook = layoutHook def ||| stoppable (layoutHook def) }
--
-- Note that the module has to distinguish between local and remote
-- proccesses, which means that it needs to know the hostname, so it looks
-- for environment variables (e.g. HOST).
--
-- Environment variables will work for most cases, but won't work if the
-- hostname changes. To cover dynamic hostnames case, in addition to
-- layoutHook you have to provide manageHook from
-- "XMonad.Util.RemoteWindows" module.
--
-- For more detailed instructions on editing the layoutHook see:
--
-- "XMonad.Doc.Extending#Editing_the_layout_hook"
signalWindow :: Signal -> Window -> X ()
signalWindow s w = do
pid <- getProp32s "_NET_WM_PID" w
io $ (signalProcess s . fromIntegral) `mapM_` fromMaybe [] pid
| 957
|
signalWindow :: Signal -> Window -> X ()
signalWindow s w = do
pid <- getProp32s "_NET_WM_PID" w
io $ (signalProcess s . fromIntegral) `mapM_` fromMaybe [] pid
| 167
|
signalWindow s w = do
pid <- getProp32s "_NET_WM_PID" w
io $ (signalProcess s . fromIntegral) `mapM_` fromMaybe [] pid
| 126
| true
| true
| 0
| 11
| 165
| 92
| 55
| 37
| null | null |
SwiftsNamesake/Cartesian
|
src/Cartesian/Plane/Core.hs
|
mit
|
--------------------------------------------------------------------------------------------------------------------------------------------
-- Functions
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------
-- | Determines if a point lies within a polygon using the odd-even method.
--
-- TODO: Use epsilon (?)
-- TODO: How to treat points that lie on an edge
-- inside :: Num n => Polygon n -> Vector2D n -> Bool
-- inside polygon (Vector2D px py) = error "Cartesian.Plane.inside is still a work in progress"
-- where
-- edges = polygon ++ [head polygon] -- Close the loop
-- between (Line (Vector ax ay) (Vector bx by)) = _
-- |
-- instance Convertible (Vector2D f, Vector3D f) where
-- _
-- TODO: Use type families for this stuff (?)
-- |
-- to3D :: Num f => Vector2D f -> Vector3D f
-- to3D (Vector2D x' y') = Vector3D x' y' 0
-- -- |
-- from3D :: Num f => Vector3D f -> Vector2D f
-- from3D (Vector3D x' y' _) = Vector2D x' y'
-- -- | Perform some unary operation on a 2D vector as a 3D vector, converting the result back to 2D by discarding the z component.
-- -- TODO: Rename (?)
-- -- TODO: Loosen Num restriction (eg. to anything with a 'zero' value) (?)
-- in3D :: (Num f, Num f') => (Vector3D f -> Vector3D f') -> Vector2D f -> Vector2D f'
-- in3D f = from3D . f . to3D
-- | Same as in3D, but for binary operations.
-- _ :: _
-- _ f = from3D . (dotmap f) . to3D
-- Vector math -----------------------------------------------------------------------------------------------------------------------------
-- | Angle (in radians) between the positive X-axis and the vector
-- argument :: (Floating a, Eq a) => Vector a -> a
-- argument (Vector 0 0) = 0
-- argument (Vector x y) = atan $ y/x
--
--
-- arg :: (Floating a, Eq a) => Vector a -> a
-- arg = argument
--
--
-- -- | Vector -> (magnitude, argument)
-- polar :: (Floating a, Eq a) => Vector a -> (a, a)
-- polar v@(Vector x y) = (magnitude v, argument v)
-- Linear functions ------------------------------------------------------------------------------------------------------------------------
-- | Yields the intersection point of two finite lines. The lines are defined inclusively by
-- their endpoints. The result is wrapped in a Maybe value to account for non-intersecting
-- lines.
-- TODO: Refactor
-- TODO: Move equation solving to separate function (two linear functions)
-- TODO: Invariants, check corner cases
-- TODO: Deal with vertical lines
-- TODO: Factor out infinite-line logic
-- TODO: Decide how to deal with identical lines
-- TODO: Factor out domain logic (eg. write restrict or domain function)
-- TODO: Return Either instead of Maybe (eg. Left "parallel") (?)
-- TODO: Visual debugging functions
-- TODO: Math notes, MathJax or LaTex
-- TODO: Intersect for curves (functions) and single points (?)
-- TODO: Polymorphic, typeclass (lines, shapes, ranges, etc.) (?)
-- TODO: Intersect Rectangles
intersect :: RealFloat f => Line (Vector2D f) -> Line (Vector2D f) -> Maybe (Vector2D f)
intersect f' g' = do
p <- mp
indomain f' p
indomain g' p
where
-- indomain :: RealFloat f => Line (Vector2D f) -> Vector2D f -> Maybe (Vector2D f)
indomain h' = restrict (h'^.begin) (h'^.end) -- TODO: Rename
-- mp :: Maybe (Vector2D f)
mp = case (linear f', linear g') of
(Just f, Nothing) -> let x' = g'^.begin.x in Just . Vector2D x' $ plotpoint f x'
(Nothing, Just g) -> let x' = f'^.begin.x in Just . Vector2D x' $ plotpoint g x'
(Just f, Just g) -> linearIntersect f g
_ -> Nothing
-- | Gives the linear function overlapping the given segment, or Nothing if there is no such function
| 3,895
|
intersect :: RealFloat f => Line (Vector2D f) -> Line (Vector2D f) -> Maybe (Vector2D f)
intersect f' g' = do
p <- mp
indomain f' p
indomain g' p
where
-- indomain :: RealFloat f => Line (Vector2D f) -> Vector2D f -> Maybe (Vector2D f)
indomain h' = restrict (h'^.begin) (h'^.end) -- TODO: Rename
-- mp :: Maybe (Vector2D f)
mp = case (linear f', linear g') of
(Just f, Nothing) -> let x' = g'^.begin.x in Just . Vector2D x' $ plotpoint f x'
(Nothing, Just g) -> let x' = f'^.begin.x in Just . Vector2D x' $ plotpoint g x'
(Just f, Just g) -> linearIntersect f g
_ -> Nothing
-- | Gives the linear function overlapping the given segment, or Nothing if there is no such function
| 749
|
intersect f' g' = do
p <- mp
indomain f' p
indomain g' p
where
-- indomain :: RealFloat f => Line (Vector2D f) -> Vector2D f -> Maybe (Vector2D f)
indomain h' = restrict (h'^.begin) (h'^.end) -- TODO: Rename
-- mp :: Maybe (Vector2D f)
mp = case (linear f', linear g') of
(Just f, Nothing) -> let x' = g'^.begin.x in Just . Vector2D x' $ plotpoint f x'
(Nothing, Just g) -> let x' = f'^.begin.x in Just . Vector2D x' $ plotpoint g x'
(Just f, Just g) -> linearIntersect f g
_ -> Nothing
-- | Gives the linear function overlapping the given segment, or Nothing if there is no such function
| 660
| true
| true
| 2
| 13
| 719
| 335
| 189
| 146
| null | null |
surajx/learn-haskell
|
crash.hs
|
mit
|
flatten :: Tree a-> [a]
flatten Null = []
| 41
|
flatten :: Tree a-> [a]
flatten Null = []
| 41
|
flatten Null = []
| 17
| false
| true
| 0
| 8
| 8
| 32
| 14
| 18
| null | null |
NicolasDP/hop
|
Hop/PullRequest.hs
|
bsd-3-clause
|
prettyPrintDiff :: Config -> Int -> (File, Int) -> IO ()
prettyPrintDiff cfg prNumber (diff, diffNum) = do
prettyPrintDiffResume diff
putStrLn ""
mapM_ prettyPrintDiffLine $ lines $ filePatch diff
putStrLn ""
askForReview
where
askForReview :: IO ()
askForReview = do
putStrLn "To see or comment this file, follow this URL in your browser: "
putStrLn $ " https://github.com/" ++ (getProjectOwner cfg) ++ "/" ++ (getProjectName cfg) ++ "/pull/" ++ show prNumber ++ "/files#diff-" ++ show diffNum
putStrLn ""
putStrLn "press [enter] to continue or 'quit' (q, Q or quit)"
resp <- getLine
case map toLower resp of
"quit" -> exitSuccess
"q" -> exitSuccess
_ -> return ()
-- Review the Commits ---------------------------------------------------------
| 869
|
prettyPrintDiff :: Config -> Int -> (File, Int) -> IO ()
prettyPrintDiff cfg prNumber (diff, diffNum) = do
prettyPrintDiffResume diff
putStrLn ""
mapM_ prettyPrintDiffLine $ lines $ filePatch diff
putStrLn ""
askForReview
where
askForReview :: IO ()
askForReview = do
putStrLn "To see or comment this file, follow this URL in your browser: "
putStrLn $ " https://github.com/" ++ (getProjectOwner cfg) ++ "/" ++ (getProjectName cfg) ++ "/pull/" ++ show prNumber ++ "/files#diff-" ++ show diffNum
putStrLn ""
putStrLn "press [enter] to continue or 'quit' (q, Q or quit)"
resp <- getLine
case map toLower resp of
"quit" -> exitSuccess
"q" -> exitSuccess
_ -> return ()
-- Review the Commits ---------------------------------------------------------
| 869
|
prettyPrintDiff cfg prNumber (diff, diffNum) = do
prettyPrintDiffResume diff
putStrLn ""
mapM_ prettyPrintDiffLine $ lines $ filePatch diff
putStrLn ""
askForReview
where
askForReview :: IO ()
askForReview = do
putStrLn "To see or comment this file, follow this URL in your browser: "
putStrLn $ " https://github.com/" ++ (getProjectOwner cfg) ++ "/" ++ (getProjectName cfg) ++ "/pull/" ++ show prNumber ++ "/files#diff-" ++ show diffNum
putStrLn ""
putStrLn "press [enter] to continue or 'quit' (q, Q or quit)"
resp <- getLine
case map toLower resp of
"quit" -> exitSuccess
"q" -> exitSuccess
_ -> return ()
-- Review the Commits ---------------------------------------------------------
| 812
| false
| true
| 0
| 15
| 235
| 217
| 99
| 118
| null | null |
alexander-at-github/eta
|
compiler/ETA/CodeGen/Monad.hs
|
bsd-3-clause
|
defineFields :: [FieldDef] -> CodeGen ()
defineFields md = modify $ \s@CgState{..} ->
s { cgFieldDefs = md ++ cgFieldDefs }
| 125
|
defineFields :: [FieldDef] -> CodeGen ()
defineFields md = modify $ \s@CgState{..} ->
s { cgFieldDefs = md ++ cgFieldDefs }
| 125
|
defineFields md = modify $ \s@CgState{..} ->
s { cgFieldDefs = md ++ cgFieldDefs }
| 84
| false
| true
| 0
| 9
| 22
| 64
| 32
| 32
| null | null |
idris-hackers/idris-bot
|
src/Main.hs
|
bsd-3-clause
|
interpretResp (SexpList [SymbolAtom "return", SexpList [SymbolAtom "ok", SexpList _], IntegerAtom _]) = Nothing
| 111
|
interpretResp (SexpList [SymbolAtom "return", SexpList [SymbolAtom "ok", SexpList _], IntegerAtom _]) = Nothing
| 111
|
interpretResp (SexpList [SymbolAtom "return", SexpList [SymbolAtom "ok", SexpList _], IntegerAtom _]) = Nothing
| 111
| false
| false
| 0
| 11
| 12
| 45
| 22
| 23
| null | null |
comonoidial/ALFIN
|
Backend/Assemble.hs
|
mit
|
asmCmp :: OpName -> CmpOp
asmCmp (OpName "zlzh" ) = CmpLT
| 58
|
asmCmp :: OpName -> CmpOp
asmCmp (OpName "zlzh" ) = CmpLT
| 58
|
asmCmp (OpName "zlzh" ) = CmpLT
| 32
| false
| true
| 0
| 9
| 11
| 30
| 13
| 17
| null | null |
lexml/lexml-linker
|
src/main/haskell/LexML/URN/Utils.hs
|
gpl-2.0
|
autoridadeConvencionada' (A_Convencionada ac) = Just ac
| 55
|
autoridadeConvencionada' (A_Convencionada ac) = Just ac
| 55
|
autoridadeConvencionada' (A_Convencionada ac) = Just ac
| 55
| false
| false
| 0
| 6
| 5
| 19
| 8
| 11
| null | null |
merijn/trifecta
|
src/Text/Trifecta/Rendering.hs
|
bsd-3-clause
|
drawSpan :: Delta -> Delta -> Delta -> Lines -> Lines
drawSpan s e d a
| nl && nh = go (column l) (rep (max (column h - column l) 0) '~') a
| nl = go (column l) (rep (max (snd (snd (bounds a)) - column l + 1) 0) '~') a
| nh = go (-1) (rep (max (column h + 1) 0) '~') a
| otherwise = a
where
go = draw spanEffects 1 . fromIntegral
l = argmin bytes s e
h = argmax bytes s e
nl = near l d
nh = near h d
rep = P.replicate . fromIntegral
-- |
-- > int main(int argc, char ** argv) { int; }
-- > ^~~
| 584
|
drawSpan :: Delta -> Delta -> Delta -> Lines -> Lines
drawSpan s e d a
| nl && nh = go (column l) (rep (max (column h - column l) 0) '~') a
| nl = go (column l) (rep (max (snd (snd (bounds a)) - column l + 1) 0) '~') a
| nh = go (-1) (rep (max (column h + 1) 0) '~') a
| otherwise = a
where
go = draw spanEffects 1 . fromIntegral
l = argmin bytes s e
h = argmax bytes s e
nl = near l d
nh = near h d
rep = P.replicate . fromIntegral
-- |
-- > int main(int argc, char ** argv) { int; }
-- > ^~~
| 584
|
drawSpan s e d a
| nl && nh = go (column l) (rep (max (column h - column l) 0) '~') a
| nl = go (column l) (rep (max (snd (snd (bounds a)) - column l + 1) 0) '~') a
| nh = go (-1) (rep (max (column h + 1) 0) '~') a
| otherwise = a
where
go = draw spanEffects 1 . fromIntegral
l = argmin bytes s e
h = argmax bytes s e
nl = near l d
nh = near h d
rep = P.replicate . fromIntegral
-- |
-- > int main(int argc, char ** argv) { int; }
-- > ^~~
| 530
| false
| true
| 3
| 17
| 213
| 281
| 140
| 141
| null | null |
ice1000/OI-codes
|
codewars/1-100/calculate-number-of-inversions-in-array.hs
|
agpl-3.0
|
countInversions :: Ord a => [a] -> Int
countInversions = length . inv
where inv xs = [(a,b) | (a:bs) <- tails xs, b <- bs, a > b]
--
| 134
|
countInversions :: Ord a => [a] -> Int
countInversions = length . inv
where inv xs = [(a,b) | (a:bs) <- tails xs, b <- bs, a > b]
--
| 134
|
countInversions = length . inv
where inv xs = [(a,b) | (a:bs) <- tails xs, b <- bs, a > b]
--
| 95
| false
| true
| 0
| 9
| 31
| 83
| 44
| 39
| null | null |
dimara/ganeti
|
src/Ganeti/OpParams.hs
|
bsd-2-clause
|
pExtParams :: Field
pExtParams =
withDoc "List of ExtStorage parameters" .
renameField "InstExtParams" .
defaultField [| toJSObject [] |] $
simpleField "ext_params" [t| JSObject JSValue |]
| 196
|
pExtParams :: Field
pExtParams =
withDoc "List of ExtStorage parameters" .
renameField "InstExtParams" .
defaultField [| toJSObject [] |] $
simpleField "ext_params" [t| JSObject JSValue |]
| 196
|
pExtParams =
withDoc "List of ExtStorage parameters" .
renameField "InstExtParams" .
defaultField [| toJSObject [] |] $
simpleField "ext_params" [t| JSObject JSValue |]
| 176
| false
| true
| 0
| 8
| 33
| 44
| 24
| 20
| null | null |
bartoszw/haslo
|
Haslo/Financing.hs
|
bsd-3-clause
|
-- Next due date >= than current one.
-- Always to be called by one of nextDueDate functions.
nextDueDate' Monthly day date | day >= d = fromGregorian y m day
| otherwise = addMonths 1 $ fromGregorian y m day
where (y,m,d) = toGregorian date
| 280
|
nextDueDate' Monthly day date | day >= d = fromGregorian y m day
| otherwise = addMonths 1 $ fromGregorian y m day
where (y,m,d) = toGregorian date
| 184
|
nextDueDate' Monthly day date | day >= d = fromGregorian y m day
| otherwise = addMonths 1 $ fromGregorian y m day
where (y,m,d) = toGregorian date
| 184
| true
| false
| 0
| 8
| 84
| 75
| 36
| 39
| null | null |
MichaelBurge/stockfighter-jailbreak
|
src/Api/Stockfighter/Jailbreak/Decompiler/Passes.hs
|
bsd-3-clause
|
assignBinop AssignMultiply = Just Multiply
| 42
|
assignBinop AssignMultiply = Just Multiply
| 42
|
assignBinop AssignMultiply = Just Multiply
| 42
| false
| false
| 0
| 5
| 4
| 12
| 5
| 7
| null | null |
minib00m/jpp
|
src/Evaluator.hs
|
mit
|
evalExpr (Not expr) = MLit . BoolLit . not . boolFromMem <$> evalExpr expr
| 74
|
evalExpr (Not expr) = MLit . BoolLit . not . boolFromMem <$> evalExpr expr
| 74
|
evalExpr (Not expr) = MLit . BoolLit . not . boolFromMem <$> evalExpr expr
| 74
| false
| false
| 1
| 7
| 13
| 36
| 16
| 20
| null | null |
danidiaz/haskell-sandbox
|
probca.hs
|
mit
|
left (U (a:>as) b c) = U as a (b:>c)
| 37
|
left (U (a:>as) b c) = U as a (b:>c)
| 37
|
left (U (a:>as) b c) = U as a (b:>c)
| 37
| false
| false
| 0
| 8
| 10
| 43
| 20
| 23
| null | null |
cirquit/hjc
|
src/Cmm/ASTToCmm.hs
|
mit
|
-- | main intro function
--
ast2cmmGen :: MiniJava -> NameGenT IO Cmm
ast2cmmGen ast = (view cmm . snd) <$> runStateT (parseMiniJavaCmm ast) cmmScope
where
-- | running state
--
cmmScope :: CmmScope
cmmScope = CmmScope
{ _curClass = Nothing
, _curMethod = Nothing
, _localObjectType = Nothing
, _symbols = symbols
, _cmm = []
, _curRetTemp = TEMP $ mkNamedTemp "t1234567890" -- the debugger assumes this notation
, _localTemps = Map.empty
, _localVars = Map.empty
, _assignment = False
}
-- | computing this twice, here and in TypeCheck.hs, this should be cached
symbols :: ST.MiniJavaTable
symbols = ST.createSymbolTable ast
| 860
|
ast2cmmGen :: MiniJava -> NameGenT IO Cmm
ast2cmmGen ast = (view cmm . snd) <$> runStateT (parseMiniJavaCmm ast) cmmScope
where
-- | running state
--
cmmScope :: CmmScope
cmmScope = CmmScope
{ _curClass = Nothing
, _curMethod = Nothing
, _localObjectType = Nothing
, _symbols = symbols
, _cmm = []
, _curRetTemp = TEMP $ mkNamedTemp "t1234567890" -- the debugger assumes this notation
, _localTemps = Map.empty
, _localVars = Map.empty
, _assignment = False
}
-- | computing this twice, here and in TypeCheck.hs, this should be cached
symbols :: ST.MiniJavaTable
symbols = ST.createSymbolTable ast
| 832
|
ast2cmmGen ast = (view cmm . snd) <$> runStateT (parseMiniJavaCmm ast) cmmScope
where
-- | running state
--
cmmScope :: CmmScope
cmmScope = CmmScope
{ _curClass = Nothing
, _curMethod = Nothing
, _localObjectType = Nothing
, _symbols = symbols
, _cmm = []
, _curRetTemp = TEMP $ mkNamedTemp "t1234567890" -- the debugger assumes this notation
, _localTemps = Map.empty
, _localVars = Map.empty
, _assignment = False
}
-- | computing this twice, here and in TypeCheck.hs, this should be cached
symbols :: ST.MiniJavaTable
symbols = ST.createSymbolTable ast
| 790
| true
| true
| 0
| 10
| 337
| 152
| 88
| 64
| null | null |
scottgw/language-eiffel
|
tests/Test.hs
|
bsd-3-clause
|
main = do
allTestFiles >>= mapM testFile >>= report
| 53
|
main = do
allTestFiles >>= mapM testFile >>= report
| 53
|
main = do
allTestFiles >>= mapM testFile >>= report
| 53
| false
| false
| 0
| 9
| 10
| 20
| 9
| 11
| null | null |
emwap/plugins-multistage
|
tests/RegressionTests.hs
|
bsd-3-clause
|
main :: IO ()
main = defaultMain tests
| 38
|
main :: IO ()
main = defaultMain tests
| 38
|
main = defaultMain tests
| 24
| false
| true
| 1
| 6
| 7
| 22
| 9
| 13
| null | null |
sumitsahrawat/calculator
|
src/Model/Arithmetic.hs
|
gpl-2.0
|
--------------------------------------------------------------------------------
modelEval :: String -> String
modelEval inp =
case parse (spaces >> expr <* spaces <* eof) "Expression" inp of
Left _ -> ""
Right n -> show n
--------------------------------------------------------------------------------
| 322
|
modelEval :: String -> String
modelEval inp =
case parse (spaces >> expr <* spaces <* eof) "Expression" inp of
Left _ -> ""
Right n -> show n
--------------------------------------------------------------------------------
| 240
|
modelEval inp =
case parse (spaces >> expr <* spaces <* eof) "Expression" inp of
Left _ -> ""
Right n -> show n
--------------------------------------------------------------------------------
| 210
| true
| true
| 0
| 10
| 49
| 67
| 33
| 34
| null | null |
HJvT/hdirect
|
src/Parser.hs
|
bsd-3-clause
|
action_496 x = happyTcHack x happyReduce_34
| 43
|
action_496 x = happyTcHack x happyReduce_34
| 43
|
action_496 x = happyTcHack x happyReduce_34
| 43
| false
| false
| 0
| 5
| 5
| 14
| 6
| 8
| null | null |
dmcclean/HaTeX
|
Text/LaTeX/Base/Writer.hs
|
bsd-3-clause
|
runLaTeXT :: Monad m => LaTeXT m a -> m (a,LaTeX)
runLaTeXT = runWriterT . unwrapLaTeXT
| 87
|
runLaTeXT :: Monad m => LaTeXT m a -> m (a,LaTeX)
runLaTeXT = runWriterT . unwrapLaTeXT
| 87
|
runLaTeXT = runWriterT . unwrapLaTeXT
| 37
| false
| true
| 0
| 8
| 15
| 40
| 20
| 20
| null | null |
greydot/iproute
|
Data/IP/Addr.hs
|
bsd-3-clause
|
toIPv6 :: [Int] -> IPv6
toIPv6 ad = IP6 (x1,x2,x3,x4)
where
[x1,x2,x3,x4] = map toWord32 $ split2 ad
split2 [] = []
split2 x = take 2 x : split2 (drop 2 x)
toWord32 [a1,a2] = fromIntegral $ shift a1 16 + a2
toWord32 _ = error "toWord32"
{-|
The 'toIPv6b' function takes a list of 'Int'
where each member repserents a single byte and returns 'IPv6'.
>>> toIPv6b [0x20,0x01,0xD,0xB8,0,0,0,0,0,0,0,0,0,0,0,1]
2001:db8::1
-}
| 455
|
toIPv6 :: [Int] -> IPv6
toIPv6 ad = IP6 (x1,x2,x3,x4)
where
[x1,x2,x3,x4] = map toWord32 $ split2 ad
split2 [] = []
split2 x = take 2 x : split2 (drop 2 x)
toWord32 [a1,a2] = fromIntegral $ shift a1 16 + a2
toWord32 _ = error "toWord32"
{-|
The 'toIPv6b' function takes a list of 'Int'
where each member repserents a single byte and returns 'IPv6'.
>>> toIPv6b [0x20,0x01,0xD,0xB8,0,0,0,0,0,0,0,0,0,0,0,1]
2001:db8::1
-}
| 455
|
toIPv6 ad = IP6 (x1,x2,x3,x4)
where
[x1,x2,x3,x4] = map toWord32 $ split2 ad
split2 [] = []
split2 x = take 2 x : split2 (drop 2 x)
toWord32 [a1,a2] = fromIntegral $ shift a1 16 + a2
toWord32 _ = error "toWord32"
{-|
The 'toIPv6b' function takes a list of 'Int'
where each member repserents a single byte and returns 'IPv6'.
>>> toIPv6b [0x20,0x01,0xD,0xB8,0,0,0,0,0,0,0,0,0,0,0,1]
2001:db8::1
-}
| 431
| false
| true
| 0
| 10
| 106
| 145
| 75
| 70
| null | null |
jmacmahon/syllabify
|
Linguisticks/Statistics/Analysis.hs
|
agpl-3.0
|
meanConfidenceInterval = Mean.meanConfidenceInterval
| 52
|
meanConfidenceInterval = Mean.meanConfidenceInterval
| 52
|
meanConfidenceInterval = Mean.meanConfidenceInterval
| 52
| false
| false
| 0
| 5
| 2
| 8
| 4
| 4
| null | null |
GaloisInc/ivory
|
ivory/src/Ivory/Language/BitData/DefBitRep.hs
|
bsd-3-clause
|
-- | Define the type instance:
--
-- type instance <fname> <x> = <rname>
--
-- for each "n" in "xs".
--
-- Used to define the set of representation types for bit lengths.
defBitRep :: Name -> Name -> [Integer] -> Q [Dec]
defBitRep fname rname xs = mapM makeInstance xs
where
makeInstance n = do
let nType = LitT (NumTyLit n)
let rType = ConT rname
tySynInstDCompat fname Nothing [pure nType] (pure rType)
| 430
|
defBitRep :: Name -> Name -> [Integer] -> Q [Dec]
defBitRep fname rname xs = mapM makeInstance xs
where
makeInstance n = do
let nType = LitT (NumTyLit n)
let rType = ConT rname
tySynInstDCompat fname Nothing [pure nType] (pure rType)
| 257
|
defBitRep fname rname xs = mapM makeInstance xs
where
makeInstance n = do
let nType = LitT (NumTyLit n)
let rType = ConT rname
tySynInstDCompat fname Nothing [pure nType] (pure rType)
| 207
| true
| true
| 0
| 13
| 100
| 119
| 59
| 60
| null | null |
atwupack/LearnOpenGL
|
src/LOGL/FRP.hs
|
bsd-3-clause
|
registerScroll :: Window -> IO (AddHandler ScrollEvent)
registerScroll w = do
(addHandler, fire) <- newAddHandler
let scrollCallback w x y = fire (w, x, y)
setScrollCallback w $ Just scrollCallback
return addHandler
| 231
|
registerScroll :: Window -> IO (AddHandler ScrollEvent)
registerScroll w = do
(addHandler, fire) <- newAddHandler
let scrollCallback w x y = fire (w, x, y)
setScrollCallback w $ Just scrollCallback
return addHandler
| 231
|
registerScroll w = do
(addHandler, fire) <- newAddHandler
let scrollCallback w x y = fire (w, x, y)
setScrollCallback w $ Just scrollCallback
return addHandler
| 175
| false
| true
| 0
| 11
| 47
| 87
| 41
| 46
| null | null |
tjakway/ghcjvm
|
compiler/llvmGen/LlvmCodeGen/CodeGen.hs
|
bsd-3-clause
|
-- XXX: EOption is an ugly and inefficient solution to this problem.
-- | i1 type expected (condition scrutinee).
i1Option :: EOption
i1Option = EOption True
| 158
|
i1Option :: EOption
i1Option = EOption True
| 43
|
i1Option = EOption True
| 23
| true
| true
| 0
| 5
| 26
| 16
| 9
| 7
| null | null |
WSCU/JSEuterpea
|
Euterpea Examples/SimpleEuterpea.hs
|
gpl-3.0
|
sMinorS b = makeScale MinorS as2 b
| 35
|
asMinorS b = makeScale MinorS as2 b
| 35
|
asMinorS b = makeScale MinorS as2 b
| 35
| false
| false
| 0
| 5
| 7
| 16
| 7
| 9
| null | null |
ecaustin/haskhol-math
|
src/HaskHOL/Lib/Arith.hs
|
bsd-2-clause
|
thmNOT_EVEN :: ArithCtxt thry => HOL cls thry HOLThm
thmNOT_EVEN = cacheProof "thmNOT_EVEN" ctxtArith .
prove [txt| !n. ~(EVEN n) <=> ODD n |] $
tacINDUCT `_THEN`
tacASM_REWRITE [defEVEN, defODD]
| 212
|
thmNOT_EVEN :: ArithCtxt thry => HOL cls thry HOLThm
thmNOT_EVEN = cacheProof "thmNOT_EVEN" ctxtArith .
prove [txt| !n. ~(EVEN n) <=> ODD n |] $
tacINDUCT `_THEN`
tacASM_REWRITE [defEVEN, defODD]
| 212
|
thmNOT_EVEN = cacheProof "thmNOT_EVEN" ctxtArith .
prove [txt| !n. ~(EVEN n) <=> ODD n |] $
tacINDUCT `_THEN`
tacASM_REWRITE [defEVEN, defODD]
| 159
| false
| true
| 2
| 7
| 46
| 63
| 31
| 32
| null | null |
brendanhay/gogol
|
gogol-dlp/gen/Network/Google/Resource/DLP/Organizations/StoredInfoTypes/Patch.hs
|
mpl-2.0
|
-- | Multipart request metadata.
ositpPayload :: Lens' OrganizationsStoredInfoTypesPatch GooglePrivacyDlpV2UpdateStoredInfoTypeRequest
ositpPayload
= lens _ositpPayload (\ s a -> s{_ositpPayload = a})
| 202
|
ositpPayload :: Lens' OrganizationsStoredInfoTypesPatch GooglePrivacyDlpV2UpdateStoredInfoTypeRequest
ositpPayload
= lens _ositpPayload (\ s a -> s{_ositpPayload = a})
| 169
|
ositpPayload
= lens _ositpPayload (\ s a -> s{_ositpPayload = a})
| 67
| true
| true
| 0
| 9
| 22
| 42
| 22
| 20
| null | null |
brendanhay/gogol
|
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/OperatingSystemVersions/List.hs
|
mpl-2.0
|
-- | Creates a value of 'OperatingSystemVersionsList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'osvlXgafv'
--
-- * 'osvlUploadProtocol'
--
-- * 'osvlAccessToken'
--
-- * 'osvlUploadType'
--
-- * 'osvlProFileId'
--
-- * 'osvlCallback'
operatingSystemVersionsList
:: Int64 -- ^ 'osvlProFileId'
-> OperatingSystemVersionsList
operatingSystemVersionsList pOsvlProFileId_ =
OperatingSystemVersionsList'
{ _osvlXgafv = Nothing
, _osvlUploadProtocol = Nothing
, _osvlAccessToken = Nothing
, _osvlUploadType = Nothing
, _osvlProFileId = _Coerce # pOsvlProFileId_
, _osvlCallback = Nothing
}
| 712
|
operatingSystemVersionsList
:: Int64 -- ^ 'osvlProFileId'
-> OperatingSystemVersionsList
operatingSystemVersionsList pOsvlProFileId_ =
OperatingSystemVersionsList'
{ _osvlXgafv = Nothing
, _osvlUploadProtocol = Nothing
, _osvlAccessToken = Nothing
, _osvlUploadType = Nothing
, _osvlProFileId = _Coerce # pOsvlProFileId_
, _osvlCallback = Nothing
}
| 386
|
operatingSystemVersionsList pOsvlProFileId_ =
OperatingSystemVersionsList'
{ _osvlXgafv = Nothing
, _osvlUploadProtocol = Nothing
, _osvlAccessToken = Nothing
, _osvlUploadType = Nothing
, _osvlProFileId = _Coerce # pOsvlProFileId_
, _osvlCallback = Nothing
}
| 289
| true
| true
| 0
| 7
| 130
| 76
| 52
| 24
| null | null |
genos/online_problems
|
advent_of_code_2016/day1/src/Main.hs
|
mit
|
allSteps p (m : ms) = ps ++ allSteps (last ps) ms where ps = steps p m
| 70
|
allSteps p (m : ms) = ps ++ allSteps (last ps) ms where ps = steps p m
| 70
|
allSteps p (m : ms) = ps ++ allSteps (last ps) ms where ps = steps p m
| 70
| false
| false
| 0
| 8
| 17
| 45
| 22
| 23
| null | null |
ktvoelker/cookie-jar
|
test/Util.hs
|
gpl-3.0
|
debugLn = if enableDebug then hPutStrLn stderr else const $ return ()
| 69
|
debugLn = if enableDebug then hPutStrLn stderr else const $ return ()
| 69
|
debugLn = if enableDebug then hPutStrLn stderr else const $ return ()
| 69
| false
| false
| 0
| 8
| 11
| 26
| 13
| 13
| null | null |
flipstone/orville
|
orville-postgresql/src/Database/Orville/PostgreSQL/Popper.hs
|
mit
|
hasOneWhere ::
Ord fieldValue
=> TableDefinition readEntity writeEntity key
-> FieldDefinition nullability fieldValue
-> SelectOptions
-> Popper fieldValue (Maybe readEntity)
hasOneWhere tableDef fieldDef opts =
PopPrim (PrimRecordBy tableDef fieldDef opts)
| 272
|
hasOneWhere ::
Ord fieldValue
=> TableDefinition readEntity writeEntity key
-> FieldDefinition nullability fieldValue
-> SelectOptions
-> Popper fieldValue (Maybe readEntity)
hasOneWhere tableDef fieldDef opts =
PopPrim (PrimRecordBy tableDef fieldDef opts)
| 272
|
hasOneWhere tableDef fieldDef opts =
PopPrim (PrimRecordBy tableDef fieldDef opts)
| 84
| false
| true
| 0
| 12
| 44
| 77
| 35
| 42
| null | null |
mightymoose/liquidhaskell
|
src/Language/Haskell/Liquid/Annotate.hs
|
bsd-3-clause
|
mkStatus (Safe) = ACSS.Safe
| 36
|
mkStatus (Safe) = ACSS.Safe
| 36
|
mkStatus (Safe) = ACSS.Safe
| 36
| false
| false
| 0
| 6
| 12
| 14
| 7
| 7
| null | null |
tjakway/ghcjvm
|
compiler/main/CmdLineParser.hs
|
bsd-3-clause
|
arg_ok (FloatSuffix _) _ _ = True
| 43
|
arg_ok (FloatSuffix _) _ _ = True
| 43
|
arg_ok (FloatSuffix _) _ _ = True
| 43
| false
| false
| 1
| 6
| 16
| 19
| 8
| 11
| null | null |
chris-wood/ccnx-pktgen
|
src/CCNxPacketGenerator.hs
|
mit
|
produceContents :: [[String]] -> [[Word8]] -> [Maybe Content]
produceContents (n:ns) (p:ps) =
case (createContent (Payload p) n) of
Nothing -> []
Just (SimpleContent msg) -> [Just (SimpleContent msg)] ++ (produceContents ns ps)
| 247
|
produceContents :: [[String]] -> [[Word8]] -> [Maybe Content]
produceContents (n:ns) (p:ps) =
case (createContent (Payload p) n) of
Nothing -> []
Just (SimpleContent msg) -> [Just (SimpleContent msg)] ++ (produceContents ns ps)
| 247
|
produceContents (n:ns) (p:ps) =
case (createContent (Payload p) n) of
Nothing -> []
Just (SimpleContent msg) -> [Just (SimpleContent msg)] ++ (produceContents ns ps)
| 185
| false
| true
| 0
| 12
| 51
| 121
| 63
| 58
| null | null |
peterokagey/haskellOEIS
|
test/DistinctMidpoints/A285491Spec.hs
|
apache-2.0
|
spec :: Spec
spec = describe "A285491" $
it "correctly computes the first 20 elements" $
take 20 (map a285491 [1..]) `shouldBe` expectedValue where
expectedValue = [1,1,2,1,4,6,2,9,1,13,8,19,2,15,12,28,32,6,4,18]
| 224
|
spec :: Spec
spec = describe "A285491" $
it "correctly computes the first 20 elements" $
take 20 (map a285491 [1..]) `shouldBe` expectedValue where
expectedValue = [1,1,2,1,4,6,2,9,1,13,8,19,2,15,12,28,32,6,4,18]
| 224
|
spec = describe "A285491" $
it "correctly computes the first 20 elements" $
take 20 (map a285491 [1..]) `shouldBe` expectedValue where
expectedValue = [1,1,2,1,4,6,2,9,1,13,8,19,2,15,12,28,32,6,4,18]
| 211
| false
| true
| 0
| 10
| 38
| 114
| 68
| 46
| null | null |
phadej/streaming-commons
|
Data/Streaming/Network.hs
|
mit
|
-- | Set the address family for the given settings.
--
-- Since 0.1.3
setAddrFamily :: NS.Family -> ClientSettings -> ClientSettings
setAddrFamily af cs = cs { clientAddrFamily = af }
| 183
|
setAddrFamily :: NS.Family -> ClientSettings -> ClientSettings
setAddrFamily af cs = cs { clientAddrFamily = af }
| 113
|
setAddrFamily af cs = cs { clientAddrFamily = af }
| 50
| true
| true
| 0
| 8
| 30
| 43
| 22
| 21
| null | null |
sebastiaanvisser/fixpoints
|
src/Data/Annotation.hs
|
bsd-3-clause
|
fullyIn :: (Monad m, Traversable f, In a f m) => Fix f -> m (FixA a f)
fullyIn = return . In <=< inA <=< mapM fullyIn . out
| 123
|
fullyIn :: (Monad m, Traversable f, In a f m) => Fix f -> m (FixA a f)
fullyIn = return . In <=< inA <=< mapM fullyIn . out
| 123
|
fullyIn = return . In <=< inA <=< mapM fullyIn . out
| 52
| false
| true
| 0
| 9
| 29
| 73
| 36
| 37
| null | null |
roelvandijk/aeson
|
Data/Aeson/TH.hs
|
bsd-3-clause
|
sumToValue :: Options -> Bool -> Name -> Q Exp -> Q Exp
sumToValue opts multiCons conName exp
| multiCons =
case sumEncoding opts of
TwoElemArray ->
[|Array|] `appE` ([|V.fromList|] `appE` listE [conStr opts conName, exp])
TaggedObject{tagFieldName, contentsFieldName} ->
[|A.object|] `appE` listE
[ infixApp [|T.pack tagFieldName|] [|(.=)|] (conStr opts conName)
, infixApp [|T.pack contentsFieldName|] [|(.=)|] exp
]
ObjectWithSingleField ->
[|A.object|] `appE` listE
[ infixApp (conTxt opts conName) [|(.=)|] exp
]
| otherwise = exp
| 708
|
sumToValue :: Options -> Bool -> Name -> Q Exp -> Q Exp
sumToValue opts multiCons conName exp
| multiCons =
case sumEncoding opts of
TwoElemArray ->
[|Array|] `appE` ([|V.fromList|] `appE` listE [conStr opts conName, exp])
TaggedObject{tagFieldName, contentsFieldName} ->
[|A.object|] `appE` listE
[ infixApp [|T.pack tagFieldName|] [|(.=)|] (conStr opts conName)
, infixApp [|T.pack contentsFieldName|] [|(.=)|] exp
]
ObjectWithSingleField ->
[|A.object|] `appE` listE
[ infixApp (conTxt opts conName) [|(.=)|] exp
]
| otherwise = exp
| 708
|
sumToValue opts multiCons conName exp
| multiCons =
case sumEncoding opts of
TwoElemArray ->
[|Array|] `appE` ([|V.fromList|] `appE` listE [conStr opts conName, exp])
TaggedObject{tagFieldName, contentsFieldName} ->
[|A.object|] `appE` listE
[ infixApp [|T.pack tagFieldName|] [|(.=)|] (conStr opts conName)
, infixApp [|T.pack contentsFieldName|] [|(.=)|] exp
]
ObjectWithSingleField ->
[|A.object|] `appE` listE
[ infixApp (conTxt opts conName) [|(.=)|] exp
]
| otherwise = exp
| 652
| false
| true
| 1
| 14
| 246
| 211
| 120
| 91
| null | null |
hvr/text
|
Data/Text/Lazy.hs
|
bsd-2-clause
|
-- | /O(n)/ The 'isPrefixOf' function takes two 'Text's and returns
-- 'True' iff the first is a prefix of the second. Subject to fusion.
isPrefixOf :: Text -> Text -> Bool
isPrefixOf Empty _ = True
| 200
|
isPrefixOf :: Text -> Text -> Bool
isPrefixOf Empty _ = True
| 61
|
isPrefixOf Empty _ = True
| 26
| true
| true
| 0
| 6
| 38
| 26
| 14
| 12
| null | null |
DavidAlphaFox/ghc
|
libraries/Cabal/cabal-install/Distribution/Client/Sandbox.hs
|
bsd-3-clause
|
loadConfigOrSandboxConfig :: Verbosity
-> GlobalFlags -- ^ For @--config-file@ and
-- @--sandbox-config-file@.
-> Flag Bool -- ^ Ignored if we're in a sandbox.
-> IO (UseSandbox, SavedConfig)
loadConfigOrSandboxConfig verbosity globalFlags userInstallFlag = do
let configFileFlag = globalConfigFile globalFlags
sandboxConfigFileFlag = globalSandboxConfigFile globalFlags
ignoreSandboxFlag = globalIgnoreSandbox globalFlags
pkgEnvDir <- getPkgEnvDir sandboxConfigFileFlag
pkgEnvType <- classifyPackageEnvironment pkgEnvDir sandboxConfigFileFlag
ignoreSandboxFlag
case pkgEnvType of
-- A @cabal.sandbox.config@ file (and possibly @cabal.config@) is present.
SandboxPackageEnvironment -> do
(sandboxDir, pkgEnv) <- tryLoadSandboxConfig verbosity globalFlags
-- ^ Prints an error message and exits on error.
let config = pkgEnvSavedConfig pkgEnv
return (UseSandbox sandboxDir, config)
-- Only @cabal.config@ is present.
UserPackageEnvironment -> do
config <- loadConfig verbosity configFileFlag userInstallFlag
userConfig <- loadUserConfig verbosity pkgEnvDir
let config' = config `mappend` userConfig
dieIfSandboxRequired config'
return (NoSandbox, config')
-- Neither @cabal.sandbox.config@ nor @cabal.config@ are present.
AmbientPackageEnvironment -> do
config <- loadConfig verbosity configFileFlag userInstallFlag
dieIfSandboxRequired config
return (NoSandbox, config)
where
-- Return the path to the package environment directory - either the
-- current directory or the one that @--sandbox-config-file@ resides in.
getPkgEnvDir :: (Flag FilePath) -> IO FilePath
getPkgEnvDir sandboxConfigFileFlag = do
case sandboxConfigFileFlag of
NoFlag -> getCurrentDirectory
Flag path -> tryCanonicalizePath . takeDirectory $ path
-- Die if @--require-sandbox@ was specified and we're not inside a sandbox.
dieIfSandboxRequired :: SavedConfig -> IO ()
dieIfSandboxRequired config = checkFlag flag
where
flag = (globalRequireSandbox . savedGlobalFlags $ config)
`mappend` (globalRequireSandbox globalFlags)
checkFlag (Flag True) =
die $ "'require-sandbox' is set to True, but no sandbox is present. "
++ "Use '--no-require-sandbox' if you want to override "
++ "'require-sandbox' temporarily."
checkFlag (Flag False) = return ()
checkFlag (NoFlag) = return ()
-- | If we're in a sandbox, call @withSandboxBinDirOnSearchPath@, otherwise do
-- nothing.
| 2,835
|
loadConfigOrSandboxConfig :: Verbosity
-> GlobalFlags -- ^ For @--config-file@ and
-- @--sandbox-config-file@.
-> Flag Bool -- ^ Ignored if we're in a sandbox.
-> IO (UseSandbox, SavedConfig)
loadConfigOrSandboxConfig verbosity globalFlags userInstallFlag = do
let configFileFlag = globalConfigFile globalFlags
sandboxConfigFileFlag = globalSandboxConfigFile globalFlags
ignoreSandboxFlag = globalIgnoreSandbox globalFlags
pkgEnvDir <- getPkgEnvDir sandboxConfigFileFlag
pkgEnvType <- classifyPackageEnvironment pkgEnvDir sandboxConfigFileFlag
ignoreSandboxFlag
case pkgEnvType of
-- A @cabal.sandbox.config@ file (and possibly @cabal.config@) is present.
SandboxPackageEnvironment -> do
(sandboxDir, pkgEnv) <- tryLoadSandboxConfig verbosity globalFlags
-- ^ Prints an error message and exits on error.
let config = pkgEnvSavedConfig pkgEnv
return (UseSandbox sandboxDir, config)
-- Only @cabal.config@ is present.
UserPackageEnvironment -> do
config <- loadConfig verbosity configFileFlag userInstallFlag
userConfig <- loadUserConfig verbosity pkgEnvDir
let config' = config `mappend` userConfig
dieIfSandboxRequired config'
return (NoSandbox, config')
-- Neither @cabal.sandbox.config@ nor @cabal.config@ are present.
AmbientPackageEnvironment -> do
config <- loadConfig verbosity configFileFlag userInstallFlag
dieIfSandboxRequired config
return (NoSandbox, config)
where
-- Return the path to the package environment directory - either the
-- current directory or the one that @--sandbox-config-file@ resides in.
getPkgEnvDir :: (Flag FilePath) -> IO FilePath
getPkgEnvDir sandboxConfigFileFlag = do
case sandboxConfigFileFlag of
NoFlag -> getCurrentDirectory
Flag path -> tryCanonicalizePath . takeDirectory $ path
-- Die if @--require-sandbox@ was specified and we're not inside a sandbox.
dieIfSandboxRequired :: SavedConfig -> IO ()
dieIfSandboxRequired config = checkFlag flag
where
flag = (globalRequireSandbox . savedGlobalFlags $ config)
`mappend` (globalRequireSandbox globalFlags)
checkFlag (Flag True) =
die $ "'require-sandbox' is set to True, but no sandbox is present. "
++ "Use '--no-require-sandbox' if you want to override "
++ "'require-sandbox' temporarily."
checkFlag (Flag False) = return ()
checkFlag (NoFlag) = return ()
-- | If we're in a sandbox, call @withSandboxBinDirOnSearchPath@, otherwise do
-- nothing.
| 2,835
|
loadConfigOrSandboxConfig verbosity globalFlags userInstallFlag = do
let configFileFlag = globalConfigFile globalFlags
sandboxConfigFileFlag = globalSandboxConfigFile globalFlags
ignoreSandboxFlag = globalIgnoreSandbox globalFlags
pkgEnvDir <- getPkgEnvDir sandboxConfigFileFlag
pkgEnvType <- classifyPackageEnvironment pkgEnvDir sandboxConfigFileFlag
ignoreSandboxFlag
case pkgEnvType of
-- A @cabal.sandbox.config@ file (and possibly @cabal.config@) is present.
SandboxPackageEnvironment -> do
(sandboxDir, pkgEnv) <- tryLoadSandboxConfig verbosity globalFlags
-- ^ Prints an error message and exits on error.
let config = pkgEnvSavedConfig pkgEnv
return (UseSandbox sandboxDir, config)
-- Only @cabal.config@ is present.
UserPackageEnvironment -> do
config <- loadConfig verbosity configFileFlag userInstallFlag
userConfig <- loadUserConfig verbosity pkgEnvDir
let config' = config `mappend` userConfig
dieIfSandboxRequired config'
return (NoSandbox, config')
-- Neither @cabal.sandbox.config@ nor @cabal.config@ are present.
AmbientPackageEnvironment -> do
config <- loadConfig verbosity configFileFlag userInstallFlag
dieIfSandboxRequired config
return (NoSandbox, config)
where
-- Return the path to the package environment directory - either the
-- current directory or the one that @--sandbox-config-file@ resides in.
getPkgEnvDir :: (Flag FilePath) -> IO FilePath
getPkgEnvDir sandboxConfigFileFlag = do
case sandboxConfigFileFlag of
NoFlag -> getCurrentDirectory
Flag path -> tryCanonicalizePath . takeDirectory $ path
-- Die if @--require-sandbox@ was specified and we're not inside a sandbox.
dieIfSandboxRequired :: SavedConfig -> IO ()
dieIfSandboxRequired config = checkFlag flag
where
flag = (globalRequireSandbox . savedGlobalFlags $ config)
`mappend` (globalRequireSandbox globalFlags)
checkFlag (Flag True) =
die $ "'require-sandbox' is set to True, but no sandbox is present. "
++ "Use '--no-require-sandbox' if you want to override "
++ "'require-sandbox' temporarily."
checkFlag (Flag False) = return ()
checkFlag (NoFlag) = return ()
-- | If we're in a sandbox, call @withSandboxBinDirOnSearchPath@, otherwise do
-- nothing.
| 2,507
| false
| true
| 16
| 15
| 777
| 442
| 217
| 225
| null | null |
bergmark/http2
|
test-hpack/hpack-stat.hs
|
bsd-3-clause
|
wdir1 :: FilePath
wdir1 = "test-hpack/hpack-test-case/haskell-http2-naive"
| 74
|
wdir1 :: FilePath
wdir1 = "test-hpack/hpack-test-case/haskell-http2-naive"
| 74
|
wdir1 = "test-hpack/hpack-test-case/haskell-http2-naive"
| 56
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
spechub/Hets
|
CASL/AS_Basic_CASL.der.hs
|
gpl-2.0
|
is_True_atom :: FORMULA f -> Bool
is_True_atom f = case f of
Atom b _ -> b
_ -> False
| 89
|
is_True_atom :: FORMULA f -> Bool
is_True_atom f = case f of
Atom b _ -> b
_ -> False
| 89
|
is_True_atom f = case f of
Atom b _ -> b
_ -> False
| 55
| false
| true
| 0
| 8
| 23
| 48
| 21
| 27
| null | null |
fmapfmapfmap/amazonka
|
amazonka-s3/gen/Network/AWS/S3/Types/Product.hs
|
mpl-2.0
|
-- | Undocumented member.
sseKey :: Lens' S3ServiceError (Maybe ObjectKey)
sseKey = lens _sseKey (\ s a -> s{_sseKey = a})
| 122
|
sseKey :: Lens' S3ServiceError (Maybe ObjectKey)
sseKey = lens _sseKey (\ s a -> s{_sseKey = a})
| 96
|
sseKey = lens _sseKey (\ s a -> s{_sseKey = a})
| 47
| true
| true
| 1
| 9
| 20
| 52
| 25
| 27
| null | null |
shayan-najd/QHaskell
|
QHaskell/Environment/Typed.hs
|
gpl-3.0
|
foldl f z (Ext x xs) = foldl f (f z x) xs
| 41
|
foldl f z (Ext x xs) = foldl f (f z x) xs
| 41
|
foldl f z (Ext x xs) = foldl f (f z x) xs
| 41
| false
| false
| 0
| 7
| 12
| 36
| 17
| 19
| null | null |
henvic/plc
|
src/FuncoesDeAltaOrdemFilterFold.hs
|
cc0-1.0
|
menorpar7 (nome,nota) = nota < 7
| 32
|
menorpar7 (nome,nota) = nota < 7
| 32
|
menorpar7 (nome,nota) = nota < 7
| 32
| false
| false
| 2
| 5
| 5
| 22
| 10
| 12
| null | null |
rudyl313/factual-haskell-driver
|
test/Tests.hs
|
bsd-3-clause
|
submitWrite :: S.Submit
submitWrite = S.Submit { S.table = Places
, S.user = "user123"
, S.factualId = Just "foobar"
, S.reference = Nothing
, S.comment = Nothing
, S.values = M.fromList [("key", "val")] }
| 334
|
submitWrite :: S.Submit
submitWrite = S.Submit { S.table = Places
, S.user = "user123"
, S.factualId = Just "foobar"
, S.reference = Nothing
, S.comment = Nothing
, S.values = M.fromList [("key", "val")] }
| 334
|
submitWrite = S.Submit { S.table = Places
, S.user = "user123"
, S.factualId = Just "foobar"
, S.reference = Nothing
, S.comment = Nothing
, S.values = M.fromList [("key", "val")] }
| 310
| false
| true
| 0
| 9
| 162
| 82
| 48
| 34
| null | null |
nicolasbrugneaux/7-languages-in-7-weeks
|
haskell/day1/evens.hs
|
mit
|
evens (h:t) = if even h then h:evens t else evens t
| 51
|
evens (h:t) = if even h then h:evens t else evens t
| 51
|
evens (h:t) = if even h then h:evens t else evens t
| 51
| false
| false
| 0
| 7
| 11
| 37
| 18
| 19
| null | null |
dimara/ganeti
|
test/hs/Test/Ganeti/Utils.hs
|
bsd-2-clause
|
-- | Test that chompPrefix on the empty string always returns Nothing for
-- prefixes of length 2 or more.
prop_chompPrefix_empty_string :: Property
prop_chompPrefix_empty_string =
forAll (choose (2, 20)) $ \len ->
forAll (vectorOf len arbitrary) $ \pfx ->
chompPrefix pfx "" ==? Nothing
| 293
|
prop_chompPrefix_empty_string :: Property
prop_chompPrefix_empty_string =
forAll (choose (2, 20)) $ \len ->
forAll (vectorOf len arbitrary) $ \pfx ->
chompPrefix pfx "" ==? Nothing
| 186
|
prop_chompPrefix_empty_string =
forAll (choose (2, 20)) $ \len ->
forAll (vectorOf len arbitrary) $ \pfx ->
chompPrefix pfx "" ==? Nothing
| 144
| true
| true
| 1
| 8
| 49
| 69
| 36
| 33
| null | null |
yalpul/CENG242
|
H99/1-10/p8.hs
|
gpl-3.0
|
p8 xs = xs
| 10
|
p8 xs = xs
| 10
|
p8 xs = xs
| 10
| false
| false
| 1
| 5
| 3
| 13
| 4
| 9
| null | null |
csrhodes/pandoc
|
src/Text/Pandoc/Writers/Docx.hs
|
gpl-2.0
|
-- | Certain characters are invalid in XML even if escaped.
-- See #1992
stripInvalidChars :: Pandoc -> Pandoc
stripInvalidChars = bottomUp (filter isValidChar)
| 160
|
stripInvalidChars :: Pandoc -> Pandoc
stripInvalidChars = bottomUp (filter isValidChar)
| 87
|
stripInvalidChars = bottomUp (filter isValidChar)
| 49
| true
| true
| 0
| 7
| 23
| 26
| 14
| 12
| null | null |
ghorn/ois-input-manager
|
src/Key.hs
|
bsd-3-clause
|
decodeKey 61 = KC_F3
| 20
|
decodeKey 61 = KC_F3
| 20
|
decodeKey 61 = KC_F3
| 20
| false
| false
| 1
| 5
| 3
| 13
| 4
| 9
| null | null |
haroldcarr/learn-haskell-coq-ml-etc
|
haskell/topic/monads/wiki-haskell-org_all-about-monads/src/Wiki_haskell_org_all_about_monads.hs
|
unlicense
|
{-
------------------------------------------------------------------------------
1.1 What is a monad?
Monads
- sequential computations
- determine how combined computations form a new computation
- frees programmer coding combination manually
1.2 Why should I make the effort to understand monads?
Monads : structuring functional programs
- Modularity
- computations composed from other computations
- separate combination strategy from computations
- Flexibility
j - programs more adaptable than programs written without monads
- monad puts computational strategy in single place
(instead of distributed in entire program)
- Isolation
- imperative-style structures isolated from main program.
------------------------------------------------------------------------------
2 Meet the Monads
-- the type of monad m
data m a = ...
-- return is a type constructor that creates monad instances
return :: a -> m a
-- combines a monad instance 'm a' with a computation 'a -> m b'
-- to produce another monad instance 'm b'
(>>=) :: m a -> (a -> m b) -> m b
Container analogy
- type constructor 'm' is container that can hold different values 'a'
- 'm a' is container holding value of type 'a'
- 'return' puts value into monad container
- >>= takes value from monad container, passes it a function
to produce a monad container containing a new value, possibly of a different type
- binding function can implement strategy for combining computations in the monad
2.3 An example
-}
maternalGF1 :: Sheep -> Maybe Sheep
maternalGF1 s =
case mother s of
Nothing -> Nothing
Just m -> father m
| 1,618
|
maternalGF1 :: Sheep -> Maybe Sheep
maternalGF1 s =
case mother s of
Nothing -> Nothing
Just m -> father m
| 117
|
maternalGF1 s =
case mother s of
Nothing -> Nothing
Just m -> father m
| 81
| true
| true
| 0
| 8
| 286
| 51
| 23
| 28
| null | null |
oldmanmike/ghc
|
compiler/main/PprTyThing.hs
|
bsd-3-clause
|
showWithLoc :: SDoc -> SDoc -> SDoc
showWithLoc loc doc
= hang doc 2 (char '\t' <> comment <+> loc)
-- The tab tries to make them line up a bit
where
comment = text "--"
| 195
|
showWithLoc :: SDoc -> SDoc -> SDoc
showWithLoc loc doc
= hang doc 2 (char '\t' <> comment <+> loc)
-- The tab tries to make them line up a bit
where
comment = text "--"
| 195
|
showWithLoc loc doc
= hang doc 2 (char '\t' <> comment <+> loc)
-- The tab tries to make them line up a bit
where
comment = text "--"
| 159
| false
| true
| 1
| 8
| 61
| 68
| 29
| 39
| null | null |
mrakgr/futhark
|
src/Futhark/Optimise/InPlaceLowering.hs
|
bsd-3-clause
|
seenVar :: VName -> ForwardingM ()
seenVar name = do
aliases <- asks $
maybe mempty entryAliases .
HM.lookup name . topDownTable
tell $ mempty { bottomUpSeen = HS.insert name aliases }
| 214
|
seenVar :: VName -> ForwardingM ()
seenVar name = do
aliases <- asks $
maybe mempty entryAliases .
HM.lookup name . topDownTable
tell $ mempty { bottomUpSeen = HS.insert name aliases }
| 214
|
seenVar name = do
aliases <- asks $
maybe mempty entryAliases .
HM.lookup name . topDownTable
tell $ mempty { bottomUpSeen = HS.insert name aliases }
| 179
| false
| true
| 0
| 11
| 61
| 74
| 35
| 39
| null | null |
zmthy/snaplet-rest
|
src/Snap/Snaplet/Rest/Failure.hs
|
mit
|
------------------------------------------------------------------------------
-- | Serve the given error code, running the given handler.
failure :: MonadSnap m => Int -> m () -> m a
failure code handler = do
modifyResponse (setResponseCode code)
handler
withResponse finishWith
| 291
|
failure :: MonadSnap m => Int -> m () -> m a
failure code handler = do
modifyResponse (setResponseCode code)
handler
withResponse finishWith
| 152
|
failure code handler = do
modifyResponse (setResponseCode code)
handler
withResponse finishWith
| 107
| true
| true
| 0
| 9
| 46
| 62
| 28
| 34
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.