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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
robx/puzzle-draw
|
src/Draw/Grid.hs
|
mit
|
gridDashing :: (Semigroup a, HasStyle a, InSpace V2 Double a) => a -> a
gridDashing = bgdashingG dashes dashoffset white'
where
white' = black `withOpacity` (0.05 :: Double)
| 179
|
gridDashing :: (Semigroup a, HasStyle a, InSpace V2 Double a) => a -> a
gridDashing = bgdashingG dashes dashoffset white'
where
white' = black `withOpacity` (0.05 :: Double)
| 179
|
gridDashing = bgdashingG dashes dashoffset white'
where
white' = black `withOpacity` (0.05 :: Double)
| 107
| false
| true
| 0
| 6
| 33
| 67
| 36
| 31
| null | null |
pbl64k/CodeSprints
|
CodeSprint-2012-05-12-Interviewstreet/Complexity/c.accepted.hs
|
bsd-2-clause
|
terminator = sc ';'
| 19
|
terminator = sc ';'
| 19
|
terminator = sc ';'
| 19
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
phaazon/phaazon.net
|
backend/src/Feed.hs
|
gpl-3.0
|
rssChan :: Maybe UTCTime -> [RSSItem] -> RSSChannel
rssChan lastUpdateTime items =
(nullChannel "phaazon.net blog" urlBlog)
{ rssItems = items,
rssLastUpdate = fmap dateToText lastUpdateTime
}
| 208
|
rssChan :: Maybe UTCTime -> [RSSItem] -> RSSChannel
rssChan lastUpdateTime items =
(nullChannel "phaazon.net blog" urlBlog)
{ rssItems = items,
rssLastUpdate = fmap dateToText lastUpdateTime
}
| 208
|
rssChan lastUpdateTime items =
(nullChannel "phaazon.net blog" urlBlog)
{ rssItems = items,
rssLastUpdate = fmap dateToText lastUpdateTime
}
| 156
| false
| true
| 0
| 8
| 41
| 65
| 32
| 33
| null | null |
trenta3/zeno-0.2.0.1
|
src/Zeno/HaskellParser.hs
|
mit
|
convertBindings (Hs.Rec binds) =
Rec <$> convertBinds True binds
| 67
|
convertBindings (Hs.Rec binds) =
Rec <$> convertBinds True binds
| 67
|
convertBindings (Hs.Rec binds) =
Rec <$> convertBinds True binds
| 67
| false
| false
| 0
| 8
| 11
| 26
| 12
| 14
| null | null |
green-haskell/ghc
|
libraries/template-haskell/Language/Haskell/TH/PprLib.hs
|
bsd-3-clause
|
vcat = liftM HPJ.vcat . sequence
| 32
|
vcat = liftM HPJ.vcat . sequence
| 32
|
vcat = liftM HPJ.vcat . sequence
| 32
| false
| false
| 0
| 7
| 5
| 15
| 7
| 8
| null | null |
keithodulaigh/Hets
|
HasCASL/Subst.hs
|
gpl-2.0
|
scName :: SubstConst -> String
scName (SConst n _) = show n
| 59
|
scName :: SubstConst -> String
scName (SConst n _) = show n
| 59
|
scName (SConst n _) = show n
| 28
| false
| true
| 0
| 9
| 11
| 35
| 15
| 20
| null | null |
acowley/ghc
|
libraries/template-haskell/Language/Haskell/TH/Ppr.hs
|
bsd-3-clause
|
pprParendType PromotedNilT = text "'[]"
| 46
|
pprParendType PromotedNilT = text "'[]"
| 46
|
pprParendType PromotedNilT = text "'[]"
| 46
| false
| false
| 0
| 5
| 11
| 12
| 5
| 7
| null | null |
transient-haskell/transient-universe
|
tests/cell.hs
|
mit
|
app= onBrowser $ local $ render $ do
mk space (Just 1) ! size "10" <|> br ++>
mk time (Just 2) ! size "10" <|> br ++>
mk speed (Just 3) ! size "10"
calc
where
size= atr "size"
space = scell "space" $ do -- runCloud $ atRemote $ local $ do
liftIO $ print "running cella at server"
norender $ gcell "speed" * gcell "time"
time = scell "time" $ do -- runCloud $ atRemote $ local $ do
liftIO $ print "running cellb at server"
norender $ gcell "space" / gcell "speed"
speed = scell "speed" $ do -- runCloud $ atRemote $ local $ do
liftIO $ print "running cellc at server"
norender $ gcell "space" / gcell "time"
| 819
|
app= onBrowser $ local $ render $ do
mk space (Just 1) ! size "10" <|> br ++>
mk time (Just 2) ! size "10" <|> br ++>
mk speed (Just 3) ! size "10"
calc
where
size= atr "size"
space = scell "space" $ do -- runCloud $ atRemote $ local $ do
liftIO $ print "running cella at server"
norender $ gcell "speed" * gcell "time"
time = scell "time" $ do -- runCloud $ atRemote $ local $ do
liftIO $ print "running cellb at server"
norender $ gcell "space" / gcell "speed"
speed = scell "speed" $ do -- runCloud $ atRemote $ local $ do
liftIO $ print "running cellc at server"
norender $ gcell "space" / gcell "time"
| 819
|
app= onBrowser $ local $ render $ do
mk space (Just 1) ! size "10" <|> br ++>
mk time (Just 2) ! size "10" <|> br ++>
mk speed (Just 3) ! size "10"
calc
where
size= atr "size"
space = scell "space" $ do -- runCloud $ atRemote $ local $ do
liftIO $ print "running cella at server"
norender $ gcell "speed" * gcell "time"
time = scell "time" $ do -- runCloud $ atRemote $ local $ do
liftIO $ print "running cellb at server"
norender $ gcell "space" / gcell "speed"
speed = scell "speed" $ do -- runCloud $ atRemote $ local $ do
liftIO $ print "running cellc at server"
norender $ gcell "space" / gcell "time"
| 819
| false
| false
| 0
| 17
| 336
| 224
| 102
| 122
| null | null |
ocharles/hackage-server
|
Distribution/Server/Features/Security/Cache.hs
|
bsd-3-clause
|
computeTimestamp :: StateComponent AcidState SecurityState
-> UTCTime
-> Snapshot
-> IO Timestamp
computeTimestamp securityState now snapshot = do
timestampVersion <- updateState securityState NextTimestampVersion
timestampKey <- queryState securityState GetTimestampKey
let timestamp = Sec.Timestamp {
timestampVersion = timestampVersion
, timestampExpires = Sec.expiresInDays now 3
, timestampInfoSnapshot = fileInfo snapshot
}
signed = Sec.withSignatures layout [timestampKey] timestamp
raw = Sec.renderJSON layout signed
md5 = Crypto.hash raw
sha256 = SHA.sha256 raw
-- We don't actually use the SHA256 of the timestamp for anything; we
-- compute it just for uniformity's sake.
return TUFFile {
tufFileContent = raw
, tufFileLength = fromIntegral $ BS.Lazy.length raw
, tufFileHashMD5 = md5
, tufFileHashSHA256 = sha256
, tufFileModified = now
, tufFileExpires = expiryTime timestamp
}
where
layout = Sec.hackageRepoLayout
{-------------------------------------------------------------------------------
The security file cache
We want to avoid re-reading the root and mirrors files every time the
security cache is prodded; at the same time we cannot have the root and
mirrors files in a different cache from the cache containing the snapshot
for reasons explained above. Hence, we cache the root and mirrors files
in a separate cache but, crucially, we do not serve from this cache. Instead
whenever we prod the main cache we just copy the cached root and mirrors files
from this secondary cache to the main cache. We prod the file cache only
when the user specifically requests it.
-------------------------------------------------------------------------------}
| 1,986
|
computeTimestamp :: StateComponent AcidState SecurityState
-> UTCTime
-> Snapshot
-> IO Timestamp
computeTimestamp securityState now snapshot = do
timestampVersion <- updateState securityState NextTimestampVersion
timestampKey <- queryState securityState GetTimestampKey
let timestamp = Sec.Timestamp {
timestampVersion = timestampVersion
, timestampExpires = Sec.expiresInDays now 3
, timestampInfoSnapshot = fileInfo snapshot
}
signed = Sec.withSignatures layout [timestampKey] timestamp
raw = Sec.renderJSON layout signed
md5 = Crypto.hash raw
sha256 = SHA.sha256 raw
-- We don't actually use the SHA256 of the timestamp for anything; we
-- compute it just for uniformity's sake.
return TUFFile {
tufFileContent = raw
, tufFileLength = fromIntegral $ BS.Lazy.length raw
, tufFileHashMD5 = md5
, tufFileHashSHA256 = sha256
, tufFileModified = now
, tufFileExpires = expiryTime timestamp
}
where
layout = Sec.hackageRepoLayout
{-------------------------------------------------------------------------------
The security file cache
We want to avoid re-reading the root and mirrors files every time the
security cache is prodded; at the same time we cannot have the root and
mirrors files in a different cache from the cache containing the snapshot
for reasons explained above. Hence, we cache the root and mirrors files
in a separate cache but, crucially, we do not serve from this cache. Instead
whenever we prod the main cache we just copy the cached root and mirrors files
from this secondary cache to the main cache. We prod the file cache only
when the user specifically requests it.
-------------------------------------------------------------------------------}
| 1,986
|
computeTimestamp securityState now snapshot = do
timestampVersion <- updateState securityState NextTimestampVersion
timestampKey <- queryState securityState GetTimestampKey
let timestamp = Sec.Timestamp {
timestampVersion = timestampVersion
, timestampExpires = Sec.expiresInDays now 3
, timestampInfoSnapshot = fileInfo snapshot
}
signed = Sec.withSignatures layout [timestampKey] timestamp
raw = Sec.renderJSON layout signed
md5 = Crypto.hash raw
sha256 = SHA.sha256 raw
-- We don't actually use the SHA256 of the timestamp for anything; we
-- compute it just for uniformity's sake.
return TUFFile {
tufFileContent = raw
, tufFileLength = fromIntegral $ BS.Lazy.length raw
, tufFileHashMD5 = md5
, tufFileHashSHA256 = sha256
, tufFileModified = now
, tufFileExpires = expiryTime timestamp
}
where
layout = Sec.hackageRepoLayout
{-------------------------------------------------------------------------------
The security file cache
We want to avoid re-reading the root and mirrors files every time the
security cache is prodded; at the same time we cannot have the root and
mirrors files in a different cache from the cache containing the snapshot
for reasons explained above. Hence, we cache the root and mirrors files
in a separate cache but, crucially, we do not serve from this cache. Instead
whenever we prod the main cache we just copy the cached root and mirrors files
from this secondary cache to the main cache. We prod the file cache only
when the user specifically requests it.
-------------------------------------------------------------------------------}
| 1,837
| false
| true
| 0
| 13
| 543
| 222
| 116
| 106
| null | null |
haskell-opengl/OpenGLRaw
|
src/Graphics/GL/Functions/F02.hs
|
bsd-3-clause
|
glCheckFramebufferStatus
:: MonadIO m
=> GLenum -- ^ @target@ of type [FramebufferTarget](Graphics-GL-Groups.html#FramebufferTarget).
-> m GLenum -- ^ of type [FramebufferStatus](Graphics-GL-Groups.html#FramebufferStatus).
glCheckFramebufferStatus v1 = liftIO $ dyn73 ptr_glCheckFramebufferStatus v1
| 305
|
glCheckFramebufferStatus
:: MonadIO m
=> GLenum -- ^ @target@ of type [FramebufferTarget](Graphics-GL-Groups.html#FramebufferTarget).
-> m GLenum
glCheckFramebufferStatus v1 = liftIO $ dyn73 ptr_glCheckFramebufferStatus v1
| 228
|
glCheckFramebufferStatus v1 = liftIO $ dyn73 ptr_glCheckFramebufferStatus v1
| 76
| true
| true
| 0
| 8
| 33
| 43
| 20
| 23
| null | null |
danr/hipspec
|
testsuite/prod/zeno_version/PropT27.hs
|
gpl-3.0
|
rev :: [a] -> [a]
rev [] = []
| 33
|
rev :: [a] -> [a]
rev [] = []
| 33
|
rev [] = []
| 15
| false
| true
| 0
| 8
| 12
| 34
| 16
| 18
| null | null |
frontrowed/stratosphere
|
library-gen/Stratosphere/ResourceProperties/SSMMaintenanceWindowTaskMaintenanceWindowStepFunctionsParameters.hs
|
mit
|
ssmMaintenanceWindowTaskMaintenanceWindowStepFunctionsParameters
:: SSMMaintenanceWindowTaskMaintenanceWindowStepFunctionsParameters
ssmMaintenanceWindowTaskMaintenanceWindowStepFunctionsParameters =
SSMMaintenanceWindowTaskMaintenanceWindowStepFunctionsParameters
{ _sSMMaintenanceWindowTaskMaintenanceWindowStepFunctionsParametersInput = Nothing
, _sSMMaintenanceWindowTaskMaintenanceWindowStepFunctionsParametersName = Nothing
}
| 442
|
ssmMaintenanceWindowTaskMaintenanceWindowStepFunctionsParameters
:: SSMMaintenanceWindowTaskMaintenanceWindowStepFunctionsParameters
ssmMaintenanceWindowTaskMaintenanceWindowStepFunctionsParameters =
SSMMaintenanceWindowTaskMaintenanceWindowStepFunctionsParameters
{ _sSMMaintenanceWindowTaskMaintenanceWindowStepFunctionsParametersInput = Nothing
, _sSMMaintenanceWindowTaskMaintenanceWindowStepFunctionsParametersName = Nothing
}
| 442
|
ssmMaintenanceWindowTaskMaintenanceWindowStepFunctionsParameters =
SSMMaintenanceWindowTaskMaintenanceWindowStepFunctionsParameters
{ _sSMMaintenanceWindowTaskMaintenanceWindowStepFunctionsParametersInput = Nothing
, _sSMMaintenanceWindowTaskMaintenanceWindowStepFunctionsParametersName = Nothing
}
| 307
| false
| true
| 1
| 7
| 25
| 32
| 16
| 16
| null | null |
shlevy/ghc
|
compiler/codeGen/StgCmmPrim.hs
|
bsd-3-clause
|
mkBasicIndexedRead :: ByteOff -- Initial offset in bytes
-> Maybe MachOp -- Optional result cast
-> CmmType -- Type of element we are accessing
-> LocalReg -- Destination
-> CmmExpr -- Base address
-> CmmType -- Type of element by which we are indexing
-> CmmExpr -- Index
-> FCode ()
mkBasicIndexedRead off Nothing ty res base idx_ty idx
= do dflags <- getDynFlags
emitAssign (CmmLocal res) (cmmLoadIndexOffExpr dflags off ty base idx_ty idx)
| 616
|
mkBasicIndexedRead :: ByteOff -- Initial offset in bytes
-> Maybe MachOp -- Optional result cast
-> CmmType -- Type of element we are accessing
-> LocalReg -- Destination
-> CmmExpr -- Base address
-> CmmType -- Type of element by which we are indexing
-> CmmExpr -- Index
-> FCode ()
mkBasicIndexedRead off Nothing ty res base idx_ty idx
= do dflags <- getDynFlags
emitAssign (CmmLocal res) (cmmLoadIndexOffExpr dflags off ty base idx_ty idx)
| 616
|
mkBasicIndexedRead off Nothing ty res base idx_ty idx
= do dflags <- getDynFlags
emitAssign (CmmLocal res) (cmmLoadIndexOffExpr dflags off ty base idx_ty idx)
| 169
| false
| true
| 0
| 14
| 246
| 111
| 55
| 56
| null | null |
Vlix/facebookmessenger
|
test/UnitTest/CallbackParse/EchoCallback.hs
|
mit
|
echoCallback :: TestTree
echoCallback = parseTest "Echo callback" echoTextVal
$ msg 1522851392983 $ CMEcho
$ Echo True
(Just 743273262513025)
Nothing
"mid.$cAAFStIxHtgpFwwl111ikQQs_I_oI"
(Just 2860)
$ EText $ EchoText "test test"
| 370
|
echoCallback :: TestTree
echoCallback = parseTest "Echo callback" echoTextVal
$ msg 1522851392983 $ CMEcho
$ Echo True
(Just 743273262513025)
Nothing
"mid.$cAAFStIxHtgpFwwl111ikQQs_I_oI"
(Just 2860)
$ EText $ EchoText "test test"
| 370
|
echoCallback = parseTest "Echo callback" echoTextVal
$ msg 1522851392983 $ CMEcho
$ Echo True
(Just 743273262513025)
Nothing
"mid.$cAAFStIxHtgpFwwl111ikQQs_I_oI"
(Just 2860)
$ EText $ EchoText "test test"
| 345
| false
| true
| 4
| 9
| 169
| 73
| 32
| 41
| null | null |
jdreaver/quantities
|
test-suite/Data/Quantities/ConstructorsSpec.hs
|
bsd-3-clause
|
spec :: Spec
spec = do
describe "fromString" $ do
let m = SimpleUnit "meter" "" 1
m2 = SimpleUnit "meter" "" 2
s = SimpleUnit "second" "" 1
ft = SimpleUnit "foot" "" 1
sn1 = SimpleUnit "second" "" (-1)
g = SimpleUnit "gram" "" 1
it "parses numbers" $ do
fromString "1" `shouldBe` makeRightQuant 1 []
fromString "-2" `shouldBe` makeRightQuant (-2) []
fromString "1e3" `shouldBe` makeRightQuant 1e3 []
fromString "-1e3" `shouldBe` makeRightQuant (-1e3) []
it "parses addition" $ do
fromString "1+1" `shouldBe` makeRightQuant 2 []
it "parses units" $ do
fromString "m" `shouldBe` makeRightQuant 1 [m]
fromString "-m" `shouldBe` makeRightQuant (-1) [m]
it "parses multiple units" $ do
fromString "m*s" `shouldBe` makeRightQuant 1 [m, s]
it "parses division" $ do
fromString "m/s" `shouldBe` makeRightQuant 1 [m, s { power = -1 }]
it "parses implicit multiplication" $ do
fromString "ft sec" `shouldBe` makeRightQuant 1 [ft, s]
fromString "(ft) -sec" `shouldBe` makeRightQuant (-1) [ft, s]
it "parses exponentiation" $ do
fromString "m^2" `shouldBe` makeRightQuant 1 [m2]
fromString "m**2" `shouldBe` makeRightQuant 1 [m2]
it "parses complex expressions" $ do
fromString "100m*ft/s" `shouldBe` makeRightQuant 100 [m, ft, sn1]
fromString "(50 m) / s" `shouldBe` makeRightQuant 50 [m, sn1]
it "handles conversions" $ do
fromString "s + min" `shouldBe` makeRightQuant 61 [s]
fromString "ft + 12in" `shouldBe` makeRightQuant 2 [ft]
fromString "ft - 12in" `shouldBe` makeRightQuant 0 [ft]
it "throws DimensionalityErrors" $ do
fromString "1 + m" `shouldSatisfy` isLeftDimError
fromString "N + s" `shouldSatisfy` isLeftDimError
it "performs unit conversions" $ do
fromString "min => s " `shouldBe` makeRightQuant 60 [s]
fromString "2 min + 15 s => s" `shouldBe` makeRightQuant 135 [s]
it "catches unit conversion errors" $ do
fromString "ft => UNDEF" `shouldBe` Left (UndefinedUnitError "UNDEF")
let scaleq = fromString "m => 3 ft"
(Right q) = fromString "3 ft"
scaleq `shouldBe` Left (ScalingFactorError q)
it "allows use of 'per' for division" $ do
fromString "m per s" `shouldBe` makeRightQuant 1 [m, s { power = -1} ]
fromString "4 per 2" `shouldBe` makeRightQuant 2 []
let expect = makeRightQuant 2 [m, g {power = -1}, sn1]
fromString "2m per s per g" `shouldBe` expect
fromString "mper s" `shouldBe` Left (UndefinedUnitError "mper")
| 2,651
|
spec :: Spec
spec = do
describe "fromString" $ do
let m = SimpleUnit "meter" "" 1
m2 = SimpleUnit "meter" "" 2
s = SimpleUnit "second" "" 1
ft = SimpleUnit "foot" "" 1
sn1 = SimpleUnit "second" "" (-1)
g = SimpleUnit "gram" "" 1
it "parses numbers" $ do
fromString "1" `shouldBe` makeRightQuant 1 []
fromString "-2" `shouldBe` makeRightQuant (-2) []
fromString "1e3" `shouldBe` makeRightQuant 1e3 []
fromString "-1e3" `shouldBe` makeRightQuant (-1e3) []
it "parses addition" $ do
fromString "1+1" `shouldBe` makeRightQuant 2 []
it "parses units" $ do
fromString "m" `shouldBe` makeRightQuant 1 [m]
fromString "-m" `shouldBe` makeRightQuant (-1) [m]
it "parses multiple units" $ do
fromString "m*s" `shouldBe` makeRightQuant 1 [m, s]
it "parses division" $ do
fromString "m/s" `shouldBe` makeRightQuant 1 [m, s { power = -1 }]
it "parses implicit multiplication" $ do
fromString "ft sec" `shouldBe` makeRightQuant 1 [ft, s]
fromString "(ft) -sec" `shouldBe` makeRightQuant (-1) [ft, s]
it "parses exponentiation" $ do
fromString "m^2" `shouldBe` makeRightQuant 1 [m2]
fromString "m**2" `shouldBe` makeRightQuant 1 [m2]
it "parses complex expressions" $ do
fromString "100m*ft/s" `shouldBe` makeRightQuant 100 [m, ft, sn1]
fromString "(50 m) / s" `shouldBe` makeRightQuant 50 [m, sn1]
it "handles conversions" $ do
fromString "s + min" `shouldBe` makeRightQuant 61 [s]
fromString "ft + 12in" `shouldBe` makeRightQuant 2 [ft]
fromString "ft - 12in" `shouldBe` makeRightQuant 0 [ft]
it "throws DimensionalityErrors" $ do
fromString "1 + m" `shouldSatisfy` isLeftDimError
fromString "N + s" `shouldSatisfy` isLeftDimError
it "performs unit conversions" $ do
fromString "min => s " `shouldBe` makeRightQuant 60 [s]
fromString "2 min + 15 s => s" `shouldBe` makeRightQuant 135 [s]
it "catches unit conversion errors" $ do
fromString "ft => UNDEF" `shouldBe` Left (UndefinedUnitError "UNDEF")
let scaleq = fromString "m => 3 ft"
(Right q) = fromString "3 ft"
scaleq `shouldBe` Left (ScalingFactorError q)
it "allows use of 'per' for division" $ do
fromString "m per s" `shouldBe` makeRightQuant 1 [m, s { power = -1} ]
fromString "4 per 2" `shouldBe` makeRightQuant 2 []
let expect = makeRightQuant 2 [m, g {power = -1}, sn1]
fromString "2m per s per g" `shouldBe` expect
fromString "mper s" `shouldBe` Left (UndefinedUnitError "mper")
| 2,651
|
spec = do
describe "fromString" $ do
let m = SimpleUnit "meter" "" 1
m2 = SimpleUnit "meter" "" 2
s = SimpleUnit "second" "" 1
ft = SimpleUnit "foot" "" 1
sn1 = SimpleUnit "second" "" (-1)
g = SimpleUnit "gram" "" 1
it "parses numbers" $ do
fromString "1" `shouldBe` makeRightQuant 1 []
fromString "-2" `shouldBe` makeRightQuant (-2) []
fromString "1e3" `shouldBe` makeRightQuant 1e3 []
fromString "-1e3" `shouldBe` makeRightQuant (-1e3) []
it "parses addition" $ do
fromString "1+1" `shouldBe` makeRightQuant 2 []
it "parses units" $ do
fromString "m" `shouldBe` makeRightQuant 1 [m]
fromString "-m" `shouldBe` makeRightQuant (-1) [m]
it "parses multiple units" $ do
fromString "m*s" `shouldBe` makeRightQuant 1 [m, s]
it "parses division" $ do
fromString "m/s" `shouldBe` makeRightQuant 1 [m, s { power = -1 }]
it "parses implicit multiplication" $ do
fromString "ft sec" `shouldBe` makeRightQuant 1 [ft, s]
fromString "(ft) -sec" `shouldBe` makeRightQuant (-1) [ft, s]
it "parses exponentiation" $ do
fromString "m^2" `shouldBe` makeRightQuant 1 [m2]
fromString "m**2" `shouldBe` makeRightQuant 1 [m2]
it "parses complex expressions" $ do
fromString "100m*ft/s" `shouldBe` makeRightQuant 100 [m, ft, sn1]
fromString "(50 m) / s" `shouldBe` makeRightQuant 50 [m, sn1]
it "handles conversions" $ do
fromString "s + min" `shouldBe` makeRightQuant 61 [s]
fromString "ft + 12in" `shouldBe` makeRightQuant 2 [ft]
fromString "ft - 12in" `shouldBe` makeRightQuant 0 [ft]
it "throws DimensionalityErrors" $ do
fromString "1 + m" `shouldSatisfy` isLeftDimError
fromString "N + s" `shouldSatisfy` isLeftDimError
it "performs unit conversions" $ do
fromString "min => s " `shouldBe` makeRightQuant 60 [s]
fromString "2 min + 15 s => s" `shouldBe` makeRightQuant 135 [s]
it "catches unit conversion errors" $ do
fromString "ft => UNDEF" `shouldBe` Left (UndefinedUnitError "UNDEF")
let scaleq = fromString "m => 3 ft"
(Right q) = fromString "3 ft"
scaleq `shouldBe` Left (ScalingFactorError q)
it "allows use of 'per' for division" $ do
fromString "m per s" `shouldBe` makeRightQuant 1 [m, s { power = -1} ]
fromString "4 per 2" `shouldBe` makeRightQuant 2 []
let expect = makeRightQuant 2 [m, g {power = -1}, sn1]
fromString "2m per s per g" `shouldBe` expect
fromString "mper s" `shouldBe` Left (UndefinedUnitError "mper")
| 2,638
| false
| true
| 0
| 24
| 684
| 894
| 434
| 460
| null | null |
badp/ganeti
|
src/Ganeti/Constants.hs
|
gpl-2.0
|
-- * OOB supported commands
oobPowerOn :: String
oobPowerOn = Types.oobCommandToRaw OobPowerOn
| 95
|
oobPowerOn :: String
oobPowerOn = Types.oobCommandToRaw OobPowerOn
| 66
|
oobPowerOn = Types.oobCommandToRaw OobPowerOn
| 45
| true
| true
| 0
| 6
| 12
| 17
| 9
| 8
| null | null |
AlexeyRaga/eta
|
compiler/ETA/TypeCheck/TcGenDeriv.hs
|
bsd-3-clause
|
mkSimpleLam :: (LHsExpr RdrName -> State [RdrName] (LHsExpr RdrName))
-> State [RdrName] (LHsExpr RdrName)
-- (mkSimpleLam fn) returns (\x. fn(x))
mkSimpleLam lam = do
(n:names) <- get
put names
body <- lam (nlHsVar n)
return (mkHsLam [nlVarPat n] body)
| 281
|
mkSimpleLam :: (LHsExpr RdrName -> State [RdrName] (LHsExpr RdrName))
-> State [RdrName] (LHsExpr RdrName)
mkSimpleLam lam = do
(n:names) <- get
put names
body <- lam (nlHsVar n)
return (mkHsLam [nlVarPat n] body)
| 241
|
mkSimpleLam lam = do
(n:names) <- get
put names
body <- lam (nlHsVar n)
return (mkHsLam [nlVarPat n] body)
| 122
| true
| true
| 0
| 11
| 66
| 113
| 54
| 59
| null | null |
erantapaa/simple-hunt
|
src/TestHoogle.hs
|
bsd-3-clause
|
checkSig _ = return ()
| 22
|
checkSig _ = return ()
| 22
|
checkSig _ = return ()
| 22
| false
| false
| 0
| 6
| 4
| 14
| 6
| 8
| null | null |
cocreature/leksah
|
src/IDE/Pane/Errors.hs
|
gpl-2.0
|
addErrorToList :: Bool -- ^ Whether to display the pane
-> Int -- ^ The index to insert at
-> LogRef
-> IDEAction
addErrorToList False index lr = getPane >>= maybe (return ()) (addErrorToList' index lr)
| 249
|
addErrorToList :: Bool -- ^ Whether to display the pane
-> Int -- ^ The index to insert at
-> LogRef
-> IDEAction
addErrorToList False index lr = getPane >>= maybe (return ()) (addErrorToList' index lr)
| 249
|
addErrorToList False index lr = getPane >>= maybe (return ()) (addErrorToList' index lr)
| 88
| false
| true
| 0
| 9
| 82
| 62
| 30
| 32
| null | null |
osa1/Idris-dev
|
src/Idris/AbsSyntaxTree.hs
|
bsd-3-clause
|
declared (PClauses _ _ n _) = []
| 32
|
declared (PClauses _ _ n _) = []
| 32
|
declared (PClauses _ _ n _) = []
| 32
| false
| false
| 0
| 6
| 7
| 24
| 11
| 13
| null | null |
keera-studios/pang-a-lambda
|
Experiments/collisions/Physics/TwoDimensions/Collisions.hs
|
gpl-3.0
|
changedVelocity :: Eq n => n -> Collisions n -> Maybe Vel2D
changedVelocity name cs =
case concatMap (filter ((== name) . fst) . collisionData) cs of
[] -> Nothing
-- vs -> Just (foldl (^+^) (0,0) (map snd vs))
(_, v') : _ -> Just v'
-- | True if the velocity of the object has been changed by any collision.
| 337
|
changedVelocity :: Eq n => n -> Collisions n -> Maybe Vel2D
changedVelocity name cs =
case concatMap (filter ((== name) . fst) . collisionData) cs of
[] -> Nothing
-- vs -> Just (foldl (^+^) (0,0) (map snd vs))
(_, v') : _ -> Just v'
-- | True if the velocity of the object has been changed by any collision.
| 337
|
changedVelocity name cs =
case concatMap (filter ((== name) . fst) . collisionData) cs of
[] -> Nothing
-- vs -> Just (foldl (^+^) (0,0) (map snd vs))
(_, v') : _ -> Just v'
-- | True if the velocity of the object has been changed by any collision.
| 277
| false
| true
| 0
| 12
| 90
| 100
| 50
| 50
| null | null |
Peaker/HaskProfileGui
|
Parser.hs
|
bsd-3-clause
|
anyLine :: P.Parser T.Text
anyLine = P.takeTill P.isEndOfLine <* P.endOfLine
| 76
|
anyLine :: P.Parser T.Text
anyLine = P.takeTill P.isEndOfLine <* P.endOfLine
| 76
|
anyLine = P.takeTill P.isEndOfLine <* P.endOfLine
| 49
| false
| true
| 0
| 7
| 9
| 31
| 15
| 16
| null | null |
nyson/kagamin
|
Kagamin/TextUtils.hs
|
mit
|
-- | Drop suffix from string, if it is indeed a suffix.
dropSuffix :: T.Text -> T.Text -> T.Text
dropSuffix suffix string = maybe string T.strip $ T.stripSuffix suffix string
| 174
|
dropSuffix :: T.Text -> T.Text -> T.Text
dropSuffix suffix string = maybe string T.strip $ T.stripSuffix suffix string
| 118
|
dropSuffix suffix string = maybe string T.strip $ T.stripSuffix suffix string
| 77
| true
| true
| 0
| 7
| 29
| 49
| 24
| 25
| null | null |
Javran/misc
|
yesod-min/src/Home.hs
|
mit
|
getHomeR :: Handler Html
getHomeR = defaultLayout $ do
setTitle "Minimal Multifile"
[whamlet|
<p>
<a href=@{AddR 5 7}>HTML addition
<p>
<a href=@{AddR 5 7}?_accept=application/json>JSON addition
|]
| 245
|
getHomeR :: Handler Html
getHomeR = defaultLayout $ do
setTitle "Minimal Multifile"
[whamlet|
<p>
<a href=@{AddR 5 7}>HTML addition
<p>
<a href=@{AddR 5 7}?_accept=application/json>JSON addition
|]
| 245
|
getHomeR = defaultLayout $ do
setTitle "Minimal Multifile"
[whamlet|
<p>
<a href=@{AddR 5 7}>HTML addition
<p>
<a href=@{AddR 5 7}?_accept=application/json>JSON addition
|]
| 220
| false
| true
| 0
| 8
| 73
| 31
| 16
| 15
| null | null |
mightybyte/reflex-dom-stubs
|
src/GHCJS/DOM/HTMLTextAreaElement.hs
|
bsd-3-clause
|
htmlTextAreaElementGetDisabled = undefined
| 42
|
htmlTextAreaElementGetDisabled = undefined
| 42
|
htmlTextAreaElementGetDisabled = undefined
| 42
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
psibi/shakespeare
|
Text/CssCommon.hs
|
mit
|
colorBlack :: Color
colorBlack = Color 0 0 0
| 44
|
colorBlack :: Color
colorBlack = Color 0 0 0
| 44
|
colorBlack = Color 0 0 0
| 24
| false
| true
| 0
| 5
| 8
| 18
| 9
| 9
| null | null |
ahushh/Monaba
|
monaba/src/Import.hs
|
mit
|
getIp = do
realIp <- fmap B.toString <$> getIpReal
cfIp <- fmap B.toString <$> getIpCF
hostIp <- getIpFromHost
let resultIp = fromJust (cfIp <|> realIp <|> Just hostIp)
return resultIp
where getIpReal = lookup "X-Real-IP" . requestHeaders <$> waiRequest
getIpCF = lookup "CF-Connecting-IP" . requestHeaders <$> waiRequest
getIpFromHost = takeWhile (not . (`elem` (":"::String))) . show . remoteHost . reqWaiRequest <$> getRequest
-------------------------------------------------------------------------------------------------------------------
-- Geo IP
-------------------------------------------------------------------------------------------------------------------
| 716
|
getIp = do
realIp <- fmap B.toString <$> getIpReal
cfIp <- fmap B.toString <$> getIpCF
hostIp <- getIpFromHost
let resultIp = fromJust (cfIp <|> realIp <|> Just hostIp)
return resultIp
where getIpReal = lookup "X-Real-IP" . requestHeaders <$> waiRequest
getIpCF = lookup "CF-Connecting-IP" . requestHeaders <$> waiRequest
getIpFromHost = takeWhile (not . (`elem` (":"::String))) . show . remoteHost . reqWaiRequest <$> getRequest
-------------------------------------------------------------------------------------------------------------------
-- Geo IP
-------------------------------------------------------------------------------------------------------------------
| 716
|
getIp = do
realIp <- fmap B.toString <$> getIpReal
cfIp <- fmap B.toString <$> getIpCF
hostIp <- getIpFromHost
let resultIp = fromJust (cfIp <|> realIp <|> Just hostIp)
return resultIp
where getIpReal = lookup "X-Real-IP" . requestHeaders <$> waiRequest
getIpCF = lookup "CF-Connecting-IP" . requestHeaders <$> waiRequest
getIpFromHost = takeWhile (not . (`elem` (":"::String))) . show . remoteHost . reqWaiRequest <$> getRequest
-------------------------------------------------------------------------------------------------------------------
-- Geo IP
-------------------------------------------------------------------------------------------------------------------
| 716
| false
| false
| 2
| 14
| 111
| 161
| 79
| 82
| null | null |
k0001/haskell-opaleye
|
Opaleye/Internal/Optimize.hs
|
bsd-3-clause
|
mergeProduct :: PQ.PrimQuery -> PQ.PrimQuery
mergeProduct = PQ.foldPrimQuery (PQ.Unit, PQ.BaseTable, product, PQ.Aggregate,
PQ.Order, PQ.Limit, PQ.Join, PQ.Values,
PQ.Binary)
where product pqs pes = PQ.Product pqs' (pes ++ pes')
where pqs' = pqs >>= queries
queries (PQ.Product qs _) = qs
queries q = NE.NEList q []
pes' = NE.toList pqs >>= conds
conds (PQ.Product _ cs) = cs
conds _ = []
| 544
|
mergeProduct :: PQ.PrimQuery -> PQ.PrimQuery
mergeProduct = PQ.foldPrimQuery (PQ.Unit, PQ.BaseTable, product, PQ.Aggregate,
PQ.Order, PQ.Limit, PQ.Join, PQ.Values,
PQ.Binary)
where product pqs pes = PQ.Product pqs' (pes ++ pes')
where pqs' = pqs >>= queries
queries (PQ.Product qs _) = qs
queries q = NE.NEList q []
pes' = NE.toList pqs >>= conds
conds (PQ.Product _ cs) = cs
conds _ = []
| 544
|
mergeProduct = PQ.foldPrimQuery (PQ.Unit, PQ.BaseTable, product, PQ.Aggregate,
PQ.Order, PQ.Limit, PQ.Join, PQ.Values,
PQ.Binary)
where product pqs pes = PQ.Product pqs' (pes ++ pes')
where pqs' = pqs >>= queries
queries (PQ.Product qs _) = qs
queries q = NE.NEList q []
pes' = NE.toList pqs >>= conds
conds (PQ.Product _ cs) = cs
conds _ = []
| 499
| false
| true
| 0
| 10
| 216
| 181
| 95
| 86
| null | null |
sgillespie/ghc
|
compiler/codeGen/StgCmmMonad.hs
|
bsd-3-clause
|
-- ----------------------------------------------------------------------------
-- Get/set the end-of-block info
withSequel :: Sequel -> FCode a -> FCode a
withSequel sequel code
= do { info <- getInfoDown
; withInfoDown code (info {cgd_sequel = sequel, cgd_self_loop = Nothing }) }
| 295
|
withSequel :: Sequel -> FCode a -> FCode a
withSequel sequel code
= do { info <- getInfoDown
; withInfoDown code (info {cgd_sequel = sequel, cgd_self_loop = Nothing }) }
| 181
|
withSequel sequel code
= do { info <- getInfoDown
; withInfoDown code (info {cgd_sequel = sequel, cgd_self_loop = Nothing }) }
| 138
| true
| true
| 0
| 11
| 49
| 72
| 37
| 35
| null | null |
m-schmidt/Asm6502
|
src/Assembler.hs
|
bsd-3-clause
|
overlappingParts :: [AsmChunk] -> [String]
overlappingParts = fst . foldr check ([], maxBound::Int)
where
check (AsmChunk start bytes) (errs, addr) =
( case start + length bytes - addr of
d | d > 0 -> (printf "'ORG $%04x' overlaps with %d bytes from 'ORG $%04x'" addr d start) : errs
_ -> errs
, start
)
-- |Merge assembled chunks into a single chunk
| 404
|
overlappingParts :: [AsmChunk] -> [String]
overlappingParts = fst . foldr check ([], maxBound::Int)
where
check (AsmChunk start bytes) (errs, addr) =
( case start + length bytes - addr of
d | d > 0 -> (printf "'ORG $%04x' overlaps with %d bytes from 'ORG $%04x'" addr d start) : errs
_ -> errs
, start
)
-- |Merge assembled chunks into a single chunk
| 404
|
overlappingParts = fst . foldr check ([], maxBound::Int)
where
check (AsmChunk start bytes) (errs, addr) =
( case start + length bytes - addr of
d | d > 0 -> (printf "'ORG $%04x' overlaps with %d bytes from 'ORG $%04x'" addr d start) : errs
_ -> errs
, start
)
-- |Merge assembled chunks into a single chunk
| 361
| false
| true
| 1
| 13
| 118
| 133
| 67
| 66
| null | null |
mcschroeder/ghc
|
compiler/hsSyn/HsPat.hs
|
bsd-3-clause
|
hsPatNeedsParens (LazyPat {}) = False
| 44
|
hsPatNeedsParens (LazyPat {}) = False
| 44
|
hsPatNeedsParens (LazyPat {}) = False
| 44
| false
| false
| 0
| 7
| 11
| 16
| 8
| 8
| null | null |
jberryman/Befunge93
|
Befunge.hs
|
bsd-3-clause
|
down, up, left, right :: Direction
down = second (+1)
| 54
|
down, up, left, right :: Direction
down = second (+1)
| 54
|
down = second (+1)
| 19
| false
| true
| 2
| 6
| 10
| 28
| 16
| 12
| null | null |
erochest/popvox-scrape
|
src/PopVox/Ranks.hs
|
apache-2.0
|
resolveStateCode 64 = Just "MT"
| 31
|
resolveStateCode 64 = Just "MT"
| 31
|
resolveStateCode 64 = Just "MT"
| 31
| false
| false
| 0
| 5
| 4
| 12
| 5
| 7
| null | null |
stevana/haarss
|
src/Haarss/View.hs
|
isc
|
itemImage :: Attr -> Attr -> Int -> AnnItem -> Image
itemImage r n w i = horizCat
[ attributed attr (i^.item.title.be "no title")
, charFill r ' ' w 1
]
where
attr :: Attr
attr | i^.isRead = r
| otherwise = n
------------------------------------------------------------------------
| 302
|
itemImage :: Attr -> Attr -> Int -> AnnItem -> Image
itemImage r n w i = horizCat
[ attributed attr (i^.item.title.be "no title")
, charFill r ' ' w 1
]
where
attr :: Attr
attr | i^.isRead = r
| otherwise = n
------------------------------------------------------------------------
| 302
|
itemImage r n w i = horizCat
[ attributed attr (i^.item.title.be "no title")
, charFill r ' ' w 1
]
where
attr :: Attr
attr | i^.isRead = r
| otherwise = n
------------------------------------------------------------------------
| 249
| false
| true
| 0
| 11
| 66
| 106
| 52
| 54
| null | null |
hepek/ErrorProp
|
src/Math/Symbolic.hs
|
gpl-2.0
|
d x (Exp a b) = (a ** b)*((d x a) * b/a + (d x b) * log a)
| 59
|
d x (Exp a b) = (a ** b)*((d x a) * b/a + (d x b) * log a)
| 59
|
d x (Exp a b) = (a ** b)*((d x a) * b/a + (d x b) * log a)
| 59
| false
| false
| 0
| 12
| 20
| 70
| 34
| 36
| null | null |
NickAger/LearningHaskell
|
HaskellProgrammingFromFirstPrinciples/Chapter15.hsproj/Monoid8.hs
|
mit
|
memLeftIdentity :: (Eq s, Eq a, Monoid a) => s -> Mem s a -> Bool
memLeftIdentity x a = (runMem (mempty <> a) $ x) == (runMem a $ x)
| 132
|
memLeftIdentity :: (Eq s, Eq a, Monoid a) => s -> Mem s a -> Bool
memLeftIdentity x a = (runMem (mempty <> a) $ x) == (runMem a $ x)
| 132
|
memLeftIdentity x a = (runMem (mempty <> a) $ x) == (runMem a $ x)
| 66
| false
| true
| 0
| 10
| 30
| 81
| 41
| 40
| null | null |
qnikst/network-transport
|
tests/sumeuler/SumEulerWorker.hs
|
bsd-3-clause
|
euler :: Int -> Int
euler n = length (filter (relPrime n) (mkList n))
| 69
|
euler :: Int -> Int
euler n = length (filter (relPrime n) (mkList n))
| 69
|
euler n = length (filter (relPrime n) (mkList n))
| 49
| false
| true
| 0
| 9
| 13
| 41
| 20
| 21
| null | null |
genos/online_problems
|
advent_of_code_2016/day6/src/Main.hs
|
mit
|
degarble :: Selector -> ByteString -> String
degarble s = map s . prepare
| 73
|
degarble :: Selector -> ByteString -> String
degarble s = map s . prepare
| 73
|
degarble s = map s . prepare
| 28
| false
| true
| 0
| 6
| 13
| 29
| 14
| 15
| null | null |
gridaphobe/ghc
|
compiler/deSugar/Coverage.hs
|
bsd-3-clause
|
addTickHsRecField :: LHsRecField' id (LHsExpr Id) -> TM (LHsRecField' id (LHsExpr Id))
addTickHsRecField (L l (HsRecField id expr pun))
= do { expr' <- addTickLHsExpr expr
; return (L l (HsRecField id expr' pun)) }
| 235
|
addTickHsRecField :: LHsRecField' id (LHsExpr Id) -> TM (LHsRecField' id (LHsExpr Id))
addTickHsRecField (L l (HsRecField id expr pun))
= do { expr' <- addTickLHsExpr expr
; return (L l (HsRecField id expr' pun)) }
| 235
|
addTickHsRecField (L l (HsRecField id expr pun))
= do { expr' <- addTickLHsExpr expr
; return (L l (HsRecField id expr' pun)) }
| 148
| false
| true
| 0
| 11
| 55
| 101
| 49
| 52
| null | null |
nightscape/platform
|
node/tests/Unison/Test/Util.hs
|
mit
|
makeTestCodebase :: IO (TestCodebase, String -> Term V, Term V -> Noted IO (Term V))
makeTestCodebase = do
logger <- L.atomic (L.atInfo L.toStandardOut)
let crypto = C.noop "dummypublickey"
putStrLn "creating block store..."
blockStore <- MBS.make' (makeRandomAddress crypto) makeAddress
putStrLn "created block store, creating Codebase store..."
store' <- BSS.make blockStore
-- store' <- FS.make "blockstore.file"
putStrLn "created Codebase store..., building extra builtins"
extraBuiltins <- EB.make logger blockStore crypto
putStrLn "extra builtins created"
codebase <- pure $ Codebase.make hash store'
let builtins = Builtin.make logger ++ extraBuiltins
Codebase.addBuiltins builtins store' codebase
let eval = Codebase.interpreter builtins codebase
L.info logger "Codebase created"
loadDeclarations logger "unison-src/base.u" codebase
loadDeclarations logger "unison-src/extra.u" codebase
builtins <- Note.run $ Codebase.allTermsByVarName Term.ref codebase
let parse = Parsers.bindBuiltins builtins [] . Parsers.unsafeParseTerm
pure (codebase, parse, eval)
| 1,102
|
makeTestCodebase :: IO (TestCodebase, String -> Term V, Term V -> Noted IO (Term V))
makeTestCodebase = do
logger <- L.atomic (L.atInfo L.toStandardOut)
let crypto = C.noop "dummypublickey"
putStrLn "creating block store..."
blockStore <- MBS.make' (makeRandomAddress crypto) makeAddress
putStrLn "created block store, creating Codebase store..."
store' <- BSS.make blockStore
-- store' <- FS.make "blockstore.file"
putStrLn "created Codebase store..., building extra builtins"
extraBuiltins <- EB.make logger blockStore crypto
putStrLn "extra builtins created"
codebase <- pure $ Codebase.make hash store'
let builtins = Builtin.make logger ++ extraBuiltins
Codebase.addBuiltins builtins store' codebase
let eval = Codebase.interpreter builtins codebase
L.info logger "Codebase created"
loadDeclarations logger "unison-src/base.u" codebase
loadDeclarations logger "unison-src/extra.u" codebase
builtins <- Note.run $ Codebase.allTermsByVarName Term.ref codebase
let parse = Parsers.bindBuiltins builtins [] . Parsers.unsafeParseTerm
pure (codebase, parse, eval)
| 1,102
|
makeTestCodebase = do
logger <- L.atomic (L.atInfo L.toStandardOut)
let crypto = C.noop "dummypublickey"
putStrLn "creating block store..."
blockStore <- MBS.make' (makeRandomAddress crypto) makeAddress
putStrLn "created block store, creating Codebase store..."
store' <- BSS.make blockStore
-- store' <- FS.make "blockstore.file"
putStrLn "created Codebase store..., building extra builtins"
extraBuiltins <- EB.make logger blockStore crypto
putStrLn "extra builtins created"
codebase <- pure $ Codebase.make hash store'
let builtins = Builtin.make logger ++ extraBuiltins
Codebase.addBuiltins builtins store' codebase
let eval = Codebase.interpreter builtins codebase
L.info logger "Codebase created"
loadDeclarations logger "unison-src/base.u" codebase
loadDeclarations logger "unison-src/extra.u" codebase
builtins <- Note.run $ Codebase.allTermsByVarName Term.ref codebase
let parse = Parsers.bindBuiltins builtins [] . Parsers.unsafeParseTerm
pure (codebase, parse, eval)
| 1,017
| false
| true
| 2
| 13
| 165
| 315
| 139
| 176
| null | null |
onponomarev/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
nicModeRouted :: String
nicModeRouted = Types.nICModeToRaw NMRouted
| 67
|
nicModeRouted :: String
nicModeRouted = Types.nICModeToRaw NMRouted
| 67
|
nicModeRouted = Types.nICModeToRaw NMRouted
| 43
| false
| true
| 0
| 6
| 6
| 22
| 9
| 13
| null | null |
tidalcycles/Tidal
|
src/Sound/Tidal/ParseBP.hs
|
gpl-3.0
|
pRatioChar :: Fractional a => MyParser a
pRatioChar = pRatioSingleChar 'w' 1
<|> pRatioSingleChar 'h' 0.5
<|> pRatioSingleChar 'q' 0.25
<|> pRatioSingleChar 'e' 0.125
<|> pRatioSingleChar 's' 0.0625
<|> pRatioSingleChar 't' (1/3)
<|> pRatioSingleChar 'f' 0.2
<|> pRatioSingleChar 'x' (1/6)
| 380
|
pRatioChar :: Fractional a => MyParser a
pRatioChar = pRatioSingleChar 'w' 1
<|> pRatioSingleChar 'h' 0.5
<|> pRatioSingleChar 'q' 0.25
<|> pRatioSingleChar 'e' 0.125
<|> pRatioSingleChar 's' 0.0625
<|> pRatioSingleChar 't' (1/3)
<|> pRatioSingleChar 'f' 0.2
<|> pRatioSingleChar 'x' (1/6)
| 380
|
pRatioChar = pRatioSingleChar 'w' 1
<|> pRatioSingleChar 'h' 0.5
<|> pRatioSingleChar 'q' 0.25
<|> pRatioSingleChar 'e' 0.125
<|> pRatioSingleChar 's' 0.0625
<|> pRatioSingleChar 't' (1/3)
<|> pRatioSingleChar 'f' 0.2
<|> pRatioSingleChar 'x' (1/6)
| 339
| false
| true
| 21
| 7
| 130
| 129
| 63
| 66
| null | null |
ku-fpg/kansas-amber
|
System/Hardware/Haskino/ShallowDeepPlugin/MutRecurPass.hs
|
bsd-3-clause
|
mutRecurPass :: ModGuts -> CoreM ModGuts
mutRecurPass guts = do
bindsL' <- (\x -> fst <$> (runStateT (runBindM $ (mapM mutRecurBind) x) (BindEnv guts []))) (mg_binds guts)
return (guts { mg_binds = concat bindsL' })
| 223
|
mutRecurPass :: ModGuts -> CoreM ModGuts
mutRecurPass guts = do
bindsL' <- (\x -> fst <$> (runStateT (runBindM $ (mapM mutRecurBind) x) (BindEnv guts []))) (mg_binds guts)
return (guts { mg_binds = concat bindsL' })
| 223
|
mutRecurPass guts = do
bindsL' <- (\x -> fst <$> (runStateT (runBindM $ (mapM mutRecurBind) x) (BindEnv guts []))) (mg_binds guts)
return (guts { mg_binds = concat bindsL' })
| 182
| false
| true
| 0
| 18
| 42
| 103
| 51
| 52
| null | null |
kuc2477/naver-unse
|
src/Web/Naver/Fortune.hs
|
mit
|
-- | Host of naver fortune API endpoint
host :: String
host = "m.search.naver.com"
| 82
|
host :: String
host = "m.search.naver.com"
| 42
|
host = "m.search.naver.com"
| 27
| true
| true
| 0
| 6
| 13
| 19
| 8
| 11
| null | null |
beni55/haste-compiler
|
libraries/ghc-7.10/ghc-prim/GHC/Prim.hs
|
bsd-3-clause
|
-- | Write a vector to specified index of mutable array of scalars; offset is in scalar elements.
writeDoubleArrayAsDoubleX4# :: MutableByteArray# s -> Int# -> DoubleX4# -> State# s -> State# s
writeDoubleArrayAsDoubleX4# = let x = x in x
| 240
|
writeDoubleArrayAsDoubleX4# :: MutableByteArray# s -> Int# -> DoubleX4# -> State# s -> State# s
writeDoubleArrayAsDoubleX4# = let x = x in x
| 140
|
writeDoubleArrayAsDoubleX4# = let x = x in x
| 44
| true
| true
| 0
| 10
| 41
| 54
| 24
| 30
| null | null |
text-utf8/text
|
Data/Text/Array.hs
|
bsd-2-clause
|
empty :: Array
empty = runST (new 0 >>= unsafeFreeze)
| 53
|
empty :: Array
empty = runST (new 0 >>= unsafeFreeze)
| 53
|
empty = runST (new 0 >>= unsafeFreeze)
| 38
| false
| true
| 0
| 8
| 9
| 31
| 13
| 18
| null | null |
input-output-hk/cardano-sl
|
generator/test/Test/Pos/Block/Logic/CreationSpec.hs
|
apache-2.0
|
validSscPayloadGen :: Genesis.Config -> Gen (SscPayload, SlotId)
validSscPayloadGen genesisConfig = do
let pm = configProtocolMagic genesisConfig
protocolConstants = configProtocolConstants genesisConfig
k = pcBlkSecurityParam protocolConstants
epochSlots = kEpochSlots k
vssCerts <- makeSmall $ fmap mkVssCertificatesMapLossy $ listOf $
vssCertificateEpochGen pm protocolConstants 0
let mkSlot i = SlotId 0 (unsafeMkLocalSlotIndex epochSlots (fromIntegral i))
oneof [ do commMap <- makeSmall $ commitmentMapEpochGen pm 0
pure (CommitmentsPayload commMap vssCerts , SlotId 0 localSlotIndexMinBound)
, do openingsMap <- makeSmall arbitrary
pure (OpeningsPayload openingsMap vssCerts, mkSlot (4 * k + 1))
, do sharesMap <- makeSmall arbitrary
pure (SharesPayload sharesMap vssCerts, mkSlot (8 * k))
, pure (CertificatesPayload vssCerts, mkSlot (7 * k))
]
| 1,023
|
validSscPayloadGen :: Genesis.Config -> Gen (SscPayload, SlotId)
validSscPayloadGen genesisConfig = do
let pm = configProtocolMagic genesisConfig
protocolConstants = configProtocolConstants genesisConfig
k = pcBlkSecurityParam protocolConstants
epochSlots = kEpochSlots k
vssCerts <- makeSmall $ fmap mkVssCertificatesMapLossy $ listOf $
vssCertificateEpochGen pm protocolConstants 0
let mkSlot i = SlotId 0 (unsafeMkLocalSlotIndex epochSlots (fromIntegral i))
oneof [ do commMap <- makeSmall $ commitmentMapEpochGen pm 0
pure (CommitmentsPayload commMap vssCerts , SlotId 0 localSlotIndexMinBound)
, do openingsMap <- makeSmall arbitrary
pure (OpeningsPayload openingsMap vssCerts, mkSlot (4 * k + 1))
, do sharesMap <- makeSmall arbitrary
pure (SharesPayload sharesMap vssCerts, mkSlot (8 * k))
, pure (CertificatesPayload vssCerts, mkSlot (7 * k))
]
| 1,023
|
validSscPayloadGen genesisConfig = do
let pm = configProtocolMagic genesisConfig
protocolConstants = configProtocolConstants genesisConfig
k = pcBlkSecurityParam protocolConstants
epochSlots = kEpochSlots k
vssCerts <- makeSmall $ fmap mkVssCertificatesMapLossy $ listOf $
vssCertificateEpochGen pm protocolConstants 0
let mkSlot i = SlotId 0 (unsafeMkLocalSlotIndex epochSlots (fromIntegral i))
oneof [ do commMap <- makeSmall $ commitmentMapEpochGen pm 0
pure (CommitmentsPayload commMap vssCerts , SlotId 0 localSlotIndexMinBound)
, do openingsMap <- makeSmall arbitrary
pure (OpeningsPayload openingsMap vssCerts, mkSlot (4 * k + 1))
, do sharesMap <- makeSmall arbitrary
pure (SharesPayload sharesMap vssCerts, mkSlot (8 * k))
, pure (CertificatesPayload vssCerts, mkSlot (7 * k))
]
| 958
| false
| true
| 0
| 16
| 278
| 281
| 133
| 148
| null | null |
ntc2/optparse-applicative
|
Options/Applicative/Common.hs
|
bsd-3-clause
|
evalParser m d f (OptP opt)
| optVisibility opt > Internal
= Left $ Leaf (f (OptHelpInfo m d) opt)
| otherwise
= Left $ MultNode []
| 155
|
evalParser m d f (OptP opt)
| optVisibility opt > Internal
= Left $ Leaf (f (OptHelpInfo m d) opt)
| otherwise
= Left $ MultNode []
| 155
|
evalParser m d f (OptP opt)
| optVisibility opt > Internal
= Left $ Leaf (f (OptHelpInfo m d) opt)
| otherwise
= Left $ MultNode []
| 155
| false
| false
| 0
| 11
| 50
| 75
| 34
| 41
| null | null |
martomi/AI-Reversi
|
Reversi_AI.hs
|
mit
|
flipIt state (c:cs) = state // [(coord, changedColor) | coord <- (c:cs)]
where changedColor = oppPlayer (state ! c)
-----------------------------------------------
-- Game Tree functions
-----------------------------------------------
| 237
|
flipIt state (c:cs) = state // [(coord, changedColor) | coord <- (c:cs)]
where changedColor = oppPlayer (state ! c)
-----------------------------------------------
-- Game Tree functions
-----------------------------------------------
| 237
|
flipIt state (c:cs) = state // [(coord, changedColor) | coord <- (c:cs)]
where changedColor = oppPlayer (state ! c)
-----------------------------------------------
-- Game Tree functions
-----------------------------------------------
| 237
| false
| false
| 1
| 10
| 27
| 72
| 37
| 35
| null | null |
daniellandau/web2rss
|
src/Lib.hs
|
agpl-3.0
|
idForHash :: (MonadBaseControl IO m, MonadIO m) => Text -> MyMonadStack m (Key FeedInfo)
idForHash feedHash = do
feedEntityMaybe <- getFeedInfo feedHash
let feedIdMaybe = fmap (\(Entity key _) -> key) feedEntityMaybe
maybe
(throw $ T.pack "The given hash does not match any existing feed")
return feedIdMaybe
| 322
|
idForHash :: (MonadBaseControl IO m, MonadIO m) => Text -> MyMonadStack m (Key FeedInfo)
idForHash feedHash = do
feedEntityMaybe <- getFeedInfo feedHash
let feedIdMaybe = fmap (\(Entity key _) -> key) feedEntityMaybe
maybe
(throw $ T.pack "The given hash does not match any existing feed")
return feedIdMaybe
| 322
|
idForHash feedHash = do
feedEntityMaybe <- getFeedInfo feedHash
let feedIdMaybe = fmap (\(Entity key _) -> key) feedEntityMaybe
maybe
(throw $ T.pack "The given hash does not match any existing feed")
return feedIdMaybe
| 233
| false
| true
| 0
| 14
| 60
| 108
| 52
| 56
| null | null |
wxzh/fcore
|
lib/SymbolicEvaluator.hs
|
bsd-2-clause
|
lift :: Op -> [SymValue] -> SymValue
lift op vs =
case (v1, v2) of
(SInt i1, SInt i2) ->
case op of
ADD -> SInt (i1 + i2)
MUL -> SInt (i1 * i2)
DIV -> SInt (i1 `div` i2)
SUB -> SInt (i1 - i2)
EQ -> SBool (i1 == i2)
NEQ -> SBool (i1 /= i2)
GT -> SBool (i1 > i2)
LT -> SBool (i1 < i2)
GE -> SBool (i1 >= i2)
LE -> SBool (i1 <= i2)
(SBool b1, SBool b2) ->
case op of
EQ -> SBool (b1 == b2)
NEQ -> SBool (b1 /= b2)
AND -> SBool (b1 && b2)
OR -> SBool (b1 || b2)
_ -> SOp op v1 v2
where v1 = vs !! 0
v2 = vs !! 1
| 673
|
lift :: Op -> [SymValue] -> SymValue
lift op vs =
case (v1, v2) of
(SInt i1, SInt i2) ->
case op of
ADD -> SInt (i1 + i2)
MUL -> SInt (i1 * i2)
DIV -> SInt (i1 `div` i2)
SUB -> SInt (i1 - i2)
EQ -> SBool (i1 == i2)
NEQ -> SBool (i1 /= i2)
GT -> SBool (i1 > i2)
LT -> SBool (i1 < i2)
GE -> SBool (i1 >= i2)
LE -> SBool (i1 <= i2)
(SBool b1, SBool b2) ->
case op of
EQ -> SBool (b1 == b2)
NEQ -> SBool (b1 /= b2)
AND -> SBool (b1 && b2)
OR -> SBool (b1 || b2)
_ -> SOp op v1 v2
where v1 = vs !! 0
v2 = vs !! 1
| 673
|
lift op vs =
case (v1, v2) of
(SInt i1, SInt i2) ->
case op of
ADD -> SInt (i1 + i2)
MUL -> SInt (i1 * i2)
DIV -> SInt (i1 `div` i2)
SUB -> SInt (i1 - i2)
EQ -> SBool (i1 == i2)
NEQ -> SBool (i1 /= i2)
GT -> SBool (i1 > i2)
LT -> SBool (i1 < i2)
GE -> SBool (i1 >= i2)
LE -> SBool (i1 <= i2)
(SBool b1, SBool b2) ->
case op of
EQ -> SBool (b1 == b2)
NEQ -> SBool (b1 /= b2)
AND -> SBool (b1 && b2)
OR -> SBool (b1 || b2)
_ -> SOp op v1 v2
where v1 = vs !! 0
v2 = vs !! 1
| 636
| false
| true
| 6
| 13
| 297
| 355
| 174
| 181
| null | null |
cgorski/general-games
|
test/Spec.hs
|
mit
|
confirmDisjoint :: (Int, Bool)
confirmDisjoint =
let mfunc1 hand = [mkRoyalFlush hand,
mkStraightFlush hand,
mkFourOfAKind hand,
mkFullHouse hand,
mkFlush hand,
mkStraight hand,
mkThreeOfAKind hand,
mkTwoPair hand,
mkPair hand,
mkHighCard hand]
maybem (Just _) = 1
maybem Nothing = 0
countJust hand = sum $ map maybem $ mfunc1 hand
allSums = map countJust allPossibleHands
collect _ (outsum, False) = (outsum, False)
collect (x:xs) (outsum, _) =
collect xs (x+outsum, if x==0 || x==1 then True else False)
collect [] output = output
in
collect allSums (0, True)
| 810
|
confirmDisjoint :: (Int, Bool)
confirmDisjoint =
let mfunc1 hand = [mkRoyalFlush hand,
mkStraightFlush hand,
mkFourOfAKind hand,
mkFullHouse hand,
mkFlush hand,
mkStraight hand,
mkThreeOfAKind hand,
mkTwoPair hand,
mkPair hand,
mkHighCard hand]
maybem (Just _) = 1
maybem Nothing = 0
countJust hand = sum $ map maybem $ mfunc1 hand
allSums = map countJust allPossibleHands
collect _ (outsum, False) = (outsum, False)
collect (x:xs) (outsum, _) =
collect xs (x+outsum, if x==0 || x==1 then True else False)
collect [] output = output
in
collect allSums (0, True)
| 810
|
confirmDisjoint =
let mfunc1 hand = [mkRoyalFlush hand,
mkStraightFlush hand,
mkFourOfAKind hand,
mkFullHouse hand,
mkFlush hand,
mkStraight hand,
mkThreeOfAKind hand,
mkTwoPair hand,
mkPair hand,
mkHighCard hand]
maybem (Just _) = 1
maybem Nothing = 0
countJust hand = sum $ map maybem $ mfunc1 hand
allSums = map countJust allPossibleHands
collect _ (outsum, False) = (outsum, False)
collect (x:xs) (outsum, _) =
collect xs (x+outsum, if x==0 || x==1 then True else False)
collect [] output = output
in
collect allSums (0, True)
| 779
| false
| true
| 0
| 14
| 335
| 255
| 130
| 125
| null | null |
FranklinChen/hugs98-plus-Sep2006
|
packages/GLUT/examples/RedBook/Texture3D.hs
|
bsd-3-clause
|
withImage :: (PixelData (Color3 GLubyte) -> IO ()) -> IO ()
withImage act =
withArray [ Color3 (s * 17) (t * 17) (r * 17) |
r <- [ 0 .. fromIntegral d - 1 ],
t <- [ 0 .. fromIntegral h - 1 ],
s <- [ 0 .. fromIntegral w - 1 ] ] $
act . PixelData RGB UnsignedByte
where (TextureSize3D w h d) = imageSize
| 355
|
withImage :: (PixelData (Color3 GLubyte) -> IO ()) -> IO ()
withImage act =
withArray [ Color3 (s * 17) (t * 17) (r * 17) |
r <- [ 0 .. fromIntegral d - 1 ],
t <- [ 0 .. fromIntegral h - 1 ],
s <- [ 0 .. fromIntegral w - 1 ] ] $
act . PixelData RGB UnsignedByte
where (TextureSize3D w h d) = imageSize
| 355
|
withImage act =
withArray [ Color3 (s * 17) (t * 17) (r * 17) |
r <- [ 0 .. fromIntegral d - 1 ],
t <- [ 0 .. fromIntegral h - 1 ],
s <- [ 0 .. fromIntegral w - 1 ] ] $
act . PixelData RGB UnsignedByte
where (TextureSize3D w h d) = imageSize
| 295
| false
| true
| 0
| 13
| 124
| 172
| 87
| 85
| null | null |
TOSPIO/yi
|
src/library/Yi/Keymap/Vim/VisualMap.hs
|
gpl-2.0
|
tagJumpBinding :: VimBinding
tagJumpBinding = VimBindingY (f . T.unpack . _unEv)
where f "<C-]>" (VimState { vsMode = (Visual _) })
= WholeMatch $ do
tag <- Tag . R.toText <$> withCurrentBuffer
(regionOfSelectionB >>= readRegionB)
withEditor $ switchModeE Normal
gotoTag tag 0 Nothing
return Finish
f _ _ = NoMatch
| 437
|
tagJumpBinding :: VimBinding
tagJumpBinding = VimBindingY (f . T.unpack . _unEv)
where f "<C-]>" (VimState { vsMode = (Visual _) })
= WholeMatch $ do
tag <- Tag . R.toText <$> withCurrentBuffer
(regionOfSelectionB >>= readRegionB)
withEditor $ switchModeE Normal
gotoTag tag 0 Nothing
return Finish
f _ _ = NoMatch
| 437
|
tagJumpBinding = VimBindingY (f . T.unpack . _unEv)
where f "<C-]>" (VimState { vsMode = (Visual _) })
= WholeMatch $ do
tag <- Tag . R.toText <$> withCurrentBuffer
(regionOfSelectionB >>= readRegionB)
withEditor $ switchModeE Normal
gotoTag tag 0 Nothing
return Finish
f _ _ = NoMatch
| 408
| false
| true
| 2
| 12
| 172
| 129
| 60
| 69
| null | null |
d0kt0r0/estuary
|
client/src/Estuary/Help/MiniTidal.hs
|
gpl-3.0
|
referenceText "rand" = "is an oscillator that generates a pattern of (pseudo-)random, floating point numbers between 0 and 1."
| 126
|
referenceText "rand" = "is an oscillator that generates a pattern of (pseudo-)random, floating point numbers between 0 and 1."
| 126
|
referenceText "rand" = "is an oscillator that generates a pattern of (pseudo-)random, floating point numbers between 0 and 1."
| 126
| false
| false
| 0
| 5
| 18
| 9
| 4
| 5
| null | null |
kim/amazonka
|
amazonka-elb/gen/Network/AWS/ELB/DeregisterInstancesFromLoadBalancer.hs
|
mpl-2.0
|
deregisterInstancesFromLoadBalancerResponse :: DeregisterInstancesFromLoadBalancerResponse
deregisterInstancesFromLoadBalancerResponse = DeregisterInstancesFromLoadBalancerResponse
{ _diflbrInstances = mempty
}
| 218
|
deregisterInstancesFromLoadBalancerResponse :: DeregisterInstancesFromLoadBalancerResponse
deregisterInstancesFromLoadBalancerResponse = DeregisterInstancesFromLoadBalancerResponse
{ _diflbrInstances = mempty
}
| 218
|
deregisterInstancesFromLoadBalancerResponse = DeregisterInstancesFromLoadBalancerResponse
{ _diflbrInstances = mempty
}
| 127
| false
| true
| 0
| 7
| 18
| 23
| 12
| 11
| null | null |
GaloisInc/halvm-ghc
|
compiler/hsSyn/HsUtils.hs
|
bsd-3-clause
|
nlHsApps :: id -> [LHsExpr id] -> LHsExpr id
nlHsApps f xs = foldl nlHsApp (nlHsVar f) xs
| 89
|
nlHsApps :: id -> [LHsExpr id] -> LHsExpr id
nlHsApps f xs = foldl nlHsApp (nlHsVar f) xs
| 89
|
nlHsApps f xs = foldl nlHsApp (nlHsVar f) xs
| 44
| false
| true
| 0
| 9
| 17
| 51
| 23
| 28
| null | null |
blancas/trex
|
src/Transform.hs
|
mit
|
zero :: Word8
zero = fromIntegral (ord '0')
| 43
|
zero :: Word8
zero = fromIntegral (ord '0')
| 43
|
zero = fromIntegral (ord '0')
| 29
| false
| true
| 0
| 7
| 7
| 27
| 11
| 16
| null | null |
izgzhen/hadrian
|
src/Settings/Builders/GhcCabal.hs
|
mit
|
withBuilderKey :: Builder -> String
withBuilderKey b = case b of
Ar _ -> "--with-ar="
Ld -> "--with-ld="
Cc _ _ -> "--with-gcc="
Ghc _ _ -> "--with-ghc="
Alex -> "--with-alex="
Happy -> "--with-happy="
GhcPkg _ _ -> "--with-ghc-pkg="
HsColour -> "--with-hscolour="
_ -> error $ "withBuilderKey: not supported builder " ++ show b
-- Expression 'with Alex' appends "--with-alex=/path/to/alex" and needs Alex.
| 486
|
withBuilderKey :: Builder -> String
withBuilderKey b = case b of
Ar _ -> "--with-ar="
Ld -> "--with-ld="
Cc _ _ -> "--with-gcc="
Ghc _ _ -> "--with-ghc="
Alex -> "--with-alex="
Happy -> "--with-happy="
GhcPkg _ _ -> "--with-ghc-pkg="
HsColour -> "--with-hscolour="
_ -> error $ "withBuilderKey: not supported builder " ++ show b
-- Expression 'with Alex' appends "--with-alex=/path/to/alex" and needs Alex.
| 486
|
withBuilderKey b = case b of
Ar _ -> "--with-ar="
Ld -> "--with-ld="
Cc _ _ -> "--with-gcc="
Ghc _ _ -> "--with-ghc="
Alex -> "--with-alex="
Happy -> "--with-happy="
GhcPkg _ _ -> "--with-ghc-pkg="
HsColour -> "--with-hscolour="
_ -> error $ "withBuilderKey: not supported builder " ++ show b
-- Expression 'with Alex' appends "--with-alex=/path/to/alex" and needs Alex.
| 450
| false
| true
| 0
| 9
| 142
| 106
| 51
| 55
| null | null |
ezyang/ghc
|
compiler/coreSyn/CoreUtils.hs
|
bsd-3-clause
|
exprType (Coercion co) = coercionType co
| 46
|
exprType (Coercion co) = coercionType co
| 46
|
exprType (Coercion co) = coercionType co
| 46
| false
| false
| 0
| 6
| 11
| 19
| 8
| 11
| null | null |
deyaaeldeen/GTLC
|
src/GTLC/Eval.hs
|
gpl-3.0
|
interp (IIf e1 e2 e3) = interp e1 >>= \(VB v) -> if v then interp e2 else interp e3
| 83
|
interp (IIf e1 e2 e3) = interp e1 >>= \(VB v) -> if v then interp e2 else interp e3
| 83
|
interp (IIf e1 e2 e3) = interp e1 >>= \(VB v) -> if v then interp e2 else interp e3
| 83
| false
| false
| 0
| 8
| 19
| 51
| 25
| 26
| null | null |
typelead/epm
|
Cabal/Distribution/PackageDescription/Check.hs
|
bsd-3-clause
|
checkTarPath :: FilePath -> Maybe PackageCheck
checkTarPath path
| length path > 255 = Just longPath
| otherwise = case pack nameMax (reverse (splitPath path)) of
Left err -> Just err
Right [] -> Nothing
Right (first:rest) -> case pack prefixMax remainder of
Left err -> Just err
Right [] -> Nothing
Right (_:_) -> Just noSplit
where
-- drop the '/' between the name and prefix:
remainder = init first : rest
where
nameMax, prefixMax :: Int
nameMax = 100
prefixMax = 155
pack _ [] = Left emptyName
pack maxLen (c:cs)
| n > maxLen = Left longName
| otherwise = Right (pack' maxLen n cs)
where n = length c
pack' maxLen n (c:cs)
| n' <= maxLen = pack' maxLen n' cs
where n' = n + length c
pack' _ _ cs = cs
longPath = PackageDistInexcusable $
"The following file name is too long to store in a portable POSIX "
++ "format tar archive. The maximum length is 255 ASCII characters.\n"
++ "The file in question is:\n " ++ path
longName = PackageDistInexcusable $
"The following file name is too long to store in a portable POSIX "
++ "format tar archive. The maximum length for the name part (including "
++ "extension) is 100 ASCII characters. The maximum length for any "
++ "individual directory component is 155.\n"
++ "The file in question is:\n " ++ path
noSplit = PackageDistInexcusable $
"The following file name is too long to store in a portable POSIX "
++ "format tar archive. While the total length is less than 255 ASCII "
++ "characters, there are unfortunately further restrictions. It has to "
++ "be possible to split the file path on a directory separator into "
++ "two parts such that the first part fits in 155 characters or less "
++ "and the second part fits in 100 characters or less. Basically you "
++ "have to make the file name or directory names shorter, or you could "
++ "split a long directory name into nested subdirectories with shorter "
++ "names.\nThe file in question is:\n " ++ path
emptyName = PackageDistInexcusable $
"Encountered a file with an empty name, something is very wrong! "
++ "Files with an empty name cannot be stored in a tar archive or in "
++ "standard file systems."
-- ------------------------------------------------------------
-- * Utils
-- ------------------------------------------------------------
| 2,586
|
checkTarPath :: FilePath -> Maybe PackageCheck
checkTarPath path
| length path > 255 = Just longPath
| otherwise = case pack nameMax (reverse (splitPath path)) of
Left err -> Just err
Right [] -> Nothing
Right (first:rest) -> case pack prefixMax remainder of
Left err -> Just err
Right [] -> Nothing
Right (_:_) -> Just noSplit
where
-- drop the '/' between the name and prefix:
remainder = init first : rest
where
nameMax, prefixMax :: Int
nameMax = 100
prefixMax = 155
pack _ [] = Left emptyName
pack maxLen (c:cs)
| n > maxLen = Left longName
| otherwise = Right (pack' maxLen n cs)
where n = length c
pack' maxLen n (c:cs)
| n' <= maxLen = pack' maxLen n' cs
where n' = n + length c
pack' _ _ cs = cs
longPath = PackageDistInexcusable $
"The following file name is too long to store in a portable POSIX "
++ "format tar archive. The maximum length is 255 ASCII characters.\n"
++ "The file in question is:\n " ++ path
longName = PackageDistInexcusable $
"The following file name is too long to store in a portable POSIX "
++ "format tar archive. The maximum length for the name part (including "
++ "extension) is 100 ASCII characters. The maximum length for any "
++ "individual directory component is 155.\n"
++ "The file in question is:\n " ++ path
noSplit = PackageDistInexcusable $
"The following file name is too long to store in a portable POSIX "
++ "format tar archive. While the total length is less than 255 ASCII "
++ "characters, there are unfortunately further restrictions. It has to "
++ "be possible to split the file path on a directory separator into "
++ "two parts such that the first part fits in 155 characters or less "
++ "and the second part fits in 100 characters or less. Basically you "
++ "have to make the file name or directory names shorter, or you could "
++ "split a long directory name into nested subdirectories with shorter "
++ "names.\nThe file in question is:\n " ++ path
emptyName = PackageDistInexcusable $
"Encountered a file with an empty name, something is very wrong! "
++ "Files with an empty name cannot be stored in a tar archive or in "
++ "standard file systems."
-- ------------------------------------------------------------
-- * Utils
-- ------------------------------------------------------------
| 2,586
|
checkTarPath path
| length path > 255 = Just longPath
| otherwise = case pack nameMax (reverse (splitPath path)) of
Left err -> Just err
Right [] -> Nothing
Right (first:rest) -> case pack prefixMax remainder of
Left err -> Just err
Right [] -> Nothing
Right (_:_) -> Just noSplit
where
-- drop the '/' between the name and prefix:
remainder = init first : rest
where
nameMax, prefixMax :: Int
nameMax = 100
prefixMax = 155
pack _ [] = Left emptyName
pack maxLen (c:cs)
| n > maxLen = Left longName
| otherwise = Right (pack' maxLen n cs)
where n = length c
pack' maxLen n (c:cs)
| n' <= maxLen = pack' maxLen n' cs
where n' = n + length c
pack' _ _ cs = cs
longPath = PackageDistInexcusable $
"The following file name is too long to store in a portable POSIX "
++ "format tar archive. The maximum length is 255 ASCII characters.\n"
++ "The file in question is:\n " ++ path
longName = PackageDistInexcusable $
"The following file name is too long to store in a portable POSIX "
++ "format tar archive. The maximum length for the name part (including "
++ "extension) is 100 ASCII characters. The maximum length for any "
++ "individual directory component is 155.\n"
++ "The file in question is:\n " ++ path
noSplit = PackageDistInexcusable $
"The following file name is too long to store in a portable POSIX "
++ "format tar archive. While the total length is less than 255 ASCII "
++ "characters, there are unfortunately further restrictions. It has to "
++ "be possible to split the file path on a directory separator into "
++ "two parts such that the first part fits in 155 characters or less "
++ "and the second part fits in 100 characters or less. Basically you "
++ "have to make the file name or directory names shorter, or you could "
++ "split a long directory name into nested subdirectories with shorter "
++ "names.\nThe file in question is:\n " ++ path
emptyName = PackageDistInexcusable $
"Encountered a file with an empty name, something is very wrong! "
++ "Files with an empty name cannot be stored in a tar archive or in "
++ "standard file systems."
-- ------------------------------------------------------------
-- * Utils
-- ------------------------------------------------------------
| 2,539
| false
| true
| 1
| 14
| 728
| 446
| 218
| 228
| null | null |
talvdav/dotfiles
|
xmonad/xmonad.hs
|
mit
|
colorLambdaDarkGrey = "#171717"
| 39
|
colorLambdaDarkGrey = "#171717"
| 39
|
colorLambdaDarkGrey = "#171717"
| 39
| false
| false
| 0
| 4
| 10
| 6
| 3
| 3
| null | null |
free2tedy/PP
|
Tema2PP/Parser.hs
|
mit
|
{-|
The alternative between two parsers.
The parsing succeeds if any of the two parsers is able to parse.
It simply concatenates the lists of parses obtained by the two parsers.
By employing the infix notation, @\`alt\`@, any number of parsers can be
legibly chained.
Examples:
>>> ((token 'a') `alt` (token 'b') `alt` (spot isDigit)) "abc"
[('a', "bc")]
>>> ((token 'a') `alt` (token 'b') `alt` (spot isDigit)) "123"
[('1', "23")]
-}
alt :: Parser a b -> Parser a b -> Parser a b
alt parser1 parser2 input = parser1 input ++ parser2 input
| 563
|
alt :: Parser a b -> Parser a b -> Parser a b
alt parser1 parser2 input = parser1 input ++ parser2 input
| 104
|
alt parser1 parser2 input = parser1 input ++ parser2 input
| 58
| true
| true
| 0
| 8
| 117
| 56
| 25
| 31
| null | null |
brendanhay/gogol
|
gogol-compute/gen/Network/Google/Resource/Compute/RegionURLMaps/Update.hs
|
mpl-2.0
|
-- | Creates a value of 'RegionURLMapsUpdate' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rumuRequestId'
--
-- * 'rumuURLMap'
--
-- * 'rumuProject'
--
-- * 'rumuPayload'
--
-- * 'rumuRegion'
regionURLMapsUpdate
:: Text -- ^ 'rumuURLMap'
-> Text -- ^ 'rumuProject'
-> URLMap -- ^ 'rumuPayload'
-> Text -- ^ 'rumuRegion'
-> RegionURLMapsUpdate
regionURLMapsUpdate pRumuURLMap_ pRumuProject_ pRumuPayload_ pRumuRegion_ =
RegionURLMapsUpdate'
{ _rumuRequestId = Nothing
, _rumuURLMap = pRumuURLMap_
, _rumuProject = pRumuProject_
, _rumuPayload = pRumuPayload_
, _rumuRegion = pRumuRegion_
}
| 723
|
regionURLMapsUpdate
:: Text -- ^ 'rumuURLMap'
-> Text -- ^ 'rumuProject'
-> URLMap -- ^ 'rumuPayload'
-> Text -- ^ 'rumuRegion'
-> RegionURLMapsUpdate
regionURLMapsUpdate pRumuURLMap_ pRumuProject_ pRumuPayload_ pRumuRegion_ =
RegionURLMapsUpdate'
{ _rumuRequestId = Nothing
, _rumuURLMap = pRumuURLMap_
, _rumuProject = pRumuProject_
, _rumuPayload = pRumuPayload_
, _rumuRegion = pRumuRegion_
}
| 442
|
regionURLMapsUpdate pRumuURLMap_ pRumuProject_ pRumuPayload_ pRumuRegion_ =
RegionURLMapsUpdate'
{ _rumuRequestId = Nothing
, _rumuURLMap = pRumuURLMap_
, _rumuProject = pRumuProject_
, _rumuPayload = pRumuPayload_
, _rumuRegion = pRumuRegion_
}
| 271
| true
| true
| 0
| 10
| 146
| 94
| 58
| 36
| null | null |
Kotolegokot/Underlisp
|
src/Interpreter.hs
|
gpl-3.0
|
loadEnv False = newIORef $ newGlobal' startEnv []
| 49
|
loadEnv False = newIORef $ newGlobal' startEnv []
| 49
|
loadEnv False = newIORef $ newGlobal' startEnv []
| 49
| false
| false
| 0
| 7
| 7
| 20
| 9
| 11
| null | null |
ababkin/railoscopy
|
src/Haste/Perch.hs
|
mit
|
ctag tag cont= nelem tag `child` cont
| 37
|
ctag tag cont= nelem tag `child` cont
| 37
|
ctag tag cont= nelem tag `child` cont
| 37
| false
| false
| 0
| 6
| 6
| 20
| 10
| 10
| null | null |
kazu-yamamoto/word8
|
Data/Word8.hs
|
bsd-3-clause
|
_circum = 0x5e
| 20
|
_circum = 0x5e
| 20
|
_circum = 0x5e
| 20
| false
| false
| 1
| 5
| 8
| 10
| 3
| 7
| null | null |
snoyberg/ghc
|
libraries/base/GHC/Show.hs
|
bsd-3-clause
|
-- Code specific for Ints.
-- | Convert an 'Int' in the range @0@..@15@ to the corresponding single
-- digit 'Char'. This function fails on other inputs, and generates
-- lower-case hexadecimal digits.
intToDigit :: Int -> Char
intToDigit (I# i)
| isTrue# (i >=# 0#) && isTrue# (i <=# 9#) = unsafeChr (ord '0' + I# i)
| isTrue# (i >=# 10#) && isTrue# (i <=# 15#) = unsafeChr (ord 'a' + I# i - 10)
| otherwise = errorWithoutStackTrace ("Char.intToDigit: not a digit " ++ show (I# i))
| 499
|
intToDigit :: Int -> Char
intToDigit (I# i)
| isTrue# (i >=# 0#) && isTrue# (i <=# 9#) = unsafeChr (ord '0' + I# i)
| isTrue# (i >=# 10#) && isTrue# (i <=# 15#) = unsafeChr (ord 'a' + I# i - 10)
| otherwise = errorWithoutStackTrace ("Char.intToDigit: not a digit " ++ show (I# i))
| 295
|
intToDigit (I# i)
| isTrue# (i >=# 0#) && isTrue# (i <=# 9#) = unsafeChr (ord '0' + I# i)
| isTrue# (i >=# 10#) && isTrue# (i <=# 15#) = unsafeChr (ord 'a' + I# i - 10)
| otherwise = errorWithoutStackTrace ("Char.intToDigit: not a digit " ++ show (I# i))
| 269
| true
| true
| 0
| 11
| 106
| 164
| 78
| 86
| null | null |
onponomarev/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
-- Set of daemons which only run on the master.
-- Keep in sync with the 'daemon-util' script.
daemonsMaster :: FrozenSet String
daemonsMaster = ConstantUtils.mkSet [wconfd, luxid, rapi]
| 186
|
daemonsMaster :: FrozenSet String
daemonsMaster = ConstantUtils.mkSet [wconfd, luxid, rapi]
| 91
|
daemonsMaster = ConstantUtils.mkSet [wconfd, luxid, rapi]
| 57
| true
| true
| 0
| 6
| 27
| 35
| 18
| 17
| null | null |
agentm/project-m36
|
src/lib/ProjectM36/AtomFunction.hs
|
unlicense
|
hashBytes :: AtomFunction -> BL.ByteString
hashBytes func = BL.fromChunks [serialise (funcName func),
serialise (funcType func),
bodyBin
]
where
bodyBin = case funcBody func of
FunctionScriptBody mScript _ -> serialise mScript
FunctionBuiltInBody _ -> ""
FunctionObjectLoadedBody f m n _ -> serialise (f,m,n)
-- | Used to mark functions which are loaded externally from the server.
| 539
|
hashBytes :: AtomFunction -> BL.ByteString
hashBytes func = BL.fromChunks [serialise (funcName func),
serialise (funcType func),
bodyBin
]
where
bodyBin = case funcBody func of
FunctionScriptBody mScript _ -> serialise mScript
FunctionBuiltInBody _ -> ""
FunctionObjectLoadedBody f m n _ -> serialise (f,m,n)
-- | Used to mark functions which are loaded externally from the server.
| 539
|
hashBytes func = BL.fromChunks [serialise (funcName func),
serialise (funcType func),
bodyBin
]
where
bodyBin = case funcBody func of
FunctionScriptBody mScript _ -> serialise mScript
FunctionBuiltInBody _ -> ""
FunctionObjectLoadedBody f m n _ -> serialise (f,m,n)
-- | Used to mark functions which are loaded externally from the server.
| 496
| false
| true
| 0
| 9
| 212
| 118
| 58
| 60
| null | null |
apyrgio/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
hvCpuType :: String
hvCpuType = "cpu_type"
| 42
|
hvCpuType :: String
hvCpuType = "cpu_type"
| 42
|
hvCpuType = "cpu_type"
| 22
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
ideas-edu/ideas
|
src/Ideas/Text/HTML.hs
|
apache-2.0
|
br :: BuildXML a => a
br = emptyTag "br"
| 41
|
br :: BuildXML a => a
br = emptyTag "br"
| 40
|
br = emptyTag "br"
| 18
| false
| true
| 0
| 7
| 10
| 27
| 11
| 16
| null | null |
jcaldwell/monadserv
|
src/MonadServ/Types.hs
|
bsd-2-clause
|
templateBackend :: a -> ServerBackend a
templateBackend bst = SrvBackend
{ initBackend = return bst
, shutdownBackend = \_ -> do putStrLn "ya'll come back now..."
return ()
, outputString = \_ h -> basicOutput h
, flushOutput = \_ -> do putStrLn "flush"
return ()
, getSingleChar = \_ _ -> return Nothing
, getInput = \_ _ -> return Nothing
, addHistory = \_ _ -> return ()
-- , setWordBreakChars = \_ _ -> return ()
-- , getWordBreakChars = \_ -> return defaultWordBreakChars
, onCancel = \_ -> return ()
-- , setAttemptedCompletionFunction = \_ _ -> return ()
, setDefaultCompletionFunction = \_ _ -> return ()
, completeFilename = \_ _ -> return []
, completeUsername = \_ _ -> return []
, clearHistoryState = \_ -> return ()
, setMaxHistoryEntries = \_ _ -> return ()
, getMaxHistoryEntries = \_ -> return 0
-- , readHistory = \_ _ -> return ()
-- , writeHistory = \_ _ -> return ()
}
| 1,359
|
templateBackend :: a -> ServerBackend a
templateBackend bst = SrvBackend
{ initBackend = return bst
, shutdownBackend = \_ -> do putStrLn "ya'll come back now..."
return ()
, outputString = \_ h -> basicOutput h
, flushOutput = \_ -> do putStrLn "flush"
return ()
, getSingleChar = \_ _ -> return Nothing
, getInput = \_ _ -> return Nothing
, addHistory = \_ _ -> return ()
-- , setWordBreakChars = \_ _ -> return ()
-- , getWordBreakChars = \_ -> return defaultWordBreakChars
, onCancel = \_ -> return ()
-- , setAttemptedCompletionFunction = \_ _ -> return ()
, setDefaultCompletionFunction = \_ _ -> return ()
, completeFilename = \_ _ -> return []
, completeUsername = \_ _ -> return []
, clearHistoryState = \_ -> return ()
, setMaxHistoryEntries = \_ _ -> return ()
, getMaxHistoryEntries = \_ -> return 0
-- , readHistory = \_ _ -> return ()
-- , writeHistory = \_ _ -> return ()
}
| 1,359
|
templateBackend bst = SrvBackend
{ initBackend = return bst
, shutdownBackend = \_ -> do putStrLn "ya'll come back now..."
return ()
, outputString = \_ h -> basicOutput h
, flushOutput = \_ -> do putStrLn "flush"
return ()
, getSingleChar = \_ _ -> return Nothing
, getInput = \_ _ -> return Nothing
, addHistory = \_ _ -> return ()
-- , setWordBreakChars = \_ _ -> return ()
-- , getWordBreakChars = \_ -> return defaultWordBreakChars
, onCancel = \_ -> return ()
-- , setAttemptedCompletionFunction = \_ _ -> return ()
, setDefaultCompletionFunction = \_ _ -> return ()
, completeFilename = \_ _ -> return []
, completeUsername = \_ _ -> return []
, clearHistoryState = \_ -> return ()
, setMaxHistoryEntries = \_ _ -> return ()
, getMaxHistoryEntries = \_ -> return 0
-- , readHistory = \_ _ -> return ()
-- , writeHistory = \_ _ -> return ()
}
| 1,319
| false
| true
| 0
| 12
| 638
| 275
| 149
| 126
| null | null |
mcmaniac/ghc
|
compiler/codeGen/CgUtils.hs
|
bsd-3-clause
|
CmmStore loc e `mustFollow` stmt = anySrc (locUsedIn loc (cmmExprType e)) stmt
| 80
|
CmmStore loc e `mustFollow` stmt = anySrc (locUsedIn loc (cmmExprType e)) stmt
| 80
|
CmmStore loc e `mustFollow` stmt = anySrc (locUsedIn loc (cmmExprType e)) stmt
| 80
| false
| false
| 0
| 9
| 13
| 42
| 19
| 23
| null | null |
awpr/xensynth
|
System.hs
|
mit
|
oddHarmonics :: Tone
oddHarmonics p = [(p, 0.5), (2*p, 0.05), (3*p, 0.2), (4*p, 0.04), (5*p, 0.1), (7*p, 0.05)]
| 111
|
oddHarmonics :: Tone
oddHarmonics p = [(p, 0.5), (2*p, 0.05), (3*p, 0.2), (4*p, 0.04), (5*p, 0.1), (7*p, 0.05)]
| 111
|
oddHarmonics p = [(p, 0.5), (2*p, 0.05), (3*p, 0.2), (4*p, 0.04), (5*p, 0.1), (7*p, 0.05)]
| 90
| false
| true
| 0
| 7
| 17
| 88
| 53
| 35
| null | null |
rbonifacio/hephaestus-pl
|
src/meta-hephaestus/HplAssets/Hephaestus.hs
|
lgpl-3.0
|
--
-- Set product name explicitly.
--
bindProductName :: String -> HsModule -> HsModule
bindProductName n = setModuleName ("HplProducts." ++ n)
| 143
|
bindProductName :: String -> HsModule -> HsModule
bindProductName n = setModuleName ("HplProducts." ++ n)
| 105
|
bindProductName n = setModuleName ("HplProducts." ++ n)
| 55
| true
| true
| 0
| 8
| 20
| 40
| 20
| 20
| null | null |
andyarvanitis/Idris-dev
|
src/IRTS/Simplified.hs
|
bsd-3-clause
|
simplify tl (DLet n v e) = do v' <- simplify False v
e' <- simplify tl e
return (SLet (Glob n) v' e')
| 161
|
simplify tl (DLet n v e) = do v' <- simplify False v
e' <- simplify tl e
return (SLet (Glob n) v' e')
| 161
|
simplify tl (DLet n v e) = do v' <- simplify False v
e' <- simplify tl e
return (SLet (Glob n) v' e')
| 161
| false
| false
| 0
| 11
| 83
| 67
| 30
| 37
| null | null |
thoughtpolice/binary-serialise-cbor
|
Data/Binary/Serialise/CBOR/Read.hs
|
bsd-3-clause
|
go_fast da@Fail{} !bs = go_fast_end da bs
| 41
|
go_fast da@Fail{} !bs = go_fast_end da bs
| 41
|
go_fast da@Fail{} !bs = go_fast_end da bs
| 41
| false
| false
| 2
| 6
| 6
| 27
| 12
| 15
| null | null |
tadeuzagallo/verve-lang
|
src/Typing/Types.hs
|
mit
|
fv (Rec fields) =
foldl union [] $ map (fv . snd) fields
| 58
|
fv (Rec fields) =
foldl union [] $ map (fv . snd) fields
| 58
|
fv (Rec fields) =
foldl union [] $ map (fv . snd) fields
| 58
| false
| false
| 0
| 8
| 14
| 38
| 18
| 20
| null | null |
unchartedworks/universalbuild
|
app/Main.hs
|
mit
|
parseSettingValue settings = (strip' . tail . snd) $ breakKeyValuePair $ head settings
| 86
|
parseSettingValue settings = (strip' . tail . snd) $ breakKeyValuePair $ head settings
| 86
|
parseSettingValue settings = (strip' . tail . snd) $ breakKeyValuePair $ head settings
| 86
| false
| false
| 0
| 9
| 12
| 31
| 15
| 16
| null | null |
josefs/hl
|
src/HL/Development.hs
|
bsd-3-clause
|
development = True
| 18
|
development = True
| 18
|
development = True
| 18
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
markus-git/imperative-edsl-vhdl
|
src/Language/Embedded/Hardware/Command/Frontend.hs
|
bsd-3-clause
|
unsafeFreezeVArray :: (VArrayCMD :<: instr, pred a)
=> VArray a -> ProgramT instr (Param2 exp pred) m (IArray a)
unsafeFreezeVArray = singleInj . UnsafeFreezeVArray
| 166
|
unsafeFreezeVArray :: (VArrayCMD :<: instr, pred a)
=> VArray a -> ProgramT instr (Param2 exp pred) m (IArray a)
unsafeFreezeVArray = singleInj . UnsafeFreezeVArray
| 166
|
unsafeFreezeVArray = singleInj . UnsafeFreezeVArray
| 51
| false
| true
| 1
| 10
| 25
| 69
| 32
| 37
| null | null |
ducis/haAni
|
hs/common/Graphics/UI/GLUT/GameMode.hs
|
gpl-2.0
|
simpleCapStr :: [Int] -> [Int] -> [Int] -> [Int] -> String
simpleCapStr ws hs bs rs =
showCap "" ws ++ showCap "x" hs ++ showCap ":" bs ++ showCap "@" rs
where showCap _ [] = ""
showCap prefix (x:_) = prefix ++ show x
| 240
|
simpleCapStr :: [Int] -> [Int] -> [Int] -> [Int] -> String
simpleCapStr ws hs bs rs =
showCap "" ws ++ showCap "x" hs ++ showCap ":" bs ++ showCap "@" rs
where showCap _ [] = ""
showCap prefix (x:_) = prefix ++ show x
| 240
|
simpleCapStr ws hs bs rs =
showCap "" ws ++ showCap "x" hs ++ showCap ":" bs ++ showCap "@" rs
where showCap _ [] = ""
showCap prefix (x:_) = prefix ++ show x
| 181
| false
| true
| 1
| 9
| 68
| 119
| 59
| 60
| null | null |
ganeti-github-testing/ganeti-test-1
|
src/Ganeti/WConfd/Core.hs
|
bsd-2-clause
|
-- | Free all locks of a given owner (i.e., a job-id lockfile pair).
freeLocks :: ClientId -> WConfdMonad ()
freeLocks cid =
modifyLockWaiting_ $ LW.releaseResources cid
| 171
|
freeLocks :: ClientId -> WConfdMonad ()
freeLocks cid =
modifyLockWaiting_ $ LW.releaseResources cid
| 102
|
freeLocks cid =
modifyLockWaiting_ $ LW.releaseResources cid
| 62
| true
| true
| 0
| 7
| 28
| 33
| 16
| 17
| null | null |
snoyberg/ghc
|
compiler/typecheck/TcType.hs
|
bsd-3-clause
|
tcEqTypeNoKindCheck :: TcType -> TcType -> Bool
tcEqTypeNoKindCheck ty1 ty2
= isNothing $ tc_eq_type coreView ty1 ty2
| 119
|
tcEqTypeNoKindCheck :: TcType -> TcType -> Bool
tcEqTypeNoKindCheck ty1 ty2
= isNothing $ tc_eq_type coreView ty1 ty2
| 119
|
tcEqTypeNoKindCheck ty1 ty2
= isNothing $ tc_eq_type coreView ty1 ty2
| 71
| false
| true
| 2
| 8
| 18
| 41
| 18
| 23
| null | null |
jaanos/TPJ-2015-16
|
lmh/examples_lmh.hs
|
mit
|
ons n l m = if m == 1 then n else l(m - 1)
| 43
|
cons n l m = if m == 1 then n else l(m - 1)
| 43
|
cons n l m = if m == 1 then n else l(m - 1)
| 43
| false
| false
| 0
| 8
| 15
| 36
| 18
| 18
| null | null |
vipo/TicTacToe
|
app/TicTacToe.hs
|
bsd-3-clause
|
variateMoves _ ms es =
let
pivot = 4
moves = addExtra ms es
beg = take pivot moves
end = drop pivot moves
in beg ++ map (\m -> m {moveValue = O}) end
| 171
|
variateMoves _ ms es =
let
pivot = 4
moves = addExtra ms es
beg = take pivot moves
end = drop pivot moves
in beg ++ map (\m -> m {moveValue = O}) end
| 171
|
variateMoves _ ms es =
let
pivot = 4
moves = addExtra ms es
beg = take pivot moves
end = drop pivot moves
in beg ++ map (\m -> m {moveValue = O}) end
| 171
| false
| false
| 0
| 12
| 56
| 79
| 40
| 39
| null | null |
olsner/ghc
|
compiler/nativeGen/PPC/CodeGen.hs
|
bsd-3-clause
|
getRegister' dflags (CmmReg reg)
= return (Fixed (cmmTypeFormat (cmmRegType dflags reg))
(getRegisterReg (targetPlatform dflags) reg) nilOL)
| 160
|
getRegister' dflags (CmmReg reg)
= return (Fixed (cmmTypeFormat (cmmRegType dflags reg))
(getRegisterReg (targetPlatform dflags) reg) nilOL)
| 160
|
getRegister' dflags (CmmReg reg)
= return (Fixed (cmmTypeFormat (cmmRegType dflags reg))
(getRegisterReg (targetPlatform dflags) reg) nilOL)
| 160
| false
| false
| 0
| 11
| 35
| 58
| 28
| 30
| null | null |
kowey/GenI
|
src/NLP/GenI/Polarity.hs
|
gpl-2.0
|
sortSemByFreq :: Sem -> [TagElem] -> Sem
sortSemByFreq tsem cands =
let counts = map lenfn tsem
lenfn l = length $ filter fn cands
where fn x = l `elem` (tsemantics x)
-- note: we introduce an extra hack to push
-- index-counted extra columns to the end; just for UI reasons
sortfn a b
| isX a && isX b = compare (snd a) (snd b)
| isX a = GT
| isX b = LT
| otherwise = compare (snd a) (snd b)
where isX = isExtraCol.fst
sorted = sortBy sortfn $ zip tsem counts
in (fst.unzip) sorted
| 595
|
sortSemByFreq :: Sem -> [TagElem] -> Sem
sortSemByFreq tsem cands =
let counts = map lenfn tsem
lenfn l = length $ filter fn cands
where fn x = l `elem` (tsemantics x)
-- note: we introduce an extra hack to push
-- index-counted extra columns to the end; just for UI reasons
sortfn a b
| isX a && isX b = compare (snd a) (snd b)
| isX a = GT
| isX b = LT
| otherwise = compare (snd a) (snd b)
where isX = isExtraCol.fst
sorted = sortBy sortfn $ zip tsem counts
in (fst.unzip) sorted
| 595
|
sortSemByFreq tsem cands =
let counts = map lenfn tsem
lenfn l = length $ filter fn cands
where fn x = l `elem` (tsemantics x)
-- note: we introduce an extra hack to push
-- index-counted extra columns to the end; just for UI reasons
sortfn a b
| isX a && isX b = compare (snd a) (snd b)
| isX a = GT
| isX b = LT
| otherwise = compare (snd a) (snd b)
where isX = isExtraCol.fst
sorted = sortBy sortfn $ zip tsem counts
in (fst.unzip) sorted
| 554
| false
| true
| 0
| 13
| 213
| 211
| 101
| 110
| null | null |
KiNaudiz/bachelor
|
CN/Tridiag.hs
|
gpl-3.0
|
zeroMx :: (Num a) => Int -> TridiagMatrix a
zeroMx n = fromBand n (0,0,0)
| 73
|
zeroMx :: (Num a) => Int -> TridiagMatrix a
zeroMx n = fromBand n (0,0,0)
| 73
|
zeroMx n = fromBand n (0,0,0)
| 29
| false
| true
| 0
| 7
| 14
| 44
| 23
| 21
| null | null |
scott-fleischman/parsec
|
test/Bugs/Bug6.hs
|
bsd-2-clause
|
main :: Test
main =
testCase "Look-ahead preserving error location (#6)" $
parseErrors variable "return" @?= ["'return' is a reserved keyword"]
| 147
|
main :: Test
main =
testCase "Look-ahead preserving error location (#6)" $
parseErrors variable "return" @?= ["'return' is a reserved keyword"]
| 147
|
main =
testCase "Look-ahead preserving error location (#6)" $
parseErrors variable "return" @?= ["'return' is a reserved keyword"]
| 134
| false
| true
| 0
| 7
| 24
| 38
| 16
| 22
| null | null |
weeeeeew/petulant-cyril
|
lab_A/LabA01.hs
|
unlicense
|
parMfft :: Int -> [Complex Float] -> [Complex Float]
parMfft t list = runPar $ go list
where
go [a] = return [a]
go as | length as < t = return $ fft as
| otherwise = let (cs,ds) = parMbflyS as in do
ls <- spawn $ go cs
rs <- spawn $ go ds
ls' <- get ls
rs' <- get rs
return $ interleave ls' rs'
-- Implementation of FFT which uses the Par monad, but only in the recursive calls.
| 503
|
parMfft :: Int -> [Complex Float] -> [Complex Float]
parMfft t list = runPar $ go list
where
go [a] = return [a]
go as | length as < t = return $ fft as
| otherwise = let (cs,ds) = parMbflyS as in do
ls <- spawn $ go cs
rs <- spawn $ go ds
ls' <- get ls
rs' <- get rs
return $ interleave ls' rs'
-- Implementation of FFT which uses the Par monad, but only in the recursive calls.
| 503
|
parMfft t list = runPar $ go list
where
go [a] = return [a]
go as | length as < t = return $ fft as
| otherwise = let (cs,ds) = parMbflyS as in do
ls <- spawn $ go cs
rs <- spawn $ go ds
ls' <- get ls
rs' <- get rs
return $ interleave ls' rs'
-- Implementation of FFT which uses the Par monad, but only in the recursive calls.
| 450
| false
| true
| 3
| 12
| 208
| 191
| 85
| 106
| null | null |
Rathcke/uni
|
ap/advanced programming/exam/src/subs/SubsInterpreter.hs
|
gpl-3.0
|
add _ = fail "+ called with wrong number of arguments"
| 54
|
add _ = fail "+ called with wrong number of arguments"
| 54
|
add _ = fail "+ called with wrong number of arguments"
| 54
| false
| false
| 0
| 5
| 10
| 13
| 5
| 8
| null | null |
beni55/snap-server
|
src/Snap/Http/Server.hs
|
bsd-3-clause
|
------------------------------------------------------------------------------
-- | A short string describing the Snap server version
snapServerVersion :: ByteString
snapServerVersion = Int.snapServerVersion
| 207
|
snapServerVersion :: ByteString
snapServerVersion = Int.snapServerVersion
| 73
|
snapServerVersion = Int.snapServerVersion
| 41
| true
| true
| 0
| 6
| 16
| 22
| 10
| 12
| null | null |
k32/QFL
|
tools/Lam2W.hs
|
unlicense
|
mkChurch :: Integer -> Lambda
mkChurch = Abs ["f", "x"] . f where
f 0 = LVar "x"
f n = LApp [LVar "f", f (n - 1)]
| 118
|
mkChurch :: Integer -> Lambda
mkChurch = Abs ["f", "x"] . f where
f 0 = LVar "x"
f n = LApp [LVar "f", f (n - 1)]
| 118
|
mkChurch = Abs ["f", "x"] . f where
f 0 = LVar "x"
f n = LApp [LVar "f", f (n - 1)]
| 88
| false
| true
| 0
| 9
| 32
| 70
| 36
| 34
| null | null |
vikraman/ghc
|
compiler/typecheck/FunDeps.hs
|
bsd-3-clause
|
improveFromInstEnv inst_env mk_loc pred
| Just (cls, tys) <- getClassPredTys_maybe pred
, tys `lengthAtLeast` 2
, let (cls_tvs, cls_fds) = classTvsFds cls
instances = classInstances inst_env cls
rough_tcs = roughMatchTcs tys
= [ FDEqn { fd_qtvs = meta_tvs, fd_eqs = eqs
, fd_pred1 = p_inst, fd_pred2 = pred
, fd_loc = mk_loc p_inst (getSrcSpan (is_dfun ispec)) }
| fd <- cls_fds -- Iterate through the fundeps first,
-- because there often are none!
, let trimmed_tcs = trimRoughMatchTcs cls_tvs fd rough_tcs
-- Trim the rough_tcs based on the head of the fundep.
-- Remember that instanceCantMatch treats both argumnents
-- symmetrically, so it's ok to trim the rough_tcs,
-- rather than trimming each inst_tcs in turn
, ispec <- instances
, (meta_tvs, eqs) <- improveClsFD cls_tvs fd ispec
tys trimmed_tcs -- NB: orientation
, let p_inst = mkClassPred cls (is_tys ispec)
]
| 1,110
|
improveFromInstEnv inst_env mk_loc pred
| Just (cls, tys) <- getClassPredTys_maybe pred
, tys `lengthAtLeast` 2
, let (cls_tvs, cls_fds) = classTvsFds cls
instances = classInstances inst_env cls
rough_tcs = roughMatchTcs tys
= [ FDEqn { fd_qtvs = meta_tvs, fd_eqs = eqs
, fd_pred1 = p_inst, fd_pred2 = pred
, fd_loc = mk_loc p_inst (getSrcSpan (is_dfun ispec)) }
| fd <- cls_fds -- Iterate through the fundeps first,
-- because there often are none!
, let trimmed_tcs = trimRoughMatchTcs cls_tvs fd rough_tcs
-- Trim the rough_tcs based on the head of the fundep.
-- Remember that instanceCantMatch treats both argumnents
-- symmetrically, so it's ok to trim the rough_tcs,
-- rather than trimming each inst_tcs in turn
, ispec <- instances
, (meta_tvs, eqs) <- improveClsFD cls_tvs fd ispec
tys trimmed_tcs -- NB: orientation
, let p_inst = mkClassPred cls (is_tys ispec)
]
| 1,110
|
improveFromInstEnv inst_env mk_loc pred
| Just (cls, tys) <- getClassPredTys_maybe pred
, tys `lengthAtLeast` 2
, let (cls_tvs, cls_fds) = classTvsFds cls
instances = classInstances inst_env cls
rough_tcs = roughMatchTcs tys
= [ FDEqn { fd_qtvs = meta_tvs, fd_eqs = eqs
, fd_pred1 = p_inst, fd_pred2 = pred
, fd_loc = mk_loc p_inst (getSrcSpan (is_dfun ispec)) }
| fd <- cls_fds -- Iterate through the fundeps first,
-- because there often are none!
, let trimmed_tcs = trimRoughMatchTcs cls_tvs fd rough_tcs
-- Trim the rough_tcs based on the head of the fundep.
-- Remember that instanceCantMatch treats both argumnents
-- symmetrically, so it's ok to trim the rough_tcs,
-- rather than trimming each inst_tcs in turn
, ispec <- instances
, (meta_tvs, eqs) <- improveClsFD cls_tvs fd ispec
tys trimmed_tcs -- NB: orientation
, let p_inst = mkClassPred cls (is_tys ispec)
]
| 1,110
| false
| false
| 0
| 13
| 377
| 222
| 118
| 104
| null | null |
brendanhay/gogol
|
gogol-shopping-content/gen/Network/Google/Resource/Content/Orders/GettestOrdertemplate.hs
|
mpl-2.0
|
-- | The country of the template to retrieve. Defaults to \`US\`.
ogoCountry :: Lens' OrdersGettestOrdertemplate (Maybe Text)
ogoCountry
= lens _ogoCountry (\ s a -> s{_ogoCountry = a})
| 187
|
ogoCountry :: Lens' OrdersGettestOrdertemplate (Maybe Text)
ogoCountry
= lens _ogoCountry (\ s a -> s{_ogoCountry = a})
| 121
|
ogoCountry
= lens _ogoCountry (\ s a -> s{_ogoCountry = a})
| 61
| true
| true
| 1
| 9
| 30
| 52
| 25
| 27
| null | null |
marcmo/hsDiagnosis
|
other/DiagClientEvent.hs
|
bsd-3-clause
|
responsePending :: Maybe HSFZMessage -> Bool
responsePending =
maybe False (\m->
let p = diagPayload (hsfz2diag m) in
length p == 3 && head p == 0x7f && p!!2 == 0x78)
| 179
|
responsePending :: Maybe HSFZMessage -> Bool
responsePending =
maybe False (\m->
let p = diagPayload (hsfz2diag m) in
length p == 3 && head p == 0x7f && p!!2 == 0x78)
| 179
|
responsePending =
maybe False (\m->
let p = diagPayload (hsfz2diag m) in
length p == 3 && head p == 0x7f && p!!2 == 0x78)
| 133
| false
| true
| 0
| 16
| 43
| 81
| 39
| 42
| null | null |
YuichiroSato/CategoryTheory
|
src/chapter02/SetsFin.hs
|
apache-2.0
|
trimObjects :: [Object] -> [Object]
trimObjects = Set.toList . Set.fromList . filter (\(Object es2) -> (not $ List.null es2) && es2 /= [EmptyElement])
| 151
|
trimObjects :: [Object] -> [Object]
trimObjects = Set.toList . Set.fromList . filter (\(Object es2) -> (not $ List.null es2) && es2 /= [EmptyElement])
| 150
|
trimObjects = Set.toList . Set.fromList . filter (\(Object es2) -> (not $ List.null es2) && es2 /= [EmptyElement])
| 114
| false
| true
| 0
| 14
| 23
| 79
| 40
| 39
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.