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
SimSaladin/hajong
hajong-server/src/Mahjong/Kyoku.hs
mit
step (WaitingDiscard pk) (InpTurnAction pk' ta) | pk /= pk' = throwError $ "Not your (" ++ tshow pk' ++ ") turn, it's turn of " ++ tshow pk | TurnTileDiscard d <- ta = processDiscard pk d | TurnAnkan t <- ta = processAnkan pk t | TurnTsumo <- ta = endKyoku =<< endTsumo pk | TurnShouminkan t <- ta = processShouminkan pk t
371
step (WaitingDiscard pk) (InpTurnAction pk' ta) | pk /= pk' = throwError $ "Not your (" ++ tshow pk' ++ ") turn, it's turn of " ++ tshow pk | TurnTileDiscard d <- ta = processDiscard pk d | TurnAnkan t <- ta = processAnkan pk t | TurnTsumo <- ta = endKyoku =<< endTsumo pk | TurnShouminkan t <- ta = processShouminkan pk t
371
step (WaitingDiscard pk) (InpTurnAction pk' ta) | pk /= pk' = throwError $ "Not your (" ++ tshow pk' ++ ") turn, it's turn of " ++ tshow pk | TurnTileDiscard d <- ta = processDiscard pk d | TurnAnkan t <- ta = processAnkan pk t | TurnTsumo <- ta = endKyoku =<< endTsumo pk | TurnShouminkan t <- ta = processShouminkan pk t
371
false
false
0
9
113
148
66
82
null
null
hjwylde/werewolf
app/Game/Werewolf/Command.hs
bsd-3-clause
validatePlayer :: (MonadError [Message] m, MonadState Game m) => Text -> Text -> m () validatePlayer callerName name' = do whenM isGameOver $ throwError [gameIsOverMessage callerName] unlessM (doesPlayerExist name') $ throwError [playerDoesNotExistMessage callerName name'] player <- findPlayerBy_ name name' when (is dead player) $ throwError [if callerName == name' then playerIsDeadMessage callerName else targetIsDeadMessage callerName player]
480
validatePlayer :: (MonadError [Message] m, MonadState Game m) => Text -> Text -> m () validatePlayer callerName name' = do whenM isGameOver $ throwError [gameIsOverMessage callerName] unlessM (doesPlayerExist name') $ throwError [playerDoesNotExistMessage callerName name'] player <- findPlayerBy_ name name' when (is dead player) $ throwError [if callerName == name' then playerIsDeadMessage callerName else targetIsDeadMessage callerName player]
480
validatePlayer callerName name' = do whenM isGameOver $ throwError [gameIsOverMessage callerName] unlessM (doesPlayerExist name') $ throwError [playerDoesNotExistMessage callerName name'] player <- findPlayerBy_ name name' when (is dead player) $ throwError [if callerName == name' then playerIsDeadMessage callerName else targetIsDeadMessage callerName player]
394
false
true
0
11
88
153
72
81
null
null
DATx02-16-14/Hastings
src/Views/Game.hs
bsd-3-clause
createGameChangeNameDOM :: LobbyAPI -> Client () createGameChangeNameDOM api = createInputFieldWithButton "game-name" "Game name" gameUpdateFunction where gameUpdateFunction = withElem "game-name-field" $ \field -> do newName <- getValue field case newName of Just "" -> return () Just name -> do setProp field "value" "" onServer $ changeGameName api <.> name Nothing -> return () -- |Creates DOM for the updatin the maximum number of players in a game -- |Contains an input field and a button. Is placed in the right sidebar
613
createGameChangeNameDOM :: LobbyAPI -> Client () createGameChangeNameDOM api = createInputFieldWithButton "game-name" "Game name" gameUpdateFunction where gameUpdateFunction = withElem "game-name-field" $ \field -> do newName <- getValue field case newName of Just "" -> return () Just name -> do setProp field "value" "" onServer $ changeGameName api <.> name Nothing -> return () -- |Creates DOM for the updatin the maximum number of players in a game -- |Contains an input field and a button. Is placed in the right sidebar
613
createGameChangeNameDOM api = createInputFieldWithButton "game-name" "Game name" gameUpdateFunction where gameUpdateFunction = withElem "game-name-field" $ \field -> do newName <- getValue field case newName of Just "" -> return () Just name -> do setProp field "value" "" onServer $ changeGameName api <.> name Nothing -> return () -- |Creates DOM for the updatin the maximum number of players in a game -- |Contains an input field and a button. Is placed in the right sidebar
564
false
true
0
16
167
127
58
69
null
null
tolysz/prepare-ghcjs
spec-lts8/cabal/cabal-install/Distribution/Client/Sandbox/PackageEnvironment.hs
bsd-3-clause
-- ^ '~/.cabal/config' -- | Is there a 'cabal.sandbox.config' or 'cabal.config' in this -- directory? classifyPackageEnvironment :: FilePath -> Flag FilePath -> Flag Bool -> IO PackageEnvironmentType classifyPackageEnvironment pkgEnvDir sandboxConfigFileFlag ignoreSandboxFlag = do isSandbox <- liftM2 (||) (return forceSandboxConfig) (configExists sandboxPackageEnvironmentFile) isUser <- configExists userPackageEnvironmentFile return (classify isSandbox isUser) where configExists fname = doesFileExist (pkgEnvDir </> fname) ignoreSandbox = fromFlagOrDefault False ignoreSandboxFlag forceSandboxConfig = isJust . flagToMaybe $ sandboxConfigFileFlag classify :: Bool -> Bool -> PackageEnvironmentType classify True _ | not ignoreSandbox = SandboxPackageEnvironment classify _ True = UserPackageEnvironment classify _ False = AmbientPackageEnvironment -- | Defaults common to 'initialPackageEnvironment' and -- 'commentPackageEnvironment'.
1,064
classifyPackageEnvironment :: FilePath -> Flag FilePath -> Flag Bool -> IO PackageEnvironmentType classifyPackageEnvironment pkgEnvDir sandboxConfigFileFlag ignoreSandboxFlag = do isSandbox <- liftM2 (||) (return forceSandboxConfig) (configExists sandboxPackageEnvironmentFile) isUser <- configExists userPackageEnvironmentFile return (classify isSandbox isUser) where configExists fname = doesFileExist (pkgEnvDir </> fname) ignoreSandbox = fromFlagOrDefault False ignoreSandboxFlag forceSandboxConfig = isJust . flagToMaybe $ sandboxConfigFileFlag classify :: Bool -> Bool -> PackageEnvironmentType classify True _ | not ignoreSandbox = SandboxPackageEnvironment classify _ True = UserPackageEnvironment classify _ False = AmbientPackageEnvironment -- | Defaults common to 'initialPackageEnvironment' and -- 'commentPackageEnvironment'.
961
classifyPackageEnvironment pkgEnvDir sandboxConfigFileFlag ignoreSandboxFlag = do isSandbox <- liftM2 (||) (return forceSandboxConfig) (configExists sandboxPackageEnvironmentFile) isUser <- configExists userPackageEnvironmentFile return (classify isSandbox isUser) where configExists fname = doesFileExist (pkgEnvDir </> fname) ignoreSandbox = fromFlagOrDefault False ignoreSandboxFlag forceSandboxConfig = isJust . flagToMaybe $ sandboxConfigFileFlag classify :: Bool -> Bool -> PackageEnvironmentType classify True _ | not ignoreSandbox = SandboxPackageEnvironment classify _ True = UserPackageEnvironment classify _ False = AmbientPackageEnvironment -- | Defaults common to 'initialPackageEnvironment' and -- 'commentPackageEnvironment'.
833
true
true
0
10
226
192
94
98
null
null
vdweegen/UvA-Software_Testing
Lab5/Jordan/Lecture5Original.hs
gpl-3.0
eraseN :: Node -> (Row,Column) -> Node eraseN n (r,c) = (s, constraints s) where s = eraseS (fst n) (r,c)
107
eraseN :: Node -> (Row,Column) -> Node eraseN n (r,c) = (s, constraints s) where s = eraseS (fst n) (r,c)
107
eraseN n (r,c) = (s, constraints s) where s = eraseS (fst n) (r,c)
68
false
true
1
9
22
78
39
39
null
null
ribag/ganeti-experiments
src/Ganeti/JQScheduler.hs
gpl-2.0
-- | Update a single job by reading it from disk, if necessary. updateJob :: JQStatus -> JobWithStat -> IO () updateJob state jb = do jb' <- readJobStatus jb maybe (return ()) (modifyJobs state . onRunningJobs . updateJobStatus) jb' when (maybe True (jobFinalized . jJob) jb') . (>> return ()) . forkIO $ do logDebug "Scheduler noticed a job to have finished." cleanupFinishedJobs state scheduleSomeJobs state -- | Move a job from one part of the queue to another. -- Return the job that was moved, or 'Nothing' if it wasn't found in -- the queue.
566
updateJob :: JQStatus -> JobWithStat -> IO () updateJob state jb = do jb' <- readJobStatus jb maybe (return ()) (modifyJobs state . onRunningJobs . updateJobStatus) jb' when (maybe True (jobFinalized . jJob) jb') . (>> return ()) . forkIO $ do logDebug "Scheduler noticed a job to have finished." cleanupFinishedJobs state scheduleSomeJobs state -- | Move a job from one part of the queue to another. -- Return the job that was moved, or 'Nothing' if it wasn't found in -- the queue.
502
updateJob state jb = do jb' <- readJobStatus jb maybe (return ()) (modifyJobs state . onRunningJobs . updateJobStatus) jb' when (maybe True (jobFinalized . jJob) jb') . (>> return ()) . forkIO $ do logDebug "Scheduler noticed a job to have finished." cleanupFinishedJobs state scheduleSomeJobs state -- | Move a job from one part of the queue to another. -- Return the job that was moved, or 'Nothing' if it wasn't found in -- the queue.
456
true
true
0
14
115
137
65
72
null
null
princemaple/SPLEE
logic.hs
mit
disj :: Parser LogicExpr disj = between (char '(') (char ')') $ do x <- expr _ <- char '|' y <- expr return (x :| y)
132
disj :: Parser LogicExpr disj = between (char '(') (char ')') $ do x <- expr _ <- char '|' y <- expr return (x :| y)
132
disj = between (char '(') (char ')') $ do x <- expr _ <- char '|' y <- expr return (x :| y)
107
false
true
0
10
42
72
33
39
null
null
TomMD/io-streams
src/System/IO/Streams/Handle.hs
bsd-3-clause
------------------------------------------------------------------------------ -- | Converts a read-only handle into an 'InputStream' of strict 'ByteString's. -- -- Note that the wrapped handle is /not/ closed when it yields end-of-stream; -- you can use 'System.IO.Streams.Combinators.atEndOfInput' to close the handle -- if you would like this behaviour. handleToInputStream :: Handle -> IO (InputStream ByteString) handleToInputStream h = makeInputStream f where f = do x <- S.hGetSome h bUFSIZ return $! if S.null x then Nothing else Just x ------------------------------------------------------------------------------ -- | Converts a writable handle into an 'OutputStream' of strict 'ByteString's. -- -- Note that the wrapped handle is /not/ closed when it receives end-of-stream; -- you can use 'System.IO.Streams.Combinators.atEndOfOutput' to close the -- handle if you would like this behaviour. -- -- /Note/: to force the 'Handle' to be flushed, you can write a null string to -- the returned 'OutputStream': -- -- > Streams.write (Just "") os
1,077
handleToInputStream :: Handle -> IO (InputStream ByteString) handleToInputStream h = makeInputStream f where f = do x <- S.hGetSome h bUFSIZ return $! if S.null x then Nothing else Just x ------------------------------------------------------------------------------ -- | Converts a writable handle into an 'OutputStream' of strict 'ByteString's. -- -- Note that the wrapped handle is /not/ closed when it receives end-of-stream; -- you can use 'System.IO.Streams.Combinators.atEndOfOutput' to close the -- handle if you would like this behaviour. -- -- /Note/: to force the 'Handle' to be flushed, you can write a null string to -- the returned 'OutputStream': -- -- > Streams.write (Just "") os
720
handleToInputStream h = makeInputStream f where f = do x <- S.hGetSome h bUFSIZ return $! if S.null x then Nothing else Just x ------------------------------------------------------------------------------ -- | Converts a writable handle into an 'OutputStream' of strict 'ByteString's. -- -- Note that the wrapped handle is /not/ closed when it receives end-of-stream; -- you can use 'System.IO.Streams.Combinators.atEndOfOutput' to close the -- handle if you would like this behaviour. -- -- /Note/: to force the 'Handle' to be flushed, you can write a null string to -- the returned 'OutputStream': -- -- > Streams.write (Just "") os
659
true
true
1
11
168
96
52
44
null
null
shlevy/ghc
compiler/main/TidyPgm.hs
bsd-3-clause
mkBootTypeEnv :: NameSet -> [Id] -> [TyCon] -> [FamInst] -> TypeEnv mkBootTypeEnv exports ids tcs fam_insts = tidyTypeEnv True $ typeEnvFromEntities final_ids tcs fam_insts where -- Find the LocalIds in the type env that are exported -- Make them into GlobalIds, and tidy their types -- -- It's very important to remove the non-exported ones -- because we don't tidy the OccNames, and if we don't remove -- the non-exported ones we'll get many things with the -- same name in the interface file, giving chaos. -- -- Do make sure that we keep Ids that are already Global. -- When typechecking an .hs-boot file, the Ids come through as -- GlobalIds. final_ids = [ (if isLocalId id then globaliseAndTidyId id else id) `setIdUnfolding` BootUnfolding | id <- ids , keep_it id ] -- default methods have their export flag set, but everything -- else doesn't (yet), because this is pre-desugaring, so we -- must test both. keep_it id = isExportedId id || idName id `elemNameSet` exports
1,201
mkBootTypeEnv :: NameSet -> [Id] -> [TyCon] -> [FamInst] -> TypeEnv mkBootTypeEnv exports ids tcs fam_insts = tidyTypeEnv True $ typeEnvFromEntities final_ids tcs fam_insts where -- Find the LocalIds in the type env that are exported -- Make them into GlobalIds, and tidy their types -- -- It's very important to remove the non-exported ones -- because we don't tidy the OccNames, and if we don't remove -- the non-exported ones we'll get many things with the -- same name in the interface file, giving chaos. -- -- Do make sure that we keep Ids that are already Global. -- When typechecking an .hs-boot file, the Ids come through as -- GlobalIds. final_ids = [ (if isLocalId id then globaliseAndTidyId id else id) `setIdUnfolding` BootUnfolding | id <- ids , keep_it id ] -- default methods have their export flag set, but everything -- else doesn't (yet), because this is pre-desugaring, so we -- must test both. keep_it id = isExportedId id || idName id `elemNameSet` exports
1,201
mkBootTypeEnv exports ids tcs fam_insts = tidyTypeEnv True $ typeEnvFromEntities final_ids tcs fam_insts where -- Find the LocalIds in the type env that are exported -- Make them into GlobalIds, and tidy their types -- -- It's very important to remove the non-exported ones -- because we don't tidy the OccNames, and if we don't remove -- the non-exported ones we'll get many things with the -- same name in the interface file, giving chaos. -- -- Do make sure that we keep Ids that are already Global. -- When typechecking an .hs-boot file, the Ids come through as -- GlobalIds. final_ids = [ (if isLocalId id then globaliseAndTidyId id else id) `setIdUnfolding` BootUnfolding | id <- ids , keep_it id ] -- default methods have their export flag set, but everything -- else doesn't (yet), because this is pre-desugaring, so we -- must test both. keep_it id = isExportedId id || idName id `elemNameSet` exports
1,133
false
true
1
12
389
146
82
64
null
null
joslugd/connect4-haskell
src/Board.hs
mit
-- |Checks if a piece can be placed in a given column of a board. canPlaceInCol :: Board -> Int -> Bool canPlaceInCol b col = -- Check whether the first row has a piece in the column. isNothing $ rowIdx b 0 col
214
canPlaceInCol :: Board -> Int -> Bool canPlaceInCol b col = -- Check whether the first row has a piece in the column. isNothing $ rowIdx b 0 col
148
canPlaceInCol b col = -- Check whether the first row has a piece in the column. isNothing $ rowIdx b 0 col
110
true
true
0
6
47
37
19
18
null
null
ezyang/ghc
compiler/backpack/RnModIface.hs
bsd-3-clause
rnIfaceDecl :: Rename IfaceDecl rnIfaceDecl d@IfaceId{} = do name <- case ifIdDetails d of IfDFunId -> rnIfaceNeverExported (ifName d) _ | isDefaultMethodOcc (occName (ifName d)) -> rnIfaceNeverExported (ifName d) -- Typeable bindings. See Note [Grand plan for Typeable]. _ | isTypeableBindOcc (occName (ifName d)) -> rnIfaceNeverExported (ifName d) | otherwise -> rnIfaceGlobal (ifName d) ty <- rnIfaceType (ifType d) details <- rnIfaceIdDetails (ifIdDetails d) info <- rnIfaceIdInfo (ifIdInfo d) return d { ifName = name , ifType = ty , ifIdDetails = details , ifIdInfo = info }
884
rnIfaceDecl :: Rename IfaceDecl rnIfaceDecl d@IfaceId{} = do name <- case ifIdDetails d of IfDFunId -> rnIfaceNeverExported (ifName d) _ | isDefaultMethodOcc (occName (ifName d)) -> rnIfaceNeverExported (ifName d) -- Typeable bindings. See Note [Grand plan for Typeable]. _ | isTypeableBindOcc (occName (ifName d)) -> rnIfaceNeverExported (ifName d) | otherwise -> rnIfaceGlobal (ifName d) ty <- rnIfaceType (ifType d) details <- rnIfaceIdDetails (ifIdDetails d) info <- rnIfaceIdInfo (ifIdInfo d) return d { ifName = name , ifType = ty , ifIdDetails = details , ifIdInfo = info }
884
rnIfaceDecl d@IfaceId{} = do name <- case ifIdDetails d of IfDFunId -> rnIfaceNeverExported (ifName d) _ | isDefaultMethodOcc (occName (ifName d)) -> rnIfaceNeverExported (ifName d) -- Typeable bindings. See Note [Grand plan for Typeable]. _ | isTypeableBindOcc (occName (ifName d)) -> rnIfaceNeverExported (ifName d) | otherwise -> rnIfaceGlobal (ifName d) ty <- rnIfaceType (ifType d) details <- rnIfaceIdDetails (ifIdDetails d) info <- rnIfaceIdInfo (ifIdInfo d) return d { ifName = name , ifType = ty , ifIdDetails = details , ifIdInfo = info }
852
false
true
0
18
391
224
106
118
null
null
suhailshergill/liboleg
Control/ExtensibleDS.hs
bsd-3-clause
test2e = prog test2
19
test2e = prog test2
19
test2e = prog test2
19
false
false
0
5
3
9
4
5
null
null
MaxGabriel/yesod
yesod-core/Yesod/Core/Handler.hs
mit
setCookie :: MonadHandler m => SetCookie -> m () setCookie = addHeaderInternal . AddCookie
90
setCookie :: MonadHandler m => SetCookie -> m () setCookie = addHeaderInternal . AddCookie
90
setCookie = addHeaderInternal . AddCookie
41
false
true
0
8
13
31
15
16
null
null
green-haskell/ghc
compiler/types/CoAxiom.hs
bsd-3-clause
toBranchedList (NextBranch h t) = NextBranch h t
48
toBranchedList (NextBranch h t) = NextBranch h t
48
toBranchedList (NextBranch h t) = NextBranch h t
48
false
false
0
7
7
22
10
12
null
null
JustusAdam/servestatic
src/Snap/Snaplet/DocumentServer.hs
bsd-3-clause
absolutize :: FilePath -> Handler b DocumentServer FilePath absolutize p = do s <- getSnapletState return $ s ^. snapletValue . directory </> p
147
absolutize :: FilePath -> Handler b DocumentServer FilePath absolutize p = do s <- getSnapletState return $ s ^. snapletValue . directory </> p
147
absolutize p = do s <- getSnapletState return $ s ^. snapletValue . directory </> p
87
false
true
0
10
27
51
24
27
null
null
mietek/stack
src/Stack/PackageIndex.hs
bsd-3-clause
updateAllIndices :: (MonadIO m,MonadLogger m ,MonadThrow m,MonadReader env m,HasHttpManager env ,HasConfig env) => EnvOverride -> m () updateAllIndices menv = asks (configPackageIndices . getConfig) >>= mapM_ (updateIndex menv)
257
updateAllIndices :: (MonadIO m,MonadLogger m ,MonadThrow m,MonadReader env m,HasHttpManager env ,HasConfig env) => EnvOverride -> m () updateAllIndices menv = asks (configPackageIndices . getConfig) >>= mapM_ (updateIndex menv)
257
updateAllIndices menv = asks (configPackageIndices . getConfig) >>= mapM_ (updateIndex menv)
96
false
true
0
9
57
91
44
47
null
null
brendanhay/gogol
gogol-gmail/gen/Network/Google/Gmail/Types/Product.hs
mpl-2.0
-- | Creates a value of 'VacationSettings' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'vsEnableAutoReply' -- -- * 'vsResponseBodyPlainText' -- -- * 'vsRestrictToDomain' -- -- * 'vsStartTime' -- -- * 'vsResponseBodyHTML' -- -- * 'vsRestrictToContacts' -- -- * 'vsResponseSubject' -- -- * 'vsEndTime' vacationSettings :: VacationSettings vacationSettings = VacationSettings' { _vsEnableAutoReply = Nothing , _vsResponseBodyPlainText = Nothing , _vsRestrictToDomain = Nothing , _vsStartTime = Nothing , _vsResponseBodyHTML = Nothing , _vsRestrictToContacts = Nothing , _vsResponseSubject = Nothing , _vsEndTime = Nothing }
751
vacationSettings :: VacationSettings vacationSettings = VacationSettings' { _vsEnableAutoReply = Nothing , _vsResponseBodyPlainText = Nothing , _vsRestrictToDomain = Nothing , _vsStartTime = Nothing , _vsResponseBodyHTML = Nothing , _vsRestrictToContacts = Nothing , _vsResponseSubject = Nothing , _vsEndTime = Nothing }
362
vacationSettings = VacationSettings' { _vsEnableAutoReply = Nothing , _vsResponseBodyPlainText = Nothing , _vsRestrictToDomain = Nothing , _vsStartTime = Nothing , _vsResponseBodyHTML = Nothing , _vsRestrictToContacts = Nothing , _vsResponseSubject = Nothing , _vsEndTime = Nothing }
321
true
true
0
7
142
90
60
30
null
null
micknelso/language-c
src/Language/CFamily/Data/Ident.hs
bsd-3-clause
bits28 :: Int bits28 = 2^(28::Int)
34
bits28 :: Int bits28 = 2^(28::Int)
34
bits28 = 2^(28::Int)
20
false
true
2
6
5
29
13
16
null
null
ChrisKuklewicz/XWords
src/StateKey.hs
bsd-3-clause
forkVacuum :: Sessions -> IO ThreadId forkVacuum (StateKey {store = s}) = forkIO . forever $ do threadDelay timeout limit <- fmap (addUTCTime ((-15)*60)) getCurrentTime m <- atomically (readTVar s) let clean (key,Client {accessed = a}) = atomically $ do time <- readTVar a when (time < limit) $ do m' <- readTVar s writeTVar s $! M.delete key m' mapM_ clean (M.assocs m) where timeout = 15*60*(10^(6::Int)) -- 15 minute timeout forever x = x >> forever x -- | Call to create an empty global session cache. Usually once per program. -- Needs to be MonadIO to initialize the randomly generated id cookies.
659
forkVacuum :: Sessions -> IO ThreadId forkVacuum (StateKey {store = s}) = forkIO . forever $ do threadDelay timeout limit <- fmap (addUTCTime ((-15)*60)) getCurrentTime m <- atomically (readTVar s) let clean (key,Client {accessed = a}) = atomically $ do time <- readTVar a when (time < limit) $ do m' <- readTVar s writeTVar s $! M.delete key m' mapM_ clean (M.assocs m) where timeout = 15*60*(10^(6::Int)) -- 15 minute timeout forever x = x >> forever x -- | Call to create an empty global session cache. Usually once per program. -- Needs to be MonadIO to initialize the randomly generated id cookies.
659
forkVacuum (StateKey {store = s}) = forkIO . forever $ do threadDelay timeout limit <- fmap (addUTCTime ((-15)*60)) getCurrentTime m <- atomically (readTVar s) let clean (key,Client {accessed = a}) = atomically $ do time <- readTVar a when (time < limit) $ do m' <- readTVar s writeTVar s $! M.delete key m' mapM_ clean (M.assocs m) where timeout = 15*60*(10^(6::Int)) -- 15 minute timeout forever x = x >> forever x -- | Call to create an empty global session cache. Usually once per program. -- Needs to be MonadIO to initialize the randomly generated id cookies.
621
false
true
1
19
160
242
117
125
null
null
stu-smith/rendering-in-haskell
src/experiment02/Main.hs
mit
sphere :: Point -> Double -> Material -> Surface sphere center radius mat = translate (origin `to` center) $ mkSphere radius mat
132
sphere :: Point -> Double -> Material -> Surface sphere center radius mat = translate (origin `to` center) $ mkSphere radius mat
132
sphere center radius mat = translate (origin `to` center) $ mkSphere radius mat
83
false
true
0
8
25
51
26
25
null
null
wavewave/hoodle-core
src/Hoodle/ModelAction/Select/Transform.hs
gpl-3.0
-- | changeLinkBy :: ((Double,Double)->(Double,Double)) -> BBoxed Link -> BBoxed Link changeLinkBy func (BBoxed (Link i typ loc t c bstr (x,y) (Dim w h)) _bbox) = let (x1,y1) = func (x,y) (x2,y2) = func (x+w,y+h) nlnk = Link i typ loc t c bstr (x1,y1) (Dim (x2-x1) (y2-y1)) in runIdentity (makeBBoxed nlnk)
326
changeLinkBy :: ((Double,Double)->(Double,Double)) -> BBoxed Link -> BBoxed Link changeLinkBy func (BBoxed (Link i typ loc t c bstr (x,y) (Dim w h)) _bbox) = let (x1,y1) = func (x,y) (x2,y2) = func (x+w,y+h) nlnk = Link i typ loc t c bstr (x1,y1) (Dim (x2-x1) (y2-y1)) in runIdentity (makeBBoxed nlnk)
320
changeLinkBy func (BBoxed (Link i typ loc t c bstr (x,y) (Dim w h)) _bbox) = let (x1,y1) = func (x,y) (x2,y2) = func (x+w,y+h) nlnk = Link i typ loc t c bstr (x1,y1) (Dim (x2-x1) (y2-y1)) in runIdentity (makeBBoxed nlnk)
239
true
true
0
13
72
207
110
97
null
null
jragonfyre/TRPG
src/Dictionary/Utils.hs
bsd-3-clause
allNumGens Uncount = [NotCount]
31
allNumGens Uncount = [NotCount]
31
allNumGens Uncount = [NotCount]
31
false
false
0
5
3
13
6
7
null
null
spl/emgm
examples/Ex02AddingDatatypeSupport.hs
bsd-3-clause
Tree3 :: Generic3 g => g a b c -> g (Tree a) (Tree b) (Tree c) rTree3 ra = rtype3 epTree epTree epTree (rsum3 (rcon3 conLeaf ra) ((rcon3 conBranch (rprod3 (rTree3 ra) (rTree3 ra)))))
183
rTree3 :: Generic3 g => g a b c -> g (Tree a) (Tree b) (Tree c) rTree3 ra = rtype3 epTree epTree epTree (rsum3 (rcon3 conLeaf ra) ((rcon3 conBranch (rprod3 (rTree3 ra) (rTree3 ra)))))
183
rTree3 ra = rtype3 epTree epTree epTree (rsum3 (rcon3 conLeaf ra) ((rcon3 conBranch (rprod3 (rTree3 ra) (rTree3 ra)))))
119
false
true
0
14
35
114
55
59
null
null
JohnLato/jaek
src/Jaek/UI/FrpHandlers.hs
lgpl-3.0
isLeft :: Either l r -> Bool isLeft (Left _) = True
51
isLeft :: Either l r -> Bool isLeft (Left _) = True
51
isLeft (Left _) = True
22
false
true
0
9
11
35
15
20
null
null
gennady-em/haskel
src/P_TTT.hs
gpl-2.0
showPlayer :: Player -> [String ] showPlayer Nought =[" ", " +-+ ", " | | ", " +-+ ", " " ]
99
showPlayer :: Player -> [String ] showPlayer Nought =[" ", " +-+ ", " | | ", " +-+ ", " " ]
99
showPlayer Nought =[" ", " +-+ ", " | | ", " +-+ ", " " ]
65
false
true
0
8
30
42
22
20
null
null
MateVM/hs-java
JVM/Builder/Instructions.hs
lgpl-3.0
iastore :: Generator e g => g e () iastore = i0 IASTORE
55
iastore :: Generator e g => g e () iastore = i0 IASTORE
55
iastore = i0 IASTORE
20
false
true
0
7
12
30
14
16
null
null
league/postgrest
src/PostgREST/Parsers.hs
mit
pOperator :: Parser Operator pOperator = cs <$> (pOp <?> "operator (eq, gt, ...)") where pOp = foldl (<|>) empty $ map (try . string . cs . fst) operators
156
pOperator :: Parser Operator pOperator = cs <$> (pOp <?> "operator (eq, gt, ...)") where pOp = foldl (<|>) empty $ map (try . string . cs . fst) operators
156
pOperator = cs <$> (pOp <?> "operator (eq, gt, ...)") where pOp = foldl (<|>) empty $ map (try . string . cs . fst) operators
127
false
true
0
10
31
64
33
31
null
null
supermario/stack
src/Stack/Setup.hs
bsd-3-clause
chunksOverTime :: (Monoid a, MonadIO m) => NominalDiffTime -> Conduit a m a chunksOverTime diff = do currentTime <- liftIO getCurrentTime evalStateC (currentTime, mempty) go where -- State is a tuple of: -- * the last time a yield happened (or the beginning of the sink) -- * the accumulated awaits since the last yield go = await >>= \case Nothing -> do (_, acc) <- get yield acc Just a -> do (lastTime, acc) <- get let acc' = acc <> a currentTime <- liftIO getCurrentTime if diff < diffUTCTime currentTime lastTime then put (currentTime, mempty) >> yield acc' else put (lastTime, acc') go -- | Perform a basic sanity check of GHC
750
chunksOverTime :: (Monoid a, MonadIO m) => NominalDiffTime -> Conduit a m a chunksOverTime diff = do currentTime <- liftIO getCurrentTime evalStateC (currentTime, mempty) go where -- State is a tuple of: -- * the last time a yield happened (or the beginning of the sink) -- * the accumulated awaits since the last yield go = await >>= \case Nothing -> do (_, acc) <- get yield acc Just a -> do (lastTime, acc) <- get let acc' = acc <> a currentTime <- liftIO getCurrentTime if diff < diffUTCTime currentTime lastTime then put (currentTime, mempty) >> yield acc' else put (lastTime, acc') go -- | Perform a basic sanity check of GHC
750
chunksOverTime diff = do currentTime <- liftIO getCurrentTime evalStateC (currentTime, mempty) go where -- State is a tuple of: -- * the last time a yield happened (or the beginning of the sink) -- * the accumulated awaits since the last yield go = await >>= \case Nothing -> do (_, acc) <- get yield acc Just a -> do (lastTime, acc) <- get let acc' = acc <> a currentTime <- liftIO getCurrentTime if diff < diffUTCTime currentTime lastTime then put (currentTime, mempty) >> yield acc' else put (lastTime, acc') go -- | Perform a basic sanity check of GHC
674
false
true
0
14
232
200
99
101
null
null
tobynet/java-poker
src/Game/Poker/Simple.hs
mit
matchPoker :: (Hand, Deck) -> IO () matchPoker (mhand, deck) = do (mres, ndeck, nmhand) <- playPoker mhand deck Player case getHand ndeck of Nothing -> error "Unexpected error" Just (ehand, odeck) -> do (eres, _,nehand) <- playPoker ehand odeck Enemy printResult nmhand nehand mres eres -- | Play poker
352
matchPoker :: (Hand, Deck) -> IO () matchPoker (mhand, deck) = do (mres, ndeck, nmhand) <- playPoker mhand deck Player case getHand ndeck of Nothing -> error "Unexpected error" Just (ehand, odeck) -> do (eres, _,nehand) <- playPoker ehand odeck Enemy printResult nmhand nehand mres eres -- | Play poker
352
matchPoker (mhand, deck) = do (mres, ndeck, nmhand) <- playPoker mhand deck Player case getHand ndeck of Nothing -> error "Unexpected error" Just (ehand, odeck) -> do (eres, _,nehand) <- playPoker ehand odeck Enemy printResult nmhand nehand mres eres -- | Play poker
316
false
true
0
14
99
133
66
67
null
null
rueshyna/gogol
gogol-drive/gen/Network/Google/Drive/Types/Product.hs
mpl-2.0
-- | The plain text content of the comment. This field is used for setting -- the content, while htmlContent should be displayed. comContent :: Lens' Comment (Maybe Text) comContent = lens _comContent (\ s a -> s{_comContent = a})
232
comContent :: Lens' Comment (Maybe Text) comContent = lens _comContent (\ s a -> s{_comContent = a})
102
comContent = lens _comContent (\ s a -> s{_comContent = a})
61
true
true
0
9
41
49
26
23
null
null
lovasko/swim
src/Command/Show/Perform.hs
bsd-2-clause
selectEntries :: [a] -- ^ entries -> Maybe Int -- ^ count -> [a] -- ^ entries subset selectEntries xs Nothing = xs
156
selectEntries :: [a] -- ^ entries -> Maybe Int -- ^ count -> [a] selectEntries xs Nothing = xs
130
selectEntries xs Nothing = xs
31
true
true
0
7
64
36
20
16
null
null
Happy0/snowdrift
Model/Project.hs
agpl-3.0
fetchProjectWikiPagesBeforeDB :: ProjectId -> UTCTime -> Int64 -> DB [Entity WikiPage] fetchProjectWikiPagesBeforeDB project_id before lim = select $ from $ \(ewp `InnerJoin` wp) -> do on_ (ewp ^. EventWikiPageWikiPage ==. wp ^. WikiPageId) where_ $ ewp ^. EventWikiPageTs <=. val before &&. exprWikiPageOnProject wp project_id orderBy [ desc $ ewp ^. EventWikiPageTs, desc $ ewp ^. EventWikiPageId ] limit lim return wp -- | Fetch all WikiEdits made on this Project before this time.
529
fetchProjectWikiPagesBeforeDB :: ProjectId -> UTCTime -> Int64 -> DB [Entity WikiPage] fetchProjectWikiPagesBeforeDB project_id before lim = select $ from $ \(ewp `InnerJoin` wp) -> do on_ (ewp ^. EventWikiPageWikiPage ==. wp ^. WikiPageId) where_ $ ewp ^. EventWikiPageTs <=. val before &&. exprWikiPageOnProject wp project_id orderBy [ desc $ ewp ^. EventWikiPageTs, desc $ ewp ^. EventWikiPageId ] limit lim return wp -- | Fetch all WikiEdits made on this Project before this time.
529
fetchProjectWikiPagesBeforeDB project_id before lim = select $ from $ \(ewp `InnerJoin` wp) -> do on_ (ewp ^. EventWikiPageWikiPage ==. wp ^. WikiPageId) where_ $ ewp ^. EventWikiPageTs <=. val before &&. exprWikiPageOnProject wp project_id orderBy [ desc $ ewp ^. EventWikiPageTs, desc $ ewp ^. EventWikiPageId ] limit lim return wp -- | Fetch all WikiEdits made on this Project before this time.
442
false
true
0
13
118
150
73
77
null
null
rcook/mlutil
mlutil/src/MLUtil/Arithmetic.hs
mit
-- TODO: Use <# and return Vector instead! sumRows :: Matrix -> Matrix sumRows m = ones (1, cols m) <> tr' m
108
sumRows :: Matrix -> Matrix sumRows m = ones (1, cols m) <> tr' m
65
sumRows m = ones (1, cols m) <> tr' m
37
true
true
0
8
22
41
20
21
null
null
daleooo/barrelfish
tools/flounder/THCStubsBackend.hs
mit
thc_await_send_fn_name_x = "thc_await_send_x"
45
thc_await_send_fn_name_x = "thc_await_send_x"
45
thc_await_send_fn_name_x = "thc_await_send_x"
45
false
false
0
4
2
6
3
3
null
null
royopa/pandoc
src/Text/Pandoc/Writers/HTML.hs
gpl-2.0
alignmentToString :: Alignment -> [Char] alignmentToString alignment = case alignment of AlignLeft -> "left" AlignRight -> "right" AlignCenter -> "center" AlignDefault -> "left"
315
alignmentToString :: Alignment -> [Char] alignmentToString alignment = case alignment of AlignLeft -> "left" AlignRight -> "right" AlignCenter -> "center" AlignDefault -> "left"
315
alignmentToString alignment = case alignment of AlignLeft -> "left" AlignRight -> "right" AlignCenter -> "center" AlignDefault -> "left"
274
false
true
0
8
160
53
26
27
null
null
ecaustin/haskhol-deductive
src/HaskHOL/Lib/Classic.hs
bsd-2-clause
thmCOND_EQ_CLAUSE :: ClassicCtxt thry => HOL cls thry HOLThm thmCOND_EQ_CLAUSE = Base.thmCOND_EQ_CLAUSE
103
thmCOND_EQ_CLAUSE :: ClassicCtxt thry => HOL cls thry HOLThm thmCOND_EQ_CLAUSE = Base.thmCOND_EQ_CLAUSE
103
thmCOND_EQ_CLAUSE = Base.thmCOND_EQ_CLAUSE
42
false
true
0
6
11
27
13
14
null
null
GaloisInc/halvm-ghc
compiler/basicTypes/OccName.hs
bsd-3-clause
mkVarOcc :: String -> OccName mkVarOcc s = mkOccName varName s
62
mkVarOcc :: String -> OccName mkVarOcc s = mkOccName varName s
62
mkVarOcc s = mkOccName varName s
32
false
true
0
5
10
23
11
12
null
null
sergv/tags-server
tests/ServerTests/Data.hs
bsd-3-clause
withWorkingDir :: NameResolutionStrictness -> WorkingDirectory -- ^ Working directory under testDataDir -> TestSet ( String -- ^ Test name , PathFragment -- ^ Filepath within the working directory , Text -- ^ Symbol to search for , ServerResponse -- ^ Expected response ) -> TestSet ServerTest withWorkingDir mode dir = fmap $ \(name, file, sym, response) -> ServerTest { stTestName = name , stNameResolutionStrictness = mode , stWorkingDirectory = dir , stFile = file , stSymbol = sym , stExpectedResponse = response }
690
withWorkingDir :: NameResolutionStrictness -> WorkingDirectory -- ^ Working directory under testDataDir -> TestSet ( String -- ^ Test name , PathFragment -- ^ Filepath within the working directory , Text -- ^ Symbol to search for , ServerResponse -- ^ Expected response ) -> TestSet ServerTest withWorkingDir mode dir = fmap $ \(name, file, sym, response) -> ServerTest { stTestName = name , stNameResolutionStrictness = mode , stWorkingDirectory = dir , stFile = file , stSymbol = sym , stExpectedResponse = response }
690
withWorkingDir mode dir = fmap $ \(name, file, sym, response) -> ServerTest { stTestName = name , stNameResolutionStrictness = mode , stWorkingDirectory = dir , stFile = file , stSymbol = sym , stExpectedResponse = response }
325
false
true
2
10
253
119
69
50
null
null
csabahruska/q3demo
src/Q3Demo/Graphics/GLBackend.hs
bsd-3-clause
setUniform' p name (U_Mat3 d) = checkUniform name p UT_Mat3 $ \i -> with d $ \p -> glUniformMatrix3fv i 1 (fromIntegral gl_TRUE) $ castPtr p
142
setUniform' p name (U_Mat3 d) = checkUniform name p UT_Mat3 $ \i -> with d $ \p -> glUniformMatrix3fv i 1 (fromIntegral gl_TRUE) $ castPtr p
142
setUniform' p name (U_Mat3 d) = checkUniform name p UT_Mat3 $ \i -> with d $ \p -> glUniformMatrix3fv i 1 (fromIntegral gl_TRUE) $ castPtr p
142
false
false
0
12
27
67
32
35
null
null
leshchevds/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
-- | The number of retries when trying to @fork@ a new job. -- Due to a bug in GHC, this can fail even though we synchronize all forks -- and restrain from other @IO@ operations in the thread. luxidRetryForkCount :: Int luxidRetryForkCount = 5
243
luxidRetryForkCount :: Int luxidRetryForkCount = 5
50
luxidRetryForkCount = 5
23
true
true
0
4
44
14
9
5
null
null
iblumenfeld/cryptol
src/Cryptol/TypeCheck/Sanity.hs
bsd-3-clause
tcModule :: Map QName Schema -> Module -> Either Error [ ProofObligation ] tcModule env m = tcDecls env (mDecls m)
114
tcModule :: Map QName Schema -> Module -> Either Error [ ProofObligation ] tcModule env m = tcDecls env (mDecls m)
114
tcModule env m = tcDecls env (mDecls m)
39
false
true
0
8
20
48
23
25
null
null
Mokosha/Lambency
lib/Lambency/Shader/Expr.hs
mit
minf :: Expr Float -> Expr Float -> Expr Float minf = binaryExpr (BinaryFunOp Min)
82
minf :: Expr Float -> Expr Float -> Expr Float minf = binaryExpr (BinaryFunOp Min)
82
minf = binaryExpr (BinaryFunOp Min)
35
false
true
0
7
14
37
17
20
null
null
changlinli/nikki
src/Sorts/Tiles/Baking.hs
lgpl-3.0
pixmapAnimationToRect :: (Animation Pixmap, Position Double) -> Rect pixmapAnimationToRect (anim, pos) = pixmapToRect (animationHead anim, pos)
147
pixmapAnimationToRect :: (Animation Pixmap, Position Double) -> Rect pixmapAnimationToRect (anim, pos) = pixmapToRect (animationHead anim, pos)
147
pixmapAnimationToRect (anim, pos) = pixmapToRect (animationHead anim, pos)
78
false
true
0
7
19
48
25
23
null
null
sheyll/b9-vm-image-builder
src/lib/B9/Artifact/Content/ErlTerms.hs
mit
prettyPrintErlTerm :: SimpleErlangTerm -> PP.Doc prettyPrintErlTerm (ErlString str) = PP.doubleQuotes (PP.text (toErlStringString str))
137
prettyPrintErlTerm :: SimpleErlangTerm -> PP.Doc prettyPrintErlTerm (ErlString str) = PP.doubleQuotes (PP.text (toErlStringString str))
137
prettyPrintErlTerm (ErlString str) = PP.doubleQuotes (PP.text (toErlStringString str))
88
false
true
0
9
14
45
22
23
null
null
svenkeidel/gnome-citadel
src/Coords.hs
gpl-3.0
from2d :: (Int,Int) -> Coord from2d (x,y) = Coord x y 0
55
from2d :: (Int,Int) -> Coord from2d (x,y) = Coord x y 0
55
from2d (x,y) = Coord x y 0
26
false
true
0
6
11
37
20
17
null
null
dimara/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
-- | The set of storage types for which node storage reporting is available -- | (as used by LUQueryNodeStorage) stsReportNodeStorage :: FrozenSet String stsReportNodeStorage = ConstantUtils.union stsReport $ ConstantUtils.mkSet [ stSharedFile , stGluster ]
426
stsReportNodeStorage :: FrozenSet String stsReportNodeStorage = ConstantUtils.union stsReport $ ConstantUtils.mkSet [ stSharedFile , stGluster ]
313
stsReportNodeStorage = ConstantUtils.union stsReport $ ConstantUtils.mkSet [ stSharedFile , stGluster ]
272
true
true
1
7
203
39
19
20
null
null
brendanhay/gogol
gogol-dataproc/gen/Network/Google/Dataproc/Types/Product.hs
mpl-2.0
-- | Optional. A mapping of property names to values, used to configure Pig. -- Properties that conflict with values set by the Dataproc API may be -- overwritten. Can include properties set in -- \/etc\/hadoop\/conf\/*-site.xml, \/etc\/pig\/conf\/pig.properties, and -- classes in user code. pProperties :: Lens' PigJob (Maybe PigJobProperties) pProperties = lens _pProperties (\ s a -> s{_pProperties = a})
410
pProperties :: Lens' PigJob (Maybe PigJobProperties) pProperties = lens _pProperties (\ s a -> s{_pProperties = a})
117
pProperties = lens _pProperties (\ s a -> s{_pProperties = a})
64
true
true
0
9
61
52
29
23
null
null
ssaavedra/liquidhaskell
benchmarks/icfp15/pos/TwiceM.hs
bsd-3-clause
{-@ appM :: forall <pre :: World -> Prop, post :: World -> b -> World -> Prop>. (a -> RIO <pre, post> b) -> a -> RIO <pre, post> b @-} appM :: (a -> RIO b) -> a -> RIO b appM f x = f x
195
appM :: (a -> RIO b) -> a -> RIO b appM f x = f x
49
appM f x = f x
14
true
true
0
8
59
41
20
21
null
null
nevrenato/Hets_Fork
OWL2/Keywords.hs
gpl-2.0
versionInfo :: String versionInfo = "versionInfo"
49
versionInfo :: String versionInfo = "versionInfo"
49
versionInfo = "versionInfo"
27
false
true
0
4
5
11
6
5
null
null
Mahdi89/eTeak
src/Call.hs
bsd-3-clause
evalError :: ShowParseNode node => [Context Decl] -> Pos -> node -> String -> (Completeness, node) evalError cs pos node message = (parseNodeError cs pos node message, node)
177
evalError :: ShowParseNode node => [Context Decl] -> Pos -> node -> String -> (Completeness, node) evalError cs pos node message = (parseNodeError cs pos node message, node)
173
evalError cs pos node message = (parseNodeError cs pos node message, node)
74
false
true
0
10
31
70
36
34
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/ExtensionPredicates.hs
bsd-3-clause
-- | Is the <https://www.opengl.org/registry/specs/EXT/draw_buffers2.txt EXT_draw_buffers2> extension supported? glGetEXTDrawBuffers2 :: MonadIO m => m Bool glGetEXTDrawBuffers2 = getExtensions >>= (return . member "GL_EXT_draw_buffers2")
238
glGetEXTDrawBuffers2 :: MonadIO m => m Bool glGetEXTDrawBuffers2 = getExtensions >>= (return . member "GL_EXT_draw_buffers2")
125
glGetEXTDrawBuffers2 = getExtensions >>= (return . member "GL_EXT_draw_buffers2")
81
true
true
0
8
22
36
18
18
null
null
a143753/AOJ
2765.hs
apache-2.0
ans xw = let t = foldr (\[x,w] a -> a + x * w) 0 xw i = if t > 0 then -1 else 1 r = (abs t) `mod` 30 m = (abs t) `div` 30 n'= if r == 0 then m else m+1 xw'= (take m $ repeat [i,30]) ++ (take (n'-m) [[i,r]]) in ([n']:xw')
258
ans xw = let t = foldr (\[x,w] a -> a + x * w) 0 xw i = if t > 0 then -1 else 1 r = (abs t) `mod` 30 m = (abs t) `div` 30 n'= if r == 0 then m else m+1 xw'= (take m $ repeat [i,30]) ++ (take (n'-m) [[i,r]]) in ([n']:xw')
258
ans xw = let t = foldr (\[x,w] a -> a + x * w) 0 xw i = if t > 0 then -1 else 1 r = (abs t) `mod` 30 m = (abs t) `div` 30 n'= if r == 0 then m else m+1 xw'= (take m $ repeat [i,30]) ++ (take (n'-m) [[i,r]]) in ([n']:xw')
258
false
false
1
13
97
191
104
87
null
null
arnihermann/timedreb2erl
src/Language/Erlang/Builder.hs
mit
atomE = ExpVal . AtomicLiteral
30
atomE = ExpVal . AtomicLiteral
30
atomE = ExpVal . AtomicLiteral
30
false
false
0
5
4
10
5
5
null
null
allanderek/ipclib
Ipc/Ipc.hs
gpl-2.0
compileForHydra :: String -- ^ The hydra stage in question -> CliOptions a -- ^ The command-line options -> FilePath -- ^ The Pepa file to compile -> IO ExitCode -- ^ The io action we return. compileForHydra "flat-mod" = compileForFlatModHydra
371
compileForHydra :: String -- ^ The hydra stage in question -> CliOptions a -- ^ The command-line options -> FilePath -- ^ The Pepa file to compile -> IO ExitCode compileForHydra "flat-mod" = compileForFlatModHydra
322
compileForHydra "flat-mod" = compileForFlatModHydra
55
true
true
0
8
168
36
19
17
null
null
muhbaasu/pfennig-client-reflex
src/ReflexExtensions.hs
mit
stylesheet :: MonadWidget t m => String -> m () stylesheet s = elAttr "link" ("rel" =: "stylesheet" <> "href" =: s) blank
121
stylesheet :: MonadWidget t m => String -> m () stylesheet s = elAttr "link" ("rel" =: "stylesheet" <> "href" =: s) blank
121
stylesheet s = elAttr "link" ("rel" =: "stylesheet" <> "href" =: s) blank
73
false
true
0
9
22
54
26
28
null
null
gleachkr/Carnap
Carnap-Server/Handler/Register.hs
gpl-3.0
postRegisterR :: Text -> Handler Html postRegisterR = postRegister registrationForm
83
postRegisterR :: Text -> Handler Html postRegisterR = postRegister registrationForm
83
postRegisterR = postRegister registrationForm
45
false
true
0
6
9
21
10
11
null
null
brendanhay/gogol
gogol-vision/gen/Network/Google/Vision/Types/Product.hs
mpl-2.0
-- | The fraction of this color that should be applied to the pixel. That is, -- the final pixel color is defined by the equation: \`pixel color = alpha -- * (this color) + (1.0 - alpha) * (background color)\` This means that a -- value of 1.0 corresponds to a solid color, whereas a value of 0.0 -- corresponds to a completely transparent color. This uses a wrapper -- message rather than a simple float scalar so that it is possible to -- distinguish between a default value and the value being unset. If -- omitted, this color object is rendered as a solid color (as if the alpha -- value had been explicitly given a value of 1.0). cAlpha :: Lens' Color (Maybe Double) cAlpha = lens _cAlpha (\ s a -> s{_cAlpha = a}) . mapping _Coerce
745
cAlpha :: Lens' Color (Maybe Double) cAlpha = lens _cAlpha (\ s a -> s{_cAlpha = a}) . mapping _Coerce
110
cAlpha = lens _cAlpha (\ s a -> s{_cAlpha = a}) . mapping _Coerce
73
true
true
1
9
148
67
36
31
null
null
phadej/Earley
bench/BenchAll.hs
bsd-3-clause
tokenExpr d (Add a b) = tokenParens (d > 0) $ tokenExpr 0 a ++ ["+"] ++ tokenExpr 1 b
85
tokenExpr d (Add a b) = tokenParens (d > 0) $ tokenExpr 0 a ++ ["+"] ++ tokenExpr 1 b
85
tokenExpr d (Add a b) = tokenParens (d > 0) $ tokenExpr 0 a ++ ["+"] ++ tokenExpr 1 b
85
false
false
0
10
19
56
26
30
null
null
zachsully/hakaru
haskell/Language/Hakaru/Sample.hs
bsd-3-clause
evaluateSCon Dirac (e1 :* End) env = VMeasure $ \p _ -> return $ Just (evaluate e1 env, p)
104
evaluateSCon Dirac (e1 :* End) env = VMeasure $ \p _ -> return $ Just (evaluate e1 env, p)
104
evaluateSCon Dirac (e1 :* End) env = VMeasure $ \p _ -> return $ Just (evaluate e1 env, p)
104
false
false
0
10
32
49
25
24
null
null
cutsea110/aop
src/Pretty.hs
bsd-3-clause
layouts (Text s) = [s]
22
layouts (Text s) = [s]
22
layouts (Text s) = [s]
22
false
false
0
6
4
19
9
10
null
null
tolysz/yesod
yesod-core/Yesod/Core/Class/Yesod.hs
mit
getApprootText :: Approot site -> site -> W.Request -> Text getApprootText ar site req = case ar of ApprootRelative -> "" ApprootStatic t -> t ApprootMaster f -> f site ApprootRequest f -> f site req
235
getApprootText :: Approot site -> site -> W.Request -> Text getApprootText ar site req = case ar of ApprootRelative -> "" ApprootStatic t -> t ApprootMaster f -> f site ApprootRequest f -> f site req
235
getApprootText ar site req = case ar of ApprootRelative -> "" ApprootStatic t -> t ApprootMaster f -> f site ApprootRequest f -> f site req
175
false
true
0
8
71
80
37
43
null
null
nomeata/cryptonite
Crypto/Cipher/Camellia/Primitive.hs
bsd-3-clause
- in decrypt mode 0->17 1->16 ... -} getKeyK :: Mode -> Camellia -> Int -> Word64 getKeyK Encrypt key i = k key `arrayRead64` i
128
getKeyK :: Mode -> Camellia -> Int -> Word64 getKeyK Encrypt key i = k key `arrayRead64` i
90
getKeyK Encrypt key i = k key `arrayRead64` i
45
true
true
7
6
26
65
33
32
null
null
atupal/xmonad-mirror
xmonad/src/XMonad/StackSet.hs
mit
-- | Clear the floating status of a window sink :: Ord a => a -> StackSet i l a s sd -> StackSet i l a s sd sink w s = s { floating = M.delete w (floating s) }
159
sink :: Ord a => a -> StackSet i l a s sd -> StackSet i l a s sd sink w s = s { floating = M.delete w (floating s) }
116
sink w s = s { floating = M.delete w (floating s) }
51
true
true
0
9
41
75
37
38
null
null
prowdsponsor/country-codes
src/Data/CountryCodes/ISO31661.hs
bsd-3-clause
toText AX = "AX"
16
toText AX = "AX"
16
toText AX = "AX"
16
false
false
0
4
3
10
4
6
null
null
Lykos/Sara
src/lib/Sara/Codegen/CodeGenerator.hs
gpl-3.0
binaryInstruction (T.TypedBinOp Plus T.Double T.Double) a b = instr $ FAdd NoFastMathFlags a b []
99
binaryInstruction (T.TypedBinOp Plus T.Double T.Double) a b = instr $ FAdd NoFastMathFlags a b []
99
binaryInstruction (T.TypedBinOp Plus T.Double T.Double) a b = instr $ FAdd NoFastMathFlags a b []
99
false
false
0
8
16
44
21
23
null
null
AubreyEAnderson/shellcheck
ShellCheck/Analytics.hs
gpl-3.0
prop_checkSpacefulness6 = verifyTree checkSpacefulness "a=foo$(lol); echo $a"
77
prop_checkSpacefulness6 = verifyTree checkSpacefulness "a=foo$(lol); echo $a"
77
prop_checkSpacefulness6 = verifyTree checkSpacefulness "a=foo$(lol); echo $a"
77
false
false
0
5
6
11
5
6
null
null
spechub/Hets
Comorphisms/ExtModal2CASL.hs
gpl-2.0
transRecord :: Args -> Record EM_FORMULA (FORMULA ()) (TERM ()) transRecord as = let extInf = extendedInfo $ modSig as currW = currentW as in (mapRecord $ const ()) { foldPredication = \ _ ps args r -> case ps of Qual_pred_name pn pTy@(Pred_type srts q) p | MapSet.member pn (toPredType pTy) $ flexPreds extInf -> Predication (Qual_pred_name (addPlace pn) (Pred_type (world : srts) q) p) (currW : args) r | null srts && Set.member pn (nominals extInf) -> mkStEq currW $ getTermOfNom as pn _ -> Predication ps args r , foldExtFORMULA = \ _ f -> transEMF as f , foldApplication = \ _ os args r -> case os of Qual_op_name opn oTy@(Op_type ok srts res q) p | MapSet.member opn (toOpType oTy) $ flexOps extInf -> Application (Qual_op_name (addPlace opn) (Op_type ok (world : srts) res q) p) (currW : args) r _ -> Application os args r }
977
transRecord :: Args -> Record EM_FORMULA (FORMULA ()) (TERM ()) transRecord as = let extInf = extendedInfo $ modSig as currW = currentW as in (mapRecord $ const ()) { foldPredication = \ _ ps args r -> case ps of Qual_pred_name pn pTy@(Pred_type srts q) p | MapSet.member pn (toPredType pTy) $ flexPreds extInf -> Predication (Qual_pred_name (addPlace pn) (Pred_type (world : srts) q) p) (currW : args) r | null srts && Set.member pn (nominals extInf) -> mkStEq currW $ getTermOfNom as pn _ -> Predication ps args r , foldExtFORMULA = \ _ f -> transEMF as f , foldApplication = \ _ os args r -> case os of Qual_op_name opn oTy@(Op_type ok srts res q) p | MapSet.member opn (toOpType oTy) $ flexOps extInf -> Application (Qual_op_name (addPlace opn) (Op_type ok (world : srts) res q) p) (currW : args) r _ -> Application os args r }
977
transRecord as = let extInf = extendedInfo $ modSig as currW = currentW as in (mapRecord $ const ()) { foldPredication = \ _ ps args r -> case ps of Qual_pred_name pn pTy@(Pred_type srts q) p | MapSet.member pn (toPredType pTy) $ flexPreds extInf -> Predication (Qual_pred_name (addPlace pn) (Pred_type (world : srts) q) p) (currW : args) r | null srts && Set.member pn (nominals extInf) -> mkStEq currW $ getTermOfNom as pn _ -> Predication ps args r , foldExtFORMULA = \ _ f -> transEMF as f , foldApplication = \ _ os args r -> case os of Qual_op_name opn oTy@(Op_type ok srts res q) p | MapSet.member opn (toOpType oTy) $ flexOps extInf -> Application (Qual_op_name (addPlace opn) (Op_type ok (world : srts) res q) p) (currW : args) r _ -> Application os args r }
913
false
true
6
16
298
409
199
210
null
null
semaj/ants
src/Main.hs
bsd-3-clause
foodH = 50.0
12
foodH = 50.0
12
foodH = 50.0
12
false
false
0
4
2
6
3
3
null
null
dorchard/constrained-normal
Control/Monad/ConstrainedNormal.hs
bsd-3-clause
lowerNM :: forall a c t. (a -> t a) -> (forall x. c x => t x -> (x -> t a) -> t a) -> NM c t a -> t a lowerNM = foldNM
118
lowerNM :: forall a c t. (a -> t a) -> (forall x. c x => t x -> (x -> t a) -> t a) -> NM c t a -> t a lowerNM = foldNM
118
lowerNM = foldNM
16
false
true
0
16
36
95
46
49
null
null
gcross/habit-of-fate
sources/library/HabitOfFate/Quests/DarkLord/Part2/Mage.hs
agpl-3.0
frost = [outcomes| = Common Title = Chilly = Common Story = The Dark Lord shoots a bolt of frost at the mage. = Common Question = Does the magical shield hold? = Success Choice = Yes. = Success Title = The Cold Front Passes By = Success Story = The bolt is absorbed by the shield, but just barely; the mage grows chilly. = Failure Choice = No. = Failure Title = Frostbite = Failure Story = Unfortunately, the shield dissipates and the bolt directly strikes the mage, turning him/her| into an icicle. The mage struggles as hard as he/she| can, but is unable to move. He/she| watches in horror as the Dark Lord approaches. "Good night!" the Dark Lord says, breaking into a laugh. He smashes his head into the mage, and | breaks into a thousand pieces. = Shame = Rest in pieces, |. |]
782
frost = [outcomes| = Common Title = Chilly = Common Story = The Dark Lord shoots a bolt of frost at the mage. = Common Question = Does the magical shield hold? = Success Choice = Yes. = Success Title = The Cold Front Passes By = Success Story = The bolt is absorbed by the shield, but just barely; the mage grows chilly. = Failure Choice = No. = Failure Title = Frostbite = Failure Story = Unfortunately, the shield dissipates and the bolt directly strikes the mage, turning him/her| into an icicle. The mage struggles as hard as he/she| can, but is unable to move. He/she| watches in horror as the Dark Lord approaches. "Good night!" the Dark Lord says, breaking into a laugh. He smashes his head into the mage, and | breaks into a thousand pieces. = Shame = Rest in pieces, |. |]
782
frost = [outcomes| = Common Title = Chilly = Common Story = The Dark Lord shoots a bolt of frost at the mage. = Common Question = Does the magical shield hold? = Success Choice = Yes. = Success Title = The Cold Front Passes By = Success Story = The bolt is absorbed by the shield, but just barely; the mage grows chilly. = Failure Choice = No. = Failure Title = Frostbite = Failure Story = Unfortunately, the shield dissipates and the bolt directly strikes the mage, turning him/her| into an icicle. The mage struggles as hard as he/she| can, but is unable to move. He/she| watches in horror as the Dark Lord approaches. "Good night!" the Dark Lord says, breaking into a laugh. He smashes his head into the mage, and | breaks into a thousand pieces. = Shame = Rest in pieces, |. |]
782
false
false
1
5
148
14
7
7
null
null
pjones/vimeta
src/Vimeta/Core/MappingFile.hs
bsd-2-clause
checkFileMapping :: (MonadIO m) => -- | The mapping. [(FilePath, a)] -> Vimeta m [Either (FilePath, a) (FilePath, a)] checkFileMapping = mapM checkFile where checkFile :: (MonadIO m) => (FilePath, a) -> Vimeta m (Either (FilePath, a) (FilePath, a)) checkFile f@(filename, a) = do let ext = takeExtension filename exists <- runIO (doesFileExist filename) case exists of False | null ext -> checkFile (filename ++ ".m4v", a) | otherwise -> return $ Left f True -> return $ Right f -- | The actual file parser.
599
checkFileMapping :: (MonadIO m) => -- | The mapping. [(FilePath, a)] -> Vimeta m [Either (FilePath, a) (FilePath, a)] checkFileMapping = mapM checkFile where checkFile :: (MonadIO m) => (FilePath, a) -> Vimeta m (Either (FilePath, a) (FilePath, a)) checkFile f@(filename, a) = do let ext = takeExtension filename exists <- runIO (doesFileExist filename) case exists of False | null ext -> checkFile (filename ++ ".m4v", a) | otherwise -> return $ Left f True -> return $ Right f -- | The actual file parser.
599
checkFileMapping = mapM checkFile where checkFile :: (MonadIO m) => (FilePath, a) -> Vimeta m (Either (FilePath, a) (FilePath, a)) checkFile f@(filename, a) = do let ext = takeExtension filename exists <- runIO (doesFileExist filename) case exists of False | null ext -> checkFile (filename ++ ".m4v", a) | otherwise -> return $ Left f True -> return $ Right f -- | The actual file parser.
473
false
true
0
13
177
224
116
108
null
null
bredelings/BAli-Phy
haskell/PopGen.hs
gpl-2.0
afsMixture thetas ps = Distribution "afsMixture" (make_densities $ ewens_sampling_mixture_probability thetas ps) (error "afsMixture has no quantile") () ()
155
afsMixture thetas ps = Distribution "afsMixture" (make_densities $ ewens_sampling_mixture_probability thetas ps) (error "afsMixture has no quantile") () ()
155
afsMixture thetas ps = Distribution "afsMixture" (make_densities $ ewens_sampling_mixture_probability thetas ps) (error "afsMixture has no quantile") () ()
155
false
false
0
8
17
44
21
23
null
null
bitemyapp/ghc
compiler/cmm/CLabel.hs
bsd-3-clause
pprCLbl (AsmTempLabel {}) = panic "pprCLbl AsmTempLabel"
62
pprCLbl (AsmTempLabel {}) = panic "pprCLbl AsmTempLabel"
62
pprCLbl (AsmTempLabel {}) = panic "pprCLbl AsmTempLabel"
62
false
false
0
6
12
20
9
11
null
null
fmapfmapfmap/amazonka
amazonka-storagegateway/test/Test/AWS/Gen/StorageGateway.hs
mpl-2.0
testUpdateMaintenanceStartTime :: UpdateMaintenanceStartTime -> TestTree testUpdateMaintenanceStartTime = req "UpdateMaintenanceStartTime" "fixture/UpdateMaintenanceStartTime.yaml"
188
testUpdateMaintenanceStartTime :: UpdateMaintenanceStartTime -> TestTree testUpdateMaintenanceStartTime = req "UpdateMaintenanceStartTime" "fixture/UpdateMaintenanceStartTime.yaml"
188
testUpdateMaintenanceStartTime = req "UpdateMaintenanceStartTime" "fixture/UpdateMaintenanceStartTime.yaml"
115
false
true
0
5
17
20
10
10
null
null
brendanhay/gogol
gogol-pubsub/gen/Network/Google/Resource/PubSub/Projects/Snapshots/TestIAMPermissions.hs
mpl-2.0
-- | JSONP pstipCallback :: Lens' ProjectsSnapshotsTestIAMPermissions (Maybe Text) pstipCallback = lens _pstipCallback (\ s a -> s{_pstipCallback = a})
159
pstipCallback :: Lens' ProjectsSnapshotsTestIAMPermissions (Maybe Text) pstipCallback = lens _pstipCallback (\ s a -> s{_pstipCallback = a})
148
pstipCallback = lens _pstipCallback (\ s a -> s{_pstipCallback = a})
76
true
true
1
9
27
51
25
26
null
null
kmels/dart-haskell
examples/interpreter/Lists.hs
bsd-3-clause
thousand = listHead myList
26
thousand = listHead myList
26
thousand = listHead myList
26
false
false
1
5
3
13
4
9
null
null
mdsteele/pylos
src/Pylos/Event.hs
gpl-3.0
fromSDLKey SDL.SDLK_n = KeyN
28
fromSDLKey SDL.SDLK_n = KeyN
28
fromSDLKey SDL.SDLK_n = KeyN
28
false
false
0
6
3
11
5
6
null
null
jystic/river
src/River/Compile.hs
bsd-3-clause
executeBinaryE :: Either String FilePath -> ExceptT CompileError IO ExecuteResult executeBinaryE src = do ExceptT . liftIO . withSystemTempDirectory "river" $ \tmp -> runExceptT $ do let executable = tmp </> "a.out" compileBinaryE src executable (code, out, err) <- liftIO $ readProcessWithExitCode executable [] "" let tout = T.pack out terr = T.pack err case T.signed T.decimal tout of Right (i, "\n") -> pure $ ExecuteResult i _ -> pure $ ExecuteError code tout terr
607
executeBinaryE :: Either String FilePath -> ExceptT CompileError IO ExecuteResult executeBinaryE src = do ExceptT . liftIO . withSystemTempDirectory "river" $ \tmp -> runExceptT $ do let executable = tmp </> "a.out" compileBinaryE src executable (code, out, err) <- liftIO $ readProcessWithExitCode executable [] "" let tout = T.pack out terr = T.pack err case T.signed T.decimal tout of Right (i, "\n") -> pure $ ExecuteResult i _ -> pure $ ExecuteError code tout terr
607
executeBinaryE src = do ExceptT . liftIO . withSystemTempDirectory "river" $ \tmp -> runExceptT $ do let executable = tmp </> "a.out" compileBinaryE src executable (code, out, err) <- liftIO $ readProcessWithExitCode executable [] "" let tout = T.pack out terr = T.pack err case T.signed T.decimal tout of Right (i, "\n") -> pure $ ExecuteResult i _ -> pure $ ExecuteError code tout terr
525
false
true
0
16
212
186
88
98
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/nativeGen/PIC.hs
bsd-3-clause
-- all other platforms howToAccessLabel dflags _ _ _ _ _ | not (gopt Opt_PIC dflags) = AccessDirectly | otherwise = panic "howToAccessLabel: PIC not defined for this platform"
208
howToAccessLabel dflags _ _ _ _ _ | not (gopt Opt_PIC dflags) = AccessDirectly | otherwise = panic "howToAccessLabel: PIC not defined for this platform"
185
howToAccessLabel dflags _ _ _ _ _ | not (gopt Opt_PIC dflags) = AccessDirectly | otherwise = panic "howToAccessLabel: PIC not defined for this platform"
185
true
false
0
10
61
51
23
28
null
null
bitc/omegagb
src/Cpu.hs
gpl-2.0
mcti 0xA7 _ = (AND A, 4, 0)
62
mcti 0xA7 _ = (AND A, 4, 0)
62
mcti 0xA7 _ = (AND A, 4, 0)
62
false
false
0
6
42
25
12
13
null
null
ucsd-cse131/01-adder
lib/Language/Adder/Types.hs
mit
exprBinds body = ([] , body)
45
exprBinds body = ([] , body)
45
exprBinds body = ([] , body)
45
false
false
0
6
22
17
9
8
null
null
ekmett/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_FS_DEFAULT :: Int wxSTC_FS_DEFAULT = 0
44
wxSTC_FS_DEFAULT :: Int wxSTC_FS_DEFAULT = 0
44
wxSTC_FS_DEFAULT = 0
20
false
true
0
6
5
18
7
11
null
null
iemxblog/hpcb
src/Hpcb/Data/NetNumbering.hs
mit
numberNet _ (NumberedNet n nn) = NumberedNet n nn
49
numberNet _ (NumberedNet n nn) = NumberedNet n nn
49
numberNet _ (NumberedNet n nn) = NumberedNet n nn
49
false
false
1
6
8
26
11
15
null
null
jordanemedlock/fungen
Graphics/UI/Fungen/Map.hs
bsd-3-clause
getTileMapScroll _ = error "Map.getTileMapScroll error: game map is not a tile map!"
84
getTileMapScroll _ = error "Map.getTileMapScroll error: game map is not a tile map!"
84
getTileMapScroll _ = error "Map.getTileMapScroll error: game map is not a tile map!"
84
false
false
0
4
12
13
5
8
null
null
brendanhay/gogol
gogol-cloudprivatecatalog/gen/Network/Google/Resource/CloudPrivateCatalog/Folders/Products/Search.hs
mpl-2.0
-- | A pagination token returned from a previous call to SearchProducts that -- indicates where this listing should continue from. This field is -- optional. fpsPageToken :: Lens' FoldersProductsSearch (Maybe Text) fpsPageToken = lens _fpsPageToken (\ s a -> s{_fpsPageToken = a})
282
fpsPageToken :: Lens' FoldersProductsSearch (Maybe Text) fpsPageToken = lens _fpsPageToken (\ s a -> s{_fpsPageToken = a})
124
fpsPageToken = lens _fpsPageToken (\ s a -> s{_fpsPageToken = a})
67
true
true
0
9
44
50
27
23
null
null
jeannekamikaze/Spear
Spear/Math/Matrix4.hs
mit
row1 (Matrix4 _ _ _ _ a10 a11 a12 a13 _ _ _ _ _ _ _ _ ) = vec4 a10 a11 a12 a13
101
row1 (Matrix4 _ _ _ _ a10 a11 a12 a13 _ _ _ _ _ _ _ _ ) = vec4 a10 a11 a12 a13
101
row1 (Matrix4 _ _ _ _ a10 a11 a12 a13 _ _ _ _ _ _ _ _ ) = vec4 a10 a11 a12 a13
101
false
false
0
6
47
55
26
29
null
null
olorin/amazonka
amazonka-iam/gen/Network/AWS/IAM/GetGroupPolicy.hs
mpl-2.0
-- | The name of the group the policy is associated with. ggpGroupName :: Lens' GetGroupPolicy Text ggpGroupName = lens _ggpGroupName (\ s a -> s{_ggpGroupName = a})
165
ggpGroupName :: Lens' GetGroupPolicy Text ggpGroupName = lens _ggpGroupName (\ s a -> s{_ggpGroupName = a})
107
ggpGroupName = lens _ggpGroupName (\ s a -> s{_ggpGroupName = a})
65
true
true
0
9
27
40
22
18
null
null
NicolasDP/hs-bspack
Tests/Tests.hs
bsd-3-clause
tests = testGroup "bspack test suit" [ refTestsOk , refTestsFail ]
78
tests = testGroup "bspack test suit" [ refTestsOk , refTestsFail ]
78
tests = testGroup "bspack test suit" [ refTestsOk , refTestsFail ]
78
false
false
0
6
22
17
9
8
null
null
niteria/deterministic-fvs
EtaReduced/FV.hs
mit
fs :: [Term] -> FV fs (t:tys) = f t `unionFV` fs tys
52
fs :: [Term] -> FV fs (t:tys) = f t `unionFV` fs tys
52
fs (t:tys) = f t `unionFV` fs tys
33
false
true
0
7
12
40
21
19
null
null
spacekitteh/smcghc
compiler/nativeGen/X86/Ppr.hs
bsd-3-clause
gsp :: SDoc gsp = char ' '
28
gsp :: SDoc gsp = char ' '
28
gsp = char ' '
16
false
true
1
5
9
17
7
10
null
null
ekmett/succinct
src/Succinct/Internal/Decoding.hs
bsd-2-clause
decodeUnary :: Decoding Int decodeUnary = Decoding step where step k v i xs | b == 0 = gallop 0 k v (wd i) | u <- lsb (complement (unsafeShiftL xs b)) = if u + b < 64 then k u (i + u + 1) xs else gallop u k v (wd i + 1) where b = bt i gallop acc k v wi = case P.unsafeIndex v wi of xs | xs == -1 -> gallop (acc + 64) k v (wi + 1) | u <- lsb (complement xs) -> k (acc + u) (unsafeShiftL wi 6 + u) xs -- | Elias gamma decoding
496
decodeUnary :: Decoding Int decodeUnary = Decoding step where step k v i xs | b == 0 = gallop 0 k v (wd i) | u <- lsb (complement (unsafeShiftL xs b)) = if u + b < 64 then k u (i + u + 1) xs else gallop u k v (wd i + 1) where b = bt i gallop acc k v wi = case P.unsafeIndex v wi of xs | xs == -1 -> gallop (acc + 64) k v (wi + 1) | u <- lsb (complement xs) -> k (acc + u) (unsafeShiftL wi 6 + u) xs -- | Elias gamma decoding
496
decodeUnary = Decoding step where step k v i xs | b == 0 = gallop 0 k v (wd i) | u <- lsb (complement (unsafeShiftL xs b)) = if u + b < 64 then k u (i + u + 1) xs else gallop u k v (wd i + 1) where b = bt i gallop acc k v wi = case P.unsafeIndex v wi of xs | xs == -1 -> gallop (acc + 64) k v (wi + 1) | u <- lsb (complement xs) -> k (acc + u) (unsafeShiftL wi 6 + u) xs -- | Elias gamma decoding
468
false
true
3
14
182
285
130
155
null
null
corajr/cataskell
src/Cataskell/GameData/Location.hs
bsd-3-clause
hexNeighborhoods :: Map.Map CentralPoint [CentralPoint] hexNeighborhoods = Map.fromList hexN where hexN = zip hexCenterPoints nns nns = map (map (toCenter . mkCenter)) $ map getNs hexCoords getNs hc = let nc = neighborCoords hc in delete hc nc
281
hexNeighborhoods :: Map.Map CentralPoint [CentralPoint] hexNeighborhoods = Map.fromList hexN where hexN = zip hexCenterPoints nns nns = map (map (toCenter . mkCenter)) $ map getNs hexCoords getNs hc = let nc = neighborCoords hc in delete hc nc
281
hexNeighborhoods = Map.fromList hexN where hexN = zip hexCenterPoints nns nns = map (map (toCenter . mkCenter)) $ map getNs hexCoords getNs hc = let nc = neighborCoords hc in delete hc nc
225
false
true
2
11
75
96
46
50
null
null
mhuesch/scheme_compiler
src/L5ToL4/Compile.hs
bsd-3-clause
addFun :: L4.Function -> CFS () --addFun f = generatedFuns %= (f:) addFun f = do cfs@(CountFunState _ _ gfs) <- get put cfs{ generatedFuns = (f:gfs) } --
161
addFun :: L4.Function -> CFS () addFun f = do cfs@(CountFunState _ _ gfs) <- get put cfs{ generatedFuns = (f:gfs) } --
126
addFun f = do cfs@(CountFunState _ _ gfs) <- get put cfs{ generatedFuns = (f:gfs) } --
94
true
true
0
11
36
68
35
33
null
null
spl/emgm
src/Generics/EMGM/Data/Ratio.hs
bsd-3-clause
-- | Representation of 'Ratio' for 'frep2'. frep2Ratio :: (Integral a1, Integral a2, Generic2 g) => g a1 a2 -> g (Ratio a1) (Ratio a2) frep2Ratio a = rtype2 epRatio epRatio (rcon2 conRatio (a `rprod2` a))
208
frep2Ratio :: (Integral a1, Integral a2, Generic2 g) => g a1 a2 -> g (Ratio a1) (Ratio a2) frep2Ratio a = rtype2 epRatio epRatio (rcon2 conRatio (a `rprod2` a))
164
frep2Ratio a = rtype2 epRatio epRatio (rcon2 conRatio (a `rprod2` a))
69
true
true
0
9
39
89
45
44
null
null
faylang/fay-jquery
src/JQuery.hs
bsd-3-clause
chainAnims (a:as) = a `chainAnim` chainAnims as
47
chainAnims (a:as) = a `chainAnim` chainAnims as
47
chainAnims (a:as) = a `chainAnim` chainAnims as
47
false
false
0
6
6
30
14
16
null
null
ambiata/mismi
mismi-s3-core/src/Mismi/S3/Core/Data.hs
bsd-3-clause
-- | @withKey f address@ : Replace the 'Key' part of an 'Address' with a new -- 'Key' resulting from the application of function @f@ to the old 'Key'. withKey :: (Key -> Key) -> Address -> Address withKey f (Address b k) = Address b $ f k
242
withKey :: (Key -> Key) -> Address -> Address withKey f (Address b k) = Address b $ f k
89
withKey f (Address b k) = Address b $ f k
43
true
true
2
10
52
58
27
31
null
null
codingiam/sandbox-hs
src/Hw02.hs
bsd-3-clause
uild :: [LogMessage] -> MessageTree build xs = foldl doInsert Leaf xs where doInsert t m = insert m t
108
build :: [LogMessage] -> MessageTree build xs = foldl doInsert Leaf xs where doInsert t m = insert m t
108
build xs = foldl doInsert Leaf xs where doInsert t m = insert m t
71
false
true
0
6
26
46
22
24
null
null
tibbe/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
translateOp dflags AddrAddOp = Just (mo_wordAdd dflags)
60
translateOp dflags AddrAddOp = Just (mo_wordAdd dflags)
60
translateOp dflags AddrAddOp = Just (mo_wordAdd dflags)
60
false
false
0
7
11
20
9
11
null
null
yupferris/write-you-a-haskell
chapter8/protohaskell/Pretty.hs
mit
spaced :: Pretty a => Int -> [a] -> Doc spaced p = hsep . fmap (ppr p)
70
spaced :: Pretty a => Int -> [a] -> Doc spaced p = hsep . fmap (ppr p)
70
spaced p = hsep . fmap (ppr p)
30
false
true
0
8
17
45
22
23
null
null
marcinmrotek/hsqml-datamodel
Setup.hs
bsd-3-clause
replace src dst xs@(x:xs') = case stripPrefix src xs of Just xs'' -> dst ++ replace src dst xs'' Nothing -> x : replace src dst xs'
142
replace src dst xs@(x:xs') = case stripPrefix src xs of Just xs'' -> dst ++ replace src dst xs'' Nothing -> x : replace src dst xs'
142
replace src dst xs@(x:xs') = case stripPrefix src xs of Just xs'' -> dst ++ replace src dst xs'' Nothing -> x : replace src dst xs'
142
false
false
0
9
37
69
33
36
null
null