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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
snoyberg/ghc | compiler/typecheck/TcBinds.hs | bsd-3-clause | tc_single :: forall thing.
TopLevelFlag -> TcSigFun -> TcPragEnv
-> LHsBind Name -> IsGroupClosed -> TcM thing
-> TcM (LHsBinds TcId, thing)
tc_single _top_lvl sig_fn _prag_fn
(L _ (PatSynBind psb@PSB{ psb_id = L _ name }))
_ thing_inside
= do { (aux_binds, tcg_env) <- tc_pat_syn_decl
; thing <- setGblEnv tcg_env thing_inside
; return (aux_binds, thing)
}
where
tc_pat_syn_decl :: TcM (LHsBinds TcId, TcGblEnv)
tc_pat_syn_decl = case sig_fn name of
Nothing -> tcInferPatSynDecl psb
Just (TcPatSynSig tpsi) -> tcCheckPatSynDecl psb tpsi
Just _ -> panic "tc_single" | 707 | tc_single :: forall thing.
TopLevelFlag -> TcSigFun -> TcPragEnv
-> LHsBind Name -> IsGroupClosed -> TcM thing
-> TcM (LHsBinds TcId, thing)
tc_single _top_lvl sig_fn _prag_fn
(L _ (PatSynBind psb@PSB{ psb_id = L _ name }))
_ thing_inside
= do { (aux_binds, tcg_env) <- tc_pat_syn_decl
; thing <- setGblEnv tcg_env thing_inside
; return (aux_binds, thing)
}
where
tc_pat_syn_decl :: TcM (LHsBinds TcId, TcGblEnv)
tc_pat_syn_decl = case sig_fn name of
Nothing -> tcInferPatSynDecl psb
Just (TcPatSynSig tpsi) -> tcCheckPatSynDecl psb tpsi
Just _ -> panic "tc_single" | 707 | tc_single _top_lvl sig_fn _prag_fn
(L _ (PatSynBind psb@PSB{ psb_id = L _ name }))
_ thing_inside
= do { (aux_binds, tcg_env) <- tc_pat_syn_decl
; thing <- setGblEnv tcg_env thing_inside
; return (aux_binds, thing)
}
where
tc_pat_syn_decl :: TcM (LHsBinds TcId, TcGblEnv)
tc_pat_syn_decl = case sig_fn name of
Nothing -> tcInferPatSynDecl psb
Just (TcPatSynSig tpsi) -> tcCheckPatSynDecl psb tpsi
Just _ -> panic "tc_single" | 534 | false | true | 1 | 14 | 226 | 216 | 107 | 109 | null | null |
mcmaniac/mycloud | src/MyCloud/Connection.hs | bsd-3-clause | sendListen = sendCmd LISTEN [] Nothing | 45 | sendListen = sendCmd LISTEN [] Nothing | 45 | sendListen = sendCmd LISTEN [] Nothing | 45 | false | false | 0 | 6 | 12 | 15 | 7 | 8 | null | null |
green-haskell/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | mapIdKey, groupWithIdKey, dollarIdKey :: Unique
mapIdKey = mkPreludeMiscIdUnique 121 | 97 | mapIdKey, groupWithIdKey, dollarIdKey :: Unique
mapIdKey = mkPreludeMiscIdUnique 121 | 97 | mapIdKey = mkPreludeMiscIdUnique 121 | 49 | false | true | 0 | 5 | 21 | 18 | 11 | 7 | null | null |
uduki/hsQt | Qtc/Enums/Gui/QBoxLayout.hs | bsd-2-clause | ieQBoxLayoutDirection :: Int -> QBoxLayoutDirection
ieQBoxLayoutDirection x = QEnum (CQBoxLayoutDirection x) | 108 | ieQBoxLayoutDirection :: Int -> QBoxLayoutDirection
ieQBoxLayoutDirection x = QEnum (CQBoxLayoutDirection x) | 108 | ieQBoxLayoutDirection x = QEnum (CQBoxLayoutDirection x) | 56 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
timds/adjourn | app/Adjrn/Adjrn.hs | bsd-3-clause | app :: App AdjState () Window
app = App
{ appDraw = pure . drawAll
, appChooseCursor = neverShowCursor
, appHandleEvent = handleEvent
, appStartEvent = return
, appAttrMap = const $ attrMap V.defAttr jrnlAttrs } | 221 | app :: App AdjState () Window
app = App
{ appDraw = pure . drawAll
, appChooseCursor = neverShowCursor
, appHandleEvent = handleEvent
, appStartEvent = return
, appAttrMap = const $ attrMap V.defAttr jrnlAttrs } | 221 | app = App
{ appDraw = pure . drawAll
, appChooseCursor = neverShowCursor
, appHandleEvent = handleEvent
, appStartEvent = return
, appAttrMap = const $ attrMap V.defAttr jrnlAttrs } | 191 | false | true | 1 | 10 | 45 | 74 | 39 | 35 | null | null |
runeksvendsen/rbpcp-handler | src/MyPrelude.hs | bsd-3-clause | newTlsManager :: IO HTTP.Manager
newTlsManager = HTTP.newManager tlsManagerSettings | 83 | newTlsManager :: IO HTTP.Manager
newTlsManager = HTTP.newManager tlsManagerSettings | 83 | newTlsManager = HTTP.newManager tlsManagerSettings | 50 | false | true | 0 | 6 | 7 | 21 | 10 | 11 | null | null |
stevezhee/shootout | src/Untyped.hs | bsd-3-clause | defn :: String -> Type -> Maybe Exp -> Tree Exp -> Exp
defn s t x e = mkExp $ App (Defn s bvs t x) $ toList e
where
bvs = toList $ instantiate $ fmap etype e | 163 | defn :: String -> Type -> Maybe Exp -> Tree Exp -> Exp
defn s t x e = mkExp $ App (Defn s bvs t x) $ toList e
where
bvs = toList $ instantiate $ fmap etype e | 163 | defn s t x e = mkExp $ App (Defn s bvs t x) $ toList e
where
bvs = toList $ instantiate $ fmap etype e | 108 | false | true | 0 | 9 | 45 | 89 | 42 | 47 | null | null |
foreverbell/unlimited-plt-toys | tapl/fullsimple/Evaluator.hs | bsd-3-clause | evaluate1 _ (TermPred TermZero) = Just TermZero | 47 | evaluate1 _ (TermPred TermZero) = Just TermZero | 47 | evaluate1 _ (TermPred TermZero) = Just TermZero | 47 | false | false | 1 | 6 | 6 | 22 | 9 | 13 | null | null |
conal/lambda-ccc | src/LambdaCCC/Unused/ToCircuit.hs | bsd-3-clause | expToCircuit :: E Prim (a -> b) -> (a :> b)
expToCircuit = cccToCircuit . toCCC | 79 | expToCircuit :: E Prim (a -> b) -> (a :> b)
expToCircuit = cccToCircuit . toCCC | 79 | expToCircuit = cccToCircuit . toCCC | 35 | false | true | 0 | 8 | 15 | 38 | 20 | 18 | null | null |
dambaev/hproxy | src/TCPServer.hs | gpl-2.0 | clientSupervisor:: HEP() -> HEPProc
clientSupervisor onInitFailed = do
msg <- receive
let handleChildLinkMessage:: Maybe LinkedMessage -> EitherT HEPProcState HEP HEPProcState
handleChildLinkMessage Nothing = lift procRunning >>= right
handleChildLinkMessage (Just (ProcessFinished pid)) = do
lift $! liftIO $! putStrLn $! "supervisor: client thread exited "
subscribed <- lift getSubscribed
case subscribed of
[] -> lift procFinished >>= left
_ -> lift procRunning >>= left
handleServiceMessage:: Maybe SupervisorMessage -> EitherT HEPProcState HEP HEPProcState
handleServiceMessage Nothing = right =<< lift procRunning
handleServiceMessage (Just (ProcWorkerFailure cpid e _ outbox)) = do
left =<< lift (do
case fromException e of
Just (IOError{ioe_type = ResourceVanished}) -> do
liftIO $! putStrLn "supervisor: client connection got ResourceVanished"
procFinish outbox
procFinished
Just (IOError{ioe_type = EOF}) -> do
liftIO $! putStrLn "supervisor: client connection got EOF"
procFinish outbox
procRunning
_ -> do
liftIO $! putStrLn $! "supervisor: client " ++ show cpid ++
" failed with: " ++ show e
procFinish outbox
procRunning
)
handleServiceMessage (Just (ProcInitFailure cpid e _ outbox)) = do
left =<< lift (do
liftIO $! putStrLn $! "ERROR: " ++ show e
liftIO $! putStrLn $! "supervisor: client init " ++ show cpid ++
" failed with: " ++ show e
procFinish outbox
onInitFailed
procRunning
)
handleClientSupervisorCommand:: Maybe ClientSupervisorCommand
-> EitherT HEPProcState HEP HEPProcState
handleClientSupervisorCommand Nothing =right =<< lift procRunning
handleClientSupervisorCommand (Just StopClient) = left =<< lift
( do
workers <- getSubscribed
forM workers $! \pid -> do
liftIO $! putStrLn $! "killing client " ++ show pid
killProc pid
procRunning
)
mreq <- runEitherT $! do
handleChildLinkMessage $! fromMessage msg
handleServiceMessage $! fromMessage msg
handleClientSupervisorCommand $! fromMessage msg
case mreq of
Left some -> return some
Right some -> return some | 2,839 | clientSupervisor:: HEP() -> HEPProc
clientSupervisor onInitFailed = do
msg <- receive
let handleChildLinkMessage:: Maybe LinkedMessage -> EitherT HEPProcState HEP HEPProcState
handleChildLinkMessage Nothing = lift procRunning >>= right
handleChildLinkMessage (Just (ProcessFinished pid)) = do
lift $! liftIO $! putStrLn $! "supervisor: client thread exited "
subscribed <- lift getSubscribed
case subscribed of
[] -> lift procFinished >>= left
_ -> lift procRunning >>= left
handleServiceMessage:: Maybe SupervisorMessage -> EitherT HEPProcState HEP HEPProcState
handleServiceMessage Nothing = right =<< lift procRunning
handleServiceMessage (Just (ProcWorkerFailure cpid e _ outbox)) = do
left =<< lift (do
case fromException e of
Just (IOError{ioe_type = ResourceVanished}) -> do
liftIO $! putStrLn "supervisor: client connection got ResourceVanished"
procFinish outbox
procFinished
Just (IOError{ioe_type = EOF}) -> do
liftIO $! putStrLn "supervisor: client connection got EOF"
procFinish outbox
procRunning
_ -> do
liftIO $! putStrLn $! "supervisor: client " ++ show cpid ++
" failed with: " ++ show e
procFinish outbox
procRunning
)
handleServiceMessage (Just (ProcInitFailure cpid e _ outbox)) = do
left =<< lift (do
liftIO $! putStrLn $! "ERROR: " ++ show e
liftIO $! putStrLn $! "supervisor: client init " ++ show cpid ++
" failed with: " ++ show e
procFinish outbox
onInitFailed
procRunning
)
handleClientSupervisorCommand:: Maybe ClientSupervisorCommand
-> EitherT HEPProcState HEP HEPProcState
handleClientSupervisorCommand Nothing =right =<< lift procRunning
handleClientSupervisorCommand (Just StopClient) = left =<< lift
( do
workers <- getSubscribed
forM workers $! \pid -> do
liftIO $! putStrLn $! "killing client " ++ show pid
killProc pid
procRunning
)
mreq <- runEitherT $! do
handleChildLinkMessage $! fromMessage msg
handleServiceMessage $! fromMessage msg
handleClientSupervisorCommand $! fromMessage msg
case mreq of
Left some -> return some
Right some -> return some | 2,839 | clientSupervisor onInitFailed = do
msg <- receive
let handleChildLinkMessage:: Maybe LinkedMessage -> EitherT HEPProcState HEP HEPProcState
handleChildLinkMessage Nothing = lift procRunning >>= right
handleChildLinkMessage (Just (ProcessFinished pid)) = do
lift $! liftIO $! putStrLn $! "supervisor: client thread exited "
subscribed <- lift getSubscribed
case subscribed of
[] -> lift procFinished >>= left
_ -> lift procRunning >>= left
handleServiceMessage:: Maybe SupervisorMessage -> EitherT HEPProcState HEP HEPProcState
handleServiceMessage Nothing = right =<< lift procRunning
handleServiceMessage (Just (ProcWorkerFailure cpid e _ outbox)) = do
left =<< lift (do
case fromException e of
Just (IOError{ioe_type = ResourceVanished}) -> do
liftIO $! putStrLn "supervisor: client connection got ResourceVanished"
procFinish outbox
procFinished
Just (IOError{ioe_type = EOF}) -> do
liftIO $! putStrLn "supervisor: client connection got EOF"
procFinish outbox
procRunning
_ -> do
liftIO $! putStrLn $! "supervisor: client " ++ show cpid ++
" failed with: " ++ show e
procFinish outbox
procRunning
)
handleServiceMessage (Just (ProcInitFailure cpid e _ outbox)) = do
left =<< lift (do
liftIO $! putStrLn $! "ERROR: " ++ show e
liftIO $! putStrLn $! "supervisor: client init " ++ show cpid ++
" failed with: " ++ show e
procFinish outbox
onInitFailed
procRunning
)
handleClientSupervisorCommand:: Maybe ClientSupervisorCommand
-> EitherT HEPProcState HEP HEPProcState
handleClientSupervisorCommand Nothing =right =<< lift procRunning
handleClientSupervisorCommand (Just StopClient) = left =<< lift
( do
workers <- getSubscribed
forM workers $! \pid -> do
liftIO $! putStrLn $! "killing client " ++ show pid
killProc pid
procRunning
)
mreq <- runEitherT $! do
handleChildLinkMessage $! fromMessage msg
handleServiceMessage $! fromMessage msg
handleClientSupervisorCommand $! fromMessage msg
case mreq of
Left some -> return some
Right some -> return some | 2,803 | false | true | 0 | 26 | 1,124 | 633 | 285 | 348 | null | null |
josuf107/Adverb | Adverb/Common.hs | gpl-3.0 | quiescently = id | 16 | quiescently = id | 16 | quiescently = id | 16 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | quotIntegerIdKey = mkPreludeMiscIdUnique 79 | 56 | quotIntegerIdKey = mkPreludeMiscIdUnique 79 | 56 | quotIntegerIdKey = mkPreludeMiscIdUnique 79 | 56 | false | false | 0 | 5 | 16 | 9 | 4 | 5 | null | null |
laszlopandy/elm-package | src/Elm/Package/Description.hs | bsd-3-clause | locateExposedModules :: (MonadIO m, MonadError String m) => Description -> m [(Module.Name, FilePath)]
locateExposedModules desc =
mapM locate (exposed desc)
where
locate modul =
let path = Module.nameToPath modul <.> "elm"
dirs = sourceDirs desc
in
do possibleLocations <-
forM dirs $ \dir -> do
exists <- liftIO $ doesFileExist (dir </> path)
return (if exists then Just (dir </> path) else Nothing)
case Maybe.catMaybes possibleLocations of
[] ->
throwError $
unlines
[ "Could not find exposed module '" ++ Module.nameToString modul ++ "' when looking through"
, "the following source directories:"
, concatMap ("\n " ++) dirs
, ""
, "You may need to add a source directory to your " ++ Path.description ++ " file."
]
[location] ->
return (modul, location)
locations ->
throwError $
unlines
[ "I found more than one module named '" ++ Module.nameToString modul ++ "' in the"
, "following locations:"
, concatMap ("\n " ++) locations
, ""
, "Module names must be unique within your package."
]
-- JSON | 1,421 | locateExposedModules :: (MonadIO m, MonadError String m) => Description -> m [(Module.Name, FilePath)]
locateExposedModules desc =
mapM locate (exposed desc)
where
locate modul =
let path = Module.nameToPath modul <.> "elm"
dirs = sourceDirs desc
in
do possibleLocations <-
forM dirs $ \dir -> do
exists <- liftIO $ doesFileExist (dir </> path)
return (if exists then Just (dir </> path) else Nothing)
case Maybe.catMaybes possibleLocations of
[] ->
throwError $
unlines
[ "Could not find exposed module '" ++ Module.nameToString modul ++ "' when looking through"
, "the following source directories:"
, concatMap ("\n " ++) dirs
, ""
, "You may need to add a source directory to your " ++ Path.description ++ " file."
]
[location] ->
return (modul, location)
locations ->
throwError $
unlines
[ "I found more than one module named '" ++ Module.nameToString modul ++ "' in the"
, "following locations:"
, concatMap ("\n " ++) locations
, ""
, "Module names must be unique within your package."
]
-- JSON | 1,421 | locateExposedModules desc =
mapM locate (exposed desc)
where
locate modul =
let path = Module.nameToPath modul <.> "elm"
dirs = sourceDirs desc
in
do possibleLocations <-
forM dirs $ \dir -> do
exists <- liftIO $ doesFileExist (dir </> path)
return (if exists then Just (dir </> path) else Nothing)
case Maybe.catMaybes possibleLocations of
[] ->
throwError $
unlines
[ "Could not find exposed module '" ++ Module.nameToString modul ++ "' when looking through"
, "the following source directories:"
, concatMap ("\n " ++) dirs
, ""
, "You may need to add a source directory to your " ++ Path.description ++ " file."
]
[location] ->
return (modul, location)
locations ->
throwError $
unlines
[ "I found more than one module named '" ++ Module.nameToString modul ++ "' in the"
, "following locations:"
, concatMap ("\n " ++) locations
, ""
, "Module names must be unique within your package."
]
-- JSON | 1,318 | false | true | 0 | 19 | 584 | 309 | 158 | 151 | null | null |
isomorphism/csound-expression | src/Csound/Air/Wav.hs | bsd-3-clause | oopLineSnd :: (Num a, Sigs a) => D -> [a] -> a
loopLineSnd dt xs = repeatSnd (dt * (int $ length xs)) $ lineSnd dt xs
| 118 | loopLineSnd :: (Num a, Sigs a) => D -> [a] -> a
loopLineSnd dt xs = repeatSnd (dt * (int $ length xs)) $ lineSnd dt xs | 118 | loopLineSnd dt xs = repeatSnd (dt * (int $ length xs)) $ lineSnd dt xs | 70 | false | true | 0 | 11 | 27 | 75 | 37 | 38 | null | null |
A1kmm/sbasetram | sbasetram.hs | agpl-3.0 | countBackground probes =
do
basecount <- S.newSTRef 0
transcount <- S.newSTRef 0
bases <- (S.newArray (0, 3) 0) ::S.ST s (S.STUArray s Word8 Int)
transitions <- (S.newArray ((0, 0), (3, 3)) 0)::S.ST s (S.STUArray s (Word8, Word8) Int)
forM probes $ \(_, probe) ->
do
byteStringForM probe $ \b ->
do
modifySTRef' basecount (+1)
modifyMArrayAtIdx bases (fromIntegral b) (+1)
byteStringPairsForM probe $ \bp -> \b ->
do
modifySTRef' transcount strictIncrement
modifyMArrayAtIdx transitions ((fromIntegral bp), (fromIntegral b)) (+1)
fbases <- S.unsafeFreeze bases
ftransitions <- S.unsafeFreeze transitions
fbasecount <- S.readSTRef basecount
ftranscount <- S.readSTRef transcount
return (fbases, fbasecount, ftransitions, ftranscount) | 936 | countBackground probes =
do
basecount <- S.newSTRef 0
transcount <- S.newSTRef 0
bases <- (S.newArray (0, 3) 0) ::S.ST s (S.STUArray s Word8 Int)
transitions <- (S.newArray ((0, 0), (3, 3)) 0)::S.ST s (S.STUArray s (Word8, Word8) Int)
forM probes $ \(_, probe) ->
do
byteStringForM probe $ \b ->
do
modifySTRef' basecount (+1)
modifyMArrayAtIdx bases (fromIntegral b) (+1)
byteStringPairsForM probe $ \bp -> \b ->
do
modifySTRef' transcount strictIncrement
modifyMArrayAtIdx transitions ((fromIntegral bp), (fromIntegral b)) (+1)
fbases <- S.unsafeFreeze bases
ftransitions <- S.unsafeFreeze transitions
fbasecount <- S.readSTRef basecount
ftranscount <- S.readSTRef transcount
return (fbases, fbasecount, ftransitions, ftranscount) | 936 | countBackground probes =
do
basecount <- S.newSTRef 0
transcount <- S.newSTRef 0
bases <- (S.newArray (0, 3) 0) ::S.ST s (S.STUArray s Word8 Int)
transitions <- (S.newArray ((0, 0), (3, 3)) 0)::S.ST s (S.STUArray s (Word8, Word8) Int)
forM probes $ \(_, probe) ->
do
byteStringForM probe $ \b ->
do
modifySTRef' basecount (+1)
modifyMArrayAtIdx bases (fromIntegral b) (+1)
byteStringPairsForM probe $ \bp -> \b ->
do
modifySTRef' transcount strictIncrement
modifyMArrayAtIdx transitions ((fromIntegral bp), (fromIntegral b)) (+1)
fbases <- S.unsafeFreeze bases
ftransitions <- S.unsafeFreeze transitions
fbasecount <- S.readSTRef basecount
ftranscount <- S.readSTRef transcount
return (fbases, fbasecount, ftransitions, ftranscount) | 936 | false | false | 0 | 19 | 301 | 335 | 166 | 169 | null | null |
adamConnerSax/perConstructor-sop | src/Generics/SOP/PerConstructor.hs | bsd-3-clause | functorDoPerConstructor' :: (Generic a, Functor g, Applicative h) => MapFieldsAndSequence (g :.: Maybe) h (Code a) -> g a -> [(g (Maybe a), h a)]
functorDoPerConstructor' mapFsAndS = functorToPerConstructorList' (mapFsAndS . distributeToFields) | 244 | functorDoPerConstructor' :: (Generic a, Functor g, Applicative h) => MapFieldsAndSequence (g :.: Maybe) h (Code a) -> g a -> [(g (Maybe a), h a)]
functorDoPerConstructor' mapFsAndS = functorToPerConstructorList' (mapFsAndS . distributeToFields) | 244 | functorDoPerConstructor' mapFsAndS = functorToPerConstructorList' (mapFsAndS . distributeToFields) | 98 | false | true | 0 | 12 | 31 | 100 | 50 | 50 | null | null |
peterokagey/haskellOEIS | src/RichardGuy/A282615.hs | apache-2.0 | enumerateA282615 :: Int -> [[(Int, Int, Int)]]
enumerateA282615 n = filter (isSeparable `also` isSelfConjugate n) $ enumerateA104429 n | 134 | enumerateA282615 :: Int -> [[(Int, Int, Int)]]
enumerateA282615 n = filter (isSeparable `also` isSelfConjugate n) $ enumerateA104429 n | 134 | enumerateA282615 n = filter (isSeparable `also` isSelfConjugate n) $ enumerateA104429 n | 87 | false | true | 0 | 9 | 17 | 55 | 30 | 25 | null | null |
snoyberg/ghc | libraries/base/GHC/List.hs | bsd-3-clause | -- | The 'zipWith3' function takes a function which combines three
-- elements, as well as three lists and returns a list of their point-wise
-- combination, analogous to 'zipWith'.
zipWith3 :: (a->b->c->d) -> [a]->[b]->[c]->[d]
zipWith3 z (a:as) (b:bs) (c:cs)
= z a b c : zipWith3 z as bs cs | 332 | zipWith3 :: (a->b->c->d) -> [a]->[b]->[c]->[d]
zipWith3 z (a:as) (b:bs) (c:cs)
= z a b c : zipWith3 z as bs cs | 150 | zipWith3 z (a:as) (b:bs) (c:cs)
= z a b c : zipWith3 z as bs cs | 88 | true | true | 2 | 12 | 90 | 115 | 59 | 56 | null | null |
thalerjonathan/phd | coding/libraries/chimera/examples/ABS/Segregation/Run.hs | gpl-3.0 | rngSeed = 42 | 12 | rngSeed = 42 | 12 | rngSeed = 42 | 12 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
phischu/fragnix | tests/packages/scotty/Network.Wai.Handler.Warp.Response.hs | bsd-3-clause | checkPersist :: Request -> IndexedHeader -> Bool
checkPersist req reqidxhdr
| ver == H.http11 = checkPersist11 conn
| otherwise = checkPersist10 conn
where
ver = httpVersion req
conn = reqidxhdr ! fromEnum ReqConnection
checkPersist11 (Just x)
| CI.foldCase x == "close" = False
checkPersist11 _ = True
checkPersist10 (Just x)
| CI.foldCase x == "keep-alive" = True
checkPersist10 _ = False | 489 | checkPersist :: Request -> IndexedHeader -> Bool
checkPersist req reqidxhdr
| ver == H.http11 = checkPersist11 conn
| otherwise = checkPersist10 conn
where
ver = httpVersion req
conn = reqidxhdr ! fromEnum ReqConnection
checkPersist11 (Just x)
| CI.foldCase x == "close" = False
checkPersist11 _ = True
checkPersist10 (Just x)
| CI.foldCase x == "keep-alive" = True
checkPersist10 _ = False | 489 | checkPersist req reqidxhdr
| ver == H.http11 = checkPersist11 conn
| otherwise = checkPersist10 conn
where
ver = httpVersion req
conn = reqidxhdr ! fromEnum ReqConnection
checkPersist11 (Just x)
| CI.foldCase x == "close" = False
checkPersist11 _ = True
checkPersist10 (Just x)
| CI.foldCase x == "keep-alive" = True
checkPersist10 _ = False | 440 | false | true | 7 | 10 | 159 | 145 | 68 | 77 | null | null |
vTurbine/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | metaDataDataConName = dcQual gHC_GENERICS (fsLit "MetaData") metaDataDataConKey | 81 | metaDataDataConName = dcQual gHC_GENERICS (fsLit "MetaData") metaDataDataConKey | 81 | metaDataDataConName = dcQual gHC_GENERICS (fsLit "MetaData") metaDataDataConKey | 81 | false | false | 0 | 7 | 8 | 19 | 9 | 10 | null | null |
myuon/Chimera | Chimera/Engine/Core/Menu.hs | mit | posloop :: Font -> [String] -> StateT SelectMap Game (Maybe String)
posloop font keys = do
(s,p) <- use pointing2
m <- use mapinfo
forM_ (wires s m) $ \(x,y) ->
color white . thickness 2 . line $ [x,y]
translate (p + 2) . color (Color 0.4 0.4 0.4 0.7) . text font 20 $ s
translate p . color white . text font 20 $ s
let keyMap = snd $ m M.! s
forM_ [KeyUp, KeyRight, KeyDown, KeyLeft] $ \k ->
keyDown k >>= \b -> when b $ case k `M.lookup` keyMap of
Just u -> when (u `elem` keys) $ pointing2 .= (u, fst $ m M.! u)
Nothing -> return ()
keyDown (charToKey 'Z') >>= \z -> case z of
True -> (Just . fst) `fmap` use pointing2
False -> return Nothing
where
wires :: String -> MapInfo -> [(Vec2, Vec2)]
wires s m = let (p,ps) = m M.! s in
F.toList $ fmap ((,) p . fst . (m M.!)) $ ps | 850 | posloop :: Font -> [String] -> StateT SelectMap Game (Maybe String)
posloop font keys = do
(s,p) <- use pointing2
m <- use mapinfo
forM_ (wires s m) $ \(x,y) ->
color white . thickness 2 . line $ [x,y]
translate (p + 2) . color (Color 0.4 0.4 0.4 0.7) . text font 20 $ s
translate p . color white . text font 20 $ s
let keyMap = snd $ m M.! s
forM_ [KeyUp, KeyRight, KeyDown, KeyLeft] $ \k ->
keyDown k >>= \b -> when b $ case k `M.lookup` keyMap of
Just u -> when (u `elem` keys) $ pointing2 .= (u, fst $ m M.! u)
Nothing -> return ()
keyDown (charToKey 'Z') >>= \z -> case z of
True -> (Just . fst) `fmap` use pointing2
False -> return Nothing
where
wires :: String -> MapInfo -> [(Vec2, Vec2)]
wires s m = let (p,ps) = m M.! s in
F.toList $ fmap ((,) p . fst . (m M.!)) $ ps | 850 | posloop font keys = do
(s,p) <- use pointing2
m <- use mapinfo
forM_ (wires s m) $ \(x,y) ->
color white . thickness 2 . line $ [x,y]
translate (p + 2) . color (Color 0.4 0.4 0.4 0.7) . text font 20 $ s
translate p . color white . text font 20 $ s
let keyMap = snd $ m M.! s
forM_ [KeyUp, KeyRight, KeyDown, KeyLeft] $ \k ->
keyDown k >>= \b -> when b $ case k `M.lookup` keyMap of
Just u -> when (u `elem` keys) $ pointing2 .= (u, fst $ m M.! u)
Nothing -> return ()
keyDown (charToKey 'Z') >>= \z -> case z of
True -> (Just . fst) `fmap` use pointing2
False -> return Nothing
where
wires :: String -> MapInfo -> [(Vec2, Vec2)]
wires s m = let (p,ps) = m M.! s in
F.toList $ fmap ((,) p . fst . (m M.!)) $ ps | 782 | false | true | 0 | 19 | 242 | 474 | 238 | 236 | null | null |
marcinmrotek/hsqml-datamodel | Setup.hs | bsd-3-clause | mkGHCiFixLibPkgId :: PackageDescription -> PackageIdentifier
mkGHCiFixLibPkgId pkgDesc =
let pid = packageId pkgDesc
(PackageName name) = pkgName pid
in pid {pkgName = PackageName $ "cbits-" ++ name} | 209 | mkGHCiFixLibPkgId :: PackageDescription -> PackageIdentifier
mkGHCiFixLibPkgId pkgDesc =
let pid = packageId pkgDesc
(PackageName name) = pkgName pid
in pid {pkgName = PackageName $ "cbits-" ++ name} | 209 | mkGHCiFixLibPkgId pkgDesc =
let pid = packageId pkgDesc
(PackageName name) = pkgName pid
in pid {pkgName = PackageName $ "cbits-" ++ name} | 148 | false | true | 0 | 10 | 36 | 63 | 31 | 32 | null | null |
bezirg/gpah | src/Generics/GPAH/Function/PPrint.hs | bsd-3-clause | -- | the list of query-functions to search for
qList = ["mkQ","gmapQ","everything", "universe", "universeBi"] | 109 | qList = ["mkQ","gmapQ","everything", "universe", "universeBi"] | 62 | qList = ["mkQ","gmapQ","everything", "universe", "universeBi"] | 62 | true | false | 1 | 5 | 13 | 25 | 14 | 11 | null | null |
GaloisInc/sk-dev-platform | libs/SCD/src/SCD/Lobster/Env.hs | bsd-3-clause | checkFileName :: String -> Env -> Bool
checkFileName f e = f `elem` fileNames e | 79 | checkFileName :: String -> Env -> Bool
checkFileName f e = f `elem` fileNames e | 79 | checkFileName f e = f `elem` fileNames e | 40 | false | true | 0 | 6 | 14 | 33 | 17 | 16 | null | null |
GaloisInc/ivory-tower-stm32 | ivory-bsp-stm32/src/Ivory/BSP/STM32/Peripheral/SPI/Peripheral.hs | bsd-3-clause | initOutPin :: GPIOPin -> GPIO_AF -> Ivory eff ()
initOutPin pin af = do
comment ("init spi output pin " ++ pinName pin)
pinEnable pin
pinSetAF pin af
pinSetMode pin gpio_mode_af
pinSetOutputType pin gpio_outputtype_pushpull
pinSetSpeed pin gpio_speed_50mhz
-- | Enable peripheral and setup GPIOs. Must be performed
-- before any other SPI peripheral actions. | 399 | initOutPin :: GPIOPin -> GPIO_AF -> Ivory eff ()
initOutPin pin af = do
comment ("init spi output pin " ++ pinName pin)
pinEnable pin
pinSetAF pin af
pinSetMode pin gpio_mode_af
pinSetOutputType pin gpio_outputtype_pushpull
pinSetSpeed pin gpio_speed_50mhz
-- | Enable peripheral and setup GPIOs. Must be performed
-- before any other SPI peripheral actions. | 399 | initOutPin pin af = do
comment ("init spi output pin " ++ pinName pin)
pinEnable pin
pinSetAF pin af
pinSetMode pin gpio_mode_af
pinSetOutputType pin gpio_outputtype_pushpull
pinSetSpeed pin gpio_speed_50mhz
-- | Enable peripheral and setup GPIOs. Must be performed
-- before any other SPI peripheral actions. | 350 | false | true | 0 | 10 | 94 | 87 | 38 | 49 | null | null |
quyse/flaw | flaw-graphics/Flaw/Graphics/Program.hs | mit | withState :: (State -> IO (State, a)) -> Program a
withState f = do
stateVar <- ask
liftIO $ do
state <- readIORef stateVar
(newState, result) <- f state
writeIORef stateVar newState
return result | 216 | withState :: (State -> IO (State, a)) -> Program a
withState f = do
stateVar <- ask
liftIO $ do
state <- readIORef stateVar
(newState, result) <- f state
writeIORef stateVar newState
return result | 216 | withState f = do
stateVar <- ask
liftIO $ do
state <- readIORef stateVar
(newState, result) <- f state
writeIORef stateVar newState
return result | 165 | false | true | 0 | 11 | 53 | 91 | 42 | 49 | null | null |
charleso/intellij-haskforce | tests/gold/parser/Fun00004.hs | apache-2.0 | -- | Insert a variable into the environment
localVar :: Typeable b => VarId -> Info b -> Opt a -> Opt a
localVar v info = local $ \env -> env {varEnv = (v, SomeInfo info):varEnv env} | 182 | localVar :: Typeable b => VarId -> Info b -> Opt a -> Opt a
localVar v info = local $ \env -> env {varEnv = (v, SomeInfo info):varEnv env} | 138 | localVar v info = local $ \env -> env {varEnv = (v, SomeInfo info):varEnv env} | 78 | true | true | 0 | 11 | 37 | 78 | 39 | 39 | null | null |
mightymoose/liquidhaskell | benchmarks/text-0.11.2.3/Data/Text/Lazy.hs | bsd-3-clause | --LIQUID specialized from Data.Text.Util.intersperse
{-@ intersperseLT :: Text -> ts:[Text]
-> {v:[Text] | (sum_ltlengths v) >= (sum_ltlengths ts)}
@-}
intersperseLT :: Text -> [Text] -> [Text]
intersperseLT _ [] = [] | 243 | intersperseLT :: Text -> [Text] -> [Text]
intersperseLT _ [] = [] | 71 | intersperseLT _ [] = [] | 29 | true | true | 0 | 7 | 56 | 36 | 20 | 16 | null | null |
tjakway/ghcjvm | compiler/utils/Util.hs | bsd-3-clause | isEqual :: Ordering -> Bool
-- Often used in (isEqual (a `compare` b))
isEqual GT = False | 89 | isEqual :: Ordering -> Bool
isEqual GT = False | 46 | isEqual GT = False | 18 | true | true | 0 | 7 | 16 | 25 | 11 | 14 | null | null |
laszlopandy/elm-package | src/Catalog.hs | bsd-3-clause | allPackages
:: (MonadIO m, MonadReader Manager.Environment m, MonadError String m)
=> Maybe Time.UTCTime
-> m (Maybe [(Package.Name, [Package.Version])])
allPackages maybeTime =
do url <- catalog "all-packages" vars
Http.send url $ \request manager -> do
response <- Client.httpLbs request manager
case Json.eitherDecode (Client.responseBody response) of
Left _ ->
return Nothing
Right summaries ->
return $ Just $ map (\(PackageSummary s) -> s) summaries
where
vars =
case maybeTime of
Nothing -> []
Just time -> [("since", show time)] | 658 | allPackages
:: (MonadIO m, MonadReader Manager.Environment m, MonadError String m)
=> Maybe Time.UTCTime
-> m (Maybe [(Package.Name, [Package.Version])])
allPackages maybeTime =
do url <- catalog "all-packages" vars
Http.send url $ \request manager -> do
response <- Client.httpLbs request manager
case Json.eitherDecode (Client.responseBody response) of
Left _ ->
return Nothing
Right summaries ->
return $ Just $ map (\(PackageSummary s) -> s) summaries
where
vars =
case maybeTime of
Nothing -> []
Just time -> [("since", show time)] | 658 | allPackages maybeTime =
do url <- catalog "all-packages" vars
Http.send url $ \request manager -> do
response <- Client.httpLbs request manager
case Json.eitherDecode (Client.responseBody response) of
Left _ ->
return Nothing
Right summaries ->
return $ Just $ map (\(PackageSummary s) -> s) summaries
where
vars =
case maybeTime of
Nothing -> []
Just time -> [("since", show time)] | 492 | false | true | 0 | 19 | 198 | 228 | 112 | 116 | null | null |
Mattiemus/LaneWars | Game/Shared/Object.hs | mit | -- |Default stat values
basicStats = Stats {
stHealth = 0,
stMaxHealth = 1,
stMana = 0,
stMaxMana = 1,
stSpeed = 0,
stDefence = 0,
stAttack = 0
} | 205 | basicStats = Stats {
stHealth = 0,
stMaxHealth = 1,
stMana = 0,
stMaxMana = 1,
stSpeed = 0,
stDefence = 0,
stAttack = 0
} | 181 | basicStats = Stats {
stHealth = 0,
stMaxHealth = 1,
stMana = 0,
stMaxMana = 1,
stSpeed = 0,
stDefence = 0,
stAttack = 0
} | 181 | true | false | 0 | 6 | 89 | 51 | 33 | 18 | null | null |
RossMeikleham/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | syntaxNames (DeclRule syms _) = mapMaybe ename syms
where ename (Keyword n) = Just n
ename _ = Nothing | 140 | syntaxNames (DeclRule syms _) = mapMaybe ename syms
where ename (Keyword n) = Just n
ename _ = Nothing | 140 | syntaxNames (DeclRule syms _) = mapMaybe ename syms
where ename (Keyword n) = Just n
ename _ = Nothing | 140 | false | false | 0 | 9 | 56 | 49 | 23 | 26 | null | null |
Philonous/d-bus | src/DBus/Introspect.hs | mit | introspectSignal :: SomeSignalDescription -> ISignal
introspectSignal (SSD (s :: SignalDescription a)) =
ISignal { iSignalName = signalDMember s
, iSignalArguments = zipWith introspectSignalArgument
(fromSing $ (sing :: Sing a))
(adToList $ signalDArguments s)
, iSignalAnnotations = [] -- signalAnnotations s
} | 424 | introspectSignal :: SomeSignalDescription -> ISignal
introspectSignal (SSD (s :: SignalDescription a)) =
ISignal { iSignalName = signalDMember s
, iSignalArguments = zipWith introspectSignalArgument
(fromSing $ (sing :: Sing a))
(adToList $ signalDArguments s)
, iSignalAnnotations = [] -- signalAnnotations s
} | 424 | introspectSignal (SSD (s :: SignalDescription a)) =
ISignal { iSignalName = signalDMember s
, iSignalArguments = zipWith introspectSignalArgument
(fromSing $ (sing :: Sing a))
(adToList $ signalDArguments s)
, iSignalAnnotations = [] -- signalAnnotations s
} | 371 | false | true | 0 | 11 | 153 | 93 | 50 | 43 | null | null |
urbanslug/ghc | compiler/utils/Util.hs | bsd-3-clause | isIn _msg x ys = x `elem` ys | 31 | isIn _msg x ys = x `elem` ys | 31 | isIn _msg x ys = x `elem` ys | 31 | false | false | 0 | 5 | 10 | 19 | 10 | 9 | null | null |
eryx67/haskell-libtorrent | src/Network/Libtorrent/TorrentHandle.hs | bsd-3-clause | setTorrentHandleMaxUploads :: MonadIO m => TorrentHandle -> C.CInt -> m ()
setTorrentHandleMaxUploads ho max_uploads =
liftIO . withPtr ho $ \hoPtr ->
checkError [except| { $(torrent_handle * hoPtr)->set_max_uploads($(int max_uploads)); } |] | 246 | setTorrentHandleMaxUploads :: MonadIO m => TorrentHandle -> C.CInt -> m ()
setTorrentHandleMaxUploads ho max_uploads =
liftIO . withPtr ho $ \hoPtr ->
checkError [except| { $(torrent_handle * hoPtr)->set_max_uploads($(int max_uploads)); } |] | 246 | setTorrentHandleMaxUploads ho max_uploads =
liftIO . withPtr ho $ \hoPtr ->
checkError [except| { $(torrent_handle * hoPtr)->set_max_uploads($(int max_uploads)); } |] | 170 | false | true | 0 | 9 | 35 | 61 | 31 | 30 | null | null |
DavidAlphaFox/ghc | libraries/Cabal/cabal-install/Distribution/Client/Setup.hs | bsd-3-clause | optionSolverFlags :: ShowOrParseArgs
-> (flags -> Flag Int ) -> (Flag Int -> flags -> flags)
-> (flags -> Flag Bool ) -> (Flag Bool -> flags -> flags)
-> (flags -> Flag Bool ) -> (Flag Bool -> flags -> flags)
-> (flags -> Flag Bool ) -> (Flag Bool -> flags -> flags)
-> (flags -> Flag Bool ) -> (Flag Bool -> flags -> flags)
-> [OptionField flags]
optionSolverFlags showOrParseArgs getmbj setmbj getrg setrg _getig _setig getsip setsip getstrfl setstrfl =
[ option [] ["max-backjumps"]
("Maximum number of backjumps allowed while solving (default: " ++ show defaultMaxBackjumps ++ "). Use a negative number to enable unlimited backtracking. Use 0 to disable backtracking completely.")
getmbj setmbj
(reqArg "NUM" (readP_to_E ("Cannot parse number: "++)
(fmap toFlag (Parse.readS_to_P reads)))
(map show . flagToList))
, option [] ["reorder-goals"]
"Try to reorder goals according to certain heuristics. Slows things down on average, but may make backtracking faster for some packages."
getrg setrg
(yesNoOpt showOrParseArgs)
-- TODO: Disabled for now because it does not work as advertised (yet).
{-
, option [] ["independent-goals"]
"Treat several goals on the command line as independent. If several goals depend on the same package, different versions can be chosen."
getig setig
(yesNoOpt showOrParseArgs)
-}
, option [] ["shadow-installed-packages"]
"If multiple package instances of the same version are installed, treat all but one as shadowed."
getsip setsip
(yesNoOpt showOrParseArgs)
, option [] ["strong-flags"]
"Do not defer flag choices (this used to be the default in cabal-install <= 1.20)."
getstrfl setstrfl
(yesNoOpt showOrParseArgs)
] | 1,934 | optionSolverFlags :: ShowOrParseArgs
-> (flags -> Flag Int ) -> (Flag Int -> flags -> flags)
-> (flags -> Flag Bool ) -> (Flag Bool -> flags -> flags)
-> (flags -> Flag Bool ) -> (Flag Bool -> flags -> flags)
-> (flags -> Flag Bool ) -> (Flag Bool -> flags -> flags)
-> (flags -> Flag Bool ) -> (Flag Bool -> flags -> flags)
-> [OptionField flags]
optionSolverFlags showOrParseArgs getmbj setmbj getrg setrg _getig _setig getsip setsip getstrfl setstrfl =
[ option [] ["max-backjumps"]
("Maximum number of backjumps allowed while solving (default: " ++ show defaultMaxBackjumps ++ "). Use a negative number to enable unlimited backtracking. Use 0 to disable backtracking completely.")
getmbj setmbj
(reqArg "NUM" (readP_to_E ("Cannot parse number: "++)
(fmap toFlag (Parse.readS_to_P reads)))
(map show . flagToList))
, option [] ["reorder-goals"]
"Try to reorder goals according to certain heuristics. Slows things down on average, but may make backtracking faster for some packages."
getrg setrg
(yesNoOpt showOrParseArgs)
-- TODO: Disabled for now because it does not work as advertised (yet).
{-
, option [] ["independent-goals"]
"Treat several goals on the command line as independent. If several goals depend on the same package, different versions can be chosen."
getig setig
(yesNoOpt showOrParseArgs)
-}
, option [] ["shadow-installed-packages"]
"If multiple package instances of the same version are installed, treat all but one as shadowed."
getsip setsip
(yesNoOpt showOrParseArgs)
, option [] ["strong-flags"]
"Do not defer flag choices (this used to be the default in cabal-install <= 1.20)."
getstrfl setstrfl
(yesNoOpt showOrParseArgs)
] | 1,934 | optionSolverFlags showOrParseArgs getmbj setmbj getrg setrg _getig _setig getsip setsip getstrfl setstrfl =
[ option [] ["max-backjumps"]
("Maximum number of backjumps allowed while solving (default: " ++ show defaultMaxBackjumps ++ "). Use a negative number to enable unlimited backtracking. Use 0 to disable backtracking completely.")
getmbj setmbj
(reqArg "NUM" (readP_to_E ("Cannot parse number: "++)
(fmap toFlag (Parse.readS_to_P reads)))
(map show . flagToList))
, option [] ["reorder-goals"]
"Try to reorder goals according to certain heuristics. Slows things down on average, but may make backtracking faster for some packages."
getrg setrg
(yesNoOpt showOrParseArgs)
-- TODO: Disabled for now because it does not work as advertised (yet).
{-
, option [] ["independent-goals"]
"Treat several goals on the command line as independent. If several goals depend on the same package, different versions can be chosen."
getig setig
(yesNoOpt showOrParseArgs)
-}
, option [] ["shadow-installed-packages"]
"If multiple package instances of the same version are installed, treat all but one as shadowed."
getsip setsip
(yesNoOpt showOrParseArgs)
, option [] ["strong-flags"]
"Do not defer flag choices (this used to be the default in cabal-install <= 1.20)."
getstrfl setstrfl
(yesNoOpt showOrParseArgs)
] | 1,461 | false | true | 0 | 18 | 535 | 370 | 189 | 181 | null | null |
soimort/GrassMudHorse | Input.hs | gpl-2.0 | parse (A:C:A:xs) = Dup:(parse xs) | 33 | parse (A:C:A:xs) = Dup:(parse xs) | 33 | parse (A:C:A:xs) = Dup:(parse xs) | 33 | false | false | 2 | 8 | 4 | 38 | 17 | 21 | null | null |
fthomas/ohloh-hs | tests/Main.hs | bsd-3-clause | tests = [
testGroup "Account" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Account -> Bool)
],
testGroup "ActivityFact" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: ActivityFact -> Bool)
],
testGroup "Analysis" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Analysis -> Bool)
],
testGroup "ContributorFact" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: ContributorFact -> Bool)
],
testGroup "ContributorLanguageFact" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: ContributorLanguageFact -> Bool)
],
testGroup "Enlistment" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Enlistment -> Bool)
],
testGroup "Factoid" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Factoid -> Bool)
],
testGroup "Kudo" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Kudo -> Bool)
],
testGroup "KudoScore" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: KudoScore -> Bool)
],
testGroup "Language" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Language -> Bool)
],
testGroup "Project" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Project -> Bool)
],
testGroup "Repository" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Repository -> Bool)
],
testGroup "SizeFact" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: SizeFact -> Bool)
],
testGroup "Stack" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Stack -> Bool)
],
testGroup "StackEntry" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: StackEntry -> Bool)
]
] | 1,738 | tests = [
testGroup "Account" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Account -> Bool)
],
testGroup "ActivityFact" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: ActivityFact -> Bool)
],
testGroup "Analysis" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Analysis -> Bool)
],
testGroup "ContributorFact" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: ContributorFact -> Bool)
],
testGroup "ContributorLanguageFact" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: ContributorLanguageFact -> Bool)
],
testGroup "Enlistment" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Enlistment -> Bool)
],
testGroup "Factoid" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Factoid -> Bool)
],
testGroup "Kudo" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Kudo -> Bool)
],
testGroup "KudoScore" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: KudoScore -> Bool)
],
testGroup "Language" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Language -> Bool)
],
testGroup "Project" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Project -> Bool)
],
testGroup "Repository" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Repository -> Bool)
],
testGroup "SizeFact" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: SizeFact -> Bool)
],
testGroup "Stack" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Stack -> Bool)
],
testGroup "StackEntry" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: StackEntry -> Bool)
]
] | 1,738 | tests = [
testGroup "Account" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Account -> Bool)
],
testGroup "ActivityFact" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: ActivityFact -> Bool)
],
testGroup "Analysis" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Analysis -> Bool)
],
testGroup "ContributorFact" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: ContributorFact -> Bool)
],
testGroup "ContributorLanguageFact" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: ContributorLanguageFact -> Bool)
],
testGroup "Enlistment" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Enlistment -> Bool)
],
testGroup "Factoid" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Factoid -> Bool)
],
testGroup "Kudo" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Kudo -> Bool)
],
testGroup "KudoScore" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: KudoScore -> Bool)
],
testGroup "Language" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Language -> Bool)
],
testGroup "Project" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Project -> Bool)
],
testGroup "Repository" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Repository -> Bool)
],
testGroup "SizeFact" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: SizeFact -> Bool)
],
testGroup "Stack" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: Stack -> Bool)
],
testGroup "StackEntry" [
testProperty "pickleUnpickle" (prop_pickleUnpickle :: StackEntry -> Bool)
]
] | 1,738 | false | false | 0 | 10 | 380 | 396 | 213 | 183 | null | null |
mcschroeder/ghc | libraries/template-haskell/Language/Haskell/TH/Syntax.hs | bsd-3-clause | tupleDataName n = mk_tup_name (n-1) DataName | 44 | tupleDataName n = mk_tup_name (n-1) DataName | 44 | tupleDataName n = mk_tup_name (n-1) DataName | 44 | false | false | 0 | 7 | 5 | 21 | 10 | 11 | null | null |
kelnage/tamarin-prover | lib/theory/src/Theory/Model/Rule.hs | gpl-3.0 | unionRuleInstance :: Int -> RuleAC
unionRuleInstance n = (Rule (IntrInfo (ConstrRule $ BC.pack "union")) (map xifact [1..n]) [prod] [prod])
where
prod = Fact KUFact [(FAPP (AC Union) (map xi [1..n]))]
xi :: Int -> LNTerm
xi k = (LIT $ Var $ LVar "x" LSortMsg (toInteger k))
xifact :: Int -> LNFact
xifact k = Fact KUFact [(xi k)] | 361 | unionRuleInstance :: Int -> RuleAC
unionRuleInstance n = (Rule (IntrInfo (ConstrRule $ BC.pack "union")) (map xifact [1..n]) [prod] [prod])
where
prod = Fact KUFact [(FAPP (AC Union) (map xi [1..n]))]
xi :: Int -> LNTerm
xi k = (LIT $ Var $ LVar "x" LSortMsg (toInteger k))
xifact :: Int -> LNFact
xifact k = Fact KUFact [(xi k)] | 361 | unionRuleInstance n = (Rule (IntrInfo (ConstrRule $ BC.pack "union")) (map xifact [1..n]) [prod] [prod])
where
prod = Fact KUFact [(FAPP (AC Union) (map xi [1..n]))]
xi :: Int -> LNTerm
xi k = (LIT $ Var $ LVar "x" LSortMsg (toInteger k))
xifact :: Int -> LNFact
xifact k = Fact KUFact [(xi k)] | 326 | false | true | 5 | 12 | 90 | 183 | 94 | 89 | null | null |
chaosmasttter/hexploration | source/Hexploration/Emulator/Internal.hs | bsd-3-clause | -- | Throw an 'OperationError' in the 'Operation' monad.
throwError :: OperationError -> Operation a
throwError = Operation . left | 130 | throwError :: OperationError -> Operation a
throwError = Operation . left | 73 | throwError = Operation . left | 29 | true | true | 0 | 6 | 19 | 23 | 12 | 11 | null | null |
locaweb/leela | src/warpdrive/src/Leela/HZMQ/Pipe.hs | apache-2.0 | selectValve OnState = OnState | 37 | selectValve OnState = OnState | 37 | selectValve OnState = OnState | 37 | false | false | 0 | 5 | 11 | 9 | 4 | 5 | null | null |
brenov/set | interpreter/Expressions.hs | mit | eval (Nat x p) (Multiplication _) (Real y _) = Real (integerToFloat(x) * y) p | 79 | eval (Nat x p) (Multiplication _) (Real y _) = Real (integerToFloat(x) * y) p | 79 | eval (Nat x p) (Multiplication _) (Real y _) = Real (integerToFloat(x) * y) p | 79 | false | false | 0 | 9 | 16 | 57 | 27 | 30 | null | null |
brendanhay/gogol | gogol-dlp/gen/Network/Google/Resource/DLP/Projects/Locations/Content/Reidentify.hs | mpl-2.0 | -- | Required. Parent resource name. The format of this value varies
-- depending on whether you have [specified a processing
-- location](https:\/\/cloud.google.com\/dlp\/docs\/specifying-location): +
-- Projects scope, location specified:
-- \`projects\/\`PROJECT_ID\`\/locations\/\`LOCATION_ID + Projects scope,
-- no location specified (defaults to global): \`projects\/\`PROJECT_ID The
-- following example \`parent\` string specifies a parent project with the
-- identifier \`example-project\`, and specifies the \`europe-west3\`
-- location for processing data:
-- parent=projects\/example-project\/locations\/europe-west3
plcrParent :: Lens' ProjectsLocationsContentReidentify Text
plcrParent
= lens _plcrParent (\ s a -> s{_plcrParent = a}) | 751 | plcrParent :: Lens' ProjectsLocationsContentReidentify Text
plcrParent
= lens _plcrParent (\ s a -> s{_plcrParent = a}) | 121 | plcrParent
= lens _plcrParent (\ s a -> s{_plcrParent = a}) | 61 | true | true | 0 | 9 | 85 | 51 | 31 | 20 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Attoparsec.Text.Buffer.hs | bsd-3-clause | writeGen :: A.MArray s -> Int -> ST s ()
writeGen a (I# gen#) = ST $ \s0# ->
case writeIntArray# (A.maBA a) 0# gen# s0# of
s1# -> (# s1#, () #) | 149 | writeGen :: A.MArray s -> Int -> ST s ()
writeGen a (I# gen#) = ST $ \s0# ->
case writeIntArray# (A.maBA a) 0# gen# s0# of
s1# -> (# s1#, () #) | 149 | writeGen a (I# gen#) = ST $ \s0# ->
case writeIntArray# (A.maBA a) 0# gen# s0# of
s1# -> (# s1#, () #) | 108 | false | true | 2 | 11 | 38 | 91 | 43 | 48 | null | null |
brendanhay/gogol | gogol-redis/gen/Network/Google/Redis/Types/Product.hs | mpl-2.0 | -- | Optional. The full name of the Google Compute Engine
-- [network](https:\/\/cloud.google.com\/vpc\/docs\/vpc) to which the
-- instance is connected. If left unspecified, the \`default\` network will
-- be used.
iAuthorizedNetwork :: Lens' Instance (Maybe Text)
iAuthorizedNetwork
= lens _iAuthorizedNetwork
(\ s a -> s{_iAuthorizedNetwork = a}) | 357 | iAuthorizedNetwork :: Lens' Instance (Maybe Text)
iAuthorizedNetwork
= lens _iAuthorizedNetwork
(\ s a -> s{_iAuthorizedNetwork = a}) | 141 | iAuthorizedNetwork
= lens _iAuthorizedNetwork
(\ s a -> s{_iAuthorizedNetwork = a}) | 91 | true | true | 1 | 9 | 54 | 54 | 28 | 26 | null | null |
diku-dk/futhark | src/Futhark/Pass/ExtractKernels.hs | isc | sequentialisedUnbalancedStm _ =
pure Nothing | 46 | sequentialisedUnbalancedStm _ =
pure Nothing | 46 | sequentialisedUnbalancedStm _ =
pure Nothing | 46 | false | false | 0 | 4 | 6 | 13 | 5 | 8 | null | null |
dorchard/camfort | tests/Camfort/Specification/Stencils/CheckSpec.hs | apache-2.0 | exampleSpecWrongVar :: String
exampleSpecWrongVar =
"program example\n\
\ real, dimension(10) :: a\n\
\ do i = 1, 10\n\
\ != stencil readOnce, pointed(dim=1) :: b\n\
\ a(i) = a(i)\n\
\ end do\n\
\end program" | 231 | exampleSpecWrongVar :: String
exampleSpecWrongVar =
"program example\n\
\ real, dimension(10) :: a\n\
\ do i = 1, 10\n\
\ != stencil readOnce, pointed(dim=1) :: b\n\
\ a(i) = a(i)\n\
\ end do\n\
\end program" | 231 | exampleSpecWrongVar =
"program example\n\
\ real, dimension(10) :: a\n\
\ do i = 1, 10\n\
\ != stencil readOnce, pointed(dim=1) :: b\n\
\ a(i) = a(i)\n\
\ end do\n\
\end program" | 201 | false | true | 0 | 4 | 56 | 11 | 6 | 5 | null | null |
AlexanderPankiv/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | shiftLIntegerIdKey = mkPreludeMiscIdUnique 95 | 56 | shiftLIntegerIdKey = mkPreludeMiscIdUnique 95 | 56 | shiftLIntegerIdKey = mkPreludeMiscIdUnique 95 | 56 | false | false | 0 | 5 | 14 | 9 | 4 | 5 | null | null |
MasseR/Views | Coffee.hs | bsd-3-clause | cacheFile f = cacheDir </> (flip addExtension ".js" (dropExtension f)) | 70 | cacheFile f = cacheDir </> (flip addExtension ".js" (dropExtension f)) | 70 | cacheFile f = cacheDir </> (flip addExtension ".js" (dropExtension f)) | 70 | false | false | 3 | 9 | 9 | 34 | 14 | 20 | null | null |
TC1211/TCP | src/3a/tester-src/Examples/reliable/reference.hs | apache-2.0 | main :: IO ()
main = withSocketsDo $ do
(o, argv) <- doOpt
unless (length argv == 2) usage
l <- getHost True $ argv !! 0
r <- getHost False $ argv !! 1
test (optDebug o) (optTimeout o) (optWindow o) l r | 212 | main :: IO ()
main = withSocketsDo $ do
(o, argv) <- doOpt
unless (length argv == 2) usage
l <- getHost True $ argv !! 0
r <- getHost False $ argv !! 1
test (optDebug o) (optTimeout o) (optWindow o) l r | 212 | main = withSocketsDo $ do
(o, argv) <- doOpt
unless (length argv == 2) usage
l <- getHost True $ argv !! 0
r <- getHost False $ argv !! 1
test (optDebug o) (optTimeout o) (optWindow o) l r | 198 | false | true | 0 | 11 | 53 | 119 | 56 | 63 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2018/M11/D23/Solution.hs | mit | ha4' :: Eq a => (Answer -> a) -> a -> [Answer] -> [Answer]
ha4' f x (a:anss) = if x == f a then anss else a:ha4' f x anss | 121 | ha4' :: Eq a => (Answer -> a) -> a -> [Answer] -> [Answer]
ha4' f x (a:anss) = if x == f a then anss else a:ha4' f x anss | 121 | ha4' f x (a:anss) = if x == f a then anss else a:ha4' f x anss | 62 | false | true | 0 | 9 | 30 | 83 | 43 | 40 | null | null |
ku-fpg/better-life | HERMIT/Set2/Life.hs | bsd-2-clause | -- rep for "empty"
repcB :: (Config -> Board) -> Config -> Board'
repcB f c = repB (f c) | 88 | repcB :: (Config -> Board) -> Config -> Board'
repcB f c = repB (f c) | 69 | repcB f c = repB (f c) | 22 | true | true | 0 | 7 | 19 | 41 | 21 | 20 | null | null |
mdsteele/fallback | src/Fallback/State/Item.hs | gpl-3.0 | itemIconCoords (ArmorItemTag tag) = armorIconCoords tag | 55 | itemIconCoords (ArmorItemTag tag) = armorIconCoords tag | 55 | itemIconCoords (ArmorItemTag tag) = armorIconCoords tag | 55 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
Paow/encore | src/front/Makefile.hs | bsd-3-clause | o = (text "-o" <+>) | 19 | o = (text "-o" <+>) | 19 | o = (text "-o" <+>) | 19 | false | false | 1 | 7 | 4 | 17 | 7 | 10 | null | null |
ghcjs/haddock-internal | src/Haddock/Convert.hs | bsd-2-clause | synifyAxBranch :: TyCon -> CoAxBranch -> TyFamInstEqn Name
synifyAxBranch tc (CoAxBranch { cab_tvs = tkvs, cab_lhs = args, cab_rhs = rhs })
= let name = synifyName tc
typats = map (synifyType WithinType) args
hs_rhs = synifyType WithinType rhs
(kvs, tvs) = partition isKindVar tkvs
in TyFamInstEqn { tfie_tycon = name
, tfie_pats = HsWB { hswb_cts = typats
, hswb_kvs = map tyVarName kvs
, hswb_tvs = map tyVarName tvs }
, tfie_rhs = hs_rhs } | 609 | synifyAxBranch :: TyCon -> CoAxBranch -> TyFamInstEqn Name
synifyAxBranch tc (CoAxBranch { cab_tvs = tkvs, cab_lhs = args, cab_rhs = rhs })
= let name = synifyName tc
typats = map (synifyType WithinType) args
hs_rhs = synifyType WithinType rhs
(kvs, tvs) = partition isKindVar tkvs
in TyFamInstEqn { tfie_tycon = name
, tfie_pats = HsWB { hswb_cts = typats
, hswb_kvs = map tyVarName kvs
, hswb_tvs = map tyVarName tvs }
, tfie_rhs = hs_rhs } | 609 | synifyAxBranch tc (CoAxBranch { cab_tvs = tkvs, cab_lhs = args, cab_rhs = rhs })
= let name = synifyName tc
typats = map (synifyType WithinType) args
hs_rhs = synifyType WithinType rhs
(kvs, tvs) = partition isKindVar tkvs
in TyFamInstEqn { tfie_tycon = name
, tfie_pats = HsWB { hswb_cts = typats
, hswb_kvs = map tyVarName kvs
, hswb_tvs = map tyVarName tvs }
, tfie_rhs = hs_rhs } | 550 | false | true | 0 | 11 | 243 | 158 | 86 | 72 | null | null |
katydid/haslapse | src/Data/Katydid/Parser/Json.hs | bsd-3-clause | uValue (JSArray vs) = uArray 0 vs | 34 | uValue (JSArray vs) = uArray 0 vs | 34 | uValue (JSArray vs) = uArray 0 vs | 34 | false | false | 0 | 7 | 7 | 20 | 9 | 11 | null | null |
sdiehl/ghc | compiler/typecheck/TcPluginM.hs | bsd-3-clause | findImportedModule :: ModuleName -> Maybe FastString -> TcPluginM FindResult
findImportedModule mod_name mb_pkg = do
hsc_env <- getTopEnv
tcPluginIO $ Finder.findImportedModule hsc_env mod_name mb_pkg | 208 | findImportedModule :: ModuleName -> Maybe FastString -> TcPluginM FindResult
findImportedModule mod_name mb_pkg = do
hsc_env <- getTopEnv
tcPluginIO $ Finder.findImportedModule hsc_env mod_name mb_pkg | 208 | findImportedModule mod_name mb_pkg = do
hsc_env <- getTopEnv
tcPluginIO $ Finder.findImportedModule hsc_env mod_name mb_pkg | 131 | false | true | 0 | 9 | 30 | 53 | 24 | 29 | null | null |
matt-keibler/monte-carlo-pi | monte-carlo-pi-hs/app/Main.hs | gpl-3.0 | outPoints :: [MCI.Point] -> [[Primitive]]
outPoints points = fmap transformPoint outPts
where outPts = filter MCI.isInUnitCircle points | 137 | outPoints :: [MCI.Point] -> [[Primitive]]
outPoints points = fmap transformPoint outPts
where outPts = filter MCI.isInUnitCircle points | 137 | outPoints points = fmap transformPoint outPts
where outPts = filter MCI.isInUnitCircle points | 95 | false | true | 0 | 9 | 18 | 54 | 26 | 28 | null | null |
brendanhay/gogol | gogol-serviceusage/gen/Network/Google/ServiceUsage/Types/Product.hs | mpl-2.0 | -- | Selects the methods to which this rule applies. Use \'*\' to indicate
-- all methods in all APIs. Refer to selector for syntax details.
urSelector :: Lens' UsageRule (Maybe Text)
urSelector
= lens _urSelector (\ s a -> s{_urSelector = a}) | 245 | urSelector :: Lens' UsageRule (Maybe Text)
urSelector
= lens _urSelector (\ s a -> s{_urSelector = a}) | 104 | urSelector
= lens _urSelector (\ s a -> s{_urSelector = a}) | 61 | true | true | 0 | 9 | 44 | 49 | 26 | 23 | null | null |
pepeiborra/yices | Math/SMT/Yices/Syntax.hs | bsd-3-clause | showExpY (MOD e1 e2) = paren $ showString "mod " . showsPrec 0 e1 . space . showsPrec 0 e2 | 90 | showExpY (MOD e1 e2) = paren $ showString "mod " . showsPrec 0 e1 . space . showsPrec 0 e2 | 90 | showExpY (MOD e1 e2) = paren $ showString "mod " . showsPrec 0 e1 . space . showsPrec 0 e2 | 90 | false | false | 0 | 9 | 19 | 46 | 21 | 25 | null | null |
jhance/llvm-untyped | LLVM/Untyped/Core.hs | gpl-3.0 | convertRealCmp :: RealComparison -> CInt
convertRealCmp cmp = fromIntegral $ case cmp of
RealPredicateFalse -> 0
RealOEQ -> 1
RealOGT -> 2
RealOGE -> 3
RealOLT -> 4
RealOLE -> 5
RealONE -> 6
RealORD -> 7
RealUNO -> 8
RealUEQ -> 9
RealUGT -> 10
RealUGE -> 11
RealULT -> 12
RealULE -> 13
RealUNE -> 14
RealPredicateTrue -> 15 | 387 | convertRealCmp :: RealComparison -> CInt
convertRealCmp cmp = fromIntegral $ case cmp of
RealPredicateFalse -> 0
RealOEQ -> 1
RealOGT -> 2
RealOGE -> 3
RealOLT -> 4
RealOLE -> 5
RealONE -> 6
RealORD -> 7
RealUNO -> 8
RealUEQ -> 9
RealUGT -> 10
RealUGE -> 11
RealULT -> 12
RealULE -> 13
RealUNE -> 14
RealPredicateTrue -> 15 | 387 | convertRealCmp cmp = fromIntegral $ case cmp of
RealPredicateFalse -> 0
RealOEQ -> 1
RealOGT -> 2
RealOGE -> 3
RealOLT -> 4
RealOLE -> 5
RealONE -> 6
RealORD -> 7
RealUNO -> 8
RealUEQ -> 9
RealUGT -> 10
RealUGE -> 11
RealULT -> 12
RealULE -> 13
RealUNE -> 14
RealPredicateTrue -> 15 | 346 | false | true | 0 | 8 | 124 | 122 | 61 | 61 | null | null |
liwanwei/pandoc | src/Text/Pandoc/Readers/Markdown.hs | gpl-2.0 | rawConTeXtEnvironment :: Parser [Char] st String
rawConTeXtEnvironment = try $ do
string "\\start"
completion <- inBrackets (letter <|> digit <|> spaceChar)
<|> (many1 letter)
contents <- manyTill (rawConTeXtEnvironment <|> (count 1 anyChar))
(try $ string "\\stop" >> string completion)
return $ "\\start" ++ completion ++ concat contents ++ "\\stop" ++ completion | 411 | rawConTeXtEnvironment :: Parser [Char] st String
rawConTeXtEnvironment = try $ do
string "\\start"
completion <- inBrackets (letter <|> digit <|> spaceChar)
<|> (many1 letter)
contents <- manyTill (rawConTeXtEnvironment <|> (count 1 anyChar))
(try $ string "\\stop" >> string completion)
return $ "\\start" ++ completion ++ concat contents ++ "\\stop" ++ completion | 411 | rawConTeXtEnvironment = try $ do
string "\\start"
completion <- inBrackets (letter <|> digit <|> spaceChar)
<|> (many1 letter)
contents <- manyTill (rawConTeXtEnvironment <|> (count 1 anyChar))
(try $ string "\\stop" >> string completion)
return $ "\\start" ++ completion ++ concat contents ++ "\\stop" ++ completion | 362 | false | true | 0 | 13 | 96 | 132 | 63 | 69 | null | null |
ProLambda/Times | Skeleton/Home.hs | gpl-3.0 | -- serve main page
home :: ScottyM ()
home =
get "/" $ authCheck (redirect "/login") $ do
texts <- liftIO $ readFile "./static/main.html"
onlinenum <- getOnlineNum -- number of people online
renderMain texts onlinenum
-- disqus page | 252 | home :: ScottyM ()
home =
get "/" $ authCheck (redirect "/login") $ do
texts <- liftIO $ readFile "./static/main.html"
onlinenum <- getOnlineNum -- number of people online
renderMain texts onlinenum
-- disqus page | 233 | home =
get "/" $ authCheck (redirect "/login") $ do
texts <- liftIO $ readFile "./static/main.html"
onlinenum <- getOnlineNum -- number of people online
renderMain texts onlinenum
-- disqus page | 214 | true | true | 0 | 10 | 57 | 68 | 32 | 36 | null | null |
DavidAlphaFox/ghc | libraries/bytestring/Data/ByteString/Builder/Internal.hs | bsd-3-clause | untrimmedStrategy :: Int -- ^ Size of the first buffer
-> Int -- ^ Size of successive buffers
-> AllocationStrategy
-- ^ An allocation strategy that does not trim any of the
-- filled buffers before converting it to a chunk
untrimmedStrategy firstSize bufSize =
AllocationStrategy nextBuffer (sanitize bufSize) (\_ _ -> False)
where
{-# INLINE nextBuffer #-}
nextBuffer Nothing = newBuffer $ sanitize firstSize
nextBuffer (Just (_, minSize)) = newBuffer minSize
-- | Use this strategy for generating lazy 'L.ByteString's whose chunks are
-- likely to survive one garbage collection. This strategy trims buffers
-- that are filled less than half in order to avoid spilling too much memory.
| 793 | untrimmedStrategy :: Int -- ^ Size of the first buffer
-> Int -- ^ Size of successive buffers
-> AllocationStrategy
untrimmedStrategy firstSize bufSize =
AllocationStrategy nextBuffer (sanitize bufSize) (\_ _ -> False)
where
{-# INLINE nextBuffer #-}
nextBuffer Nothing = newBuffer $ sanitize firstSize
nextBuffer (Just (_, minSize)) = newBuffer minSize
-- | Use this strategy for generating lazy 'L.ByteString's whose chunks are
-- likely to survive one garbage collection. This strategy trims buffers
-- that are filled less than half in order to avoid spilling too much memory.
| 649 | untrimmedStrategy firstSize bufSize =
AllocationStrategy nextBuffer (sanitize bufSize) (\_ _ -> False)
where
{-# INLINE nextBuffer #-}
nextBuffer Nothing = newBuffer $ sanitize firstSize
nextBuffer (Just (_, minSize)) = newBuffer minSize
-- | Use this strategy for generating lazy 'L.ByteString's whose chunks are
-- likely to survive one garbage collection. This strategy trims buffers
-- that are filled less than half in order to avoid spilling too much memory.
| 497 | true | true | 1 | 9 | 214 | 94 | 52 | 42 | null | null |
dolio/vector | Data/Vector/Storable.hs | bsd-3-clause | foldr' = G.foldr' | 17 | foldr' = G.foldr' | 17 | foldr' = G.foldr' | 17 | false | false | 1 | 6 | 2 | 12 | 4 | 8 | null | null |
liyanchang/scheme-in-haskell | src/chp6.hs | mit | eqv badArgList = throwError $ NumArgs 2 badArgList | 50 | eqv badArgList = throwError $ NumArgs 2 badArgList | 50 | eqv badArgList = throwError $ NumArgs 2 badArgList | 50 | false | false | 0 | 6 | 7 | 18 | 8 | 10 | null | null |
FranklinChen/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | highestFC (PType fc) = Just fc | 43 | highestFC (PType fc) = Just fc | 43 | highestFC (PType fc) = Just fc | 43 | false | false | 0 | 7 | 18 | 18 | 8 | 10 | null | null |
foreverbell/project-euler-solutions | src/12.hs | bsd-3-clause | main = print ((n * (n + 1)) `div` 2)
where n = head (dropWhile (\x -> (numOfTriDivisors x) <= 500) [1 .. ]) | 111 | main = print ((n * (n + 1)) `div` 2)
where n = head (dropWhile (\x -> (numOfTriDivisors x) <= 500) [1 .. ]) | 111 | main = print ((n * (n + 1)) `div` 2)
where n = head (dropWhile (\x -> (numOfTriDivisors x) <= 500) [1 .. ]) | 111 | false | false | 0 | 14 | 27 | 72 | 40 | 32 | null | null |
erikd/hs-tls | core/Network/TLS/Crypto/IES.hs | bsd-3-clause | groupGetPubShared (GroupPub_FFDHE8192 pub) = getPubShared ffdhe8192 pub GroupPub_FFDHE8192 | 90 | groupGetPubShared (GroupPub_FFDHE8192 pub) = getPubShared ffdhe8192 pub GroupPub_FFDHE8192 | 90 | groupGetPubShared (GroupPub_FFDHE8192 pub) = getPubShared ffdhe8192 pub GroupPub_FFDHE8192 | 90 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
DanielSchuessler/hstri | PreRenderable.hs | gpl-3.0 | pr_visibility :: PreRenderable s -> AnySimplex2Of s -> Visibility
pr_visibility = getL pr_visibilityL | 101 | pr_visibility :: PreRenderable s -> AnySimplex2Of s -> Visibility
pr_visibility = getL pr_visibilityL | 101 | pr_visibility = getL pr_visibilityL | 35 | false | true | 0 | 8 | 12 | 35 | 14 | 21 | null | null |
da-x/fancydiff | src/Fancydiff/Lib.hs | bsd-3-clause | getHighlighterByFilename :: Text -> Highlighter
getHighlighterByFilename filename = t l
where l = concat $ map (\(_, (d, _, e)) -> map (\i -> (i, d)) e) $ Map.toList syntaxMap
t ((ext, highlighter):xs) =
if ext `T.isSuffixOf` filename
then highlighter
else t xs
t [] = SH.Generic | 353 | getHighlighterByFilename :: Text -> Highlighter
getHighlighterByFilename filename = t l
where l = concat $ map (\(_, (d, _, e)) -> map (\i -> (i, d)) e) $ Map.toList syntaxMap
t ((ext, highlighter):xs) =
if ext `T.isSuffixOf` filename
then highlighter
else t xs
t [] = SH.Generic | 353 | getHighlighterByFilename filename = t l
where l = concat $ map (\(_, (d, _, e)) -> map (\i -> (i, d)) e) $ Map.toList syntaxMap
t ((ext, highlighter):xs) =
if ext `T.isSuffixOf` filename
then highlighter
else t xs
t [] = SH.Generic | 305 | false | true | 4 | 11 | 120 | 151 | 77 | 74 | null | null |
alevy/mappend | src/Blog/Models/Post.hs | agpl-3.0 | slugFromTitle :: Text -> Text
slugFromTitle title = T.take 32 $
T.map (\c -> if c == ' ' then '-' else toLower c) $
T.filter (\c -> c == ' ' || isAlphaNum c) title | 167 | slugFromTitle :: Text -> Text
slugFromTitle title = T.take 32 $
T.map (\c -> if c == ' ' then '-' else toLower c) $
T.filter (\c -> c == ' ' || isAlphaNum c) title | 167 | slugFromTitle title = T.take 32 $
T.map (\c -> if c == ' ' then '-' else toLower c) $
T.filter (\c -> c == ' ' || isAlphaNum c) title | 137 | false | true | 0 | 11 | 39 | 85 | 43 | 42 | null | null |
abailly/hs-word2vec | src/PCA.hs | bsd-3-clause | fastPCARec n dataSet phis =
let (_,cov) = meanCov dataSet -- compute covariance matrix
max_iter = 30
phi_p :: Vector Double
phi_p = unitary $ konst 1 (cols dataSet)
gram_schmidt :: Vector Double -> [ Vector Double ] -> Vector Double
gram_schmidt phip phis = phip - sum (map (\ phi_j -> cmap (* (phip <.> phi_j)) phi_j) phis)
go :: Vector Double -> Int -> Vector Double
go phi k | k > max_iter = phi
| otherwise = let phi_p_new = cov #> phi
norm_phi = unitary $ gram_schmidt phi_p_new phis
conv = abs (norm_phi <.> phi - 1) < peps
in if conv
then norm_phi
else go norm_phi (k+1)
new_phi = go phi_p 0
in new_phi : fastPCARec (n-1) dataSet (new_phi:phis) | 915 | fastPCARec n dataSet phis =
let (_,cov) = meanCov dataSet -- compute covariance matrix
max_iter = 30
phi_p :: Vector Double
phi_p = unitary $ konst 1 (cols dataSet)
gram_schmidt :: Vector Double -> [ Vector Double ] -> Vector Double
gram_schmidt phip phis = phip - sum (map (\ phi_j -> cmap (* (phip <.> phi_j)) phi_j) phis)
go :: Vector Double -> Int -> Vector Double
go phi k | k > max_iter = phi
| otherwise = let phi_p_new = cov #> phi
norm_phi = unitary $ gram_schmidt phi_p_new phis
conv = abs (norm_phi <.> phi - 1) < peps
in if conv
then norm_phi
else go norm_phi (k+1)
new_phi = go phi_p 0
in new_phi : fastPCARec (n-1) dataSet (new_phi:phis) | 915 | fastPCARec n dataSet phis =
let (_,cov) = meanCov dataSet -- compute covariance matrix
max_iter = 30
phi_p :: Vector Double
phi_p = unitary $ konst 1 (cols dataSet)
gram_schmidt :: Vector Double -> [ Vector Double ] -> Vector Double
gram_schmidt phip phis = phip - sum (map (\ phi_j -> cmap (* (phip <.> phi_j)) phi_j) phis)
go :: Vector Double -> Int -> Vector Double
go phi k | k > max_iter = phi
| otherwise = let phi_p_new = cov #> phi
norm_phi = unitary $ gram_schmidt phi_p_new phis
conv = abs (norm_phi <.> phi - 1) < peps
in if conv
then norm_phi
else go norm_phi (k+1)
new_phi = go phi_p 0
in new_phi : fastPCARec (n-1) dataSet (new_phi:phis) | 915 | false | false | 0 | 18 | 387 | 297 | 149 | 148 | null | null |
garykl/Horg | Horg.hs | bsd-3-clause | justTags :: FilePath -> IO ()
justTags fn = do
cntnt <- readFile fn
let gg = Parse.parseFile cntnt
print $ S.toList . S.unions . (map Heading.collectTags) $ gg | 171 | justTags :: FilePath -> IO ()
justTags fn = do
cntnt <- readFile fn
let gg = Parse.parseFile cntnt
print $ S.toList . S.unions . (map Heading.collectTags) $ gg | 171 | justTags fn = do
cntnt <- readFile fn
let gg = Parse.parseFile cntnt
print $ S.toList . S.unions . (map Heading.collectTags) $ gg | 141 | false | true | 0 | 11 | 40 | 78 | 36 | 42 | null | null |
mcmaniac/ghc | compiler/main/CmdLineParser.hs | bsd-3-clause | getCmdLineState :: CmdLineP s s
getCmdLineState = CmdLineP $ \s -> (s,s) | 74 | getCmdLineState :: CmdLineP s s
getCmdLineState = CmdLineP $ \s -> (s,s) | 74 | getCmdLineState = CmdLineP $ \s -> (s,s) | 42 | false | true | 2 | 7 | 13 | 38 | 18 | 20 | null | null |
input-output-hk/pos-haskell-prototype | cluster/app/demo/Main.hs | mit | main :: IO ()
main = void $ do
hSetBuffering stdout NoBuffering -- Instead of LineBuffering
args <- parseArgsOrExit cli =<< getArgs
when (args `isPresent` (longOption "help")) $ exitWithUsage cli
let nCores = getArgInt args "cores"
let nRelays = getArgInt args "relays"
let nEdges = getArgInt args "edges"
putTextLn $ sformat
("Cluster is starting ("%build%" core(s), "%build%" relay(s), "%build%" edge(s))...")
nCores nRelays nEdges
cluster <- startCluster prefix $ mconcat
[ mkNamedNodes NodeCore nCores
, mkNamedNodes NodeRelay nRelays
, mkNamedNodes NodeEdge nEdges
]
handles <- forM cluster $ \case
RunningNode nodeType (NodeName nodeId) env manager handle -> do
let addr = unsafeNetworkAddressFromString (env ! "NODE_API_ADDRESS")
let client = mkHttpClient (ntwrkAddrToBaseUrl addr) manager
putText "..." >> waitForNode client (MaxWaitingTime 90) printProgress
putTextFromStart $ "..." <> nodeId <> " OK!"
when (nodeType /= NodeEdge) $ putText
$ "\n......address: " <> toText (env ! "LISTEN")
-- todo, dont mapm over chars
putTextLn
$ "\n......api address: " <> toText (env ! "NODE_API_ADDRESS")
<> "\n......doc address: " <> toText (env ! "NODE_DOC_ADDRESS")
<> "\n......system start: " <> toText (env ! "SYSTEM_START")
return handle
putTextLn "Cluster is ready!"
waitAny handles
where
-- | Args are defaulted to something, so we know they exist
getArgInt :: Arguments -> String -> Int
getArgInt args =
unsafeIntFromString . fromJust . getArg args . longOption
putTextFromStart :: Text -> IO ()
putTextFromStart txt = do
hSetCursorColumn stdout 0 >> clearFromCursorToLineEnd
putText txt
printProgress :: Maybe SyncPercentage -> IO ()
printProgress progress = do
case progress of
Nothing ->
putTextFromStart "...starting"
Just p ->
putTextFromStart $ "...syncing " <> (sformat build p) | 2,192 | main :: IO ()
main = void $ do
hSetBuffering stdout NoBuffering -- Instead of LineBuffering
args <- parseArgsOrExit cli =<< getArgs
when (args `isPresent` (longOption "help")) $ exitWithUsage cli
let nCores = getArgInt args "cores"
let nRelays = getArgInt args "relays"
let nEdges = getArgInt args "edges"
putTextLn $ sformat
("Cluster is starting ("%build%" core(s), "%build%" relay(s), "%build%" edge(s))...")
nCores nRelays nEdges
cluster <- startCluster prefix $ mconcat
[ mkNamedNodes NodeCore nCores
, mkNamedNodes NodeRelay nRelays
, mkNamedNodes NodeEdge nEdges
]
handles <- forM cluster $ \case
RunningNode nodeType (NodeName nodeId) env manager handle -> do
let addr = unsafeNetworkAddressFromString (env ! "NODE_API_ADDRESS")
let client = mkHttpClient (ntwrkAddrToBaseUrl addr) manager
putText "..." >> waitForNode client (MaxWaitingTime 90) printProgress
putTextFromStart $ "..." <> nodeId <> " OK!"
when (nodeType /= NodeEdge) $ putText
$ "\n......address: " <> toText (env ! "LISTEN")
-- todo, dont mapm over chars
putTextLn
$ "\n......api address: " <> toText (env ! "NODE_API_ADDRESS")
<> "\n......doc address: " <> toText (env ! "NODE_DOC_ADDRESS")
<> "\n......system start: " <> toText (env ! "SYSTEM_START")
return handle
putTextLn "Cluster is ready!"
waitAny handles
where
-- | Args are defaulted to something, so we know they exist
getArgInt :: Arguments -> String -> Int
getArgInt args =
unsafeIntFromString . fromJust . getArg args . longOption
putTextFromStart :: Text -> IO ()
putTextFromStart txt = do
hSetCursorColumn stdout 0 >> clearFromCursorToLineEnd
putText txt
printProgress :: Maybe SyncPercentage -> IO ()
printProgress progress = do
case progress of
Nothing ->
putTextFromStart "...starting"
Just p ->
putTextFromStart $ "...syncing " <> (sformat build p) | 2,192 | main = void $ do
hSetBuffering stdout NoBuffering -- Instead of LineBuffering
args <- parseArgsOrExit cli =<< getArgs
when (args `isPresent` (longOption "help")) $ exitWithUsage cli
let nCores = getArgInt args "cores"
let nRelays = getArgInt args "relays"
let nEdges = getArgInt args "edges"
putTextLn $ sformat
("Cluster is starting ("%build%" core(s), "%build%" relay(s), "%build%" edge(s))...")
nCores nRelays nEdges
cluster <- startCluster prefix $ mconcat
[ mkNamedNodes NodeCore nCores
, mkNamedNodes NodeRelay nRelays
, mkNamedNodes NodeEdge nEdges
]
handles <- forM cluster $ \case
RunningNode nodeType (NodeName nodeId) env manager handle -> do
let addr = unsafeNetworkAddressFromString (env ! "NODE_API_ADDRESS")
let client = mkHttpClient (ntwrkAddrToBaseUrl addr) manager
putText "..." >> waitForNode client (MaxWaitingTime 90) printProgress
putTextFromStart $ "..." <> nodeId <> " OK!"
when (nodeType /= NodeEdge) $ putText
$ "\n......address: " <> toText (env ! "LISTEN")
-- todo, dont mapm over chars
putTextLn
$ "\n......api address: " <> toText (env ! "NODE_API_ADDRESS")
<> "\n......doc address: " <> toText (env ! "NODE_DOC_ADDRESS")
<> "\n......system start: " <> toText (env ! "SYSTEM_START")
return handle
putTextLn "Cluster is ready!"
waitAny handles
where
-- | Args are defaulted to something, so we know they exist
getArgInt :: Arguments -> String -> Int
getArgInt args =
unsafeIntFromString . fromJust . getArg args . longOption
putTextFromStart :: Text -> IO ()
putTextFromStart txt = do
hSetCursorColumn stdout 0 >> clearFromCursorToLineEnd
putText txt
printProgress :: Maybe SyncPercentage -> IO ()
printProgress progress = do
case progress of
Nothing ->
putTextFromStart "...starting"
Just p ->
putTextFromStart $ "...syncing " <> (sformat build p) | 2,178 | false | true | 30 | 13 | 660 | 531 | 266 | 265 | null | null |
input-output-hk/pos-haskell-prototype | lib/src/Pos/Client/CLI/Params.hs | mit | getBaseParams :: LoggerName -> CommonNodeArgs -> BaseParams
getBaseParams defaultLoggerName args@CommonNodeArgs {..} =
BaseParams { bpLoggingParams = loggingParams defaultLoggerName args } | 192 | getBaseParams :: LoggerName -> CommonNodeArgs -> BaseParams
getBaseParams defaultLoggerName args@CommonNodeArgs {..} =
BaseParams { bpLoggingParams = loggingParams defaultLoggerName args } | 192 | getBaseParams defaultLoggerName args@CommonNodeArgs {..} =
BaseParams { bpLoggingParams = loggingParams defaultLoggerName args } | 132 | false | true | 0 | 8 | 23 | 46 | 24 | 22 | null | null |
boggle/neo4j-haskell-driver | src/Database/Neo4j/Internal/PGM.hs | apache-2.0 | (|--) :: (Eq v) => Maybe (Step v) -> Node v -> Maybe (Segment v)
(|--) (Just step) startNode | stepDirection step == INCOMING =
if stepOtherNodeId step == nodeId startNode
then Just Segment {
segmentDirection = if nodeId startNode == nodeId endNode then Nothing else Just INCOMING,
segmentUnboundRelationship = stepUnboundRelationship step,
segmentStartNode = startNode,
segmentEndNode = endNode
}
else Nothing
where
endNode = stepNode step | 490 | (|--) :: (Eq v) => Maybe (Step v) -> Node v -> Maybe (Segment v)
(|--) (Just step) startNode | stepDirection step == INCOMING =
if stepOtherNodeId step == nodeId startNode
then Just Segment {
segmentDirection = if nodeId startNode == nodeId endNode then Nothing else Just INCOMING,
segmentUnboundRelationship = stepUnboundRelationship step,
segmentStartNode = startNode,
segmentEndNode = endNode
}
else Nothing
where
endNode = stepNode step | 490 | (|--) (Just step) startNode | stepDirection step == INCOMING =
if stepOtherNodeId step == nodeId startNode
then Just Segment {
segmentDirection = if nodeId startNode == nodeId endNode then Nothing else Just INCOMING,
segmentUnboundRelationship = stepUnboundRelationship step,
segmentStartNode = startNode,
segmentEndNode = endNode
}
else Nothing
where
endNode = stepNode step | 425 | false | true | 1 | 12 | 115 | 167 | 82 | 85 | null | null |
olsner/ghc | compiler/nativeGen/SPARC/CodeGen/Gen32.hs | bsd-3-clause | irem :: Bool -> CmmExpr -> CmmExpr -> NatM Register
-- For unsigned operands:
-- Division is between a 64 bit numerator and a 32 bit denominator,
-- so we still have to clear the Y register.
irem False x y
= do
(a_reg, a_code) <- getSomeReg x
(b_reg, b_code) <- getSomeReg y
tmp_reg <- getNewRegNat II32
let code dst
= a_code
`appOL` b_code
`appOL` toOL
[ WRY g0 g0
, UDIV False a_reg (RIReg b_reg) tmp_reg
, UMUL False tmp_reg (RIReg b_reg) tmp_reg
, SUB False False a_reg (RIReg tmp_reg) dst]
return (Any II32 code)
-- For signed operands:
-- Make sure to sign extend into the Y register, or the remainder
-- will have the wrong sign when the numerator is negative.
--
-- TODO: When sign extending, GCC only shifts the a_reg right by 17 bits,
-- not the full 32. Not sure why this is, something to do with overflow?
-- If anyone cares enough about the speed of signed remainder they
-- can work it out themselves (then tell me). -- BL 2009/01/20 | 1,274 | irem :: Bool -> CmmExpr -> CmmExpr -> NatM Register
irem False x y
= do
(a_reg, a_code) <- getSomeReg x
(b_reg, b_code) <- getSomeReg y
tmp_reg <- getNewRegNat II32
let code dst
= a_code
`appOL` b_code
`appOL` toOL
[ WRY g0 g0
, UDIV False a_reg (RIReg b_reg) tmp_reg
, UMUL False tmp_reg (RIReg b_reg) tmp_reg
, SUB False False a_reg (RIReg tmp_reg) dst]
return (Any II32 code)
-- For signed operands:
-- Make sure to sign extend into the Y register, or the remainder
-- will have the wrong sign when the numerator is negative.
--
-- TODO: When sign extending, GCC only shifts the a_reg right by 17 bits,
-- not the full 32. Not sure why this is, something to do with overflow?
-- If anyone cares enough about the speed of signed remainder they
-- can work it out themselves (then tell me). -- BL 2009/01/20 | 1,108 | irem False x y
= do
(a_reg, a_code) <- getSomeReg x
(b_reg, b_code) <- getSomeReg y
tmp_reg <- getNewRegNat II32
let code dst
= a_code
`appOL` b_code
`appOL` toOL
[ WRY g0 g0
, UDIV False a_reg (RIReg b_reg) tmp_reg
, UMUL False tmp_reg (RIReg b_reg) tmp_reg
, SUB False False a_reg (RIReg tmp_reg) dst]
return (Any II32 code)
-- For signed operands:
-- Make sure to sign extend into the Y register, or the remainder
-- will have the wrong sign when the numerator is negative.
--
-- TODO: When sign extending, GCC only shifts the a_reg right by 17 bits,
-- not the full 32. Not sure why this is, something to do with overflow?
-- If anyone cares enough about the speed of signed remainder they
-- can work it out themselves (then tell me). -- BL 2009/01/20 | 1,056 | true | true | 0 | 15 | 504 | 196 | 100 | 96 | null | null |
spencerjanssen/cabal2nix | src/Cabal2Nix/Name.hs | bsd-3-clause | libNixName "pthread" = [] | 52 | libNixName "pthread" = [] | 52 | libNixName "pthread" = [] | 52 | false | false | 0 | 5 | 30 | 11 | 5 | 6 | null | null |
suhailshergill/liboleg | System/RandomIO.hs | bsd-3-clause | endian_read2 :: IterateeGM Word8 RBIO (Maybe Word16)
endian_read2 =
bindm snext $ \c1 ->
bindm snext $ \c2 -> do
flag <- lift rb_msb_first
if flag then
return $ return $ (fromIntegral c1 `shiftL` 8) .|. fromIntegral c2
else
return $ return $ (fromIntegral c2 `shiftL` 8) .|. fromIntegral c1 | 315 | endian_read2 :: IterateeGM Word8 RBIO (Maybe Word16)
endian_read2 =
bindm snext $ \c1 ->
bindm snext $ \c2 -> do
flag <- lift rb_msb_first
if flag then
return $ return $ (fromIntegral c1 `shiftL` 8) .|. fromIntegral c2
else
return $ return $ (fromIntegral c2 `shiftL` 8) .|. fromIntegral c1 | 315 | endian_read2 =
bindm snext $ \c1 ->
bindm snext $ \c2 -> do
flag <- lift rb_msb_first
if flag then
return $ return $ (fromIntegral c1 `shiftL` 8) .|. fromIntegral c2
else
return $ return $ (fromIntegral c2 `shiftL` 8) .|. fromIntegral c1 | 262 | false | true | 0 | 16 | 74 | 123 | 62 | 61 | null | null |
UBMLtonGroup/timberc | src/Lambdalift.hs | bsd-3-clause | -- Convert an expression
llExp env (ECall x ts es) = do es <- mapM (llExp env) es
case lookup x (expansions env) of
Just (vs,xs) -> return (ECall x (map tVar vs ++ ts) (map (mkEVar env) xs ++ es))
Nothing -> return (ECall x ts es) | 385 | llExp env (ECall x ts es) = do es <- mapM (llExp env) es
case lookup x (expansions env) of
Just (vs,xs) -> return (ECall x (map tVar vs ++ ts) (map (mkEVar env) xs ++ es))
Nothing -> return (ECall x ts es) | 360 | llExp env (ECall x ts es) = do es <- mapM (llExp env) es
case lookup x (expansions env) of
Just (vs,xs) -> return (ECall x (map tVar vs ++ ts) (map (mkEVar env) xs ++ es))
Nothing -> return (ECall x ts es) | 360 | true | false | 0 | 17 | 202 | 137 | 65 | 72 | null | null |
shouya/thinking-dumps | haskell-types/src/Chap11.hs | mit | prj :: forall f t ts. Member t ts => OpenSum f ts -> Maybe (f t)
prj (UnsafeOpenSum i ft) = if i == findElem @t @ts
then Just $ unsafeCoerce ft
else Nothing | 210 | prj :: forall f t ts. Member t ts => OpenSum f ts -> Maybe (f t)
prj (UnsafeOpenSum i ft) = if i == findElem @t @ts
then Just $ unsafeCoerce ft
else Nothing | 210 | prj (UnsafeOpenSum i ft) = if i == findElem @t @ts
then Just $ unsafeCoerce ft
else Nothing | 145 | false | true | 0 | 10 | 88 | 88 | 43 | 45 | null | null |
anttisalonen/freekick2 | src/CreateTeam.hs | gpl-3.0 | mkPos 6 = return Defender | 26 | mkPos 6 = return Defender | 26 | mkPos 6 = return Defender | 26 | false | false | 0 | 5 | 5 | 12 | 5 | 7 | null | null |
massysett/cartel | cartel/lib/Cartel/Ast.hs | bsd-3-clause | -- | Extra libraries to link with.
extraLibraries :: HasBuildInfo a => [NonEmptyString] -> a
extraLibraries = buildInfo . ExtraLibraries | 136 | extraLibraries :: HasBuildInfo a => [NonEmptyString] -> a
extraLibraries = buildInfo . ExtraLibraries | 101 | extraLibraries = buildInfo . ExtraLibraries | 43 | true | true | 0 | 7 | 19 | 30 | 16 | 14 | null | null |
eklitzke/hspresent | Main.hs | isc | newPad :: Char -> Int -> Pad
newPad c w = Pad { padLeft = padl
, padRight = padr }
where
pad' t = replicate (w - length t) c
shorten = take w
padl t = pad' t ++ shorten t
padr t = shorten t ++ pad' t
-- |Split an input list | 276 | newPad :: Char -> Int -> Pad
newPad c w = Pad { padLeft = padl
, padRight = padr }
where
pad' t = replicate (w - length t) c
shorten = take w
padl t = pad' t ++ shorten t
padr t = shorten t ++ pad' t
-- |Split an input list | 276 | newPad c w = Pad { padLeft = padl
, padRight = padr }
where
pad' t = replicate (w - length t) c
shorten = take w
padl t = pad' t ++ shorten t
padr t = shorten t ++ pad' t
-- |Split an input list | 247 | false | true | 3 | 8 | 108 | 124 | 56 | 68 | null | null |
metabrainz/changed-mbid-feed | service/src/Main.hs | gpl-2.0 | --------------------------------------------------------------------------------
redirectTo :: MonadSnap m => Int -> m ()
redirectTo csId = redirect $ Encoding.encodeUtf8 $ Text.pack $
"http://changed-mbids.musicbrainz.org/pub/musicbrainz/data/changed-mbids/changed-ids-" ++
show csId ++ ".json.gz" | 304 | redirectTo :: MonadSnap m => Int -> m ()
redirectTo csId = redirect $ Encoding.encodeUtf8 $ Text.pack $
"http://changed-mbids.musicbrainz.org/pub/musicbrainz/data/changed-mbids/changed-ids-" ++
show csId ++ ".json.gz" | 223 | redirectTo csId = redirect $ Encoding.encodeUtf8 $ Text.pack $
"http://changed-mbids.musicbrainz.org/pub/musicbrainz/data/changed-mbids/changed-ids-" ++
show csId ++ ".json.gz" | 182 | true | true | 0 | 10 | 30 | 58 | 28 | 30 | null | null |
travitch/hsqml | Setup.hs | bsd-3-clause | buildGHCiFix ::
Verbosity -> PackageDescription -> LocalBuildInfo -> Library -> IO ()
buildGHCiFix verb pkgDesc lbi lib = do
let bDir = buildDir lbi
ms = map ModuleName.toFilePath $ libModules lib
hsObjs = map ((bDir </>) . (<.> "o")) ms
stubObjs <- fmap catMaybes $
mapM (findFileWithExtension ["o"] [bDir]) $ map (++ "_stub") ms
(ld,_) <- requireProgram verb ldProgram (withPrograms lbi)
combineObjectFiles verb ld
(bDir </> (("HS" ++) $ display $ packageId pkgDesc) <.> ".o")
(stubObjs ++ hsObjs)
(ghc,_) <- requireProgram verb ghcProgram (withPrograms lbi)
let bi = libBuildInfo lib
runProgram verb ghc (
["-shared","-fPIC","-o",bDir </> (mkGHCiFixLibName pkgDesc)] ++
(map ("-optc" ++) $ ccOptions bi) ++
(map ("-optc" ++) $ cppOptions bi) ++
(map ("-I" ++) $ includeDirs bi) ++
(ldOptions bi) ++ (map ("-l" ++) $ extraLibs bi) ++
(map ("-L"++) $ extraLibDirs bi) ++
(cSources bi))
return () | 966 | buildGHCiFix ::
Verbosity -> PackageDescription -> LocalBuildInfo -> Library -> IO ()
buildGHCiFix verb pkgDesc lbi lib = do
let bDir = buildDir lbi
ms = map ModuleName.toFilePath $ libModules lib
hsObjs = map ((bDir </>) . (<.> "o")) ms
stubObjs <- fmap catMaybes $
mapM (findFileWithExtension ["o"] [bDir]) $ map (++ "_stub") ms
(ld,_) <- requireProgram verb ldProgram (withPrograms lbi)
combineObjectFiles verb ld
(bDir </> (("HS" ++) $ display $ packageId pkgDesc) <.> ".o")
(stubObjs ++ hsObjs)
(ghc,_) <- requireProgram verb ghcProgram (withPrograms lbi)
let bi = libBuildInfo lib
runProgram verb ghc (
["-shared","-fPIC","-o",bDir </> (mkGHCiFixLibName pkgDesc)] ++
(map ("-optc" ++) $ ccOptions bi) ++
(map ("-optc" ++) $ cppOptions bi) ++
(map ("-I" ++) $ includeDirs bi) ++
(ldOptions bi) ++ (map ("-l" ++) $ extraLibs bi) ++
(map ("-L"++) $ extraLibDirs bi) ++
(cSources bi))
return () | 966 | buildGHCiFix verb pkgDesc lbi lib = do
let bDir = buildDir lbi
ms = map ModuleName.toFilePath $ libModules lib
hsObjs = map ((bDir </>) . (<.> "o")) ms
stubObjs <- fmap catMaybes $
mapM (findFileWithExtension ["o"] [bDir]) $ map (++ "_stub") ms
(ld,_) <- requireProgram verb ldProgram (withPrograms lbi)
combineObjectFiles verb ld
(bDir </> (("HS" ++) $ display $ packageId pkgDesc) <.> ".o")
(stubObjs ++ hsObjs)
(ghc,_) <- requireProgram verb ghcProgram (withPrograms lbi)
let bi = libBuildInfo lib
runProgram verb ghc (
["-shared","-fPIC","-o",bDir </> (mkGHCiFixLibName pkgDesc)] ++
(map ("-optc" ++) $ ccOptions bi) ++
(map ("-optc" ++) $ cppOptions bi) ++
(map ("-I" ++) $ includeDirs bi) ++
(ldOptions bi) ++ (map ("-l" ++) $ extraLibs bi) ++
(map ("-L"++) $ extraLibDirs bi) ++
(cSources bi))
return () | 878 | false | true | 0 | 19 | 209 | 419 | 213 | 206 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/SSMMaintenanceWindowTaskTaskInvocationParameters.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-taskinvocationparameters.html#cfn-ssm-maintenancewindowtask-taskinvocationparameters-maintenancewindowruncommandparameters
ssmmwttipMaintenanceWindowRunCommandParameters :: Lens' SSMMaintenanceWindowTaskTaskInvocationParameters (Maybe SSMMaintenanceWindowTaskMaintenanceWindowRunCommandParameters)
ssmmwttipMaintenanceWindowRunCommandParameters = lens _sSMMaintenanceWindowTaskTaskInvocationParametersMaintenanceWindowRunCommandParameters (\s a -> s { _sSMMaintenanceWindowTaskTaskInvocationParametersMaintenanceWindowRunCommandParameters = a }) | 653 | ssmmwttipMaintenanceWindowRunCommandParameters :: Lens' SSMMaintenanceWindowTaskTaskInvocationParameters (Maybe SSMMaintenanceWindowTaskMaintenanceWindowRunCommandParameters)
ssmmwttipMaintenanceWindowRunCommandParameters = lens _sSMMaintenanceWindowTaskTaskInvocationParametersMaintenanceWindowRunCommandParameters (\s a -> s { _sSMMaintenanceWindowTaskTaskInvocationParametersMaintenanceWindowRunCommandParameters = a }) | 422 | ssmmwttipMaintenanceWindowRunCommandParameters = lens _sSMMaintenanceWindowTaskTaskInvocationParametersMaintenanceWindowRunCommandParameters (\s a -> s { _sSMMaintenanceWindowTaskTaskInvocationParametersMaintenanceWindowRunCommandParameters = a }) | 247 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
urbanslug/ghc | testsuite/tests/dph/nbody/Dump.hs | bsd-3-clause | -- | Right justify a doc, padding with a given character.
padRc :: Int -> Char -> String -> String
padRc n c str
= replicate (n - length str) c ++ str | 158 | padRc :: Int -> Char -> String -> String
padRc n c str
= replicate (n - length str) c ++ str | 100 | padRc n c str
= replicate (n - length str) c ++ str | 59 | true | true | 2 | 9 | 40 | 58 | 26 | 32 | null | null |
bitemyapp/ghc | compiler/basicTypes/OccName.hs | bsd-3-clause | isSymOcc (OccName TcClsName s) = isLexSym s | 43 | isSymOcc (OccName TcClsName s) = isLexSym s | 43 | isSymOcc (OccName TcClsName s) = isLexSym s | 43 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
avh4/elm-format | elm-format-lib/src/ElmFormat/AST/PublicAST/Expression.hs | bsd-3-clause | mkDefinitions ::
forall a.
Config
-> (Definition -> a)
-> List (MaybeF LocatedIfRequested (DefinitionBuilder a))
-> List (MaybeF LocatedIfRequested a)
mkDefinitions config fromDef items =
let
collectAnnotation :: DefinitionBuilder a -> Maybe (LowercaseIdentifier, AST.C2 'AST.BeforeSeparator 'AST.AfterSeparator (ASTNS Located [UppercaseIdentifier] 'TypeNK))
collectAnnotation decl =
case decl of
Right (AST.TypeAnnotation (C preColon (VarRef () name)) (C postColon typ)) ->
Just (name, C (preColon, postColon) typ)
_ -> Nothing
annotations :: Map LowercaseIdentifier (AST.C2 'AST.BeforeSeparator 'AST.AfterSeparator (ASTNS Located [UppercaseIdentifier] 'TypeNK))
annotations =
Map.fromList $ mapMaybe (collectAnnotation . extract) items
merge :: DefinitionBuilder a -> Maybe a
merge decl =
case decl of
Right (AST.Definition (I.Fix (At _ pat)) args comments expr) ->
let
annotation =
case pat of
AST.VarPattern name ->
Map.lookup name annotations
_ -> Nothing
in
Just $ fromDef $ mkDefinition config pat args annotation expr
Right (AST.TypeAnnotation _ _) ->
-- TODO: retain annotations that don't have a matching definition
Nothing
Left a ->
Just a
in
mapMaybe (traverse merge) items | 1,677 | mkDefinitions ::
forall a.
Config
-> (Definition -> a)
-> List (MaybeF LocatedIfRequested (DefinitionBuilder a))
-> List (MaybeF LocatedIfRequested a)
mkDefinitions config fromDef items =
let
collectAnnotation :: DefinitionBuilder a -> Maybe (LowercaseIdentifier, AST.C2 'AST.BeforeSeparator 'AST.AfterSeparator (ASTNS Located [UppercaseIdentifier] 'TypeNK))
collectAnnotation decl =
case decl of
Right (AST.TypeAnnotation (C preColon (VarRef () name)) (C postColon typ)) ->
Just (name, C (preColon, postColon) typ)
_ -> Nothing
annotations :: Map LowercaseIdentifier (AST.C2 'AST.BeforeSeparator 'AST.AfterSeparator (ASTNS Located [UppercaseIdentifier] 'TypeNK))
annotations =
Map.fromList $ mapMaybe (collectAnnotation . extract) items
merge :: DefinitionBuilder a -> Maybe a
merge decl =
case decl of
Right (AST.Definition (I.Fix (At _ pat)) args comments expr) ->
let
annotation =
case pat of
AST.VarPattern name ->
Map.lookup name annotations
_ -> Nothing
in
Just $ fromDef $ mkDefinition config pat args annotation expr
Right (AST.TypeAnnotation _ _) ->
-- TODO: retain annotations that don't have a matching definition
Nothing
Left a ->
Just a
in
mapMaybe (traverse merge) items | 1,677 | mkDefinitions config fromDef items =
let
collectAnnotation :: DefinitionBuilder a -> Maybe (LowercaseIdentifier, AST.C2 'AST.BeforeSeparator 'AST.AfterSeparator (ASTNS Located [UppercaseIdentifier] 'TypeNK))
collectAnnotation decl =
case decl of
Right (AST.TypeAnnotation (C preColon (VarRef () name)) (C postColon typ)) ->
Just (name, C (preColon, postColon) typ)
_ -> Nothing
annotations :: Map LowercaseIdentifier (AST.C2 'AST.BeforeSeparator 'AST.AfterSeparator (ASTNS Located [UppercaseIdentifier] 'TypeNK))
annotations =
Map.fromList $ mapMaybe (collectAnnotation . extract) items
merge :: DefinitionBuilder a -> Maybe a
merge decl =
case decl of
Right (AST.Definition (I.Fix (At _ pat)) args comments expr) ->
let
annotation =
case pat of
AST.VarPattern name ->
Map.lookup name annotations
_ -> Nothing
in
Just $ fromDef $ mkDefinition config pat args annotation expr
Right (AST.TypeAnnotation _ _) ->
-- TODO: retain annotations that don't have a matching definition
Nothing
Left a ->
Just a
in
mapMaybe (traverse merge) items | 1,506 | false | true | 0 | 20 | 652 | 448 | 220 | 228 | null | null |
dmjio/aeson | tests/Encoders.hs | bsd-3-clause | gNullaryToJSONTaggedObject :: Nullary -> Value
gNullaryToJSONTaggedObject = genericToJSON optsTaggedObject | 106 | gNullaryToJSONTaggedObject :: Nullary -> Value
gNullaryToJSONTaggedObject = genericToJSON optsTaggedObject | 106 | gNullaryToJSONTaggedObject = genericToJSON optsTaggedObject | 59 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
spinda/liquidhaskell | src/Language/Haskell/Liquid/RefType.hs | bsd-3-clause | shiftVV t _
= t | 17 | shiftVV t _
= t | 17 | shiftVV t _
= t | 17 | false | false | 0 | 4 | 6 | 13 | 5 | 8 | null | null |
geocurnoff/nikki | src/Sorts/Robots/Cannon.hs | lgpl-3.0 | initBase space ep = do
let baryCenterOffset = size2vector $ fmap (/ 2) baseSize
start = negateAbelian end
end = baryCenterOffset
shapeType = mkRectFromPositions start end
shape = mkShapeDescription shapeAttributes shapeType
pos = position2vector (epToPosition robotSize ep)
+~ baryCenterOffset +~ position2vector baseOffset
pin = pos +~ pinOffset
attributes =
mkMaterialBodyAttributes robotMaterialMass [shapeType] pos
c <- initChipmunk space attributes [shape] baryCenterOffset
return (c, pin) | 594 | initBase space ep = do
let baryCenterOffset = size2vector $ fmap (/ 2) baseSize
start = negateAbelian end
end = baryCenterOffset
shapeType = mkRectFromPositions start end
shape = mkShapeDescription shapeAttributes shapeType
pos = position2vector (epToPosition robotSize ep)
+~ baryCenterOffset +~ position2vector baseOffset
pin = pos +~ pinOffset
attributes =
mkMaterialBodyAttributes robotMaterialMass [shapeType] pos
c <- initChipmunk space attributes [shape] baryCenterOffset
return (c, pin) | 594 | initBase space ep = do
let baryCenterOffset = size2vector $ fmap (/ 2) baseSize
start = negateAbelian end
end = baryCenterOffset
shapeType = mkRectFromPositions start end
shape = mkShapeDescription shapeAttributes shapeType
pos = position2vector (epToPosition robotSize ep)
+~ baryCenterOffset +~ position2vector baseOffset
pin = pos +~ pinOffset
attributes =
mkMaterialBodyAttributes robotMaterialMass [shapeType] pos
c <- initChipmunk space attributes [shape] baryCenterOffset
return (c, pin) | 594 | false | false | 1 | 15 | 162 | 153 | 74 | 79 | null | null |
archhaskell/archlinux-web | Distribution/ArchLinux/Report.hs | bsd-3-clause | url :: String
url = "http://www.galois.com/~dons/hackage/hackage-downloads.csv" | 79 | url :: String
url = "http://www.galois.com/~dons/hackage/hackage-downloads.csv" | 79 | url = "http://www.galois.com/~dons/hackage/hackage-downloads.csv" | 65 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
TimRichter/Idris-dev | src/Idris/DSL.hs | bsd-3-clause | debind :: PTerm -> PTerm -> PTerm
-- For every arg which is an AppBind, lift it out
debind b tm = let (tm', (bs, _)) = runState (db' tm) ([], 0) in
bindAll (reverse bs) tm'
where
db' :: PTerm -> State ([(Name, FC, PTerm)], Int) PTerm
db' (PAppBind _ (PApp fc t args) [])
= db' (PAppBind fc t args)
db' (PAppBind fc t args)
= do args' <- dbs args
(bs, n) <- get
let nm = sUN ("_bindApp" ++ show n)
put ((nm, fc, PApp fc t args') : bs, n+1)
return (PRef fc [] nm)
db' (PApp fc t args)
= do t' <- db' t
args' <- mapM dbArg args
return (PApp fc t' args')
db' (PLam fc n nfc ty sc) = return (PLam fc n nfc ty (debind b sc))
db' (PLet fc n nfc ty v sc) = do v' <- db' v
return (PLet fc n nfc ty v' (debind b sc))
db' (PCase fc s opts) = do s' <- db' s
return (PCase fc s' (map (pmap (debind b)) opts))
db' (PPair fc hls p l r) = do l' <- db' l
r' <- db' r
return (PPair fc hls p l' r')
db' (PDPair fc hls p l t r) = do l' <- db' l
r' <- db' r
return (PDPair fc hls p l' t r')
db' (PRunElab fc t ns) = fmap (\tm -> PRunElab fc tm ns) (db' t)
db' (PConstSugar fc tm) = liftM (PConstSugar fc) (db' tm)
db' t = return t
dbArg a = do t' <- db' (getTm a)
return (a { getTm = t' })
dbs [] = return []
dbs (a : as) = do let t = getTm a
t' <- db' t
as' <- dbs as
return (a { getTm = t' } : as')
bindAll [] tm = tm
bindAll ((n, fc, t) : bs) tm
= PApp fc b [pexp t, pexp (PLam fc n NoFC Placeholder (bindAll bs tm))] | 1,896 | debind :: PTerm -> PTerm -> PTerm
debind b tm = let (tm', (bs, _)) = runState (db' tm) ([], 0) in
bindAll (reverse bs) tm'
where
db' :: PTerm -> State ([(Name, FC, PTerm)], Int) PTerm
db' (PAppBind _ (PApp fc t args) [])
= db' (PAppBind fc t args)
db' (PAppBind fc t args)
= do args' <- dbs args
(bs, n) <- get
let nm = sUN ("_bindApp" ++ show n)
put ((nm, fc, PApp fc t args') : bs, n+1)
return (PRef fc [] nm)
db' (PApp fc t args)
= do t' <- db' t
args' <- mapM dbArg args
return (PApp fc t' args')
db' (PLam fc n nfc ty sc) = return (PLam fc n nfc ty (debind b sc))
db' (PLet fc n nfc ty v sc) = do v' <- db' v
return (PLet fc n nfc ty v' (debind b sc))
db' (PCase fc s opts) = do s' <- db' s
return (PCase fc s' (map (pmap (debind b)) opts))
db' (PPair fc hls p l r) = do l' <- db' l
r' <- db' r
return (PPair fc hls p l' r')
db' (PDPair fc hls p l t r) = do l' <- db' l
r' <- db' r
return (PDPair fc hls p l' t r')
db' (PRunElab fc t ns) = fmap (\tm -> PRunElab fc tm ns) (db' t)
db' (PConstSugar fc tm) = liftM (PConstSugar fc) (db' tm)
db' t = return t
dbArg a = do t' <- db' (getTm a)
return (a { getTm = t' })
dbs [] = return []
dbs (a : as) = do let t = getTm a
t' <- db' t
as' <- dbs as
return (a { getTm = t' } : as')
bindAll [] tm = tm
bindAll ((n, fc, t) : bs) tm
= PApp fc b [pexp t, pexp (PLam fc n NoFC Placeholder (bindAll bs tm))] | 1,846 | debind b tm = let (tm', (bs, _)) = runState (db' tm) ([], 0) in
bindAll (reverse bs) tm'
where
db' :: PTerm -> State ([(Name, FC, PTerm)], Int) PTerm
db' (PAppBind _ (PApp fc t args) [])
= db' (PAppBind fc t args)
db' (PAppBind fc t args)
= do args' <- dbs args
(bs, n) <- get
let nm = sUN ("_bindApp" ++ show n)
put ((nm, fc, PApp fc t args') : bs, n+1)
return (PRef fc [] nm)
db' (PApp fc t args)
= do t' <- db' t
args' <- mapM dbArg args
return (PApp fc t' args')
db' (PLam fc n nfc ty sc) = return (PLam fc n nfc ty (debind b sc))
db' (PLet fc n nfc ty v sc) = do v' <- db' v
return (PLet fc n nfc ty v' (debind b sc))
db' (PCase fc s opts) = do s' <- db' s
return (PCase fc s' (map (pmap (debind b)) opts))
db' (PPair fc hls p l r) = do l' <- db' l
r' <- db' r
return (PPair fc hls p l' r')
db' (PDPair fc hls p l t r) = do l' <- db' l
r' <- db' r
return (PDPair fc hls p l' t r')
db' (PRunElab fc t ns) = fmap (\tm -> PRunElab fc tm ns) (db' t)
db' (PConstSugar fc tm) = liftM (PConstSugar fc) (db' tm)
db' t = return t
dbArg a = do t' <- db' (getTm a)
return (a { getTm = t' })
dbs [] = return []
dbs (a : as) = do let t = getTm a
t' <- db' t
as' <- dbs as
return (a { getTm = t' } : as')
bindAll [] tm = tm
bindAll ((n, fc, t) : bs) tm
= PApp fc b [pexp t, pexp (PLam fc n NoFC Placeholder (bindAll bs tm))] | 1,812 | true | true | 0 | 15 | 834 | 943 | 450 | 493 | null | null |
DougBurke/swish | tests/RDFProofTest.hs | lgpl-2.1 | result71 = makeRDFGraphFromN3Builder result71str | 48 | result71 = makeRDFGraphFromN3Builder result71str | 48 | result71 = makeRDFGraphFromN3Builder result71str | 48 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.