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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
blippy/halog | src/Parser.hs | mit | findMonth:: String -> Int -- starting from 1
findMonth mmm = 1 + (fromJust $ findIndex (== mmm) monthNames) | 120 | findMonth:: String -> Int
findMonth mmm = 1 + (fromJust $ findIndex (== mmm) monthNames) | 88 | findMonth mmm = 1 + (fromJust $ findIndex (== mmm) monthNames) | 62 | true | true | 0 | 9 | 31 | 39 | 21 | 18 | null | null |
Cahu/krpc-hs | src/KRPCHS/SpaceCenter.hs | gpl-3.0 | getVesselSurfaceReferenceFrameStream :: KRPCHS.SpaceCenter.Vessel -> RPCContext (KRPCStream (KRPCHS.SpaceCenter.ReferenceFrame))
getVesselSurfaceReferenceFrameStream thisArg = requestStream $ getVesselSurfaceReferenceFrameStreamReq thisArg | 239 | getVesselSurfaceReferenceFrameStream :: KRPCHS.SpaceCenter.Vessel -> RPCContext (KRPCStream (KRPCHS.SpaceCenter.ReferenceFrame))
getVesselSurfaceReferenceFrameStream thisArg = requestStream $ getVesselSurfaceReferenceFrameStreamReq thisArg | 239 | getVesselSurfaceReferenceFrameStream thisArg = requestStream $ getVesselSurfaceReferenceFrameStreamReq thisArg | 110 | false | true | 0 | 10 | 13 | 43 | 22 | 21 | null | null |
Lainepress/hledger | tools/simplifyprof.hs | gpl-3.0 | main = do
args <- getArgs
let f = head args
s <- readFile f
let ls = lines s
let (firstpart, secondpart) = break ("individual inherited" `isInfixOf`) ls
putStr $ unlines firstpart
let fields = map getfields $ filter (not . null) $ drop 2 secondpart
let maxnamelen = maximum $ map (length . head) fields
let fmt = "%-" ++ show maxnamelen ++ "s %10s %5s %6s %9s %10s"
putStrLn $ showheading fmt
putStr $ unlines $ map (format fmt) fields | 461 | main = do
args <- getArgs
let f = head args
s <- readFile f
let ls = lines s
let (firstpart, secondpart) = break ("individual inherited" `isInfixOf`) ls
putStr $ unlines firstpart
let fields = map getfields $ filter (not . null) $ drop 2 secondpart
let maxnamelen = maximum $ map (length . head) fields
let fmt = "%-" ++ show maxnamelen ++ "s %10s %5s %6s %9s %10s"
putStrLn $ showheading fmt
putStr $ unlines $ map (format fmt) fields | 461 | main = do
args <- getArgs
let f = head args
s <- readFile f
let ls = lines s
let (firstpart, secondpart) = break ("individual inherited" `isInfixOf`) ls
putStr $ unlines firstpart
let fields = map getfields $ filter (not . null) $ drop 2 secondpart
let maxnamelen = maximum $ map (length . head) fields
let fmt = "%-" ++ show maxnamelen ++ "s %10s %5s %6s %9s %10s"
putStrLn $ showheading fmt
putStr $ unlines $ map (format fmt) fields | 461 | false | false | 0 | 14 | 108 | 196 | 90 | 106 | null | null |
gscalzo/HaskellTheHardWay | scala/3_7.hs | mit | myStar :: (Num a, Eq a) => a -> a -> a
myStar 0 _ = 0 | 53 | myStar :: (Num a, Eq a) => a -> a -> a
myStar 0 _ = 0 | 53 | myStar 0 _ = 0 | 14 | false | true | 0 | 7 | 16 | 39 | 20 | 19 | null | null |
vTurbine/ghc | compiler/hsSyn/HsBinds.hs | bsd-3-clause | isDefaultMethod :: TcSpecPrags -> Bool
isDefaultMethod IsDefaultMethod = True | 77 | isDefaultMethod :: TcSpecPrags -> Bool
isDefaultMethod IsDefaultMethod = True | 77 | isDefaultMethod IsDefaultMethod = True | 38 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
pdmurray/haskell-book-ex | src/ch12/Exercises12.5.hs | bsd-3-clause | -- 3.
fromMaybe :: a -> Maybe a -> a
fromMaybe a Nothing = a | 61 | fromMaybe :: a -> Maybe a -> a
fromMaybe a Nothing = a | 55 | fromMaybe a Nothing = a | 24 | true | true | 0 | 8 | 15 | 34 | 15 | 19 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Query/Tech.hs | mit | mineralsCost Hallucination = 150 | 32 | mineralsCost Hallucination = 150 | 32 | mineralsCost Hallucination = 150 | 32 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
urbanslug/ghc | compiler/utils/Outputable.hs | bsd-3-clause | qualName _other mod _ = NameQual (moduleName mod) | 59 | qualName _other mod _ = NameQual (moduleName mod) | 59 | qualName _other mod _ = NameQual (moduleName mod) | 59 | false | false | 0 | 7 | 17 | 23 | 10 | 13 | null | null |
DimaSamoz/thodo | src/Printing.hs | mit | exItems :: [Item]
exItems =
[ Item "Bread" False
, Item "Milk" True
, Item "Toothpaste" False
] | 111 | exItems :: [Item]
exItems =
[ Item "Bread" False
, Item "Milk" True
, Item "Toothpaste" False
] | 111 | exItems =
[ Item "Bread" False
, Item "Milk" True
, Item "Toothpaste" False
] | 93 | false | true | 0 | 6 | 33 | 38 | 20 | 18 | null | null |
prasmussen/glot-www | Yesod/Auth/Simple.hs | mit | setPasswordR :: AuthRoute
setPasswordR = PluginR "simple" ["set-password"] | 74 | setPasswordR :: AuthRoute
setPasswordR = PluginR "simple" ["set-password"] | 74 | setPasswordR = PluginR "simple" ["set-password"] | 48 | false | true | 0 | 6 | 7 | 19 | 10 | 9 | null | null |
fgaz/yabi | yabi.hs | mit | bf (Input:commands) (ml, _:mr) = do
char <- getChar
let m = fromIntegral $ ord char
bf commands (ml, m:mr)
--loop (brackets) | 130 | bf (Input:commands) (ml, _:mr) = do
char <- getChar
let m = fromIntegral $ ord char
bf commands (ml, m:mr)
--loop (brackets) | 130 | bf (Input:commands) (ml, _:mr) = do
char <- getChar
let m = fromIntegral $ ord char
bf commands (ml, m:mr)
--loop (brackets) | 130 | false | false | 1 | 12 | 27 | 73 | 35 | 38 | null | null |
skedgeme/wrecker | test/Wrecker/RecorderSpec.hs | bsd-3-clause | spec :: Spec
spec = describe "Recorder" $ do
it "add/read event" $ do
pending
it "stop recorder closes the queue" $ do
pending
it "records success is timed correctly" $ do
pending
it "records status code failure correctly" $ do
pending
it "records totally failure correctly" $ do
pending | 317 | spec :: Spec
spec = describe "Recorder" $ do
it "add/read event" $ do
pending
it "stop recorder closes the queue" $ do
pending
it "records success is timed correctly" $ do
pending
it "records status code failure correctly" $ do
pending
it "records totally failure correctly" $ do
pending | 317 | spec = describe "Recorder" $ do
it "add/read event" $ do
pending
it "stop recorder closes the queue" $ do
pending
it "records success is timed correctly" $ do
pending
it "records status code failure correctly" $ do
pending
it "records totally failure correctly" $ do
pending | 304 | false | true | 0 | 11 | 79 | 90 | 35 | 55 | null | null |
ozgurakgun/Idris-dev | src/Idris/IBC.hs | bsd-3-clause | mkIBC (i:is) f = do ist <- getIState
logIBC 5 $ show i ++ " " ++ show (L.length is)
f' <- ibc ist i f
mkIBC is f' | 173 | mkIBC (i:is) f = do ist <- getIState
logIBC 5 $ show i ++ " " ++ show (L.length is)
f' <- ibc ist i f
mkIBC is f' | 173 | mkIBC (i:is) f = do ist <- getIState
logIBC 5 $ show i ++ " " ++ show (L.length is)
f' <- ibc ist i f
mkIBC is f' | 173 | false | false | 1 | 12 | 88 | 84 | 35 | 49 | null | null |
clarkcb/xsearch | haskell/hssearch/test/HsSearch/SearchOptionsTest.hs | mit | getDebugTests :: IO [Test]
getDebugTests = do
let args = ["--debug"]
searchOptions <- getSearchOptions
--let settings = settingsFromArgs searchOptions args
case settingsFromArgs searchOptions args of
Left errMsg -> return []
Right settings ->
return [ testCase "debug" (debug settings @?= True)
, testCase "verbose" (verbose settings @?= True)
] | 393 | getDebugTests :: IO [Test]
getDebugTests = do
let args = ["--debug"]
searchOptions <- getSearchOptions
--let settings = settingsFromArgs searchOptions args
case settingsFromArgs searchOptions args of
Left errMsg -> return []
Right settings ->
return [ testCase "debug" (debug settings @?= True)
, testCase "verbose" (verbose settings @?= True)
] | 393 | getDebugTests = do
let args = ["--debug"]
searchOptions <- getSearchOptions
--let settings = settingsFromArgs searchOptions args
case settingsFromArgs searchOptions args of
Left errMsg -> return []
Right settings ->
return [ testCase "debug" (debug settings @?= True)
, testCase "verbose" (verbose settings @?= True)
] | 366 | false | true | 0 | 15 | 96 | 111 | 53 | 58 | null | null |
iron-codegen/iron | library/Iron/IR.hs | bsd-3-clause | mkCallExpr :: Embeddable t (AnnExpr d b) => ExprAnn -> t -> Vector t -> t
mkCallExpr a f = embed . EnvT a . CallExpr f | 118 | mkCallExpr :: Embeddable t (AnnExpr d b) => ExprAnn -> t -> Vector t -> t
mkCallExpr a f = embed . EnvT a . CallExpr f | 118 | mkCallExpr a f = embed . EnvT a . CallExpr f | 44 | false | true | 2 | 10 | 26 | 69 | 30 | 39 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/HTMLOptionsCollection.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionsCollection.add Mozilla HTMLOptionsCollection.add documentation>
addBefore ::
(MonadDOM m, IsHTMLOptionElementOrGroup element,
IsHTMLElementOrLong before) =>
HTMLOptionsCollection -> element -> Maybe before -> m ()
addBefore self element before
= liftDOM
(void (self ^. jsf "add" [toJSVal element, toJSVal before])) | 422 | addBefore ::
(MonadDOM m, IsHTMLOptionElementOrGroup element,
IsHTMLElementOrLong before) =>
HTMLOptionsCollection -> element -> Maybe before -> m ()
addBefore self element before
= liftDOM
(void (self ^. jsf "add" [toJSVal element, toJSVal before])) | 291 | addBefore self element before
= liftDOM
(void (self ^. jsf "add" [toJSVal element, toJSVal before])) | 108 | true | true | 0 | 12 | 80 | 93 | 46 | 47 | null | null |
zeitgeist87/HaskellServer | Settings.hs | gpl-3.0 | processFlag (Port p) s = case reads p :: [(Int,String)] of
(x, _):_ -> validatePort p x s
_ -> s { settMsg = Just ("Unable to parse port: "
++ p ++ "\n") }
where
validatePort p x s
| x > 0 && x < 65536 = s { settPort = x }
| otherwise = s { settMsg = Just ("Invalid port number: "
++ p ++ "\n") } | 427 | processFlag (Port p) s = case reads p :: [(Int,String)] of
(x, _):_ -> validatePort p x s
_ -> s { settMsg = Just ("Unable to parse port: "
++ p ++ "\n") }
where
validatePort p x s
| x > 0 && x < 65536 = s { settPort = x }
| otherwise = s { settMsg = Just ("Invalid port number: "
++ p ++ "\n") } | 427 | processFlag (Port p) s = case reads p :: [(Int,String)] of
(x, _):_ -> validatePort p x s
_ -> s { settMsg = Just ("Unable to parse port: "
++ p ++ "\n") }
where
validatePort p x s
| x > 0 && x < 65536 = s { settPort = x }
| otherwise = s { settMsg = Just ("Invalid port number: "
++ p ++ "\n") } | 427 | false | false | 4 | 11 | 202 | 145 | 76 | 69 | null | null |
piyush-kurur/yesod | yesod/Build.hs | mit | updateFileTime :: FilePath -> FilePath -> IO ()
updateFileTime x hs = do
(_ , modx) <- getFileStatus' x
(access, _ ) <- getFileStatus' hs
_ <- try' (setFileTimes hs access modx)
return () | 201 | updateFileTime :: FilePath -> FilePath -> IO ()
updateFileTime x hs = do
(_ , modx) <- getFileStatus' x
(access, _ ) <- getFileStatus' hs
_ <- try' (setFileTimes hs access modx)
return () | 201 | updateFileTime x hs = do
(_ , modx) <- getFileStatus' x
(access, _ ) <- getFileStatus' hs
_ <- try' (setFileTimes hs access modx)
return () | 153 | false | true | 0 | 10 | 47 | 89 | 42 | 47 | null | null |
BartAdv/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | reflectErr :: Err -> Raw
reflectErr (Msg msg) = raw_apply (Var $ reflErrName "Msg") [RConstant (Str msg)] | 105 | reflectErr :: Err -> Raw
reflectErr (Msg msg) = raw_apply (Var $ reflErrName "Msg") [RConstant (Str msg)] | 105 | reflectErr (Msg msg) = raw_apply (Var $ reflErrName "Msg") [RConstant (Str msg)] | 80 | false | true | 0 | 9 | 16 | 51 | 25 | 26 | null | null |
jaiyalas/sdl2-image | src/SDL/Image/Loading.hs | mit | -- | @.tif@ loader
surfaceTIF :: MonadIO m => FilePath -> m SDL.Surface
surfaceTIF = surfaceFromFileT Img_TIF | 109 | surfaceTIF :: MonadIO m => FilePath -> m SDL.Surface
surfaceTIF = surfaceFromFileT Img_TIF | 90 | surfaceTIF = surfaceFromFileT Img_TIF | 37 | true | true | 0 | 9 | 16 | 36 | 16 | 20 | null | null |
jff/TeLLer | src/ReductionRules.hs | gpl-3.0 | reduceWithStateIO _ = return Nothing | 36 | reduceWithStateIO _ = return Nothing | 36 | reduceWithStateIO _ = return Nothing | 36 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
antalsz/hs-to-coq | examples/containers/extraction/src/ExtractedSet.hs | mit | minView :: Set a -> Maybe (a,Set a)
minView = S2.minView | 56 | minView :: Set a -> Maybe (a,Set a)
minView = S2.minView | 56 | minView = S2.minView | 20 | false | true | 0 | 9 | 10 | 38 | 17 | 21 | null | null |
haraldsteinlechner/assimp | viewer/assimp_view.hs | bsd-3-clause | aiTransformVecByMatrix4 :: Vec3 -> Mat4 -> Vec3
aiTransformVecByMatrix4 (Vec3 x y z)
(Mat4 (Vec4 a1 a2 a3 a4)
(Vec4 b1 b2 b3 b4)
(Vec4 c1 c2 c3 c4)
(Vec4 d1 d2 d3 d4)) = Vec3
(a1 * x + a2 * y + a3 * z + a4)
(b1 * x + b2 * y + b3 * z + b4)
(c1 * x + c2 * y + c3 * z + c4) | 373 | aiTransformVecByMatrix4 :: Vec3 -> Mat4 -> Vec3
aiTransformVecByMatrix4 (Vec3 x y z)
(Mat4 (Vec4 a1 a2 a3 a4)
(Vec4 b1 b2 b3 b4)
(Vec4 c1 c2 c3 c4)
(Vec4 d1 d2 d3 d4)) = Vec3
(a1 * x + a2 * y + a3 * z + a4)
(b1 * x + b2 * y + b3 * z + b4)
(c1 * x + c2 * y + c3 * z + c4) | 373 | aiTransformVecByMatrix4 (Vec3 x y z)
(Mat4 (Vec4 a1 a2 a3 a4)
(Vec4 b1 b2 b3 b4)
(Vec4 c1 c2 c3 c4)
(Vec4 d1 d2 d3 d4)) = Vec3
(a1 * x + a2 * y + a3 * z + a4)
(b1 * x + b2 * y + b3 * z + b4)
(c1 * x + c2 * y + c3 * z + c4) | 325 | false | true | 0 | 11 | 176 | 184 | 92 | 92 | null | null |
crackleware/hscolour | Language/Haskell/HsColour/ANSI.hs | gpl-2.0 | cleareol = "\ESC[K" | 22 | cleareol = "\ESC[K" | 22 | cleareol = "\ESC[K" | 22 | false | false | 0 | 4 | 5 | 6 | 3 | 3 | null | null |
markus-git/co-feldspar | src/Feldspar/Hardware/Optimize.hs | bsd-3-clause | -- Simplify and-expressions.
simplifyUp (SymP _ And :$ LitP t False :$ _) = LitP t False | 88 | simplifyUp (SymP _ And :$ LitP t False :$ _) = LitP t False | 59 | simplifyUp (SymP _ And :$ LitP t False :$ _) = LitP t False | 59 | true | false | 0 | 9 | 16 | 36 | 17 | 19 | null | null |
jlamothe/passman | src/Password.hs | lgpl-3.0 | validatePWData
:: PWData
-- ^ the data to be validated
-> Bool
-- ^ @"True"@ if valid; @"False"@ otherwise
validatePWData x =
validatePWPolicy (x^.pwPolicy) &&
B.length (x^.pwSalt.to runPWSalt) > 0 | 209 | validatePWData
:: PWData
-- ^ the data to be validated
-> Bool
validatePWData x =
validatePWPolicy (x^.pwPolicy) &&
B.length (x^.pwSalt.to runPWSalt) > 0 | 163 | validatePWData x =
validatePWPolicy (x^.pwPolicy) &&
B.length (x^.pwSalt.to runPWSalt) > 0 | 94 | true | true | 4 | 8 | 41 | 63 | 29 | 34 | null | null |
sgraf812/feed-gipeda | src/FeedGipeda/Master.hs | bsd-3-clause | finalizeRepos
:: Event
-> Lock
-> Paths
-> Deployment
-> Set Repo
-> (UTCTime, Set Repo)
-> Map Repo UTCTime
-> IO (Map Repo UTCTime)
finalizeRepos notFinalizing lock paths deployment activeRepos (timestamp, repos) lastGenerated =
foldM finalizeRepo lastGenerated (Set.toList repos)
where
finalizeRepo lastGenerated repo = Lock.with lock $
case Map.lookup repo lastGenerated of
Just lg | lg > timestamp -> return lastGenerated
_ -> do
Event.clear notFinalizing
newLG <- Time.getCurrentTime
-- TODO: parallelize the gipeda step
Finalize.regenerateAndDeploy (gipeda paths) deployment activeRepos repo
Event.set notFinalizing
return (Map.insert repo newLG lastGenerated) | 795 | finalizeRepos
:: Event
-> Lock
-> Paths
-> Deployment
-> Set Repo
-> (UTCTime, Set Repo)
-> Map Repo UTCTime
-> IO (Map Repo UTCTime)
finalizeRepos notFinalizing lock paths deployment activeRepos (timestamp, repos) lastGenerated =
foldM finalizeRepo lastGenerated (Set.toList repos)
where
finalizeRepo lastGenerated repo = Lock.with lock $
case Map.lookup repo lastGenerated of
Just lg | lg > timestamp -> return lastGenerated
_ -> do
Event.clear notFinalizing
newLG <- Time.getCurrentTime
-- TODO: parallelize the gipeda step
Finalize.regenerateAndDeploy (gipeda paths) deployment activeRepos repo
Event.set notFinalizing
return (Map.insert repo newLG lastGenerated) | 795 | finalizeRepos notFinalizing lock paths deployment activeRepos (timestamp, repos) lastGenerated =
foldM finalizeRepo lastGenerated (Set.toList repos)
where
finalizeRepo lastGenerated repo = Lock.with lock $
case Map.lookup repo lastGenerated of
Just lg | lg > timestamp -> return lastGenerated
_ -> do
Event.clear notFinalizing
newLG <- Time.getCurrentTime
-- TODO: parallelize the gipeda step
Finalize.regenerateAndDeploy (gipeda paths) deployment activeRepos repo
Event.set notFinalizing
return (Map.insert repo newLG lastGenerated) | 645 | false | true | 0 | 15 | 216 | 234 | 107 | 127 | null | null |
Hinidu/Arkanoid | src/Hage/Game/Arkanoid/EventHandler.hs | mit | keyUpHandle :: SDL.Keysym -> GameState -> GameState
keyUpHandle ks gs =
case SDL.symKey ks of
SDL.SDLK_LEFT -> changePaddleSpeed gs paddleSpeed
SDL.SDLK_RIGHT -> changePaddleSpeed gs (-paddleSpeed)
_ -> gs | 247 | keyUpHandle :: SDL.Keysym -> GameState -> GameState
keyUpHandle ks gs =
case SDL.symKey ks of
SDL.SDLK_LEFT -> changePaddleSpeed gs paddleSpeed
SDL.SDLK_RIGHT -> changePaddleSpeed gs (-paddleSpeed)
_ -> gs | 247 | keyUpHandle ks gs =
case SDL.symKey ks of
SDL.SDLK_LEFT -> changePaddleSpeed gs paddleSpeed
SDL.SDLK_RIGHT -> changePaddleSpeed gs (-paddleSpeed)
_ -> gs | 195 | false | true | 0 | 10 | 69 | 72 | 35 | 37 | null | null |
kairuku/stack | src/main/Main.hs | bsd-3-clause | -- | List the dependencies
listDependenciesCmd :: Text -> GlobalOpts -> IO ()
listDependenciesCmd sep go = withBuildConfig go (listDependencies sep')
where sep' = T.replace "\\t" "\t" (T.replace "\\n" "\n" sep) | 212 | listDependenciesCmd :: Text -> GlobalOpts -> IO ()
listDependenciesCmd sep go = withBuildConfig go (listDependencies sep')
where sep' = T.replace "\\t" "\t" (T.replace "\\n" "\n" sep) | 185 | listDependenciesCmd sep go = withBuildConfig go (listDependencies sep')
where sep' = T.replace "\\t" "\t" (T.replace "\\n" "\n" sep) | 134 | true | true | 0 | 8 | 32 | 70 | 34 | 36 | null | null |
DimaSamoz/mezzo | src/Mezzo/Compose/Templates.hs | mit | mkTriConvs :: DecsQ
mkTriConvs = do
triTyNames <- filter (\n -> nameBase n /= "DoubledD") <$> getDataCons ''TriadType
let declareFun choTy = do
let choStr = tail (choTyFormatter choTy)
valName1 = mkName $ choStr ++ "'"
valName2 = mkName $ choStr
tySig1 <- sigD valName1 $
[t| forall r i. ChorC' Triad r $(conT choTy) i |]
dec1 <- [d| $(varP valName1) = \i -> constConv Cho |]
tySig2 <- sigD valName2 $
[t| forall r. ChorC Triad r $(conT choTy) |]
dec2 <- [d| $(varP valName2) = constConv Cho |]
return $ (tySig1 : dec1) ++ (tySig2 : dec2)
join <$> traverse declareFun triTyNames
-- | Generate converters from roots to doubled dyads, for each dyad type. | 801 | mkTriConvs :: DecsQ
mkTriConvs = do
triTyNames <- filter (\n -> nameBase n /= "DoubledD") <$> getDataCons ''TriadType
let declareFun choTy = do
let choStr = tail (choTyFormatter choTy)
valName1 = mkName $ choStr ++ "'"
valName2 = mkName $ choStr
tySig1 <- sigD valName1 $
[t| forall r i. ChorC' Triad r $(conT choTy) i |]
dec1 <- [d| $(varP valName1) = \i -> constConv Cho |]
tySig2 <- sigD valName2 $
[t| forall r. ChorC Triad r $(conT choTy) |]
dec2 <- [d| $(varP valName2) = constConv Cho |]
return $ (tySig1 : dec1) ++ (tySig2 : dec2)
join <$> traverse declareFun triTyNames
-- | Generate converters from roots to doubled dyads, for each dyad type. | 801 | mkTriConvs = do
triTyNames <- filter (\n -> nameBase n /= "DoubledD") <$> getDataCons ''TriadType
let declareFun choTy = do
let choStr = tail (choTyFormatter choTy)
valName1 = mkName $ choStr ++ "'"
valName2 = mkName $ choStr
tySig1 <- sigD valName1 $
[t| forall r i. ChorC' Triad r $(conT choTy) i |]
dec1 <- [d| $(varP valName1) = \i -> constConv Cho |]
tySig2 <- sigD valName2 $
[t| forall r. ChorC Triad r $(conT choTy) |]
dec2 <- [d| $(varP valName2) = constConv Cho |]
return $ (tySig1 : dec1) ++ (tySig2 : dec2)
join <$> traverse declareFun triTyNames
-- | Generate converters from roots to doubled dyads, for each dyad type. | 781 | false | true | 0 | 18 | 266 | 200 | 101 | 99 | null | null |
bgamari/text | tests/Tests/Properties.hs | bsd-2-clause | t_findContains = unsquare $ \(NotEmpty s) ->
all (T.isPrefixOf s . snd) . T.breakOnAll s . T.intercalate s | 110 | t_findContains = unsquare $ \(NotEmpty s) ->
all (T.isPrefixOf s . snd) . T.breakOnAll s . T.intercalate s | 110 | t_findContains = unsquare $ \(NotEmpty s) ->
all (T.isPrefixOf s . snd) . T.breakOnAll s . T.intercalate s | 110 | false | false | 0 | 13 | 21 | 54 | 26 | 28 | null | null |
olorin/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | The ID of the snapshot. Each snapshot receives a unique identifier when
-- it is created.
sSnapshotId :: Lens' Snapshot Text
sSnapshotId = lens _sSnapshotId (\ s a -> s{_sSnapshotId = a}) | 192 | sSnapshotId :: Lens' Snapshot Text
sSnapshotId = lens _sSnapshotId (\ s a -> s{_sSnapshotId = a}) | 97 | sSnapshotId = lens _sSnapshotId (\ s a -> s{_sSnapshotId = a}) | 62 | true | true | 0 | 9 | 33 | 41 | 23 | 18 | null | null |
thielema/optparse-applicative | Options/Applicative/Builder/Internal.hs | bsd-3-clause | internal :: Mod f a
internal = optionMod $ \p -> p { propVisibility = Internal } | 80 | internal :: Mod f a
internal = optionMod $ \p -> p { propVisibility = Internal } | 80 | internal = optionMod $ \p -> p { propVisibility = Internal } | 60 | false | true | 0 | 8 | 16 | 33 | 18 | 15 | null | null |
facebookincubator/duckling | Duckling/Rules/KM.hs | bsd-3-clause | langRules (Seal Volume) = Volume.rules | 38 | langRules (Seal Volume) = Volume.rules | 38 | langRules (Seal Volume) = Volume.rules | 38 | false | false | 0 | 7 | 4 | 17 | 8 | 9 | null | null |
OpenXT/manager | xenmgr/XenMgr/Connect/Xl.hs | gpl-2.0 | resumeFromSleep :: Uuid -> IO Bool
resumeFromSleep uuid = do
domid <- getDomainId uuid
exitCode <- system ("xl trigger " ++ domid ++ " s3resume")
case exitCode of
_ -> waitForAcpiState uuid 0 (Just 10)
--Given the uuid, get the domid, if there is one | 270 | resumeFromSleep :: Uuid -> IO Bool
resumeFromSleep uuid = do
domid <- getDomainId uuid
exitCode <- system ("xl trigger " ++ domid ++ " s3resume")
case exitCode of
_ -> waitForAcpiState uuid 0 (Just 10)
--Given the uuid, get the domid, if there is one | 270 | resumeFromSleep uuid = do
domid <- getDomainId uuid
exitCode <- system ("xl trigger " ++ domid ++ " s3resume")
case exitCode of
_ -> waitForAcpiState uuid 0 (Just 10)
--Given the uuid, get the domid, if there is one | 235 | false | true | 0 | 13 | 64 | 84 | 38 | 46 | null | null |
kcharter/spdy-base | test/StreamTests.hs | bsd-3-clause | propM_addIncoming :: PropertyM IO ()
propM_addIncoming =
implements (fromTestStream $ \sm ->
oneof [genIncomingContent sm
,genOversizedIncomingContent sm])
(flip addIncoming) specAddIncoming | 230 | propM_addIncoming :: PropertyM IO ()
propM_addIncoming =
implements (fromTestStream $ \sm ->
oneof [genIncomingContent sm
,genOversizedIncomingContent sm])
(flip addIncoming) specAddIncoming | 230 | propM_addIncoming =
implements (fromTestStream $ \sm ->
oneof [genIncomingContent sm
,genOversizedIncomingContent sm])
(flip addIncoming) specAddIncoming | 193 | false | true | 0 | 11 | 59 | 60 | 29 | 31 | null | null |
nikhilunni/HaskellBoy | src/GBC.hs | gpl-2.0 | tick :: Cycles -> GBC ()
tick n = do
readRef gpu_cycles >>= \cycles -> writeRef gpu_cycles $ cycles + n
GPU.tick n | 121 | tick :: Cycles -> GBC ()
tick n = do
readRef gpu_cycles >>= \cycles -> writeRef gpu_cycles $ cycles + n
GPU.tick n | 120 | tick n = do
readRef gpu_cycles >>= \cycles -> writeRef gpu_cycles $ cycles + n
GPU.tick n | 95 | false | true | 0 | 12 | 29 | 61 | 27 | 34 | null | null |
CulpaBS/wbBach | src/Futhark/Analysis/HORepresentation/SOAC.hs | bsd-3-clause | inputs (Stream _ _ _ _ arrs) = arrs | 40 | inputs (Stream _ _ _ _ arrs) = arrs | 40 | inputs (Stream _ _ _ _ arrs) = arrs | 40 | false | false | 0 | 7 | 13 | 23 | 11 | 12 | null | null |
alexander-at-github/eta | compiler/ETA/Utils/Outputable.hs | bsd-3-clause | dcolon = unicodeSyntax (char '∷') (docToSDoc $ Pretty.ptext (sLit "::")) | 76 | dcolon = unicodeSyntax (char '∷') (docToSDoc $ Pretty.ptext (sLit "::")) | 76 | dcolon = unicodeSyntax (char '∷') (docToSDoc $ Pretty.ptext (sLit "::")) | 76 | false | false | 0 | 10 | 13 | 35 | 17 | 18 | null | null |
urbanslug/ghc | testsuite/tests/parser/should_run/ParserMultiWayIf.hs | bsd-3-clause | x7 = (if | True -> 0) | 21 | x7 = (if | True -> 0) | 21 | x7 = (if | True -> 0) | 21 | false | false | 0 | 9 | 6 | 18 | 9 | 9 | null | null |
svenpanne/Vulkan | RegistryProcessor/src/MangledRegistry.hs | bsd-3-clause | toRegistry :: ToEnumType -> R.Registry -> Registry
toRegistry toEnumType r = Registry {
types = fromList'
[ (typeNameOf t, toType t)
| R.TypesElement te <- rs
, t <- R.unTypes te ],
groups = fromList' [],
enums = M.fromListWith (++)
[ (enumName en, [en])
| R.EnumsElement ee <- rs
, Left e <- R.enumsEnumOrUnuseds ee
, let en = toEnum' (toEnumType (error "remove me 1") (error "remove me 2") (R.enumsType ee)) e ],
commands = fromList'
[ (CommandName . R.protoName . R.commandProto $ c, toCommand c)
| R.CommandsElement ce <- rs
, c <- R.unCommands ce ],
features = fromList'
[ ((API (R.featureAPI f), read (R.featureNumber f)),
map toModification (R.featureModifications f))
| R.FeatureElement f <- rs ],
extensions =
[ toExtension x
| R.ExtensionsElement ee <- R.unRegistry r
, x <- R.unExtensions ee ]
} where rs = R.unRegistry r | 906 | toRegistry :: ToEnumType -> R.Registry -> Registry
toRegistry toEnumType r = Registry {
types = fromList'
[ (typeNameOf t, toType t)
| R.TypesElement te <- rs
, t <- R.unTypes te ],
groups = fromList' [],
enums = M.fromListWith (++)
[ (enumName en, [en])
| R.EnumsElement ee <- rs
, Left e <- R.enumsEnumOrUnuseds ee
, let en = toEnum' (toEnumType (error "remove me 1") (error "remove me 2") (R.enumsType ee)) e ],
commands = fromList'
[ (CommandName . R.protoName . R.commandProto $ c, toCommand c)
| R.CommandsElement ce <- rs
, c <- R.unCommands ce ],
features = fromList'
[ ((API (R.featureAPI f), read (R.featureNumber f)),
map toModification (R.featureModifications f))
| R.FeatureElement f <- rs ],
extensions =
[ toExtension x
| R.ExtensionsElement ee <- R.unRegistry r
, x <- R.unExtensions ee ]
} where rs = R.unRegistry r | 906 | toRegistry toEnumType r = Registry {
types = fromList'
[ (typeNameOf t, toType t)
| R.TypesElement te <- rs
, t <- R.unTypes te ],
groups = fromList' [],
enums = M.fromListWith (++)
[ (enumName en, [en])
| R.EnumsElement ee <- rs
, Left e <- R.enumsEnumOrUnuseds ee
, let en = toEnum' (toEnumType (error "remove me 1") (error "remove me 2") (R.enumsType ee)) e ],
commands = fromList'
[ (CommandName . R.protoName . R.commandProto $ c, toCommand c)
| R.CommandsElement ce <- rs
, c <- R.unCommands ce ],
features = fromList'
[ ((API (R.featureAPI f), read (R.featureNumber f)),
map toModification (R.featureModifications f))
| R.FeatureElement f <- rs ],
extensions =
[ toExtension x
| R.ExtensionsElement ee <- R.unRegistry r
, x <- R.unExtensions ee ]
} where rs = R.unRegistry r | 855 | false | true | 0 | 18 | 213 | 383 | 194 | 189 | null | null |
CulpaBS/wbBach | src/Language/Futhark/Attributes.hs | bsd-3-clause | -- | An empty array with the given row type.
emptyArray :: ArrayShape (shape vn) =>
TypeBase shape as vn -> Value
emptyArray = arrayValue [] | 154 | emptyArray :: ArrayShape (shape vn) =>
TypeBase shape as vn -> Value
emptyArray = arrayValue [] | 109 | emptyArray = arrayValue [] | 26 | true | true | 0 | 8 | 39 | 41 | 20 | 21 | null | null |
akamaus/gcodec | test/CNC/HCodeTests.hs | bsd-3-clause | hcode_samples = [ (hcode_prog1, "Example1"),
(hcode_prog2, "Example2"),
(hcode_if_loops, "if_loops - test for compound operators in if branches"),
(hcode_for, "for loop"),
(hcode_poligon, "Poligon drawer"),
(hcode_gwhile_break, "gwhile with break") ] | 310 | hcode_samples = [ (hcode_prog1, "Example1"),
(hcode_prog2, "Example2"),
(hcode_if_loops, "if_loops - test for compound operators in if branches"),
(hcode_for, "for loop"),
(hcode_poligon, "Poligon drawer"),
(hcode_gwhile_break, "gwhile with break") ] | 310 | hcode_samples = [ (hcode_prog1, "Example1"),
(hcode_prog2, "Example2"),
(hcode_if_loops, "if_loops - test for compound operators in if branches"),
(hcode_for, "for loop"),
(hcode_poligon, "Poligon drawer"),
(hcode_gwhile_break, "gwhile with break") ] | 310 | false | false | 0 | 6 | 87 | 60 | 39 | 21 | null | null |
dmjio/snaplet-typescript | src/Snap/Snaplet/TypeScript.hs | gpl-3.0 | typeScriptServe :: Handler b TypeScriptConf ()
typeScriptServe = do
modifyResponse . setContentType $ "text/javascript;charset=utf-8"
cfg <- get
requestedFile <- (srcDir cfg ++) . requestedTypeScriptFile .
BS.unpack . rqURI <$> getRequest
when (Development == compileMode cfg) $ liftIO $ compileFiles cfg [requestedFile]
serveDirectory $ destinationDir cfg
-- | Compiles the files that are being served, but ignores all other files. | 474 | typeScriptServe :: Handler b TypeScriptConf ()
typeScriptServe = do
modifyResponse . setContentType $ "text/javascript;charset=utf-8"
cfg <- get
requestedFile <- (srcDir cfg ++) . requestedTypeScriptFile .
BS.unpack . rqURI <$> getRequest
when (Development == compileMode cfg) $ liftIO $ compileFiles cfg [requestedFile]
serveDirectory $ destinationDir cfg
-- | Compiles the files that are being served, but ignores all other files. | 474 | typeScriptServe = do
modifyResponse . setContentType $ "text/javascript;charset=utf-8"
cfg <- get
requestedFile <- (srcDir cfg ++) . requestedTypeScriptFile .
BS.unpack . rqURI <$> getRequest
when (Development == compileMode cfg) $ liftIO $ compileFiles cfg [requestedFile]
serveDirectory $ destinationDir cfg
-- | Compiles the files that are being served, but ignores all other files. | 427 | false | true | 0 | 13 | 100 | 113 | 54 | 59 | null | null |
testexplode/testexplode | doc/examples/Te_LA.hs | lgpl-3.0 | -- enter SB
enterSBcode :: TeLACnf -> TeLAVars -> L.Text
enterSBcode cfg locals = [qc|
sendGKS(1, \{"Z"=> 3000\});
godistance(10);|] | 136 | enterSBcode :: TeLACnf -> TeLAVars -> L.Text
enterSBcode cfg locals = [qc|
sendGKS(1, \{"Z"=> 3000\});
godistance(10);|] | 124 | enterSBcode cfg locals = [qc|
sendGKS(1, \{"Z"=> 3000\});
godistance(10);|] | 79 | true | true | 0 | 9 | 22 | 37 | 19 | 18 | null | null |
ben-schulz/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp v (LSLe ATFloat) [l, r] = v ++ "FLOATBOP(<=," ++ creg l ++ ", " ++ creg r ++ ")" | 85 | doOp v (LSLe ATFloat) [l, r] = v ++ "FLOATBOP(<=," ++ creg l ++ ", " ++ creg r ++ ")" | 85 | doOp v (LSLe ATFloat) [l, r] = v ++ "FLOATBOP(<=," ++ creg l ++ ", " ++ creg r ++ ")" | 85 | false | false | 0 | 9 | 20 | 54 | 25 | 29 | null | null |
m4lvin/HasCacBDD | hs/Data/HasCacBDD.hs | gpl-2.0 | ravel (Var n nthen nelse) = ifthenelse (var n) (ravel nthen) (ravel nelse) | 74 | ravel (Var n nthen nelse) = ifthenelse (var n) (ravel nthen) (ravel nelse) | 74 | ravel (Var n nthen nelse) = ifthenelse (var n) (ravel nthen) (ravel nelse) | 74 | false | false | 0 | 7 | 12 | 45 | 21 | 24 | null | null |
shlevy/ghc | compiler/nativeGen/PPC/CodeGen.hs | bsd-3-clause | genCCall target dest_regs argsAndHints
= do dflags <- getDynFlags
let platform = targetPlatform dflags
case target of
PrimTarget (MO_S_QuotRem width) -> divOp1 platform True width
dest_regs argsAndHints
PrimTarget (MO_U_QuotRem width) -> divOp1 platform False width
dest_regs argsAndHints
PrimTarget (MO_U_QuotRem2 width) -> divOp2 platform width dest_regs
argsAndHints
PrimTarget (MO_U_Mul2 width) -> multOp2 platform width dest_regs
argsAndHints
PrimTarget (MO_Add2 _) -> add2Op platform dest_regs argsAndHints
PrimTarget (MO_SubWordC _) -> subcOp platform dest_regs argsAndHints
PrimTarget (MO_AddIntC width) -> addSubCOp ADDO platform width
dest_regs argsAndHints
PrimTarget (MO_SubIntC width) -> addSubCOp SUBFO platform width
dest_regs argsAndHints
PrimTarget MO_F64_Fabs -> fabs platform dest_regs argsAndHints
PrimTarget MO_F32_Fabs -> fabs platform dest_regs argsAndHints
_ -> genCCall' dflags (platformToGCP platform)
target dest_regs argsAndHints
where divOp1 platform signed width [res_q, res_r] [arg_x, arg_y]
= do let reg_q = getRegisterReg platform (CmmLocal res_q)
reg_r = getRegisterReg platform (CmmLocal res_r)
fmt = intFormat width
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ DIV fmt signed reg_q x_reg y_reg
, MULL fmt reg_r reg_q (RIReg y_reg)
, SUBF reg_r reg_r x_reg
]
divOp1 _ _ _ _ _
= panic "genCCall: Wrong number of arguments for divOp1"
divOp2 platform width [res_q, res_r]
[arg_x_high, arg_x_low, arg_y]
= do let reg_q = getRegisterReg platform (CmmLocal res_q)
reg_r = getRegisterReg platform (CmmLocal res_r)
fmt = intFormat width
half = 4 * (formatInBytes fmt)
(xh_reg, xh_code) <- getSomeReg arg_x_high
(xl_reg, xl_code) <- getSomeReg arg_x_low
(y_reg, y_code) <- getSomeReg arg_y
s <- getNewRegNat fmt
b <- getNewRegNat fmt
v <- getNewRegNat fmt
vn1 <- getNewRegNat fmt
vn0 <- getNewRegNat fmt
un32 <- getNewRegNat fmt
tmp <- getNewRegNat fmt
un10 <- getNewRegNat fmt
un1 <- getNewRegNat fmt
un0 <- getNewRegNat fmt
q1 <- getNewRegNat fmt
rhat <- getNewRegNat fmt
tmp1 <- getNewRegNat fmt
q0 <- getNewRegNat fmt
un21 <- getNewRegNat fmt
again1 <- getBlockIdNat
no1 <- getBlockIdNat
then1 <- getBlockIdNat
endif1 <- getBlockIdNat
again2 <- getBlockIdNat
no2 <- getBlockIdNat
then2 <- getBlockIdNat
endif2 <- getBlockIdNat
return $ y_code `appOL` xl_code `appOL` xh_code `appOL`
-- see Hacker's Delight p 196 Figure 9-3
toOL [ -- b = 2 ^ (bits_in_word / 2)
LI b (ImmInt 1)
, SL fmt b b (RIImm (ImmInt half))
-- s = clz(y)
, CNTLZ fmt s y_reg
-- v = y << s
, SL fmt v y_reg (RIReg s)
-- vn1 = upper half of v
, SR fmt vn1 v (RIImm (ImmInt half))
-- vn0 = lower half of v
, CLRLI fmt vn0 v half
-- un32 = (u1 << s)
-- | (u0 >> (bits_in_word - s))
, SL fmt un32 xh_reg (RIReg s)
, SUBFC tmp s
(RIImm (ImmInt (8 * formatInBytes fmt)))
, SR fmt tmp xl_reg (RIReg tmp)
, OR un32 un32 (RIReg tmp)
-- un10 = u0 << s
, SL fmt un10 xl_reg (RIReg s)
-- un1 = upper half of un10
, SR fmt un1 un10 (RIImm (ImmInt half))
-- un0 = lower half of un10
, CLRLI fmt un0 un10 half
-- q1 = un32/vn1
, DIV fmt False q1 un32 vn1
-- rhat = un32 - q1*vn1
, MULL fmt tmp q1 (RIReg vn1)
, SUBF rhat tmp un32
, BCC ALWAYS again1 Nothing
, NEWBLOCK again1
-- if (q1 >= b || q1*vn0 > b*rhat + un1)
, CMPL fmt q1 (RIReg b)
, BCC GEU then1 Nothing
, BCC ALWAYS no1 Nothing
, NEWBLOCK no1
, MULL fmt tmp q1 (RIReg vn0)
, SL fmt tmp1 rhat (RIImm (ImmInt half))
, ADD tmp1 tmp1 (RIReg un1)
, CMPL fmt tmp (RIReg tmp1)
, BCC LEU endif1 Nothing
, BCC ALWAYS then1 Nothing
, NEWBLOCK then1
-- q1 = q1 - 1
, ADD q1 q1 (RIImm (ImmInt (-1)))
-- rhat = rhat + vn1
, ADD rhat rhat (RIReg vn1)
-- if (rhat < b) goto again1
, CMPL fmt rhat (RIReg b)
, BCC LTT again1 Nothing
, BCC ALWAYS endif1 Nothing
, NEWBLOCK endif1
-- un21 = un32*b + un1 - q1*v
, SL fmt un21 un32 (RIImm (ImmInt half))
, ADD un21 un21 (RIReg un1)
, MULL fmt tmp q1 (RIReg v)
, SUBF un21 tmp un21
-- compute second quotient digit
-- q0 = un21/vn1
, DIV fmt False q0 un21 vn1
-- rhat = un21- q0*vn1
, MULL fmt tmp q0 (RIReg vn1)
, SUBF rhat tmp un21
, BCC ALWAYS again2 Nothing
, NEWBLOCK again2
-- if (q0>b || q0*vn0 > b*rhat + un0)
, CMPL fmt q0 (RIReg b)
, BCC GEU then2 Nothing
, BCC ALWAYS no2 Nothing
, NEWBLOCK no2
, MULL fmt tmp q0 (RIReg vn0)
, SL fmt tmp1 rhat (RIImm (ImmInt half))
, ADD tmp1 tmp1 (RIReg un0)
, CMPL fmt tmp (RIReg tmp1)
, BCC LEU endif2 Nothing
, BCC ALWAYS then2 Nothing
, NEWBLOCK then2
-- q0 = q0 - 1
, ADD q0 q0 (RIImm (ImmInt (-1)))
-- rhat = rhat + vn1
, ADD rhat rhat (RIReg vn1)
-- if (rhat<b) goto again2
, CMPL fmt rhat (RIReg b)
, BCC LTT again2 Nothing
, BCC ALWAYS endif2 Nothing
, NEWBLOCK endif2
-- compute remainder
-- r = (un21*b + un0 - q0*v) >> s
, SL fmt reg_r un21 (RIImm (ImmInt half))
, ADD reg_r reg_r (RIReg un0)
, MULL fmt tmp q0 (RIReg v)
, SUBF reg_r tmp reg_r
, SR fmt reg_r reg_r (RIReg s)
-- compute quotient
-- q = q1*b + q0
, SL fmt reg_q q1 (RIImm (ImmInt half))
, ADD reg_q reg_q (RIReg q0)
]
divOp2 _ _ _ _
= panic "genCCall: Wrong number of arguments for divOp2"
multOp2 platform width [res_h, res_l] [arg_x, arg_y]
= do let reg_h = getRegisterReg platform (CmmLocal res_h)
reg_l = getRegisterReg platform (CmmLocal res_l)
fmt = intFormat width
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ MULL fmt reg_l x_reg (RIReg y_reg)
, MULHU fmt reg_h x_reg y_reg
]
multOp2 _ _ _ _
= panic "genCall: Wrong number of arguments for multOp2"
add2Op platform [res_h, res_l] [arg_x, arg_y]
= do let reg_h = getRegisterReg platform (CmmLocal res_h)
reg_l = getRegisterReg platform (CmmLocal res_l)
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ LI reg_h (ImmInt 0)
, ADDC reg_l x_reg y_reg
, ADDZE reg_h reg_h
]
add2Op _ _ _
= panic "genCCall: Wrong number of arguments/results for add2"
-- PowerPC subfc sets the carry for rT = ~(rA) + rB + 1,
-- which is 0 for borrow and 1 otherwise. We need 1 and 0
-- so xor with 1.
subcOp platform [res_r, res_c] [arg_x, arg_y]
= do let reg_r = getRegisterReg platform (CmmLocal res_r)
reg_c = getRegisterReg platform (CmmLocal res_c)
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ LI reg_c (ImmInt 0)
, SUBFC reg_r y_reg (RIReg x_reg)
, ADDZE reg_c reg_c
, XOR reg_c reg_c (RIImm (ImmInt 1))
]
subcOp _ _ _
= panic "genCCall: Wrong number of arguments/results for subc"
addSubCOp instr platform width [res_r, res_c] [arg_x, arg_y]
= do let reg_r = getRegisterReg platform (CmmLocal res_r)
reg_c = getRegisterReg platform (CmmLocal res_c)
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ instr reg_r y_reg x_reg,
-- SUBFO argument order reversed!
MFOV (intFormat width) reg_c
]
addSubCOp _ _ _ _ _
= panic "genCall: Wrong number of arguments/results for addC"
fabs platform [res] [arg]
= do let res_r = getRegisterReg platform (CmmLocal res)
(arg_reg, arg_code) <- getSomeReg arg
return $ arg_code `snocOL` FABS res_r arg_reg
fabs _ _ _
= panic "genCall: Wrong number of arguments/results for fabs"
-- TODO: replace 'Int' by an enum such as 'PPC_64ABI' | 13,659 | genCCall target dest_regs argsAndHints
= do dflags <- getDynFlags
let platform = targetPlatform dflags
case target of
PrimTarget (MO_S_QuotRem width) -> divOp1 platform True width
dest_regs argsAndHints
PrimTarget (MO_U_QuotRem width) -> divOp1 platform False width
dest_regs argsAndHints
PrimTarget (MO_U_QuotRem2 width) -> divOp2 platform width dest_regs
argsAndHints
PrimTarget (MO_U_Mul2 width) -> multOp2 platform width dest_regs
argsAndHints
PrimTarget (MO_Add2 _) -> add2Op platform dest_regs argsAndHints
PrimTarget (MO_SubWordC _) -> subcOp platform dest_regs argsAndHints
PrimTarget (MO_AddIntC width) -> addSubCOp ADDO platform width
dest_regs argsAndHints
PrimTarget (MO_SubIntC width) -> addSubCOp SUBFO platform width
dest_regs argsAndHints
PrimTarget MO_F64_Fabs -> fabs platform dest_regs argsAndHints
PrimTarget MO_F32_Fabs -> fabs platform dest_regs argsAndHints
_ -> genCCall' dflags (platformToGCP platform)
target dest_regs argsAndHints
where divOp1 platform signed width [res_q, res_r] [arg_x, arg_y]
= do let reg_q = getRegisterReg platform (CmmLocal res_q)
reg_r = getRegisterReg platform (CmmLocal res_r)
fmt = intFormat width
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ DIV fmt signed reg_q x_reg y_reg
, MULL fmt reg_r reg_q (RIReg y_reg)
, SUBF reg_r reg_r x_reg
]
divOp1 _ _ _ _ _
= panic "genCCall: Wrong number of arguments for divOp1"
divOp2 platform width [res_q, res_r]
[arg_x_high, arg_x_low, arg_y]
= do let reg_q = getRegisterReg platform (CmmLocal res_q)
reg_r = getRegisterReg platform (CmmLocal res_r)
fmt = intFormat width
half = 4 * (formatInBytes fmt)
(xh_reg, xh_code) <- getSomeReg arg_x_high
(xl_reg, xl_code) <- getSomeReg arg_x_low
(y_reg, y_code) <- getSomeReg arg_y
s <- getNewRegNat fmt
b <- getNewRegNat fmt
v <- getNewRegNat fmt
vn1 <- getNewRegNat fmt
vn0 <- getNewRegNat fmt
un32 <- getNewRegNat fmt
tmp <- getNewRegNat fmt
un10 <- getNewRegNat fmt
un1 <- getNewRegNat fmt
un0 <- getNewRegNat fmt
q1 <- getNewRegNat fmt
rhat <- getNewRegNat fmt
tmp1 <- getNewRegNat fmt
q0 <- getNewRegNat fmt
un21 <- getNewRegNat fmt
again1 <- getBlockIdNat
no1 <- getBlockIdNat
then1 <- getBlockIdNat
endif1 <- getBlockIdNat
again2 <- getBlockIdNat
no2 <- getBlockIdNat
then2 <- getBlockIdNat
endif2 <- getBlockIdNat
return $ y_code `appOL` xl_code `appOL` xh_code `appOL`
-- see Hacker's Delight p 196 Figure 9-3
toOL [ -- b = 2 ^ (bits_in_word / 2)
LI b (ImmInt 1)
, SL fmt b b (RIImm (ImmInt half))
-- s = clz(y)
, CNTLZ fmt s y_reg
-- v = y << s
, SL fmt v y_reg (RIReg s)
-- vn1 = upper half of v
, SR fmt vn1 v (RIImm (ImmInt half))
-- vn0 = lower half of v
, CLRLI fmt vn0 v half
-- un32 = (u1 << s)
-- | (u0 >> (bits_in_word - s))
, SL fmt un32 xh_reg (RIReg s)
, SUBFC tmp s
(RIImm (ImmInt (8 * formatInBytes fmt)))
, SR fmt tmp xl_reg (RIReg tmp)
, OR un32 un32 (RIReg tmp)
-- un10 = u0 << s
, SL fmt un10 xl_reg (RIReg s)
-- un1 = upper half of un10
, SR fmt un1 un10 (RIImm (ImmInt half))
-- un0 = lower half of un10
, CLRLI fmt un0 un10 half
-- q1 = un32/vn1
, DIV fmt False q1 un32 vn1
-- rhat = un32 - q1*vn1
, MULL fmt tmp q1 (RIReg vn1)
, SUBF rhat tmp un32
, BCC ALWAYS again1 Nothing
, NEWBLOCK again1
-- if (q1 >= b || q1*vn0 > b*rhat + un1)
, CMPL fmt q1 (RIReg b)
, BCC GEU then1 Nothing
, BCC ALWAYS no1 Nothing
, NEWBLOCK no1
, MULL fmt tmp q1 (RIReg vn0)
, SL fmt tmp1 rhat (RIImm (ImmInt half))
, ADD tmp1 tmp1 (RIReg un1)
, CMPL fmt tmp (RIReg tmp1)
, BCC LEU endif1 Nothing
, BCC ALWAYS then1 Nothing
, NEWBLOCK then1
-- q1 = q1 - 1
, ADD q1 q1 (RIImm (ImmInt (-1)))
-- rhat = rhat + vn1
, ADD rhat rhat (RIReg vn1)
-- if (rhat < b) goto again1
, CMPL fmt rhat (RIReg b)
, BCC LTT again1 Nothing
, BCC ALWAYS endif1 Nothing
, NEWBLOCK endif1
-- un21 = un32*b + un1 - q1*v
, SL fmt un21 un32 (RIImm (ImmInt half))
, ADD un21 un21 (RIReg un1)
, MULL fmt tmp q1 (RIReg v)
, SUBF un21 tmp un21
-- compute second quotient digit
-- q0 = un21/vn1
, DIV fmt False q0 un21 vn1
-- rhat = un21- q0*vn1
, MULL fmt tmp q0 (RIReg vn1)
, SUBF rhat tmp un21
, BCC ALWAYS again2 Nothing
, NEWBLOCK again2
-- if (q0>b || q0*vn0 > b*rhat + un0)
, CMPL fmt q0 (RIReg b)
, BCC GEU then2 Nothing
, BCC ALWAYS no2 Nothing
, NEWBLOCK no2
, MULL fmt tmp q0 (RIReg vn0)
, SL fmt tmp1 rhat (RIImm (ImmInt half))
, ADD tmp1 tmp1 (RIReg un0)
, CMPL fmt tmp (RIReg tmp1)
, BCC LEU endif2 Nothing
, BCC ALWAYS then2 Nothing
, NEWBLOCK then2
-- q0 = q0 - 1
, ADD q0 q0 (RIImm (ImmInt (-1)))
-- rhat = rhat + vn1
, ADD rhat rhat (RIReg vn1)
-- if (rhat<b) goto again2
, CMPL fmt rhat (RIReg b)
, BCC LTT again2 Nothing
, BCC ALWAYS endif2 Nothing
, NEWBLOCK endif2
-- compute remainder
-- r = (un21*b + un0 - q0*v) >> s
, SL fmt reg_r un21 (RIImm (ImmInt half))
, ADD reg_r reg_r (RIReg un0)
, MULL fmt tmp q0 (RIReg v)
, SUBF reg_r tmp reg_r
, SR fmt reg_r reg_r (RIReg s)
-- compute quotient
-- q = q1*b + q0
, SL fmt reg_q q1 (RIImm (ImmInt half))
, ADD reg_q reg_q (RIReg q0)
]
divOp2 _ _ _ _
= panic "genCCall: Wrong number of arguments for divOp2"
multOp2 platform width [res_h, res_l] [arg_x, arg_y]
= do let reg_h = getRegisterReg platform (CmmLocal res_h)
reg_l = getRegisterReg platform (CmmLocal res_l)
fmt = intFormat width
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ MULL fmt reg_l x_reg (RIReg y_reg)
, MULHU fmt reg_h x_reg y_reg
]
multOp2 _ _ _ _
= panic "genCall: Wrong number of arguments for multOp2"
add2Op platform [res_h, res_l] [arg_x, arg_y]
= do let reg_h = getRegisterReg platform (CmmLocal res_h)
reg_l = getRegisterReg platform (CmmLocal res_l)
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ LI reg_h (ImmInt 0)
, ADDC reg_l x_reg y_reg
, ADDZE reg_h reg_h
]
add2Op _ _ _
= panic "genCCall: Wrong number of arguments/results for add2"
-- PowerPC subfc sets the carry for rT = ~(rA) + rB + 1,
-- which is 0 for borrow and 1 otherwise. We need 1 and 0
-- so xor with 1.
subcOp platform [res_r, res_c] [arg_x, arg_y]
= do let reg_r = getRegisterReg platform (CmmLocal res_r)
reg_c = getRegisterReg platform (CmmLocal res_c)
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ LI reg_c (ImmInt 0)
, SUBFC reg_r y_reg (RIReg x_reg)
, ADDZE reg_c reg_c
, XOR reg_c reg_c (RIImm (ImmInt 1))
]
subcOp _ _ _
= panic "genCCall: Wrong number of arguments/results for subc"
addSubCOp instr platform width [res_r, res_c] [arg_x, arg_y]
= do let reg_r = getRegisterReg platform (CmmLocal res_r)
reg_c = getRegisterReg platform (CmmLocal res_c)
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ instr reg_r y_reg x_reg,
-- SUBFO argument order reversed!
MFOV (intFormat width) reg_c
]
addSubCOp _ _ _ _ _
= panic "genCall: Wrong number of arguments/results for addC"
fabs platform [res] [arg]
= do let res_r = getRegisterReg platform (CmmLocal res)
(arg_reg, arg_code) <- getSomeReg arg
return $ arg_code `snocOL` FABS res_r arg_reg
fabs _ _ _
= panic "genCall: Wrong number of arguments/results for fabs"
-- TODO: replace 'Int' by an enum such as 'PPC_64ABI' | 13,659 | genCCall target dest_regs argsAndHints
= do dflags <- getDynFlags
let platform = targetPlatform dflags
case target of
PrimTarget (MO_S_QuotRem width) -> divOp1 platform True width
dest_regs argsAndHints
PrimTarget (MO_U_QuotRem width) -> divOp1 platform False width
dest_regs argsAndHints
PrimTarget (MO_U_QuotRem2 width) -> divOp2 platform width dest_regs
argsAndHints
PrimTarget (MO_U_Mul2 width) -> multOp2 platform width dest_regs
argsAndHints
PrimTarget (MO_Add2 _) -> add2Op platform dest_regs argsAndHints
PrimTarget (MO_SubWordC _) -> subcOp platform dest_regs argsAndHints
PrimTarget (MO_AddIntC width) -> addSubCOp ADDO platform width
dest_regs argsAndHints
PrimTarget (MO_SubIntC width) -> addSubCOp SUBFO platform width
dest_regs argsAndHints
PrimTarget MO_F64_Fabs -> fabs platform dest_regs argsAndHints
PrimTarget MO_F32_Fabs -> fabs platform dest_regs argsAndHints
_ -> genCCall' dflags (platformToGCP platform)
target dest_regs argsAndHints
where divOp1 platform signed width [res_q, res_r] [arg_x, arg_y]
= do let reg_q = getRegisterReg platform (CmmLocal res_q)
reg_r = getRegisterReg platform (CmmLocal res_r)
fmt = intFormat width
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ DIV fmt signed reg_q x_reg y_reg
, MULL fmt reg_r reg_q (RIReg y_reg)
, SUBF reg_r reg_r x_reg
]
divOp1 _ _ _ _ _
= panic "genCCall: Wrong number of arguments for divOp1"
divOp2 platform width [res_q, res_r]
[arg_x_high, arg_x_low, arg_y]
= do let reg_q = getRegisterReg platform (CmmLocal res_q)
reg_r = getRegisterReg platform (CmmLocal res_r)
fmt = intFormat width
half = 4 * (formatInBytes fmt)
(xh_reg, xh_code) <- getSomeReg arg_x_high
(xl_reg, xl_code) <- getSomeReg arg_x_low
(y_reg, y_code) <- getSomeReg arg_y
s <- getNewRegNat fmt
b <- getNewRegNat fmt
v <- getNewRegNat fmt
vn1 <- getNewRegNat fmt
vn0 <- getNewRegNat fmt
un32 <- getNewRegNat fmt
tmp <- getNewRegNat fmt
un10 <- getNewRegNat fmt
un1 <- getNewRegNat fmt
un0 <- getNewRegNat fmt
q1 <- getNewRegNat fmt
rhat <- getNewRegNat fmt
tmp1 <- getNewRegNat fmt
q0 <- getNewRegNat fmt
un21 <- getNewRegNat fmt
again1 <- getBlockIdNat
no1 <- getBlockIdNat
then1 <- getBlockIdNat
endif1 <- getBlockIdNat
again2 <- getBlockIdNat
no2 <- getBlockIdNat
then2 <- getBlockIdNat
endif2 <- getBlockIdNat
return $ y_code `appOL` xl_code `appOL` xh_code `appOL`
-- see Hacker's Delight p 196 Figure 9-3
toOL [ -- b = 2 ^ (bits_in_word / 2)
LI b (ImmInt 1)
, SL fmt b b (RIImm (ImmInt half))
-- s = clz(y)
, CNTLZ fmt s y_reg
-- v = y << s
, SL fmt v y_reg (RIReg s)
-- vn1 = upper half of v
, SR fmt vn1 v (RIImm (ImmInt half))
-- vn0 = lower half of v
, CLRLI fmt vn0 v half
-- un32 = (u1 << s)
-- | (u0 >> (bits_in_word - s))
, SL fmt un32 xh_reg (RIReg s)
, SUBFC tmp s
(RIImm (ImmInt (8 * formatInBytes fmt)))
, SR fmt tmp xl_reg (RIReg tmp)
, OR un32 un32 (RIReg tmp)
-- un10 = u0 << s
, SL fmt un10 xl_reg (RIReg s)
-- un1 = upper half of un10
, SR fmt un1 un10 (RIImm (ImmInt half))
-- un0 = lower half of un10
, CLRLI fmt un0 un10 half
-- q1 = un32/vn1
, DIV fmt False q1 un32 vn1
-- rhat = un32 - q1*vn1
, MULL fmt tmp q1 (RIReg vn1)
, SUBF rhat tmp un32
, BCC ALWAYS again1 Nothing
, NEWBLOCK again1
-- if (q1 >= b || q1*vn0 > b*rhat + un1)
, CMPL fmt q1 (RIReg b)
, BCC GEU then1 Nothing
, BCC ALWAYS no1 Nothing
, NEWBLOCK no1
, MULL fmt tmp q1 (RIReg vn0)
, SL fmt tmp1 rhat (RIImm (ImmInt half))
, ADD tmp1 tmp1 (RIReg un1)
, CMPL fmt tmp (RIReg tmp1)
, BCC LEU endif1 Nothing
, BCC ALWAYS then1 Nothing
, NEWBLOCK then1
-- q1 = q1 - 1
, ADD q1 q1 (RIImm (ImmInt (-1)))
-- rhat = rhat + vn1
, ADD rhat rhat (RIReg vn1)
-- if (rhat < b) goto again1
, CMPL fmt rhat (RIReg b)
, BCC LTT again1 Nothing
, BCC ALWAYS endif1 Nothing
, NEWBLOCK endif1
-- un21 = un32*b + un1 - q1*v
, SL fmt un21 un32 (RIImm (ImmInt half))
, ADD un21 un21 (RIReg un1)
, MULL fmt tmp q1 (RIReg v)
, SUBF un21 tmp un21
-- compute second quotient digit
-- q0 = un21/vn1
, DIV fmt False q0 un21 vn1
-- rhat = un21- q0*vn1
, MULL fmt tmp q0 (RIReg vn1)
, SUBF rhat tmp un21
, BCC ALWAYS again2 Nothing
, NEWBLOCK again2
-- if (q0>b || q0*vn0 > b*rhat + un0)
, CMPL fmt q0 (RIReg b)
, BCC GEU then2 Nothing
, BCC ALWAYS no2 Nothing
, NEWBLOCK no2
, MULL fmt tmp q0 (RIReg vn0)
, SL fmt tmp1 rhat (RIImm (ImmInt half))
, ADD tmp1 tmp1 (RIReg un0)
, CMPL fmt tmp (RIReg tmp1)
, BCC LEU endif2 Nothing
, BCC ALWAYS then2 Nothing
, NEWBLOCK then2
-- q0 = q0 - 1
, ADD q0 q0 (RIImm (ImmInt (-1)))
-- rhat = rhat + vn1
, ADD rhat rhat (RIReg vn1)
-- if (rhat<b) goto again2
, CMPL fmt rhat (RIReg b)
, BCC LTT again2 Nothing
, BCC ALWAYS endif2 Nothing
, NEWBLOCK endif2
-- compute remainder
-- r = (un21*b + un0 - q0*v) >> s
, SL fmt reg_r un21 (RIImm (ImmInt half))
, ADD reg_r reg_r (RIReg un0)
, MULL fmt tmp q0 (RIReg v)
, SUBF reg_r tmp reg_r
, SR fmt reg_r reg_r (RIReg s)
-- compute quotient
-- q = q1*b + q0
, SL fmt reg_q q1 (RIImm (ImmInt half))
, ADD reg_q reg_q (RIReg q0)
]
divOp2 _ _ _ _
= panic "genCCall: Wrong number of arguments for divOp2"
multOp2 platform width [res_h, res_l] [arg_x, arg_y]
= do let reg_h = getRegisterReg platform (CmmLocal res_h)
reg_l = getRegisterReg platform (CmmLocal res_l)
fmt = intFormat width
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ MULL fmt reg_l x_reg (RIReg y_reg)
, MULHU fmt reg_h x_reg y_reg
]
multOp2 _ _ _ _
= panic "genCall: Wrong number of arguments for multOp2"
add2Op platform [res_h, res_l] [arg_x, arg_y]
= do let reg_h = getRegisterReg platform (CmmLocal res_h)
reg_l = getRegisterReg platform (CmmLocal res_l)
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ LI reg_h (ImmInt 0)
, ADDC reg_l x_reg y_reg
, ADDZE reg_h reg_h
]
add2Op _ _ _
= panic "genCCall: Wrong number of arguments/results for add2"
-- PowerPC subfc sets the carry for rT = ~(rA) + rB + 1,
-- which is 0 for borrow and 1 otherwise. We need 1 and 0
-- so xor with 1.
subcOp platform [res_r, res_c] [arg_x, arg_y]
= do let reg_r = getRegisterReg platform (CmmLocal res_r)
reg_c = getRegisterReg platform (CmmLocal res_c)
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ LI reg_c (ImmInt 0)
, SUBFC reg_r y_reg (RIReg x_reg)
, ADDZE reg_c reg_c
, XOR reg_c reg_c (RIImm (ImmInt 1))
]
subcOp _ _ _
= panic "genCCall: Wrong number of arguments/results for subc"
addSubCOp instr platform width [res_r, res_c] [arg_x, arg_y]
= do let reg_r = getRegisterReg platform (CmmLocal res_r)
reg_c = getRegisterReg platform (CmmLocal res_c)
(x_reg, x_code) <- getSomeReg arg_x
(y_reg, y_code) <- getSomeReg arg_y
return $ y_code `appOL` x_code
`appOL` toOL [ instr reg_r y_reg x_reg,
-- SUBFO argument order reversed!
MFOV (intFormat width) reg_c
]
addSubCOp _ _ _ _ _
= panic "genCall: Wrong number of arguments/results for addC"
fabs platform [res] [arg]
= do let res_r = getRegisterReg platform (CmmLocal res)
(arg_reg, arg_code) <- getSomeReg arg
return $ arg_code `snocOL` FABS res_r arg_reg
fabs _ _ _
= panic "genCall: Wrong number of arguments/results for fabs"
-- TODO: replace 'Int' by an enum such as 'PPC_64ABI' | 13,659 | false | false | 11 | 17 | 7,692 | 2,697 | 1,326 | 1,371 | null | null |
robstewart57/ripl | src/SkeletonTemplates/IUnzipFilter2D.hs | bsd-3-clause | topRightAction width = C.AnActn (C.ActnTagsStmts tag head stmts)
where
tag = C.ActnTagDecl [C.Ident "topRight"]
head =
C.ActnHeadGuardedVars
[streamInPattern]
[streamOutPattern "Out1"]
[guardExp]
localVars
guardExp = C.BEEQ (mkVar "midPtr") (mkInt (width - 1))
localVars =
C.LocVarsDecl
[ mkBufferIdxAssignment "p1" (identCalExp "idx")
, mkBufferIdxAssignment
"p2"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1)))
, mkBufferIdxAssignment
"p3"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1)))
, mkBufferIdxAssignment "p4" (identCalExp "idx")
, mkBufferIdxAssignment
"p5"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1)))
, mkBufferIdxAssignment
"p6"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1)))
, mkBufferIdxAssignment
"p7"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt width)))
, mkBufferIdxAssignment
"p8"
(findIndexFunc
(C.BEAdd (identCalExp "idx") (C.BEAdd (mkInt width) (mkInt 1))))
, mkBufferIdxAssignment
"p9"
(findIndexFunc
(C.BEAdd (identCalExp "idx") (C.BEAdd (mkInt width) (mkInt 2))))
, C.LocVarDecl
(C.VDeclExpIMut
(intCalType 16)
(C.Ident "v")
[]
(C.IdBrSExpCons
(C.Ident "applyKernel1")
(map
identCalExp
["p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9"])))
]
stmts =
[ arrayExpUpdate
"buffer"
(C.BExp (findIndexFunc (C.BEAdd (mkVar "idx") (mkVar "bufferSize"))))
("token")
, varIncr "consumed"
, varSetExp "idx" (findIndexFunc (C.BEAdd (mkVar "idx") (mkInt 1)))
, varSetInt "midPtr" 0
, varSetInt "processedRows" 1
, varNot "isEven"
] | 2,063 | topRightAction width = C.AnActn (C.ActnTagsStmts tag head stmts)
where
tag = C.ActnTagDecl [C.Ident "topRight"]
head =
C.ActnHeadGuardedVars
[streamInPattern]
[streamOutPattern "Out1"]
[guardExp]
localVars
guardExp = C.BEEQ (mkVar "midPtr") (mkInt (width - 1))
localVars =
C.LocVarsDecl
[ mkBufferIdxAssignment "p1" (identCalExp "idx")
, mkBufferIdxAssignment
"p2"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1)))
, mkBufferIdxAssignment
"p3"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1)))
, mkBufferIdxAssignment "p4" (identCalExp "idx")
, mkBufferIdxAssignment
"p5"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1)))
, mkBufferIdxAssignment
"p6"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1)))
, mkBufferIdxAssignment
"p7"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt width)))
, mkBufferIdxAssignment
"p8"
(findIndexFunc
(C.BEAdd (identCalExp "idx") (C.BEAdd (mkInt width) (mkInt 1))))
, mkBufferIdxAssignment
"p9"
(findIndexFunc
(C.BEAdd (identCalExp "idx") (C.BEAdd (mkInt width) (mkInt 2))))
, C.LocVarDecl
(C.VDeclExpIMut
(intCalType 16)
(C.Ident "v")
[]
(C.IdBrSExpCons
(C.Ident "applyKernel1")
(map
identCalExp
["p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9"])))
]
stmts =
[ arrayExpUpdate
"buffer"
(C.BExp (findIndexFunc (C.BEAdd (mkVar "idx") (mkVar "bufferSize"))))
("token")
, varIncr "consumed"
, varSetExp "idx" (findIndexFunc (C.BEAdd (mkVar "idx") (mkInt 1)))
, varSetInt "midPtr" 0
, varSetInt "processedRows" 1
, varNot "isEven"
] | 2,063 | topRightAction width = C.AnActn (C.ActnTagsStmts tag head stmts)
where
tag = C.ActnTagDecl [C.Ident "topRight"]
head =
C.ActnHeadGuardedVars
[streamInPattern]
[streamOutPattern "Out1"]
[guardExp]
localVars
guardExp = C.BEEQ (mkVar "midPtr") (mkInt (width - 1))
localVars =
C.LocVarsDecl
[ mkBufferIdxAssignment "p1" (identCalExp "idx")
, mkBufferIdxAssignment
"p2"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1)))
, mkBufferIdxAssignment
"p3"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1)))
, mkBufferIdxAssignment "p4" (identCalExp "idx")
, mkBufferIdxAssignment
"p5"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1)))
, mkBufferIdxAssignment
"p6"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt 1)))
, mkBufferIdxAssignment
"p7"
(findIndexFunc (C.BEAdd (identCalExp "idx") (mkInt width)))
, mkBufferIdxAssignment
"p8"
(findIndexFunc
(C.BEAdd (identCalExp "idx") (C.BEAdd (mkInt width) (mkInt 1))))
, mkBufferIdxAssignment
"p9"
(findIndexFunc
(C.BEAdd (identCalExp "idx") (C.BEAdd (mkInt width) (mkInt 2))))
, C.LocVarDecl
(C.VDeclExpIMut
(intCalType 16)
(C.Ident "v")
[]
(C.IdBrSExpCons
(C.Ident "applyKernel1")
(map
identCalExp
["p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9"])))
]
stmts =
[ arrayExpUpdate
"buffer"
(C.BExp (findIndexFunc (C.BEAdd (mkVar "idx") (mkVar "bufferSize"))))
("token")
, varIncr "consumed"
, varSetExp "idx" (findIndexFunc (C.BEAdd (mkVar "idx") (mkInt 1)))
, varSetInt "midPtr" 0
, varSetInt "processedRows" 1
, varNot "isEven"
] | 2,063 | false | false | 6 | 15 | 746 | 660 | 324 | 336 | null | null |
rueshyna/gogol | gogol-compute/gen/Network/Google/Compute/Types/Product.hs | mpl-2.0 | -- | [Output Only] Metadata about this warning in key: value format. For
-- example: \"data\": [ { \"key\": \"scope\", \"value\":
-- \"zones\/us-east1-d\" }
dslwData :: Lens' DisksScopedListWarning [DisksScopedListWarningDataItem]
dslwData
= lens _dslwData (\ s a -> s{_dslwData = a}) .
_Default
. _Coerce | 319 | dslwData :: Lens' DisksScopedListWarning [DisksScopedListWarningDataItem]
dslwData
= lens _dslwData (\ s a -> s{_dslwData = a}) .
_Default
. _Coerce | 162 | dslwData
= lens _dslwData (\ s a -> s{_dslwData = a}) .
_Default
. _Coerce | 88 | true | true | 2 | 9 | 57 | 60 | 30 | 30 | null | null |
glutamate/ig | src/Instagram/Types.hs | bsd-3-clause | -- | get client id in ByteString form
clientIDBS :: Credentials -> ByteString
clientIDBS=TE.encodeUtf8 . cClientID | 114 | clientIDBS :: Credentials -> ByteString
clientIDBS=TE.encodeUtf8 . cClientID | 76 | clientIDBS=TE.encodeUtf8 . cClientID | 36 | true | true | 0 | 6 | 15 | 22 | 12 | 10 | null | null |
MasseR/shoppinglist | Handler/HouseholdSettings.hs | bsd-2-clause | householdForm name = renderDivs $ HouseholdForm <$> areq textField "Name for the household" name | 96 | householdForm name = renderDivs $ HouseholdForm <$> areq textField "Name for the household" name | 96 | householdForm name = renderDivs $ HouseholdForm <$> areq textField "Name for the household" name | 96 | false | false | 0 | 6 | 13 | 24 | 11 | 13 | null | null |
phischu/bsprt | Main.hs | bsd-3-clause | cameraForward :: Camera -> Direction
cameraForward (Camera _ theta phi) = V3 (sin phi * sin theta) (sin theta) (cos phi * sin theta) | 132 | cameraForward :: Camera -> Direction
cameraForward (Camera _ theta phi) = V3 (sin phi * sin theta) (sin theta) (cos phi * sin theta) | 132 | cameraForward (Camera _ theta phi) = V3 (sin phi * sin theta) (sin theta) (cos phi * sin theta) | 95 | false | true | 0 | 9 | 23 | 72 | 33 | 39 | null | null |
tpsinnem/Idris-dev | src/Idris/Docstrings.hs | bsd-3-clause | -- | Check whether a docstring is emtpy
nullDocstring :: Docstring a -> Bool
nullDocstring (DocString _ blocks) = S.null blocks | 127 | nullDocstring :: Docstring a -> Bool
nullDocstring (DocString _ blocks) = S.null blocks | 87 | nullDocstring (DocString _ blocks) = S.null blocks | 50 | true | true | 0 | 7 | 20 | 35 | 17 | 18 | null | null |
jstolarek/ghc | compiler/nativeGen/RegAlloc/Linear/Main.hs | bsd-3-clause | newLocation :: SpillLoc -> RealReg -> Loc
-- if the tmp was read from a slot, then now its in a reg as well
newLocation (ReadMem slot) my_reg = InBoth my_reg slot | 162 | newLocation :: SpillLoc -> RealReg -> Loc
newLocation (ReadMem slot) my_reg = InBoth my_reg slot | 96 | newLocation (ReadMem slot) my_reg = InBoth my_reg slot | 54 | true | true | 0 | 10 | 31 | 41 | 19 | 22 | null | null |
guoguo12/haskell-ptable | ptable.hs | apache-2.0 | gnum "Eu" = -1 | 14 | gnum "Eu" = -1 | 14 | gnum "Eu" = -1 | 14 | false | false | 0 | 5 | 3 | 12 | 5 | 7 | null | null |
rimmington/cabal | cabal-install/Distribution/Client/Install.hs | bsd-3-clause | installUnpackedPackage
:: Verbosity
-> JobLimit
-> Lock
-> Int
-> LibraryName
-> SetupScriptOptions
-> InstallMisc
-> ConfigFlags
-> InstallFlags
-> HaddockFlags
-> CompilerInfo
-> Platform
-> PackageDescription
-> PackageDescriptionOverride
-> Maybe FilePath -- ^ Directory to change to before starting the installation.
-> UseLogFile -- ^ File to log output to (if any)
-> IO BuildResult
installUnpackedPackage verbosity buildLimit installLock numJobs libname
scriptOptions miscOptions
configFlags installFlags haddockFlags
cinfo platform pkg pkgoverride workingDir useLogFile = do
-- Override the .cabal file if necessary
case pkgoverride of
Nothing -> return ()
Just pkgtxt -> do
let descFilePath = fromMaybe "." workingDir
</> display (packageName pkgid) <.> "cabal"
info verbosity $
"Updating " ++ display (packageName pkgid) <.> "cabal"
++ " with the latest revision from the index."
writeFileAtomic descFilePath pkgtxt
-- Make sure that we pass --libsubdir etc to 'setup configure' (necessary if
-- the setup script was compiled against an old version of the Cabal lib).
configFlags' <- addDefaultInstallDirs configFlags
-- Filter out flags not supported by the old versions of the Cabal lib.
let configureFlags :: Version -> ConfigFlags
configureFlags = filterConfigureFlags configFlags' {
configVerbosity = toFlag verbosity'
}
-- Path to the optional log file.
mLogPath <- maybeLogPath
-- Configure phase
onFailure ConfigureFailed $ withJobLimit buildLimit $ do
when (numJobs > 1) $ notice verbosity $
"Configuring " ++ display pkgid ++ "..."
setup configureCommand configureFlags mLogPath
-- Build phase
onFailure BuildFailed $ do
when (numJobs > 1) $ notice verbosity $
"Building " ++ display pkgid ++ "..."
setup buildCommand' buildFlags mLogPath
-- Doc generation phase
docsResult <- if shouldHaddock
then (do setup haddockCommand haddockFlags' mLogPath
return DocsOk)
`catchIO` (\_ -> return DocsFailed)
`catchExit` (\_ -> return DocsFailed)
else return DocsNotTried
-- Tests phase
onFailure TestsFailed $ do
when (testsEnabled && PackageDescription.hasTests pkg) $
setup Cabal.testCommand testFlags mLogPath
let testsResult | testsEnabled = TestsOk
| otherwise = TestsNotTried
-- Install phase
onFailure InstallFailed $ criticalSection installLock $ do
-- Capture installed package configuration file
maybePkgConf <- maybeGenPkgConf mLogPath
-- Actual installation
withWin32SelfUpgrade verbosity libname configFlags
cinfo platform pkg $ do
case rootCmd miscOptions of
(Just cmd) -> reexec cmd
Nothing -> do
setup Cabal.copyCommand copyFlags mLogPath
when shouldRegister $ do
setup Cabal.registerCommand registerFlags mLogPath
return (Right (BuildOk docsResult testsResult maybePkgConf))
where
pkgid = packageId pkg
buildCommand' = buildCommand defaultProgramConfiguration
buildFlags _ = emptyBuildFlags {
buildDistPref = configDistPref configFlags,
buildVerbosity = toFlag verbosity'
}
shouldHaddock = fromFlag (installDocumentation installFlags)
haddockFlags' _ = haddockFlags {
haddockVerbosity = toFlag verbosity',
haddockDistPref = configDistPref configFlags
}
testsEnabled = fromFlag (configTests configFlags)
&& fromFlagOrDefault False (installRunTests installFlags)
testFlags _ = Cabal.emptyTestFlags {
Cabal.testDistPref = configDistPref configFlags
}
copyFlags _ = Cabal.emptyCopyFlags {
Cabal.copyDistPref = configDistPref configFlags,
Cabal.copyDest = toFlag InstallDirs.NoCopyDest,
Cabal.copyVerbosity = toFlag verbosity'
}
shouldRegister = PackageDescription.hasLibs pkg
registerFlags _ = Cabal.emptyRegisterFlags {
Cabal.regDistPref = configDistPref configFlags,
Cabal.regVerbosity = toFlag verbosity'
}
verbosity' = maybe verbosity snd useLogFile
tempTemplate name = name ++ "-" ++ display pkgid
addDefaultInstallDirs :: ConfigFlags -> IO ConfigFlags
addDefaultInstallDirs configFlags' = do
defInstallDirs <- InstallDirs.defaultInstallDirs flavor userInstall False
return $ configFlags' {
configInstallDirs = fmap Cabal.Flag .
InstallDirs.substituteInstallDirTemplates env $
InstallDirs.combineInstallDirs fromFlagOrDefault
defInstallDirs (configInstallDirs configFlags)
}
where
CompilerId flavor _ = compilerInfoId cinfo
env = initialPathTemplateEnv pkgid libname cinfo platform
userInstall = fromFlagOrDefault defaultUserInstall
(configUserInstall configFlags')
maybeGenPkgConf :: Maybe FilePath
-> IO (Maybe Installed.InstalledPackageInfo)
maybeGenPkgConf mLogPath =
if shouldRegister then do
tmp <- getTemporaryDirectory
withTempFile tmp (tempTemplate "pkgConf") $ \pkgConfFile handle -> do
hClose handle
let registerFlags' version = (registerFlags version) {
Cabal.regGenPkgConf = toFlag (Just pkgConfFile)
}
setup Cabal.registerCommand registerFlags' mLogPath
withUTF8FileContents pkgConfFile $ \pkgConfText ->
case Installed.parseInstalledPackageInfo pkgConfText of
Installed.ParseFailed perror -> pkgConfParseFailed perror
Installed.ParseOk warns pkgConf -> do
unless (null warns) $
warn verbosity $ unlines (map (showPWarning pkgConfFile) warns)
return (Just pkgConf)
else return Nothing
pkgConfParseFailed :: Installed.PError -> IO a
pkgConfParseFailed perror =
die $ "Couldn't parse the output of 'setup register --gen-pkg-config':"
++ show perror
maybeLogPath :: IO (Maybe FilePath)
maybeLogPath =
case useLogFile of
Nothing -> return Nothing
Just (mkLogFileName, _) -> do
let logFileName = mkLogFileName (packageId pkg) libname
logDir = takeDirectory logFileName
unless (null logDir) $ createDirectoryIfMissing True logDir
logFileExists <- doesFileExist logFileName
when logFileExists $ removeFile logFileName
return (Just logFileName)
setup cmd flags mLogPath =
Exception.bracket
(traverse (\path -> openFile path AppendMode) mLogPath)
(traverse_ hClose)
(\logFileHandle ->
setupWrapper verbosity
scriptOptions { useLoggingHandle = logFileHandle
, useWorkingDir = workingDir }
(Just pkg)
cmd flags [])
reexec cmd = do
-- look for our own executable file and re-exec ourselves using a helper
-- program like sudo to elevate privileges:
self <- getExecutablePath
weExist <- doesFileExist self
if weExist
then inDir workingDir $
rawSystemExit verbosity cmd
[self, "install", "--only"
,"--verbose=" ++ showForCabal verbosity]
else die $ "Unable to find cabal executable at: " ++ self
-- helper | 7,785 | installUnpackedPackage
:: Verbosity
-> JobLimit
-> Lock
-> Int
-> LibraryName
-> SetupScriptOptions
-> InstallMisc
-> ConfigFlags
-> InstallFlags
-> HaddockFlags
-> CompilerInfo
-> Platform
-> PackageDescription
-> PackageDescriptionOverride
-> Maybe FilePath -- ^ Directory to change to before starting the installation.
-> UseLogFile -- ^ File to log output to (if any)
-> IO BuildResult
installUnpackedPackage verbosity buildLimit installLock numJobs libname
scriptOptions miscOptions
configFlags installFlags haddockFlags
cinfo platform pkg pkgoverride workingDir useLogFile = do
-- Override the .cabal file if necessary
case pkgoverride of
Nothing -> return ()
Just pkgtxt -> do
let descFilePath = fromMaybe "." workingDir
</> display (packageName pkgid) <.> "cabal"
info verbosity $
"Updating " ++ display (packageName pkgid) <.> "cabal"
++ " with the latest revision from the index."
writeFileAtomic descFilePath pkgtxt
-- Make sure that we pass --libsubdir etc to 'setup configure' (necessary if
-- the setup script was compiled against an old version of the Cabal lib).
configFlags' <- addDefaultInstallDirs configFlags
-- Filter out flags not supported by the old versions of the Cabal lib.
let configureFlags :: Version -> ConfigFlags
configureFlags = filterConfigureFlags configFlags' {
configVerbosity = toFlag verbosity'
}
-- Path to the optional log file.
mLogPath <- maybeLogPath
-- Configure phase
onFailure ConfigureFailed $ withJobLimit buildLimit $ do
when (numJobs > 1) $ notice verbosity $
"Configuring " ++ display pkgid ++ "..."
setup configureCommand configureFlags mLogPath
-- Build phase
onFailure BuildFailed $ do
when (numJobs > 1) $ notice verbosity $
"Building " ++ display pkgid ++ "..."
setup buildCommand' buildFlags mLogPath
-- Doc generation phase
docsResult <- if shouldHaddock
then (do setup haddockCommand haddockFlags' mLogPath
return DocsOk)
`catchIO` (\_ -> return DocsFailed)
`catchExit` (\_ -> return DocsFailed)
else return DocsNotTried
-- Tests phase
onFailure TestsFailed $ do
when (testsEnabled && PackageDescription.hasTests pkg) $
setup Cabal.testCommand testFlags mLogPath
let testsResult | testsEnabled = TestsOk
| otherwise = TestsNotTried
-- Install phase
onFailure InstallFailed $ criticalSection installLock $ do
-- Capture installed package configuration file
maybePkgConf <- maybeGenPkgConf mLogPath
-- Actual installation
withWin32SelfUpgrade verbosity libname configFlags
cinfo platform pkg $ do
case rootCmd miscOptions of
(Just cmd) -> reexec cmd
Nothing -> do
setup Cabal.copyCommand copyFlags mLogPath
when shouldRegister $ do
setup Cabal.registerCommand registerFlags mLogPath
return (Right (BuildOk docsResult testsResult maybePkgConf))
where
pkgid = packageId pkg
buildCommand' = buildCommand defaultProgramConfiguration
buildFlags _ = emptyBuildFlags {
buildDistPref = configDistPref configFlags,
buildVerbosity = toFlag verbosity'
}
shouldHaddock = fromFlag (installDocumentation installFlags)
haddockFlags' _ = haddockFlags {
haddockVerbosity = toFlag verbosity',
haddockDistPref = configDistPref configFlags
}
testsEnabled = fromFlag (configTests configFlags)
&& fromFlagOrDefault False (installRunTests installFlags)
testFlags _ = Cabal.emptyTestFlags {
Cabal.testDistPref = configDistPref configFlags
}
copyFlags _ = Cabal.emptyCopyFlags {
Cabal.copyDistPref = configDistPref configFlags,
Cabal.copyDest = toFlag InstallDirs.NoCopyDest,
Cabal.copyVerbosity = toFlag verbosity'
}
shouldRegister = PackageDescription.hasLibs pkg
registerFlags _ = Cabal.emptyRegisterFlags {
Cabal.regDistPref = configDistPref configFlags,
Cabal.regVerbosity = toFlag verbosity'
}
verbosity' = maybe verbosity snd useLogFile
tempTemplate name = name ++ "-" ++ display pkgid
addDefaultInstallDirs :: ConfigFlags -> IO ConfigFlags
addDefaultInstallDirs configFlags' = do
defInstallDirs <- InstallDirs.defaultInstallDirs flavor userInstall False
return $ configFlags' {
configInstallDirs = fmap Cabal.Flag .
InstallDirs.substituteInstallDirTemplates env $
InstallDirs.combineInstallDirs fromFlagOrDefault
defInstallDirs (configInstallDirs configFlags)
}
where
CompilerId flavor _ = compilerInfoId cinfo
env = initialPathTemplateEnv pkgid libname cinfo platform
userInstall = fromFlagOrDefault defaultUserInstall
(configUserInstall configFlags')
maybeGenPkgConf :: Maybe FilePath
-> IO (Maybe Installed.InstalledPackageInfo)
maybeGenPkgConf mLogPath =
if shouldRegister then do
tmp <- getTemporaryDirectory
withTempFile tmp (tempTemplate "pkgConf") $ \pkgConfFile handle -> do
hClose handle
let registerFlags' version = (registerFlags version) {
Cabal.regGenPkgConf = toFlag (Just pkgConfFile)
}
setup Cabal.registerCommand registerFlags' mLogPath
withUTF8FileContents pkgConfFile $ \pkgConfText ->
case Installed.parseInstalledPackageInfo pkgConfText of
Installed.ParseFailed perror -> pkgConfParseFailed perror
Installed.ParseOk warns pkgConf -> do
unless (null warns) $
warn verbosity $ unlines (map (showPWarning pkgConfFile) warns)
return (Just pkgConf)
else return Nothing
pkgConfParseFailed :: Installed.PError -> IO a
pkgConfParseFailed perror =
die $ "Couldn't parse the output of 'setup register --gen-pkg-config':"
++ show perror
maybeLogPath :: IO (Maybe FilePath)
maybeLogPath =
case useLogFile of
Nothing -> return Nothing
Just (mkLogFileName, _) -> do
let logFileName = mkLogFileName (packageId pkg) libname
logDir = takeDirectory logFileName
unless (null logDir) $ createDirectoryIfMissing True logDir
logFileExists <- doesFileExist logFileName
when logFileExists $ removeFile logFileName
return (Just logFileName)
setup cmd flags mLogPath =
Exception.bracket
(traverse (\path -> openFile path AppendMode) mLogPath)
(traverse_ hClose)
(\logFileHandle ->
setupWrapper verbosity
scriptOptions { useLoggingHandle = logFileHandle
, useWorkingDir = workingDir }
(Just pkg)
cmd flags [])
reexec cmd = do
-- look for our own executable file and re-exec ourselves using a helper
-- program like sudo to elevate privileges:
self <- getExecutablePath
weExist <- doesFileExist self
if weExist
then inDir workingDir $
rawSystemExit verbosity cmd
[self, "install", "--only"
,"--verbose=" ++ showForCabal verbosity]
else die $ "Unable to find cabal executable at: " ++ self
-- helper | 7,785 | installUnpackedPackage verbosity buildLimit installLock numJobs libname
scriptOptions miscOptions
configFlags installFlags haddockFlags
cinfo platform pkg pkgoverride workingDir useLogFile = do
-- Override the .cabal file if necessary
case pkgoverride of
Nothing -> return ()
Just pkgtxt -> do
let descFilePath = fromMaybe "." workingDir
</> display (packageName pkgid) <.> "cabal"
info verbosity $
"Updating " ++ display (packageName pkgid) <.> "cabal"
++ " with the latest revision from the index."
writeFileAtomic descFilePath pkgtxt
-- Make sure that we pass --libsubdir etc to 'setup configure' (necessary if
-- the setup script was compiled against an old version of the Cabal lib).
configFlags' <- addDefaultInstallDirs configFlags
-- Filter out flags not supported by the old versions of the Cabal lib.
let configureFlags :: Version -> ConfigFlags
configureFlags = filterConfigureFlags configFlags' {
configVerbosity = toFlag verbosity'
}
-- Path to the optional log file.
mLogPath <- maybeLogPath
-- Configure phase
onFailure ConfigureFailed $ withJobLimit buildLimit $ do
when (numJobs > 1) $ notice verbosity $
"Configuring " ++ display pkgid ++ "..."
setup configureCommand configureFlags mLogPath
-- Build phase
onFailure BuildFailed $ do
when (numJobs > 1) $ notice verbosity $
"Building " ++ display pkgid ++ "..."
setup buildCommand' buildFlags mLogPath
-- Doc generation phase
docsResult <- if shouldHaddock
then (do setup haddockCommand haddockFlags' mLogPath
return DocsOk)
`catchIO` (\_ -> return DocsFailed)
`catchExit` (\_ -> return DocsFailed)
else return DocsNotTried
-- Tests phase
onFailure TestsFailed $ do
when (testsEnabled && PackageDescription.hasTests pkg) $
setup Cabal.testCommand testFlags mLogPath
let testsResult | testsEnabled = TestsOk
| otherwise = TestsNotTried
-- Install phase
onFailure InstallFailed $ criticalSection installLock $ do
-- Capture installed package configuration file
maybePkgConf <- maybeGenPkgConf mLogPath
-- Actual installation
withWin32SelfUpgrade verbosity libname configFlags
cinfo platform pkg $ do
case rootCmd miscOptions of
(Just cmd) -> reexec cmd
Nothing -> do
setup Cabal.copyCommand copyFlags mLogPath
when shouldRegister $ do
setup Cabal.registerCommand registerFlags mLogPath
return (Right (BuildOk docsResult testsResult maybePkgConf))
where
pkgid = packageId pkg
buildCommand' = buildCommand defaultProgramConfiguration
buildFlags _ = emptyBuildFlags {
buildDistPref = configDistPref configFlags,
buildVerbosity = toFlag verbosity'
}
shouldHaddock = fromFlag (installDocumentation installFlags)
haddockFlags' _ = haddockFlags {
haddockVerbosity = toFlag verbosity',
haddockDistPref = configDistPref configFlags
}
testsEnabled = fromFlag (configTests configFlags)
&& fromFlagOrDefault False (installRunTests installFlags)
testFlags _ = Cabal.emptyTestFlags {
Cabal.testDistPref = configDistPref configFlags
}
copyFlags _ = Cabal.emptyCopyFlags {
Cabal.copyDistPref = configDistPref configFlags,
Cabal.copyDest = toFlag InstallDirs.NoCopyDest,
Cabal.copyVerbosity = toFlag verbosity'
}
shouldRegister = PackageDescription.hasLibs pkg
registerFlags _ = Cabal.emptyRegisterFlags {
Cabal.regDistPref = configDistPref configFlags,
Cabal.regVerbosity = toFlag verbosity'
}
verbosity' = maybe verbosity snd useLogFile
tempTemplate name = name ++ "-" ++ display pkgid
addDefaultInstallDirs :: ConfigFlags -> IO ConfigFlags
addDefaultInstallDirs configFlags' = do
defInstallDirs <- InstallDirs.defaultInstallDirs flavor userInstall False
return $ configFlags' {
configInstallDirs = fmap Cabal.Flag .
InstallDirs.substituteInstallDirTemplates env $
InstallDirs.combineInstallDirs fromFlagOrDefault
defInstallDirs (configInstallDirs configFlags)
}
where
CompilerId flavor _ = compilerInfoId cinfo
env = initialPathTemplateEnv pkgid libname cinfo platform
userInstall = fromFlagOrDefault defaultUserInstall
(configUserInstall configFlags')
maybeGenPkgConf :: Maybe FilePath
-> IO (Maybe Installed.InstalledPackageInfo)
maybeGenPkgConf mLogPath =
if shouldRegister then do
tmp <- getTemporaryDirectory
withTempFile tmp (tempTemplate "pkgConf") $ \pkgConfFile handle -> do
hClose handle
let registerFlags' version = (registerFlags version) {
Cabal.regGenPkgConf = toFlag (Just pkgConfFile)
}
setup Cabal.registerCommand registerFlags' mLogPath
withUTF8FileContents pkgConfFile $ \pkgConfText ->
case Installed.parseInstalledPackageInfo pkgConfText of
Installed.ParseFailed perror -> pkgConfParseFailed perror
Installed.ParseOk warns pkgConf -> do
unless (null warns) $
warn verbosity $ unlines (map (showPWarning pkgConfFile) warns)
return (Just pkgConf)
else return Nothing
pkgConfParseFailed :: Installed.PError -> IO a
pkgConfParseFailed perror =
die $ "Couldn't parse the output of 'setup register --gen-pkg-config':"
++ show perror
maybeLogPath :: IO (Maybe FilePath)
maybeLogPath =
case useLogFile of
Nothing -> return Nothing
Just (mkLogFileName, _) -> do
let logFileName = mkLogFileName (packageId pkg) libname
logDir = takeDirectory logFileName
unless (null logDir) $ createDirectoryIfMissing True logDir
logFileExists <- doesFileExist logFileName
when logFileExists $ removeFile logFileName
return (Just logFileName)
setup cmd flags mLogPath =
Exception.bracket
(traverse (\path -> openFile path AppendMode) mLogPath)
(traverse_ hClose)
(\logFileHandle ->
setupWrapper verbosity
scriptOptions { useLoggingHandle = logFileHandle
, useWorkingDir = workingDir }
(Just pkg)
cmd flags [])
reexec cmd = do
-- look for our own executable file and re-exec ourselves using a helper
-- program like sudo to elevate privileges:
self <- getExecutablePath
weExist <- doesFileExist self
if weExist
then inDir workingDir $
rawSystemExit verbosity cmd
[self, "install", "--only"
,"--verbose=" ++ showForCabal verbosity]
else die $ "Unable to find cabal executable at: " ++ self
-- helper | 7,361 | false | true | 23 | 31 | 2,338 | 1,715 | 788 | 927 | null | null |
Fuuzetsu/yi-emacs-colours | src/Yi/Style/EmacsColours.hs | gpl-2.0 | -- | Names: @["grey92"]@
--
-- R235 G235 B235, 0xebebeb
grey92 :: Color
grey92 = RGB 235 235 235 | 96 | grey92 :: Color
grey92 = RGB 235 235 235 | 40 | grey92 = RGB 235 235 235 | 24 | true | true | 0 | 6 | 18 | 27 | 13 | 14 | null | null |
heathweiss/Tricad | src/Primitives/Cylindrical.hs | gpl-2.0 | cylinderSolidNoSlopeSquaredOffLengthenY :: Radius -> Origin -> [Angle] -> Height -> Power -> LengthenFactor -> [CornerPoints]
cylinderSolidNoSlopeSquaredOffLengthenY radius origin angles height power lengthenFactor =
--createBottomFacesSquaredOffLengthenY :: Origin -> [Radius] -> [Angle] -> Slope -> Slope -> Power -> LengthenFactor -> [CornerPoints]
createBottomFacesSquaredOffLengthenY origin [radius | x <- [1..]] angles flatXSlope flatYSlope power lengthenFactor
|@+++#@|
(upperFaceFromLowerFace . (transposeZ (+height))) | 560 | cylinderSolidNoSlopeSquaredOffLengthenY :: Radius -> Origin -> [Angle] -> Height -> Power -> LengthenFactor -> [CornerPoints]
cylinderSolidNoSlopeSquaredOffLengthenY radius origin angles height power lengthenFactor =
--createBottomFacesSquaredOffLengthenY :: Origin -> [Radius] -> [Angle] -> Slope -> Slope -> Power -> LengthenFactor -> [CornerPoints]
createBottomFacesSquaredOffLengthenY origin [radius | x <- [1..]] angles flatXSlope flatYSlope power lengthenFactor
|@+++#@|
(upperFaceFromLowerFace . (transposeZ (+height))) | 560 | cylinderSolidNoSlopeSquaredOffLengthenY radius origin angles height power lengthenFactor =
--createBottomFacesSquaredOffLengthenY :: Origin -> [Radius] -> [Angle] -> Slope -> Slope -> Power -> LengthenFactor -> [CornerPoints]
createBottomFacesSquaredOffLengthenY origin [radius | x <- [1..]] angles flatXSlope flatYSlope power lengthenFactor
|@+++#@|
(upperFaceFromLowerFace . (transposeZ (+height))) | 433 | false | true | 1 | 11 | 90 | 107 | 57 | 50 | null | null |
GaloisInc/hpb | src/Data/HPB.hs | apache-2.0 | emptyMessageRep :: Monoid a => Text -> MessageRep a
emptyMessageRep nm =
Rep { initMessage = mempty
, mergeMessage = mappend
, messageName = nm
, fieldSerializers = V.empty
, fieldDeserializers = HMap.empty
, requiredFields = V.empty
} | 273 | emptyMessageRep :: Monoid a => Text -> MessageRep a
emptyMessageRep nm =
Rep { initMessage = mempty
, mergeMessage = mappend
, messageName = nm
, fieldSerializers = V.empty
, fieldDeserializers = HMap.empty
, requiredFields = V.empty
} | 273 | emptyMessageRep nm =
Rep { initMessage = mempty
, mergeMessage = mappend
, messageName = nm
, fieldSerializers = V.empty
, fieldDeserializers = HMap.empty
, requiredFields = V.empty
} | 221 | false | true | 0 | 8 | 75 | 80 | 43 | 37 | null | null |
DavidAlphaFox/darcs | src/Darcs/Patch/Match.hs | gpl-2.0 | getNonrangeMatchS :: (ApplyMonad m (ApplyState p), MonadProgress m, Matchable p, ApplyState p ~ Tree)
=> [MatchFlag]
-> PatchSet p Origin wX
-> m ()
getNonrangeMatchS fs repo =
case nonrangeMatcher fs of
Just m -> if nonrangeMatcherIsTag fs
then getTagS m repo
else getMatcherS Exclusive m repo
Nothing -> fail "Pattern not specified in getNonrangeMatch."
-- | @firstMatch fs@ tells whether @fs@ implies a "first match", that
-- is if we match against patches from a point in the past on, rather
-- than against all patches since the creation of the repository. | 684 | getNonrangeMatchS :: (ApplyMonad m (ApplyState p), MonadProgress m, Matchable p, ApplyState p ~ Tree)
=> [MatchFlag]
-> PatchSet p Origin wX
-> m ()
getNonrangeMatchS fs repo =
case nonrangeMatcher fs of
Just m -> if nonrangeMatcherIsTag fs
then getTagS m repo
else getMatcherS Exclusive m repo
Nothing -> fail "Pattern not specified in getNonrangeMatch."
-- | @firstMatch fs@ tells whether @fs@ implies a "first match", that
-- is if we match against patches from a point in the past on, rather
-- than against all patches since the creation of the repository. | 684 | getNonrangeMatchS fs repo =
case nonrangeMatcher fs of
Just m -> if nonrangeMatcherIsTag fs
then getTagS m repo
else getMatcherS Exclusive m repo
Nothing -> fail "Pattern not specified in getNonrangeMatch."
-- | @firstMatch fs@ tells whether @fs@ implies a "first match", that
-- is if we match against patches from a point in the past on, rather
-- than against all patches since the creation of the repository. | 481 | false | true | 0 | 9 | 215 | 130 | 64 | 66 | null | null |
Arguggi/documentator | data/Lens.hs | gpl-3.0 | -- | Build an index-preserving 'Lens' from a 'Control.Lens.Getter.Getter' and a
-- 'Control.Lens.Setter.Setter'.
iplens :: (s -> a) -> (s -> b -> t) -> IndexPreservingLens s t a b
iplens sa sbt pafb = cotabulate $ \ws -> sbt (extract ws) <$> cosieve pafb (sa <$> ws) | 266 | iplens :: (s -> a) -> (s -> b -> t) -> IndexPreservingLens s t a b
iplens sa sbt pafb = cotabulate $ \ws -> sbt (extract ws) <$> cosieve pafb (sa <$> ws) | 153 | iplens sa sbt pafb = cotabulate $ \ws -> sbt (extract ws) <$> cosieve pafb (sa <$> ws) | 86 | true | true | 2 | 10 | 47 | 94 | 47 | 47 | null | null |
nikki-and-the-robots/nikki | src/Utils.hs | lgpl-3.0 | -- applies a given monadic operation n times
applyTimesM :: Monad m => Int -> (a -> m a) -> a -> m a
applyTimesM 0 _ = return | 125 | applyTimesM :: Monad m => Int -> (a -> m a) -> a -> m a
applyTimesM 0 _ = return | 80 | applyTimesM 0 _ = return | 24 | true | true | 0 | 11 | 28 | 54 | 25 | 29 | null | null |
enolan/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | c_irts (FArith (ATInt ITNative)) l x = l ++ "MKINT((i_int)(" ++ x ++ "))" | 73 | c_irts (FArith (ATInt ITNative)) l x = l ++ "MKINT((i_int)(" ++ x ++ "))" | 73 | c_irts (FArith (ATInt ITNative)) l x = l ++ "MKINT((i_int)(" ++ x ++ "))" | 73 | false | false | 1 | 12 | 13 | 41 | 18 | 23 | null | null |
kim/amazonka | amazonka-sqs/gen/Network/AWS/SQS/GetQueueUrl.hs | mpl-2.0 | -- | The AWS account ID of the account that created the queue.
gquQueueOwnerAWSAccountId :: Lens' GetQueueUrl (Maybe Text)
gquQueueOwnerAWSAccountId =
lens _gquQueueOwnerAWSAccountId
(\s a -> s { _gquQueueOwnerAWSAccountId = a }) | 241 | gquQueueOwnerAWSAccountId :: Lens' GetQueueUrl (Maybe Text)
gquQueueOwnerAWSAccountId =
lens _gquQueueOwnerAWSAccountId
(\s a -> s { _gquQueueOwnerAWSAccountId = a }) | 178 | gquQueueOwnerAWSAccountId =
lens _gquQueueOwnerAWSAccountId
(\s a -> s { _gquQueueOwnerAWSAccountId = a }) | 118 | true | true | 1 | 9 | 43 | 52 | 25 | 27 | null | null |
HaskVan/tiempo | src/Tiempo.hs | mit | timeToSeconds Days dys = timeToSeconds Hours (dys * hoursPerDay) | 64 | timeToSeconds Days dys = timeToSeconds Hours (dys * hoursPerDay) | 64 | timeToSeconds Days dys = timeToSeconds Hours (dys * hoursPerDay) | 64 | false | false | 1 | 7 | 8 | 27 | 11 | 16 | null | null |
Julianporter/Haskell-MapReduce | src/Parallel/MapReduce/WordCount/Interface.hs | bsd-3-clause | tests :: [ATest]
tests = [T {testName="Simple totalising test", test=prop_Equal},
T {testName="Detailed test", test=prop_FullCheck}
] | 166 | tests :: [ATest]
tests = [T {testName="Simple totalising test", test=prop_Equal},
T {testName="Detailed test", test=prop_FullCheck}
] | 151 | tests = [T {testName="Simple totalising test", test=prop_Equal},
T {testName="Detailed test", test=prop_FullCheck}
] | 134 | false | true | 0 | 7 | 47 | 48 | 30 | 18 | null | null |
simonced/haskell-kata | gloss/tree.hs | gpl-3.0 | calculatePoint2 :: Point -> Length -> Angle -> Point
calculatePoint2 (x, y) l a = (x2, y2)
where x2 = l * sin a + x
y2 = l * cos a + y | 148 | calculatePoint2 :: Point -> Length -> Angle -> Point
calculatePoint2 (x, y) l a = (x2, y2)
where x2 = l * sin a + x
y2 = l * cos a + y | 148 | calculatePoint2 (x, y) l a = (x2, y2)
where x2 = l * sin a + x
y2 = l * cos a + y | 95 | false | true | 1 | 9 | 47 | 79 | 40 | 39 | null | null |
rueshyna/gogol | gogol-youtube/gen/Network/Google/Resource/YouTube/Videos/List.hs | mpl-2.0 | -- | The videoCategoryId parameter identifies the video category for which
-- the chart should be retrieved. This parameter can only be used in
-- conjunction with the chart parameter. By default, charts are not
-- restricted to a particular category.
vlVideoCategoryId :: Lens' VideosList Text
vlVideoCategoryId
= lens _vlVideoCategoryId
(\ s a -> s{_vlVideoCategoryId = a}) | 383 | vlVideoCategoryId :: Lens' VideosList Text
vlVideoCategoryId
= lens _vlVideoCategoryId
(\ s a -> s{_vlVideoCategoryId = a}) | 131 | vlVideoCategoryId
= lens _vlVideoCategoryId
(\ s a -> s{_vlVideoCategoryId = a}) | 88 | true | true | 0 | 9 | 64 | 45 | 25 | 20 | null | null |
wdanilo/container | src/Data/AutoVector.hs | apache-2.0 | -- TODO[WD]: Move to containers as container utility function
thaw :: PrimMonad m => AutoVector a -> m (MAutoVector (PrimState m) a)
thaw = wrappedM' $ mapM V.thaw | 163 | thaw :: PrimMonad m => AutoVector a -> m (MAutoVector (PrimState m) a)
thaw = wrappedM' $ mapM V.thaw | 101 | thaw = wrappedM' $ mapM V.thaw | 30 | true | true | 0 | 12 | 27 | 57 | 26 | 31 | null | null |
ganeti/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | qrFilter :: String
qrFilter = "filter" | 38 | qrFilter :: String
qrFilter = "filter" | 38 | qrFilter = "filter" | 19 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
patperry/hs-linear-algebra | tests-old/HermMatrix.hs | bsd-3-clause | prop_herm_apply (HermMatrixMV (h :: HM) a x) =
h <*> x ~== a <*> x | 70 | prop_herm_apply (HermMatrixMV (h :: HM) a x) =
h <*> x ~== a <*> x | 70 | prop_herm_apply (HermMatrixMV (h :: HM) a x) =
h <*> x ~== a <*> x | 70 | false | false | 0 | 9 | 18 | 38 | 19 | 19 | null | null |
droundy/franchise | Distribution/Franchise/Persistency.hs | bsd-3-clause | checkOnce :: (Read a, Show a, Monoid a) => String -- ^ name of test
-> C a -- ^ action to perform
-> C a
checkOnce name check = require name check `catchC` \_ -> return mempty | 195 | checkOnce :: (Read a, Show a, Monoid a) => String -- ^ name of test
-> C a -- ^ action to perform
-> C a
checkOnce name check = require name check `catchC` \_ -> return mempty | 195 | checkOnce name check = require name check `catchC` \_ -> return mempty | 70 | false | true | 0 | 8 | 57 | 72 | 37 | 35 | null | null |
bkoropoff/Idris-dev | src/Idris/Delaborate.hs | bsd-3-clause | showPart ist (TermPart tm) = pprintTerm ist (delabSugared ist tm) | 66 | showPart ist (TermPart tm) = pprintTerm ist (delabSugared ist tm) | 66 | showPart ist (TermPart tm) = pprintTerm ist (delabSugared ist tm) | 66 | false | false | 0 | 7 | 10 | 32 | 14 | 18 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'V.map'
v_map = V.map | 25 | v_map = V.map | 13 | v_map = V.map | 13 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
snoyberg/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | -- Annotation type checking
toAnnotationWrapperName :: Name
toAnnotationWrapperName = varQual gHC_DESUGAR (fsLit "toAnnotationWrapper") toAnnotationWrapperIdKey | 160 | toAnnotationWrapperName :: Name
toAnnotationWrapperName = varQual gHC_DESUGAR (fsLit "toAnnotationWrapper") toAnnotationWrapperIdKey | 132 | toAnnotationWrapperName = varQual gHC_DESUGAR (fsLit "toAnnotationWrapper") toAnnotationWrapperIdKey | 100 | true | true | 0 | 7 | 13 | 25 | 13 | 12 | null | null |
josefs/sbv | Data/SBV/Utils/Lib.hs | bsd-3-clause | -- | Monadic lift over 2-tuples
mlift2 :: Monad m => (a' -> b' -> r) -> (a -> m a') -> (b -> m b') -> (a, b) -> m r
mlift2 k f g (a, b) = f a >>= \a' -> g b >>= \b' -> return $ k a' b' | 184 | mlift2 :: Monad m => (a' -> b' -> r) -> (a -> m a') -> (b -> m b') -> (a, b) -> m r
mlift2 k f g (a, b) = f a >>= \a' -> g b >>= \b' -> return $ k a' b' | 152 | mlift2 k f g (a, b) = f a >>= \a' -> g b >>= \b' -> return $ k a' b' | 68 | true | true | 4 | 12 | 53 | 131 | 66 | 65 | null | null |
JoeyEremondi/elm-type-effect | src/Type/Effect/Solve.hs | bsd-3-clause | --TODO implement this case
unifyInfo Top Top = return Top | 57 | unifyInfo Top Top = return Top | 30 | unifyInfo Top Top = return Top | 30 | true | false | 1 | 5 | 9 | 19 | 7 | 12 | null | null |
urv/fixhs | src/Data/FIX/Spec/FIX43.hs | lgpl-2.1 | tTradSesPreCloseTime :: FIXTag
tTradSesPreCloseTime = FIXTag
{ tName = "TradSesPreCloseTime"
, tnum = 343
, tparser = toFIXTimestamp
, arbitraryValue = FIXTimestamp <$> arbitrary } | 193 | tTradSesPreCloseTime :: FIXTag
tTradSesPreCloseTime = FIXTag
{ tName = "TradSesPreCloseTime"
, tnum = 343
, tparser = toFIXTimestamp
, arbitraryValue = FIXTimestamp <$> arbitrary } | 193 | tTradSesPreCloseTime = FIXTag
{ tName = "TradSesPreCloseTime"
, tnum = 343
, tparser = toFIXTimestamp
, arbitraryValue = FIXTimestamp <$> arbitrary } | 162 | false | true | 0 | 8 | 37 | 45 | 26 | 19 | null | null |
lessandro/gridc | src/GridC/Lexer.hs | mit | parens :: Parser u a -> Parser u a
parens = P.parens lexer | 58 | parens :: Parser u a -> Parser u a
parens = P.parens lexer | 58 | parens = P.parens lexer | 23 | false | true | 0 | 7 | 12 | 36 | 15 | 21 | null | null |
alexander-at-github/eta | compiler/ETA/Prelude/ForeignCall.hs | bsd-3-clause | ccallConvToInt CApiConv = panic "ccallConvToInt CApiConv" | 60 | ccallConvToInt CApiConv = panic "ccallConvToInt CApiConv" | 60 | ccallConvToInt CApiConv = panic "ccallConvToInt CApiConv" | 60 | false | false | 0 | 5 | 8 | 12 | 5 | 7 | null | null |
graninas/Haskell-Algorithms | Programs/GameOfLifeComonad/SampleCells.hs | gpl-3.0 | metaCells = map (map zeroCellCreator) cellsGlider | 49 | metaCells = map (map zeroCellCreator) cellsGlider | 49 | metaCells = map (map zeroCellCreator) cellsGlider | 49 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
blancas/trex | src/Transform.hs | mit | processFile :: Transfn -> Bool -> String -> IO ()
processFile f header path = do
contents <- LB.readFile path
LB.writeFile out $ process f header contents
putStrLn path
where out = path ++ ".out" | 209 | processFile :: Transfn -> Bool -> String -> IO ()
processFile f header path = do
contents <- LB.readFile path
LB.writeFile out $ process f header contents
putStrLn path
where out = path ++ ".out" | 209 | processFile f header path = do
contents <- LB.readFile path
LB.writeFile out $ process f header contents
putStrLn path
where out = path ++ ".out" | 159 | false | true | 3 | 10 | 48 | 93 | 39 | 54 | null | null |
muspellsson/hiccup | RToken.hs | lgpl-2.1 | compile :: BString -> RTokCmd
compile str = clean . tconcat . map toTok . elift . parseSubstAll $ str
where clean [r] = r
clean rl = CatLst rl
tconcat (Lit a:Lit b:xs) = tconcat (Lit (B.append a b):xs)
tconcat (x:xs) = x : tconcat xs
tconcat [] = []
toTok x = case x of
SStr s -> litIfy s
SCmd c -> compCmds c
SVar v -> case parseVarName v of
NSQual ns (VarName n (Just ind)) -> ArrRef ns n (compile ind)
vn -> VarRef vn | 563 | compile :: BString -> RTokCmd
compile str = clean . tconcat . map toTok . elift . parseSubstAll $ str
where clean [r] = r
clean rl = CatLst rl
tconcat (Lit a:Lit b:xs) = tconcat (Lit (B.append a b):xs)
tconcat (x:xs) = x : tconcat xs
tconcat [] = []
toTok x = case x of
SStr s -> litIfy s
SCmd c -> compCmds c
SVar v -> case parseVarName v of
NSQual ns (VarName n (Just ind)) -> ArrRef ns n (compile ind)
vn -> VarRef vn | 563 | compile str = clean . tconcat . map toTok . elift . parseSubstAll $ str
where clean [r] = r
clean rl = CatLst rl
tconcat (Lit a:Lit b:xs) = tconcat (Lit (B.append a b):xs)
tconcat (x:xs) = x : tconcat xs
tconcat [] = []
toTok x = case x of
SStr s -> litIfy s
SCmd c -> compCmds c
SVar v -> case parseVarName v of
NSQual ns (VarName n (Just ind)) -> ArrRef ns n (compile ind)
vn -> VarRef vn | 533 | false | true | 7 | 11 | 232 | 243 | 118 | 125 | null | null |
aBhallo/AoC2016 | Day 4/day4part2.hs | mit | checkSum (x:xs) ((y,_):ys)
| x == y = checkSum xs ys | 56 | checkSum (x:xs) ((y,_):ys)
| x == y = checkSum xs ys | 56 | checkSum (x:xs) ((y,_):ys)
| x == y = checkSum xs ys | 56 | false | false | 0 | 8 | 14 | 46 | 23 | 23 | null | null |
balangs/eTeak | src/Graph.hs | bsd-3-clause | findBackLinkDup :: Eq a => Array Int [a] -> Array Int [a] -> (Int, (Int, a)) -> [a]
findBackLinkDup fin fout (from, (to, backlink))
| preds `intersect` succs == [] = []
| preds `intersect` (succs `intersect` [backlink]) /= [] = [backlink,backlink]
| otherwise = [backlink]
where
preds = fin!from
succs = fout!to
-- NEW
--- misc functions
-- gets the bounds of a list of edges | 450 | findBackLinkDup :: Eq a => Array Int [a] -> Array Int [a] -> (Int, (Int, a)) -> [a]
findBackLinkDup fin fout (from, (to, backlink))
| preds `intersect` succs == [] = []
| preds `intersect` (succs `intersect` [backlink]) /= [] = [backlink,backlink]
| otherwise = [backlink]
where
preds = fin!from
succs = fout!to
-- NEW
--- misc functions
-- gets the bounds of a list of edges | 446 | findBackLinkDup fin fout (from, (to, backlink))
| preds `intersect` succs == [] = []
| preds `intersect` (succs `intersect` [backlink]) /= [] = [backlink,backlink]
| otherwise = [backlink]
where
preds = fin!from
succs = fout!to
-- NEW
--- misc functions
-- gets the bounds of a list of edges | 362 | false | true | 2 | 12 | 141 | 178 | 98 | 80 | null | null |
ciderpunx/project_euler_in_haskell | fact.hs | gpl-2.0 | -- NB: Use :set -XPostfixOperators if running from GHCi
(!) :: Integer -> Integer
(!) n = product [1..n] | 105 | (!) :: Integer -> Integer
(!) n = product [1..n] | 48 | (!) n = product [1..n] | 22 | true | true | 0 | 6 | 19 | 31 | 18 | 13 | null | null |
jaimeMF/mediawiki-dl | mediawiki-dl.hs | bsd-2-clause | printUsageInfo = putStrLn $ usageInfo usageHeader options | 57 | printUsageInfo = putStrLn $ usageInfo usageHeader options | 57 | printUsageInfo = putStrLn $ usageInfo usageHeader options | 57 | false | false | 0 | 6 | 6 | 15 | 7 | 8 | null | null |
urbanslug/ghc | testsuite/tests/perf/compiler/T783.hs | bsd-3-clause | foo x | x == 65 = 65 | 20 | foo x | x == 65 = 65 | 20 | foo x | x == 65 = 65 | 20 | false | false | 0 | 8 | 7 | 23 | 9 | 14 | null | null |
ocharles/hackage-server | Distribution/Client/Mirror/Session.hs | bsd-3-clause | formatEntity :: Entity -> String
formatEntity EntityIndex = "the package index" | 89 | formatEntity :: Entity -> String
formatEntity EntityIndex = "the package index" | 89 | formatEntity EntityIndex = "the package index" | 56 | false | true | 0 | 5 | 20 | 22 | 10 | 12 | null | null |
bitemyapp/ghc | libraries/template-haskell/Language/Haskell/TH/Ppr.hs | bsd-3-clause | pprString :: String -> Doc
-- Print newlines as newlines with Haskell string escape notation,
-- not as '\n'. For other non-printables use regular escape notation.
pprString s = vcat (map text (showMultiLineString s)) | 218 | pprString :: String -> Doc
pprString s = vcat (map text (showMultiLineString s)) | 80 | pprString s = vcat (map text (showMultiLineString s)) | 53 | true | true | 0 | 9 | 34 | 43 | 20 | 23 | null | null |
sdiehl/ghc | compiler/main/DynFlags.hs | bsd-3-clause | allNonDeprecatedFlags :: [String]
allNonDeprecatedFlags = allFlagsDeps False | 76 | allNonDeprecatedFlags :: [String]
allNonDeprecatedFlags = allFlagsDeps False | 76 | allNonDeprecatedFlags = allFlagsDeps False | 42 | false | true | 0 | 5 | 6 | 17 | 9 | 8 | null | null |
jwiegley/ghc-release | libraries/Cabal/cabal-install/Distribution/Client/Setup.hs | gpl-3.0 | usagePackages :: String -> String -> String
usagePackages name pname =
"Usage: " ++ pname ++ " " ++ name ++ " [PACKAGES]\n\n"
++ "Flags for " ++ name ++ ":" | 163 | usagePackages :: String -> String -> String
usagePackages name pname =
"Usage: " ++ pname ++ " " ++ name ++ " [PACKAGES]\n\n"
++ "Flags for " ++ name ++ ":" | 163 | usagePackages name pname =
"Usage: " ++ pname ++ " " ++ name ++ " [PACKAGES]\n\n"
++ "Flags for " ++ name ++ ":" | 119 | false | true | 2 | 8 | 37 | 54 | 26 | 28 | null | null |
phischu/fragnix | builtins/base/GHC.IO.FD.hs | bsd-3-clause | isSeekable :: FD -> IO Bool
isSeekable fd = do
t <- devType fd
return (t == RegularFile || t == RawDevice) | 110 | isSeekable :: FD -> IO Bool
isSeekable fd = do
t <- devType fd
return (t == RegularFile || t == RawDevice) | 110 | isSeekable fd = do
t <- devType fd
return (t == RegularFile || t == RawDevice) | 82 | false | true | 0 | 12 | 25 | 57 | 25 | 32 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxLANGUAGE_UZBEK :: Int
wxLANGUAGE_UZBEK = 218 | 46 | wxLANGUAGE_UZBEK :: Int
wxLANGUAGE_UZBEK = 218 | 46 | wxLANGUAGE_UZBEK = 218 | 22 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
susisu/Dolce | src/Parser.hs | mit | funcLiteral :: Parser Literal
funcLiteral = P.char '{' *> (operationToFuncLiteral <$> dol) <* P.char '}' | 104 | funcLiteral :: Parser Literal
funcLiteral = P.char '{' *> (operationToFuncLiteral <$> dol) <* P.char '}' | 104 | funcLiteral = P.char '{' *> (operationToFuncLiteral <$> dol) <* P.char '}' | 74 | false | true | 1 | 8 | 14 | 42 | 19 | 23 | null | null |
dnvriend/study-category-theory | funprog/C9_Functional_Programming_Fundamentals/Week5/lists.hs | apache-2.0 | concat' :: [[a]] -> [a]
concat' xxs = [x | xs <- xxs, x <- xs] | 62 | concat' :: [[a]] -> [a]
concat' xxs = [x | xs <- xxs, x <- xs] | 62 | concat' xxs = [x | xs <- xxs, x <- xs] | 38 | false | true | 0 | 7 | 15 | 46 | 25 | 21 | null | null |
jbearer/hspl | src/Control/Hspl/Internal/UI.hs | mit | formatPredicate :: Predicate -> String
formatPredicate (Predicate _ _ name t) = name ++ "? " ++ parensTerm t | 108 | formatPredicate :: Predicate -> String
formatPredicate (Predicate _ _ name t) = name ++ "? " ++ parensTerm t | 108 | formatPredicate (Predicate _ _ name t) = name ++ "? " ++ parensTerm t | 69 | false | true | 0 | 6 | 18 | 45 | 21 | 24 | null | null |
yi-editor/yi | yi-core/src/Yi/Interact.hs | gpl-2.0 | findWrites _ Fail = Dead | 24 | findWrites _ Fail = Dead | 24 | findWrites _ Fail = Dead | 24 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
esengie/fpl-exploration-tool | src/specLang/SortCheck.hs | bsd-3-clause | sortCheck :: LangSpec -> SortCheckM ()
sortCheck lsp = do
sortCheckSorts lsp
sortCheckFunSyms (AST.funSyms lsp)
stabs <~ checkStab (AST.stabilities lsp)
sortCheckAxioms (AST.axioms lsp)
sortCheckReductions (AST.reductions lsp) | 246 | sortCheck :: LangSpec -> SortCheckM ()
sortCheck lsp = do
sortCheckSorts lsp
sortCheckFunSyms (AST.funSyms lsp)
stabs <~ checkStab (AST.stabilities lsp)
sortCheckAxioms (AST.axioms lsp)
sortCheckReductions (AST.reductions lsp) | 246 | sortCheck lsp = do
sortCheckSorts lsp
sortCheckFunSyms (AST.funSyms lsp)
stabs <~ checkStab (AST.stabilities lsp)
sortCheckAxioms (AST.axioms lsp)
sortCheckReductions (AST.reductions lsp) | 207 | false | true | 0 | 12 | 45 | 94 | 40 | 54 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.