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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SuperDrew/sql-server-gen
|
src/Database/SqlServer/Definition/MessageType.hs
|
bsd-2-clause
|
renderPreRequisites (Right x) = toDoc x $+$ text "GO"
| 53
|
renderPreRequisites (Right x) = toDoc x $+$ text "GO"
| 53
|
renderPreRequisites (Right x) = toDoc x $+$ text "GO"
| 53
| false
| false
| 0
| 7
| 8
| 25
| 11
| 14
| null | null |
olsner/ghc
|
compiler/types/Type.hs
|
bsd-3-clause
|
tyConAppTyConPicky_maybe (FunTy {}) = Just funTyCon
| 56
|
tyConAppTyConPicky_maybe (FunTy {}) = Just funTyCon
| 56
|
tyConAppTyConPicky_maybe (FunTy {}) = Just funTyCon
| 56
| false
| false
| 0
| 7
| 10
| 19
| 9
| 10
| null | null |
ndmitchell/shake
|
src/General/Wait.hs
|
bsd-3-clause
|
firstLeftWaitUnordered :: MonadIO m => (a -> Wait m (Either e b)) -> [a] -> Wait m (Either e [b])
firstLeftWaitUnordered f xs = do
let n = length xs
mut <- liftIO $ newArray n undefined
res <- go mut [] $ zipFrom 0 $ map f xs
case res of
Just e -> pure $ Left e
Nothing -> liftIO $ Right <$> mapM (readArray mut) [0..n-1]
where
-- keep a list of those things we might visit later, and ask for each we see in turn
go :: MonadIO m => MutableArray RealWorld b -> [(Int, (Either e b -> m ()) -> m ())] -> [(Int, Wait m (Either e b))] -> Wait m (Maybe e)
go mut later ((i,x):xs) = case x of
Now (Left e) -> Now $ Just e
Now (Right b) -> do
liftIO $ writeArray mut i b
go mut later xs
Later l -> go mut ((i,l):later) xs
Lift x -> Lift $ do
x <- x
pure $ go mut later ((i,x):xs)
go _ [] [] = Now Nothing
go mut ls [] = Later $ \callback -> do
ref <- liftIO $ newIORef $ length ls
forM_ ls $ \(i,l) -> l $ \r -> do
old <- liftIO $ readIORef ref
when (old > 0) $ case r of
Left a -> do
liftIO $ writeIORef' ref 0
callback $ Just a
Right v -> do
liftIO $ writeArray mut i v
liftIO $ writeIORef' ref $ old-1
when (old == 1) $ callback Nothing
| 1,559
|
firstLeftWaitUnordered :: MonadIO m => (a -> Wait m (Either e b)) -> [a] -> Wait m (Either e [b])
firstLeftWaitUnordered f xs = do
let n = length xs
mut <- liftIO $ newArray n undefined
res <- go mut [] $ zipFrom 0 $ map f xs
case res of
Just e -> pure $ Left e
Nothing -> liftIO $ Right <$> mapM (readArray mut) [0..n-1]
where
-- keep a list of those things we might visit later, and ask for each we see in turn
go :: MonadIO m => MutableArray RealWorld b -> [(Int, (Either e b -> m ()) -> m ())] -> [(Int, Wait m (Either e b))] -> Wait m (Maybe e)
go mut later ((i,x):xs) = case x of
Now (Left e) -> Now $ Just e
Now (Right b) -> do
liftIO $ writeArray mut i b
go mut later xs
Later l -> go mut ((i,l):later) xs
Lift x -> Lift $ do
x <- x
pure $ go mut later ((i,x):xs)
go _ [] [] = Now Nothing
go mut ls [] = Later $ \callback -> do
ref <- liftIO $ newIORef $ length ls
forM_ ls $ \(i,l) -> l $ \r -> do
old <- liftIO $ readIORef ref
when (old > 0) $ case r of
Left a -> do
liftIO $ writeIORef' ref 0
callback $ Just a
Right v -> do
liftIO $ writeArray mut i v
liftIO $ writeIORef' ref $ old-1
when (old == 1) $ callback Nothing
| 1,559
|
firstLeftWaitUnordered f xs = do
let n = length xs
mut <- liftIO $ newArray n undefined
res <- go mut [] $ zipFrom 0 $ map f xs
case res of
Just e -> pure $ Left e
Nothing -> liftIO $ Right <$> mapM (readArray mut) [0..n-1]
where
-- keep a list of those things we might visit later, and ask for each we see in turn
go :: MonadIO m => MutableArray RealWorld b -> [(Int, (Either e b -> m ()) -> m ())] -> [(Int, Wait m (Either e b))] -> Wait m (Maybe e)
go mut later ((i,x):xs) = case x of
Now (Left e) -> Now $ Just e
Now (Right b) -> do
liftIO $ writeArray mut i b
go mut later xs
Later l -> go mut ((i,l):later) xs
Lift x -> Lift $ do
x <- x
pure $ go mut later ((i,x):xs)
go _ [] [] = Now Nothing
go mut ls [] = Later $ \callback -> do
ref <- liftIO $ newIORef $ length ls
forM_ ls $ \(i,l) -> l $ \r -> do
old <- liftIO $ readIORef ref
when (old > 0) $ case r of
Left a -> do
liftIO $ writeIORef' ref 0
callback $ Just a
Right v -> do
liftIO $ writeArray mut i v
liftIO $ writeIORef' ref $ old-1
when (old == 1) $ callback Nothing
| 1,461
| false
| true
| 0
| 24
| 685
| 670
| 320
| 350
| null | null |
brendanhay/gogol
|
gogol-discovery/gen/Network/Google/Discovery/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'RestDescriptionIcons' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rdiX16'
--
-- * 'rdiX32'
restDescriptionIcons
:: RestDescriptionIcons
restDescriptionIcons =
RestDescriptionIcons' {_rdiX16 = Nothing, _rdiX32 = Nothing}
| 340
|
restDescriptionIcons
:: RestDescriptionIcons
restDescriptionIcons =
RestDescriptionIcons' {_rdiX16 = Nothing, _rdiX32 = Nothing}
| 134
|
restDescriptionIcons =
RestDescriptionIcons' {_rdiX16 = Nothing, _rdiX32 = Nothing}
| 85
| true
| true
| 0
| 7
| 55
| 42
| 24
| 18
| null | null |
mzini/termlib
|
Termlib/Rule.hs
|
gpl-3.0
|
isShallow :: Rule -> Bool
isShallow = bothsides T.isShallow
| 59
|
isShallow :: Rule -> Bool
isShallow = bothsides T.isShallow
| 59
|
isShallow = bothsides T.isShallow
| 33
| false
| true
| 0
| 6
| 8
| 20
| 10
| 10
| null | null |
tdammers/ginger
|
cli/Options.hs
|
mit
|
runOptions :: Parser Options
runOptions =
RunOptions <$> templateSource <*> dataSource
| 88
|
runOptions :: Parser Options
runOptions =
RunOptions <$> templateSource <*> dataSource
| 88
|
runOptions =
RunOptions <$> templateSource <*> dataSource
| 59
| false
| true
| 0
| 6
| 12
| 22
| 11
| 11
| null | null |
nikivazou/hscolour
|
Language/Haskell/HsColour/MIRC.hs
|
gpl-2.0
|
code Red False = "5"
| 24
|
code Red False = "5"
| 24
|
code Red False = "5"
| 24
| false
| false
| 1
| 5
| 8
| 16
| 5
| 11
| null | null |
brendanhay/gogol
|
gogol-tagmanager/gen/Network/Google/Resource/TagManager/Accounts/UserPermissions/Update.hs
|
mpl-2.0
|
-- | Creates a value of 'AccountsUserPermissionsUpdate' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aupuXgafv'
--
-- * 'aupuUploadProtocol'
--
-- * 'aupuPath'
--
-- * 'aupuAccessToken'
--
-- * 'aupuUploadType'
--
-- * 'aupuPayload'
--
-- * 'aupuCallback'
accountsUserPermissionsUpdate
:: Text -- ^ 'aupuPath'
-> UserPermission -- ^ 'aupuPayload'
-> AccountsUserPermissionsUpdate
accountsUserPermissionsUpdate pAupuPath_ pAupuPayload_ =
AccountsUserPermissionsUpdate'
{ _aupuXgafv = Nothing
, _aupuUploadProtocol = Nothing
, _aupuPath = pAupuPath_
, _aupuAccessToken = Nothing
, _aupuUploadType = Nothing
, _aupuPayload = pAupuPayload_
, _aupuCallback = Nothing
}
| 798
|
accountsUserPermissionsUpdate
:: Text -- ^ 'aupuPath'
-> UserPermission -- ^ 'aupuPayload'
-> AccountsUserPermissionsUpdate
accountsUserPermissionsUpdate pAupuPath_ pAupuPayload_ =
AccountsUserPermissionsUpdate'
{ _aupuXgafv = Nothing
, _aupuUploadProtocol = Nothing
, _aupuPath = pAupuPath_
, _aupuAccessToken = Nothing
, _aupuUploadType = Nothing
, _aupuPayload = pAupuPayload_
, _aupuCallback = Nothing
}
| 453
|
accountsUserPermissionsUpdate pAupuPath_ pAupuPayload_ =
AccountsUserPermissionsUpdate'
{ _aupuXgafv = Nothing
, _aupuUploadProtocol = Nothing
, _aupuPath = pAupuPath_
, _aupuAccessToken = Nothing
, _aupuUploadType = Nothing
, _aupuPayload = pAupuPayload_
, _aupuCallback = Nothing
}
| 317
| true
| true
| 0
| 8
| 150
| 96
| 62
| 34
| null | null |
danidiaz/users-mysql-haskell
|
tests/tests.hs
|
mit
|
testPasswordReset :: Backend -> Assertion
testPasswordReset b = do
_ <- createTenUsers b
do let name = "name3"
Just usrid <- getUserIdByName b name
tok <- requestPasswordReset b usrid 10
Just usr <- verifyPasswordResetToken b tok
assertEqual "verification user" name (u_name usr)
return ()
do let name = "name4"
Just usrid <- getUserIdByName b name
tok <- requestPasswordReset b usrid 1
threadDelay 3e6
Nothing <- verifyPasswordResetToken b tok
return ()
do let name = "name5"
Just usrid <- getUserIdByName b name
tok <- requestPasswordReset b usrid 10
Right () <- applyNewPassword b tok (PasswordHash "newpasswd")
Nothing <- verifyPasswordResetToken b tok
return ()
| 788
|
testPasswordReset :: Backend -> Assertion
testPasswordReset b = do
_ <- createTenUsers b
do let name = "name3"
Just usrid <- getUserIdByName b name
tok <- requestPasswordReset b usrid 10
Just usr <- verifyPasswordResetToken b tok
assertEqual "verification user" name (u_name usr)
return ()
do let name = "name4"
Just usrid <- getUserIdByName b name
tok <- requestPasswordReset b usrid 1
threadDelay 3e6
Nothing <- verifyPasswordResetToken b tok
return ()
do let name = "name5"
Just usrid <- getUserIdByName b name
tok <- requestPasswordReset b usrid 10
Right () <- applyNewPassword b tok (PasswordHash "newpasswd")
Nothing <- verifyPasswordResetToken b tok
return ()
| 788
|
testPasswordReset b = do
_ <- createTenUsers b
do let name = "name3"
Just usrid <- getUserIdByName b name
tok <- requestPasswordReset b usrid 10
Just usr <- verifyPasswordResetToken b tok
assertEqual "verification user" name (u_name usr)
return ()
do let name = "name4"
Just usrid <- getUserIdByName b name
tok <- requestPasswordReset b usrid 1
threadDelay 3e6
Nothing <- verifyPasswordResetToken b tok
return ()
do let name = "name5"
Just usrid <- getUserIdByName b name
tok <- requestPasswordReset b usrid 10
Right () <- applyNewPassword b tok (PasswordHash "newpasswd")
Nothing <- verifyPasswordResetToken b tok
return ()
| 746
| false
| true
| 0
| 13
| 223
| 267
| 110
| 157
| null | null |
ssaavedra/liquidhaskell
|
benchmarks/hmatrix-0.15.0.1/lib/Data/Packed/Internal/Matrix.hs
|
bsd-3-clause
|
conformVs vs = map (conformVTo n) vs
where
n = maximum (map dim vs)
| 73
|
conformVs vs = map (conformVTo n) vs
where
n = maximum (map dim vs)
| 73
|
conformVs vs = map (conformVTo n) vs
where
n = maximum (map dim vs)
| 73
| false
| false
| 0
| 7
| 19
| 39
| 18
| 21
| null | null |
arnizamani/aiw
|
Instances.hs
|
gpl-2.0
|
makeU :: String -> Exp -> Exp
makeU s e = Unary (Oper s) e
| 58
|
makeU :: String -> Exp -> Exp
makeU s e = Unary (Oper s) e
| 58
|
makeU s e = Unary (Oper s) e
| 28
| false
| true
| 0
| 8
| 14
| 42
| 18
| 24
| null | null |
PuZZleDucK/Hls
|
Hls.hs
|
gpl-3.0
|
formatListing :: [String] -> Int -> Int -> [String]
formatListing [] _entryMaxWidth _width = []
| 95
|
formatListing :: [String] -> Int -> Int -> [String]
formatListing [] _entryMaxWidth _width = []
| 95
|
formatListing [] _entryMaxWidth _width = []
| 43
| false
| true
| 0
| 8
| 14
| 40
| 21
| 19
| null | null |
rueshyna/gogol
|
gogol-compute/gen/Network/Google/Resource/Compute/Disks/Delete.hs
|
mpl-2.0
|
-- | Name of the persistent disk to delete.
ddDisk :: Lens' DisksDelete Text
ddDisk = lens _ddDisk (\ s a -> s{_ddDisk = a})
| 124
|
ddDisk :: Lens' DisksDelete Text
ddDisk = lens _ddDisk (\ s a -> s{_ddDisk = a})
| 80
|
ddDisk = lens _ddDisk (\ s a -> s{_ddDisk = a})
| 47
| true
| true
| 0
| 9
| 24
| 40
| 22
| 18
| null | null |
oldmanmike/ghc
|
compiler/hsSyn/HsUtils.hs
|
bsd-3-clause
|
-------------------
hsLInstDeclBinders :: LInstDecl name -> ([Located name], [LFieldOcc name])
hsLInstDeclBinders (L _ (ClsInstD { cid_inst = ClsInstDecl { cid_datafam_insts = dfis } }))
= foldMap (hsDataFamInstBinders . unLoc) dfis
| 234
|
hsLInstDeclBinders :: LInstDecl name -> ([Located name], [LFieldOcc name])
hsLInstDeclBinders (L _ (ClsInstD { cid_inst = ClsInstDecl { cid_datafam_insts = dfis } }))
= foldMap (hsDataFamInstBinders . unLoc) dfis
| 214
|
hsLInstDeclBinders (L _ (ClsInstD { cid_inst = ClsInstDecl { cid_datafam_insts = dfis } }))
= foldMap (hsDataFamInstBinders . unLoc) dfis
| 139
| true
| true
| 0
| 14
| 31
| 82
| 43
| 39
| null | null |
crogers1/manager
|
xenmgr/Vm/Config.hs
|
gpl-2.0
|
diskSpecs :: VmConfig -> Rpc [DiskSpec]
diskSpecs cfg = mapM (diskSpec uuid crypto_dirs) =<< disks where
disks = filter diskEnabled <$> validDisks cfg
crypto_dirs = vmcfgCryptoKeyDirs cfg
uuid = vmcfgUuid cfg
| 227
|
diskSpecs :: VmConfig -> Rpc [DiskSpec]
diskSpecs cfg = mapM (diskSpec uuid crypto_dirs) =<< disks where
disks = filter diskEnabled <$> validDisks cfg
crypto_dirs = vmcfgCryptoKeyDirs cfg
uuid = vmcfgUuid cfg
| 227
|
diskSpecs cfg = mapM (diskSpec uuid crypto_dirs) =<< disks where
disks = filter diskEnabled <$> validDisks cfg
crypto_dirs = vmcfgCryptoKeyDirs cfg
uuid = vmcfgUuid cfg
| 187
| false
| true
| 0
| 8
| 49
| 72
| 35
| 37
| null | null |
GaloisInc/halvm-ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
typeable2ClassKey = mkPreludeClassUnique 22
| 49
|
typeable2ClassKey = mkPreludeClassUnique 22
| 49
|
typeable2ClassKey = mkPreludeClassUnique 22
| 49
| false
| false
| 1
| 5
| 9
| 12
| 4
| 8
| null | null |
palf/free-driver
|
apps/src/Examples/Intercom/Programs.hs
|
bsd-3-clause
|
fetchAllAdmins :: IntercomP [Text]
fetchAllAdmins
= (fmap . fmap) I.adminName I.listAdmins
| 92
|
fetchAllAdmins :: IntercomP [Text]
fetchAllAdmins
= (fmap . fmap) I.adminName I.listAdmins
| 92
|
fetchAllAdmins
= (fmap . fmap) I.adminName I.listAdmins
| 57
| false
| true
| 1
| 6
| 12
| 37
| 17
| 20
| null | null |
mikeplus64/plissken
|
src/Editor.hs
|
gpl-3.0
|
gameStageToEditor :: IORef GameS -> IORef Editor -> IO ()
gameStageToEditor game' editor' = do
gstage <- view stage <$> readIORef game'
modifyIORef editor' (editStage .~ gstage)
| 185
|
gameStageToEditor :: IORef GameS -> IORef Editor -> IO ()
gameStageToEditor game' editor' = do
gstage <- view stage <$> readIORef game'
modifyIORef editor' (editStage .~ gstage)
| 185
|
gameStageToEditor game' editor' = do
gstage <- view stage <$> readIORef game'
modifyIORef editor' (editStage .~ gstage)
| 127
| false
| true
| 0
| 9
| 34
| 67
| 30
| 37
| null | null |
Sgoettschkes/learning
|
haskell/RealWorldHaskell/ch03/Guard.hs
|
mit
|
-- file: ch03/Guard.hs
-- From chapter 3, http://book.realworldhaskell.org/read/defining-types-streamlining-functions.html
fromMaybe defval wrapped =
case wrapped of
Nothing -> defval
Just value -> value
| 225
|
fromMaybe defval wrapped =
case wrapped of
Nothing -> defval
Just value -> value
| 101
|
fromMaybe defval wrapped =
case wrapped of
Nothing -> defval
Just value -> value
| 101
| true
| false
| 0
| 8
| 43
| 33
| 16
| 17
| null | null |
rahulmutt/codec-jvm
|
src/Codec/JVM/Opcode.hs
|
apache-2.0
|
opcode :: Opcode -> Word8
opcode (Opcode i) = fromIntegral i
| 60
|
opcode :: Opcode -> Word8
opcode (Opcode i) = fromIntegral i
| 60
|
opcode (Opcode i) = fromIntegral i
| 34
| false
| true
| 0
| 7
| 10
| 27
| 13
| 14
| null | null |
green-haskell/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
maxBound_RDR = varQual_RDR gHC_ENUM (fsLit "maxBound")
| 65
|
maxBound_RDR = varQual_RDR gHC_ENUM (fsLit "maxBound")
| 65
|
maxBound_RDR = varQual_RDR gHC_ENUM (fsLit "maxBound")
| 65
| false
| false
| 0
| 7
| 16
| 17
| 8
| 9
| null | null |
hiratara/TypedPerl
|
src/TypedPerl/Inferance/TypeContext.hs
|
bsd-3-clause
|
lookupContext :: MonadState TypeContext m =>
PerlVars -> Context -> m (Maybe PerlCType)
lookupContext v ctx = mplus `liftM` lookup1 `ap` lookup2
where
lookup1 = do
cv <- varWithNamespace v
return (lookup cv ctx)
lookup2 = return (lookup (PerlCVar (NsGlobal "CORE") v) ctx)
| 311
|
lookupContext :: MonadState TypeContext m =>
PerlVars -> Context -> m (Maybe PerlCType)
lookupContext v ctx = mplus `liftM` lookup1 `ap` lookup2
where
lookup1 = do
cv <- varWithNamespace v
return (lookup cv ctx)
lookup2 = return (lookup (PerlCVar (NsGlobal "CORE") v) ctx)
| 311
|
lookupContext v ctx = mplus `liftM` lookup1 `ap` lookup2
where
lookup1 = do
cv <- varWithNamespace v
return (lookup cv ctx)
lookup2 = return (lookup (PerlCVar (NsGlobal "CORE") v) ctx)
| 206
| false
| true
| 2
| 11
| 81
| 127
| 58
| 69
| null | null |
tamasgal/haskell_exercises
|
CIS-194/homework-01/creditcard.hs
|
mit
|
sumDigits (x:xs) = digitSum x + sumDigits xs
| 44
|
sumDigits (x:xs) = digitSum x + sumDigits xs
| 44
|
sumDigits (x:xs) = digitSum x + sumDigits xs
| 44
| false
| false
| 2
| 6
| 7
| 28
| 12
| 16
| null | null |
acowley/ghc
|
compiler/hsSyn/HsExpr.hs
|
bsd-3-clause
|
ppr_expr (HsPar e) = parens (ppr_lexpr e)
| 48
|
ppr_expr (HsPar e) = parens (ppr_lexpr e)
| 48
|
ppr_expr (HsPar e) = parens (ppr_lexpr e)
| 48
| false
| false
| 0
| 6
| 13
| 25
| 11
| 14
| null | null |
frontrowed/stratosphere
|
library-gen/Stratosphere/ResourceProperties/GlueConnectionPhysicalConnectionRequirements.hs
|
mit
|
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-physicalconnectionrequirements.html#cfn-glue-connection-physicalconnectionrequirements-subnetid
gcpcrSubnetId :: Lens' GlueConnectionPhysicalConnectionRequirements (Maybe (Val Text))
gcpcrSubnetId = lens _glueConnectionPhysicalConnectionRequirementsSubnetId (\s a -> s { _glueConnectionPhysicalConnectionRequirementsSubnetId = a })
| 429
|
gcpcrSubnetId :: Lens' GlueConnectionPhysicalConnectionRequirements (Maybe (Val Text))
gcpcrSubnetId = lens _glueConnectionPhysicalConnectionRequirementsSubnetId (\s a -> s { _glueConnectionPhysicalConnectionRequirementsSubnetId = a })
| 235
|
gcpcrSubnetId = lens _glueConnectionPhysicalConnectionRequirementsSubnetId (\s a -> s { _glueConnectionPhysicalConnectionRequirementsSubnetId = a })
| 148
| true
| true
| 1
| 9
| 22
| 55
| 28
| 27
| null | null |
dzeban/haskell-exercises
|
rwh/ch03/FruitMistake.hs
|
mit
|
-- This doesn't work, because apple and orange here are locally binded variables
-- whichFruit :: String -> Fruit
-- whichFruit f = case f of
-- apple -> Apple
-- orange -> Orange
whichFruit :: String -> Fruit
whichFruit f
| f == apple = Apple
| f == orange = Orange
| 309
|
whichFruit :: String -> Fruit
whichFruit f
| f == apple = Apple
| f == orange = Orange
| 94
|
whichFruit f
| f == apple = Apple
| f == orange = Orange
| 64
| true
| true
| 0
| 8
| 95
| 54
| 26
| 28
| null | null |
tolysz/yesod
|
yesod/Yesod/Default/Util.hs
|
mit
|
-- | An implementation of 'addStaticContent' which stores the contents in an
-- external file. Files are created in the given static folder with names based
-- on a hash of their content. This allows expiration dates to be set far in
-- the future without worry of users receiving stale content.
addStaticContentExternal
:: (L.ByteString -> Either a L.ByteString) -- ^ javascript minifier
-> (L.ByteString -> String) -- ^ hash function to determine file name
-> FilePath -- ^ location of static directory. files will be placed within a "tmp" subfolder
-> ([Text] -> Route master) -- ^ route constructor, taking a list of pieces
-> Text -- ^ filename extension
-> Text -- ^ mime type
-> L.ByteString -- ^ file contents
-> HandlerT master IO (Maybe (Either Text (Route master, [(Text, Text)])))
addStaticContentExternal minify hash staticDir toRoute ext' _ content = do
liftIO $ createDirectoryIfMissing True statictmp
exists <- liftIO $ doesFileExist fn'
unless exists $
liftIO $ runResourceT $ sourceLbs content' $$ sinkFileCautious fn'
return $ Just $ Right (toRoute ["tmp", pack fn], [])
where
fn, statictmp, fn' :: FilePath
-- by basing the hash off of the un-minified content, we avoid a costly
-- minification if the file already exists
fn = hash content ++ '.' : unpack ext'
statictmp = staticDir ++ "/tmp/"
fn' = statictmp ++ fn
content' :: L.ByteString
content'
| ext' == "js" = either (const content) id $ minify content
| otherwise = content
-- | expects a file extension for each type, e.g: hamlet lucius julius
| 1,630
|
addStaticContentExternal
:: (L.ByteString -> Either a L.ByteString) -- ^ javascript minifier
-> (L.ByteString -> String) -- ^ hash function to determine file name
-> FilePath -- ^ location of static directory. files will be placed within a "tmp" subfolder
-> ([Text] -> Route master) -- ^ route constructor, taking a list of pieces
-> Text -- ^ filename extension
-> Text -- ^ mime type
-> L.ByteString -- ^ file contents
-> HandlerT master IO (Maybe (Either Text (Route master, [(Text, Text)])))
addStaticContentExternal minify hash staticDir toRoute ext' _ content = do
liftIO $ createDirectoryIfMissing True statictmp
exists <- liftIO $ doesFileExist fn'
unless exists $
liftIO $ runResourceT $ sourceLbs content' $$ sinkFileCautious fn'
return $ Just $ Right (toRoute ["tmp", pack fn], [])
where
fn, statictmp, fn' :: FilePath
-- by basing the hash off of the un-minified content, we avoid a costly
-- minification if the file already exists
fn = hash content ++ '.' : unpack ext'
statictmp = staticDir ++ "/tmp/"
fn' = statictmp ++ fn
content' :: L.ByteString
content'
| ext' == "js" = either (const content) id $ minify content
| otherwise = content
-- | expects a file extension for each type, e.g: hamlet lucius julius
| 1,334
|
addStaticContentExternal minify hash staticDir toRoute ext' _ content = do
liftIO $ createDirectoryIfMissing True statictmp
exists <- liftIO $ doesFileExist fn'
unless exists $
liftIO $ runResourceT $ sourceLbs content' $$ sinkFileCautious fn'
return $ Just $ Right (toRoute ["tmp", pack fn], [])
where
fn, statictmp, fn' :: FilePath
-- by basing the hash off of the un-minified content, we avoid a costly
-- minification if the file already exists
fn = hash content ++ '.' : unpack ext'
statictmp = staticDir ++ "/tmp/"
fn' = statictmp ++ fn
content' :: L.ByteString
content'
| ext' == "js" = either (const content) id $ minify content
| otherwise = content
-- | expects a file extension for each type, e.g: hamlet lucius julius
| 805
| true
| true
| 15
| 19
| 363
| 340
| 174
| 166
| null | null |
beni55/hspec
|
hspec-core/src/Test/Hspec/Core/Formatters/Internal.hs
|
mit
|
getRealTime :: FormatM Double
getRealTime = do
t1 <- liftIO getPOSIXTime
t0 <- gets startTime
return (realToFrac $ t1 - t0)
| 129
|
getRealTime :: FormatM Double
getRealTime = do
t1 <- liftIO getPOSIXTime
t0 <- gets startTime
return (realToFrac $ t1 - t0)
| 129
|
getRealTime = do
t1 <- liftIO getPOSIXTime
t0 <- gets startTime
return (realToFrac $ t1 - t0)
| 99
| false
| true
| 1
| 11
| 26
| 55
| 23
| 32
| null | null |
plumlife/cabal
|
Cabal/Distribution/Simple/Setup.hs
|
bsd-3-clause
|
parseHoleMapEntry :: Parse.ReadP r (ModuleName, (InstalledPackageId, ModuleName))
parseHoleMapEntry = do
x <- parse
_ <- Parse.char '='
y <- parse
_ <- Parse.char '@'
z <- parse
return (x, (z, y))
| 208
|
parseHoleMapEntry :: Parse.ReadP r (ModuleName, (InstalledPackageId, ModuleName))
parseHoleMapEntry = do
x <- parse
_ <- Parse.char '='
y <- parse
_ <- Parse.char '@'
z <- parse
return (x, (z, y))
| 208
|
parseHoleMapEntry = do
x <- parse
_ <- Parse.char '='
y <- parse
_ <- Parse.char '@'
z <- parse
return (x, (z, y))
| 126
| false
| true
| 0
| 9
| 42
| 93
| 46
| 47
| null | null |
listx/syscfg
|
xmonad/xmonad.hs
|
bsd-3-clause
|
l_modifyVisible :: Eq i =>
(W.Stack a -> W.Stack a)
-> W.Workspace i l s
-> W.StackSet i l a sid sd
-> W.StackSet i l a sid sd
l_modifyVisible editStack ww windowSet
| wwIsCurrent = W.modify Nothing (Just . editStack) windowSet
| otherwise = maybe windowSet replaceIfFound (find ((==W.tag ww) . W.tag . W.workspace) $ W.visible windowSet)
where
wwIsCurrent = (==W.tag ww) $ W.currentTag windowSet
-- No need to bind the first thing here, because we reference windowSet from
-- the outer scope. Closures!
replaceIfFound _ = windowSet
{ W.visible = l_replaceIf (\s -> W.tag (W.workspace s) == W.tag ww) editStackOfScreen $ W.visible windowSet }
editStackOfScreen s = s
{ W.workspace = (W.workspace s)
{ W.stack = fmap editStack . W.stack $ W.workspace s }}
| 792
|
l_modifyVisible :: Eq i =>
(W.Stack a -> W.Stack a)
-> W.Workspace i l s
-> W.StackSet i l a sid sd
-> W.StackSet i l a sid sd
l_modifyVisible editStack ww windowSet
| wwIsCurrent = W.modify Nothing (Just . editStack) windowSet
| otherwise = maybe windowSet replaceIfFound (find ((==W.tag ww) . W.tag . W.workspace) $ W.visible windowSet)
where
wwIsCurrent = (==W.tag ww) $ W.currentTag windowSet
-- No need to bind the first thing here, because we reference windowSet from
-- the outer scope. Closures!
replaceIfFound _ = windowSet
{ W.visible = l_replaceIf (\s -> W.tag (W.workspace s) == W.tag ww) editStackOfScreen $ W.visible windowSet }
editStackOfScreen s = s
{ W.workspace = (W.workspace s)
{ W.stack = fmap editStack . W.stack $ W.workspace s }}
| 792
|
l_modifyVisible editStack ww windowSet
| wwIsCurrent = W.modify Nothing (Just . editStack) windowSet
| otherwise = maybe windowSet replaceIfFound (find ((==W.tag ww) . W.tag . W.workspace) $ W.visible windowSet)
where
wwIsCurrent = (==W.tag ww) $ W.currentTag windowSet
-- No need to bind the first thing here, because we reference windowSet from
-- the outer scope. Closures!
replaceIfFound _ = windowSet
{ W.visible = l_replaceIf (\s -> W.tag (W.workspace s) == W.tag ww) editStackOfScreen $ W.visible windowSet }
editStackOfScreen s = s
{ W.workspace = (W.workspace s)
{ W.stack = fmap editStack . W.stack $ W.workspace s }}
| 657
| false
| true
| 1
| 15
| 163
| 310
| 153
| 157
| null | null |
sordina/matasano-cryptopals
|
src/Set1/Challenge_5.hs
|
mit
|
keyCycle :: BSL.ByteString
keyCycle = BSL.cycle "ICE"
| 53
|
keyCycle :: BSL.ByteString
keyCycle = BSL.cycle "ICE"
| 53
|
keyCycle = BSL.cycle "ICE"
| 26
| false
| true
| 0
| 7
| 6
| 25
| 10
| 15
| null | null |
manyoo/ghcjs
|
src/Gen2/Compactor.hs
|
mit
|
encodeMax :: Integer
encodeMax = 737189
| 39
|
encodeMax :: Integer
encodeMax = 737189
| 39
|
encodeMax = 737189
| 18
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
icyfork/shellcheck
|
ShellCheck/Analytics.hs
|
gpl-3.0
|
checkSshHereDoc _ (T_Redirecting _ redirs cmd)
| cmd `isCommand` "ssh" =
mapM_ checkHereDoc redirs
where
hasVariables = mkRegex "[`$]"
checkHereDoc (T_FdRedirect _ _ (T_HereDoc id _ Unquoted token tokens))
| not (all isConstant tokens) =
warn id 2087 $ "Quote '" ++ token ++ "' to make here document expansions happen on the server side rather than on the client."
checkHereDoc _ = return ()
| 433
|
checkSshHereDoc _ (T_Redirecting _ redirs cmd)
| cmd `isCommand` "ssh" =
mapM_ checkHereDoc redirs
where
hasVariables = mkRegex "[`$]"
checkHereDoc (T_FdRedirect _ _ (T_HereDoc id _ Unquoted token tokens))
| not (all isConstant tokens) =
warn id 2087 $ "Quote '" ++ token ++ "' to make here document expansions happen on the server side rather than on the client."
checkHereDoc _ = return ()
| 433
|
checkSshHereDoc _ (T_Redirecting _ redirs cmd)
| cmd `isCommand` "ssh" =
mapM_ checkHereDoc redirs
where
hasVariables = mkRegex "[`$]"
checkHereDoc (T_FdRedirect _ _ (T_HereDoc id _ Unquoted token tokens))
| not (all isConstant tokens) =
warn id 2087 $ "Quote '" ++ token ++ "' to make here document expansions happen on the server side rather than on the client."
checkHereDoc _ = return ()
| 433
| false
| false
| 1
| 10
| 106
| 132
| 60
| 72
| null | null |
brendanhay/gogol
|
gogol-android-publisher/gen/Network/Google/AndroidPublisher/Types/Product.hs
|
mpl-2.0
|
-- | Payload to attach to the purchase.
pparDeveloperPayload :: Lens' ProductPurchasesAcknowledgeRequest (Maybe Text)
pparDeveloperPayload
= lens _pparDeveloperPayload
(\ s a -> s{_pparDeveloperPayload = a})
| 215
|
pparDeveloperPayload :: Lens' ProductPurchasesAcknowledgeRequest (Maybe Text)
pparDeveloperPayload
= lens _pparDeveloperPayload
(\ s a -> s{_pparDeveloperPayload = a})
| 175
|
pparDeveloperPayload
= lens _pparDeveloperPayload
(\ s a -> s{_pparDeveloperPayload = a})
| 97
| true
| true
| 0
| 9
| 32
| 48
| 25
| 23
| null | null |
beni55/haste-compiler
|
libraries/ghc-7.10/base/GHC/Enum.hs
|
bsd-3-clause
|
predError :: String -> a
predError inst_ty =
error $ "Enum.pred{" ++ inst_ty ++ "}: tried to take `pred' of minBound"
| 121
|
predError :: String -> a
predError inst_ty =
error $ "Enum.pred{" ++ inst_ty ++ "}: tried to take `pred' of minBound"
| 121
|
predError inst_ty =
error $ "Enum.pred{" ++ inst_ty ++ "}: tried to take `pred' of minBound"
| 96
| false
| true
| 0
| 7
| 24
| 30
| 15
| 15
| null | null |
dnaq/crypto-sodium
|
src/Crypto/Sodium/PwHash/ScryptSalsa208Sha256.hs
|
mit
|
mkHashedPassword :: ByteString -> Maybe HashedPassword
mkHashedPassword = mkHelper hashedPasswordBytes HashedPassword
| 117
|
mkHashedPassword :: ByteString -> Maybe HashedPassword
mkHashedPassword = mkHelper hashedPasswordBytes HashedPassword
| 117
|
mkHashedPassword = mkHelper hashedPasswordBytes HashedPassword
| 62
| false
| true
| 0
| 6
| 10
| 23
| 11
| 12
| null | null |
oldmanmike/ghc
|
compiler/types/Type.hs
|
bsd-3-clause
|
-- | Retrieve the free variables in this type, splitting them based
-- on whether the variable was used in a dependent context. It's possible
-- for a variable to be reported twice, if it's used both dependently
-- and non-dependently. (This isn't the most precise analysis, because
-- it's used in the typechecking knot. It might list some dependent
-- variables as also non-dependent.)
splitDepVarsOfType :: Type -> Pair TyCoVarSet
splitDepVarsOfType = go
where
go (TyVarTy tv) = Pair (tyCoVarsOfType $ tyVarKind tv)
(unitVarSet tv)
go (AppTy t1 t2) = go t1 `mappend` go t2
go (TyConApp _ tys) = foldMap go tys
go (ForAllTy (Anon arg) res) = go arg `mappend` go res
go (ForAllTy (Named tv _) ty)
= let Pair kvs tvs = go ty in
Pair (kvs `delVarSet` tv `unionVarSet` tyCoVarsOfType (tyVarKind tv))
(tvs `delVarSet` tv)
go (LitTy {}) = mempty
go (CastTy ty co) = go ty `mappend` Pair (tyCoVarsOfCo co)
emptyVarSet
go (CoercionTy co) = go_co co
go_co co = let Pair ty1 ty2 = coercionKind co in
go ty1 `mappend` go ty2 -- NB: the Pairs separate along different
-- dimensions here. Be careful!
-- | Like 'splitDepVarsOfType', but over a list of types
| 1,435
|
splitDepVarsOfType :: Type -> Pair TyCoVarSet
splitDepVarsOfType = go
where
go (TyVarTy tv) = Pair (tyCoVarsOfType $ tyVarKind tv)
(unitVarSet tv)
go (AppTy t1 t2) = go t1 `mappend` go t2
go (TyConApp _ tys) = foldMap go tys
go (ForAllTy (Anon arg) res) = go arg `mappend` go res
go (ForAllTy (Named tv _) ty)
= let Pair kvs tvs = go ty in
Pair (kvs `delVarSet` tv `unionVarSet` tyCoVarsOfType (tyVarKind tv))
(tvs `delVarSet` tv)
go (LitTy {}) = mempty
go (CastTy ty co) = go ty `mappend` Pair (tyCoVarsOfCo co)
emptyVarSet
go (CoercionTy co) = go_co co
go_co co = let Pair ty1 ty2 = coercionKind co in
go ty1 `mappend` go ty2 -- NB: the Pairs separate along different
-- dimensions here. Be careful!
-- | Like 'splitDepVarsOfType', but over a list of types
| 1,047
|
splitDepVarsOfType = go
where
go (TyVarTy tv) = Pair (tyCoVarsOfType $ tyVarKind tv)
(unitVarSet tv)
go (AppTy t1 t2) = go t1 `mappend` go t2
go (TyConApp _ tys) = foldMap go tys
go (ForAllTy (Anon arg) res) = go arg `mappend` go res
go (ForAllTy (Named tv _) ty)
= let Pair kvs tvs = go ty in
Pair (kvs `delVarSet` tv `unionVarSet` tyCoVarsOfType (tyVarKind tv))
(tvs `delVarSet` tv)
go (LitTy {}) = mempty
go (CastTy ty co) = go ty `mappend` Pair (tyCoVarsOfCo co)
emptyVarSet
go (CoercionTy co) = go_co co
go_co co = let Pair ty1 ty2 = coercionKind co in
go ty1 `mappend` go ty2 -- NB: the Pairs separate along different
-- dimensions here. Be careful!
-- | Like 'splitDepVarsOfType', but over a list of types
| 1,001
| true
| true
| 1
| 9
| 490
| 355
| 172
| 183
| null | null |
unknownloner/HaskellSynth
|
src/Sound/Notes.hs
|
mit
|
bf0 :: Int
bf0 = c0 + 10
| 24
|
bf0 :: Int
bf0 = c0 + 10
| 24
|
bf0 = c0 + 10
| 13
| false
| true
| 2
| 6
| 7
| 23
| 9
| 14
| null | null |
jkarni/forum
|
src/Forum/Internal/Utils.hs
|
bsd-3-clause
|
nextName :: Name -> Name
nextName (CountName n x) = CountName n $ succ x
| 72
|
nextName :: Name -> Name
nextName (CountName n x) = CountName n $ succ x
| 72
|
nextName (CountName n x) = CountName n $ succ x
| 47
| false
| true
| 0
| 9
| 14
| 41
| 18
| 23
| null | null |
fmapfmapfmap/amazonka
|
amazonka-cloudsearch/gen/Network/AWS/CloudSearch/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'DoubleOptions' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dSourceField'
--
-- * 'dReturnEnabled'
--
-- * 'dFacetEnabled'
--
-- * 'dSearchEnabled'
--
-- * 'dSortEnabled'
--
-- * 'dDefaultValue'
doubleOptions
:: DoubleOptions
doubleOptions =
DoubleOptions'
{ _dSourceField = Nothing
, _dReturnEnabled = Nothing
, _dFacetEnabled = Nothing
, _dSearchEnabled = Nothing
, _dSortEnabled = Nothing
, _dDefaultValue = Nothing
}
| 570
|
doubleOptions
:: DoubleOptions
doubleOptions =
DoubleOptions'
{ _dSourceField = Nothing
, _dReturnEnabled = Nothing
, _dFacetEnabled = Nothing
, _dSearchEnabled = Nothing
, _dSortEnabled = Nothing
, _dDefaultValue = Nothing
}
| 261
|
doubleOptions =
DoubleOptions'
{ _dSourceField = Nothing
, _dReturnEnabled = Nothing
, _dFacetEnabled = Nothing
, _dSearchEnabled = Nothing
, _dSortEnabled = Nothing
, _dDefaultValue = Nothing
}
| 226
| true
| true
| 0
| 6
| 120
| 64
| 46
| 18
| null | null |
rueshyna/gogol
|
gogol-prediction/gen/Network/Google/Prediction/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'AnalyzeDataDescriptionOutputFeatureTextItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'addoftiValue'
--
-- * 'addoftiCount'
analyzeDataDescriptionOutputFeatureTextItem
:: AnalyzeDataDescriptionOutputFeatureTextItem
analyzeDataDescriptionOutputFeatureTextItem =
AnalyzeDataDescriptionOutputFeatureTextItem'
{ _addoftiValue = Nothing
, _addoftiCount = Nothing
}
| 496
|
analyzeDataDescriptionOutputFeatureTextItem
:: AnalyzeDataDescriptionOutputFeatureTextItem
analyzeDataDescriptionOutputFeatureTextItem =
AnalyzeDataDescriptionOutputFeatureTextItem'
{ _addoftiValue = Nothing
, _addoftiCount = Nothing
}
| 255
|
analyzeDataDescriptionOutputFeatureTextItem =
AnalyzeDataDescriptionOutputFeatureTextItem'
{ _addoftiValue = Nothing
, _addoftiCount = Nothing
}
| 160
| true
| true
| 0
| 6
| 72
| 32
| 22
| 10
| null | null |
mmarx/jebediah
|
cli/dangervisit/Main.hs
|
gpl-3.0
|
dc2 = fifth' c2
| 15
|
dc2 = fifth' c2
| 15
|
dc2 = fifth' c2
| 15
| false
| false
| 1
| 5
| 3
| 12
| 4
| 8
| null | null |
aBhallo/AoC2016
|
Day 10/day10part2.hs
|
mit
|
receive :: State -> TakeInstruction -> State
receive [] (id, val) = [(id, [val])]
| 81
|
receive :: State -> TakeInstruction -> State
receive [] (id, val) = [(id, [val])]
| 81
|
receive [] (id, val) = [(id, [val])]
| 36
| false
| true
| 0
| 7
| 13
| 44
| 25
| 19
| null | null |
isomorphism/webgl
|
src/Graphics/Rendering/WebGL/Constants.hs
|
mit
|
gl_OR :: GLenum
gl_OR = 0x1507
| 30
|
gl_OR :: GLenum
gl_OR = 0x1507
| 30
|
gl_OR = 0x1507
| 14
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
mlite/hLLVM
|
src/Llvm/AsmHirConversion/HirToAsm.hs
|
bsd-3-clause
|
getLabelId (A.ExplicitBlockLabel l) = l
| 39
|
getLabelId (A.ExplicitBlockLabel l) = l
| 39
|
getLabelId (A.ExplicitBlockLabel l) = l
| 39
| false
| false
| 0
| 8
| 4
| 17
| 8
| 9
| null | null |
reflex-frp/reflex
|
bench/RunAll.hs
|
bsd-3-clause
|
benchmarks :: [(String, Int -> IO ())]
benchmarks = implGroup "spider" runSpiderHost cases
where
implGroup :: (MonadReflexHost' t m, MonadSample t m) => String -> (forall a. m a -> IO a) -> [(String, TestCase)] -> [(String, Int -> IO ())]
implGroup name runHost = group name . fmap (second (benchFiring runHost))
group name = fmap $ first ((name <> "/") <>)
sub n frames = group ("subscribing " ++ show (n, frames)) $ Focused.subscribing n frames
firing n = group ("firing " <> show n) $ Focused.firing n
merging n = group ("merging " <> show n) $ Focused.merging n
dynamics n = group ("dynamics " <> show n) $ Focused.dynamics n
cases = concat
[ sub 100 40
, dynamics 100
, dynamics 1000
, firing 1000
, firing 10000
, merging 10
, merging 50
, merging 100
, merging 200
]
| 882
|
benchmarks :: [(String, Int -> IO ())]
benchmarks = implGroup "spider" runSpiderHost cases
where
implGroup :: (MonadReflexHost' t m, MonadSample t m) => String -> (forall a. m a -> IO a) -> [(String, TestCase)] -> [(String, Int -> IO ())]
implGroup name runHost = group name . fmap (second (benchFiring runHost))
group name = fmap $ first ((name <> "/") <>)
sub n frames = group ("subscribing " ++ show (n, frames)) $ Focused.subscribing n frames
firing n = group ("firing " <> show n) $ Focused.firing n
merging n = group ("merging " <> show n) $ Focused.merging n
dynamics n = group ("dynamics " <> show n) $ Focused.dynamics n
cases = concat
[ sub 100 40
, dynamics 100
, dynamics 1000
, firing 1000
, firing 10000
, merging 10
, merging 50
, merging 100
, merging 200
]
| 882
|
benchmarks = implGroup "spider" runSpiderHost cases
where
implGroup :: (MonadReflexHost' t m, MonadSample t m) => String -> (forall a. m a -> IO a) -> [(String, TestCase)] -> [(String, Int -> IO ())]
implGroup name runHost = group name . fmap (second (benchFiring runHost))
group name = fmap $ first ((name <> "/") <>)
sub n frames = group ("subscribing " ++ show (n, frames)) $ Focused.subscribing n frames
firing n = group ("firing " <> show n) $ Focused.firing n
merging n = group ("merging " <> show n) $ Focused.merging n
dynamics n = group ("dynamics " <> show n) $ Focused.dynamics n
cases = concat
[ sub 100 40
, dynamics 100
, dynamics 1000
, firing 1000
, firing 10000
, merging 10
, merging 50
, merging 100
, merging 200
]
| 843
| false
| true
| 9
| 15
| 253
| 407
| 189
| 218
| null | null |
olsner/ghc
|
compiler/utils/Panic.hs
|
bsd-3-clause
|
-- | Show an exception which can possibly throw other exceptions.
-- Used when displaying exception thrown within TH code.
safeShowException :: Exception e => e -> IO String
safeShowException e = do
-- ensure the whole error message is evaluated inside try
r <- try (return $! forceList (showException e))
case r of
Right msg -> return msg
Left e' -> safeShowException (e' :: SomeException)
where
forceList [] = []
forceList xs@(x : xt) = x `seq` forceList xt `seq` xs
-- | Append a description of the given exception to this string.
--
-- Note that this uses 'DynFlags.unsafeGlobalDynFlags', which may have some
-- uninitialized fields if invoked before 'GHC.initGhcMonad' has been called.
-- If the error message to be printed includes a pretty-printer document
-- which forces one of these fields this call may bottom.
| 870
|
safeShowException :: Exception e => e -> IO String
safeShowException e = do
-- ensure the whole error message is evaluated inside try
r <- try (return $! forceList (showException e))
case r of
Right msg -> return msg
Left e' -> safeShowException (e' :: SomeException)
where
forceList [] = []
forceList xs@(x : xt) = x `seq` forceList xt `seq` xs
-- | Append a description of the given exception to this string.
--
-- Note that this uses 'DynFlags.unsafeGlobalDynFlags', which may have some
-- uninitialized fields if invoked before 'GHC.initGhcMonad' has been called.
-- If the error message to be printed includes a pretty-printer document
-- which forces one of these fields this call may bottom.
| 747
|
safeShowException e = do
-- ensure the whole error message is evaluated inside try
r <- try (return $! forceList (showException e))
case r of
Right msg -> return msg
Left e' -> safeShowException (e' :: SomeException)
where
forceList [] = []
forceList xs@(x : xt) = x `seq` forceList xt `seq` xs
-- | Append a description of the given exception to this string.
--
-- Note that this uses 'DynFlags.unsafeGlobalDynFlags', which may have some
-- uninitialized fields if invoked before 'GHC.initGhcMonad' has been called.
-- If the error message to be printed includes a pretty-printer document
-- which forces one of these fields this call may bottom.
| 696
| true
| true
| 2
| 13
| 186
| 161
| 78
| 83
| null | null |
spechub/Hets
|
OWL2/PrintAS.hs
|
gpl-2.0
|
printDataPropertyAssertion :: GA.PrefixMap -> AxiomAnnotations
-> DataPropertyExpression -> SourceIndividual -> TargetValue -> Doc
printDataPropertyAssertion pds axAnns dataPropExpr srcInd targVal =
keyword dataPropertyAssertionS
<> sParens (hsep . concat $
[docAxAnns, [docDataPropExpr, docSrcInd, docTargVal]])
where
docAxAnns = map (printAnnotation pds) axAnns
docDataPropExpr = printIRI pds dataPropExpr
docSrcInd = printIRI pds srcInd
docTargVal = printLiteral pds targVal
| 533
|
printDataPropertyAssertion :: GA.PrefixMap -> AxiomAnnotations
-> DataPropertyExpression -> SourceIndividual -> TargetValue -> Doc
printDataPropertyAssertion pds axAnns dataPropExpr srcInd targVal =
keyword dataPropertyAssertionS
<> sParens (hsep . concat $
[docAxAnns, [docDataPropExpr, docSrcInd, docTargVal]])
where
docAxAnns = map (printAnnotation pds) axAnns
docDataPropExpr = printIRI pds dataPropExpr
docSrcInd = printIRI pds srcInd
docTargVal = printLiteral pds targVal
| 533
|
printDataPropertyAssertion pds axAnns dataPropExpr srcInd targVal =
keyword dataPropertyAssertionS
<> sParens (hsep . concat $
[docAxAnns, [docDataPropExpr, docSrcInd, docTargVal]])
where
docAxAnns = map (printAnnotation pds) axAnns
docDataPropExpr = printIRI pds dataPropExpr
docSrcInd = printIRI pds srcInd
docTargVal = printLiteral pds targVal
| 398
| false
| true
| 5
| 11
| 109
| 132
| 66
| 66
| null | null |
mkscrg/hashring
|
tests/Properties.hs
|
bsd-2-clause
|
pIndexId :: Int -> IRing -> Bool
pIndexId msgnode ring = R.insert msgnode ring ! msgnode == msgnode
| 99
|
pIndexId :: Int -> IRing -> Bool
pIndexId msgnode ring = R.insert msgnode ring ! msgnode == msgnode
| 99
|
pIndexId msgnode ring = R.insert msgnode ring ! msgnode == msgnode
| 66
| false
| true
| 0
| 8
| 17
| 39
| 19
| 20
| null | null |
forked-upstream-packages-for-ghcjs/ghcjs
|
ghcjs/src/Gen2/Optimizer.hs
|
mit
|
negateEqOp StrictNeqOp = StrictEqOp
| 35
|
negateEqOp StrictNeqOp = StrictEqOp
| 35
|
negateEqOp StrictNeqOp = StrictEqOp
| 35
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
dillonhuff/Proper
|
src/Proper/Parser.hs
|
bsd-3-clause
|
updatePos :: SourcePos -> Token -> [Token] -> SourcePos
updatePos _ _ (pt:_) = pos pt
| 85
|
updatePos :: SourcePos -> Token -> [Token] -> SourcePos
updatePos _ _ (pt:_) = pos pt
| 85
|
updatePos _ _ (pt:_) = pos pt
| 29
| false
| true
| 0
| 8
| 15
| 43
| 22
| 21
| null | null |
Happy0/snowdrift
|
Handler/Wiki/Comment.hs
|
agpl-3.0
|
getEditWikiCommentR :: Text -> Text -> CommentId -> Handler Html
getEditWikiCommentR project_handle target comment_id = do
(widget, _) <-
makeWikiPageCommentActionWidget
makeEditCommentWidget
project_handle
target
comment_id
def
getMaxDepth
defaultLayout (wikiDiscussionPage project_handle target widget)
| 380
|
getEditWikiCommentR :: Text -> Text -> CommentId -> Handler Html
getEditWikiCommentR project_handle target comment_id = do
(widget, _) <-
makeWikiPageCommentActionWidget
makeEditCommentWidget
project_handle
target
comment_id
def
getMaxDepth
defaultLayout (wikiDiscussionPage project_handle target widget)
| 380
|
getEditWikiCommentR project_handle target comment_id = do
(widget, _) <-
makeWikiPageCommentActionWidget
makeEditCommentWidget
project_handle
target
comment_id
def
getMaxDepth
defaultLayout (wikiDiscussionPage project_handle target widget)
| 315
| false
| true
| 0
| 9
| 106
| 75
| 36
| 39
| null | null |
Drezil/subhask
|
src/SubHask/Compatibility/Base.hs
|
bsd-3-clause
|
dummy2 = undefined :: StateT s m a
| 34
|
dummy2 = undefined :: StateT s m a
| 34
|
dummy2 = undefined :: StateT s m a
| 34
| false
| false
| 0
| 5
| 7
| 16
| 8
| 8
| null | null |
leepike/theresistance
|
src/Resistance/Game.hs
|
bsd-3-clause
|
failCards :: [MissionCard] -> Int
failCards cards = length (filter (== Fail) cards)
| 83
|
failCards :: [MissionCard] -> Int
failCards cards = length (filter (== Fail) cards)
| 83
|
failCards cards = length (filter (== Fail) cards)
| 49
| false
| true
| 0
| 8
| 12
| 42
| 20
| 22
| null | null |
benkolera/haskell-ldap-classy
|
LDAP/Classy/Dn.hs
|
mit
|
dnFromTextEither :: Text -> Either String Dn
dnFromTextEither = eitherResult . flip feed "" . parse distinguishedName
| 117
|
dnFromTextEither :: Text -> Either String Dn
dnFromTextEither = eitherResult . flip feed "" . parse distinguishedName
| 117
|
dnFromTextEither = eitherResult . flip feed "" . parse distinguishedName
| 72
| false
| true
| 1
| 7
| 16
| 42
| 18
| 24
| null | null |
WawerOS/Chessotron2000
|
src/Main.hs
|
mit
|
flushOut :: IO ()
flushOut = hFlush stdout
| 42
|
flushOut :: IO ()
flushOut = hFlush stdout
| 42
|
flushOut = hFlush stdout
| 24
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
phischu/fragnix
|
builtins/base/System.IO.hs
|
bsd-3-clause
|
-- | Like 'openTempFile', but opens the file in binary mode. See 'openBinaryFile' for more comments.
openBinaryTempFile :: FilePath -> String -> IO (FilePath, Handle)
openBinaryTempFile tmp_dir template
= openTempFile' "openBinaryTempFile" tmp_dir template True 0o600
| 271
|
openBinaryTempFile :: FilePath -> String -> IO (FilePath, Handle)
openBinaryTempFile tmp_dir template
= openTempFile' "openBinaryTempFile" tmp_dir template True 0o600
| 170
|
openBinaryTempFile tmp_dir template
= openTempFile' "openBinaryTempFile" tmp_dir template True 0o600
| 104
| true
| true
| 0
| 8
| 38
| 50
| 24
| 26
| null | null |
ezyang/ghc
|
libraries/base/GHC/Natural.hs
|
bsd-3-clause
|
timesNatural x (NatS# 1##) = x
| 38
|
timesNatural x (NatS# 1##) = x
| 38
|
timesNatural x (NatS# 1##) = x
| 38
| false
| false
| 0
| 7
| 13
| 17
| 8
| 9
| null | null |
snapframework/snap-core
|
test/TestSuite.hs
|
bsd-3-clause
|
------------------------------------------------------------------------------
main :: IO ()
main = defaultMain tests
where
tests = [ testGroup "Snap.Internal.Http.Types.Tests"
Snap.Internal.Http.Types.Tests.tests
, testGroup "Snap.Internal.Routing.Tests"
Snap.Internal.Routing.Tests.tests
, testGroup "Snap.Core.Tests"
Snap.Core.Tests.tests
, testGroup "Snap.Internal.Parsing.Tests"
Snap.Internal.Parsing.Tests.tests
, testGroup "Snap.Types.Headers.Tests"
Snap.Types.Headers.Tests.tests
, testGroup "Snap.Util.FileServe.Tests"
Snap.Util.FileServe.Tests.tests
, testGroup "Snap.Util.FileUploads.Tests"
Snap.Util.FileUploads.Tests.tests
, testGroup "Snap.Util.GZip.Tests"
Snap.Util.GZip.Tests.tests
, testGroup "Snap.Util.Proxy.Tests"
Snap.Util.Proxy.Tests.tests
, testGroup "Snap.Util.CORS.Tests"
Snap.Util.CORS.Tests.tests
, testGroup "Snap.Test.Tests"
Snap.Test.Tests.tests
]
| 1,279
|
main :: IO ()
main = defaultMain tests
where
tests = [ testGroup "Snap.Internal.Http.Types.Tests"
Snap.Internal.Http.Types.Tests.tests
, testGroup "Snap.Internal.Routing.Tests"
Snap.Internal.Routing.Tests.tests
, testGroup "Snap.Core.Tests"
Snap.Core.Tests.tests
, testGroup "Snap.Internal.Parsing.Tests"
Snap.Internal.Parsing.Tests.tests
, testGroup "Snap.Types.Headers.Tests"
Snap.Types.Headers.Tests.tests
, testGroup "Snap.Util.FileServe.Tests"
Snap.Util.FileServe.Tests.tests
, testGroup "Snap.Util.FileUploads.Tests"
Snap.Util.FileUploads.Tests.tests
, testGroup "Snap.Util.GZip.Tests"
Snap.Util.GZip.Tests.tests
, testGroup "Snap.Util.Proxy.Tests"
Snap.Util.Proxy.Tests.tests
, testGroup "Snap.Util.CORS.Tests"
Snap.Util.CORS.Tests.tests
, testGroup "Snap.Test.Tests"
Snap.Test.Tests.tests
]
| 1,200
|
main = defaultMain tests
where
tests = [ testGroup "Snap.Internal.Http.Types.Tests"
Snap.Internal.Http.Types.Tests.tests
, testGroup "Snap.Internal.Routing.Tests"
Snap.Internal.Routing.Tests.tests
, testGroup "Snap.Core.Tests"
Snap.Core.Tests.tests
, testGroup "Snap.Internal.Parsing.Tests"
Snap.Internal.Parsing.Tests.tests
, testGroup "Snap.Types.Headers.Tests"
Snap.Types.Headers.Tests.tests
, testGroup "Snap.Util.FileServe.Tests"
Snap.Util.FileServe.Tests.tests
, testGroup "Snap.Util.FileUploads.Tests"
Snap.Util.FileUploads.Tests.tests
, testGroup "Snap.Util.GZip.Tests"
Snap.Util.GZip.Tests.tests
, testGroup "Snap.Util.Proxy.Tests"
Snap.Util.Proxy.Tests.tests
, testGroup "Snap.Util.CORS.Tests"
Snap.Util.CORS.Tests.tests
, testGroup "Snap.Test.Tests"
Snap.Test.Tests.tests
]
| 1,186
| true
| true
| 0
| 7
| 458
| 170
| 101
| 69
| null | null |
cjp256/manager
|
xenmgr/Vm/Config.hs
|
gpl-2.0
|
vmS3Mode = property "s3-mode"
| 29
|
vmS3Mode = property "s3-mode"
| 29
|
vmS3Mode = property "s3-mode"
| 29
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
exercism/xhaskell
|
exercises/practice/beer-song/.meta/examples/success-standard/src/Beer.hs
|
mit
|
action :: Int -> String
action n | n > 0 = "Take " ++ it n ++ " down and pass it around"
| otherwise = "Go to the store and buy some more"
| 151
|
action :: Int -> String
action n | n > 0 = "Take " ++ it n ++ " down and pass it around"
| otherwise = "Go to the store and buy some more"
| 151
|
action n | n > 0 = "Take " ++ it n ++ " down and pass it around"
| otherwise = "Go to the store and buy some more"
| 127
| false
| true
| 0
| 8
| 47
| 48
| 22
| 26
| null | null |
kubkon/gnuplot
|
src/Graphics/Gnuplot/Private/FrameOption.hs
|
bsd-3-clause
|
{- |
Constructs a generic option from Strings for the first and second field of 'T'.
This is very flexible, but not very safe.
Use it only as fall-back,
if there is no specific setter function in "Graphics.Gnuplot.Frame.OptionSet".
-}
custom :: String -> String -> T
custom = Cons
| 281
|
custom :: String -> String -> T
custom = Cons
| 45
|
custom = Cons
| 13
| true
| true
| 0
| 6
| 49
| 20
| 11
| 9
| null | null |
jeffreyrosenbluth/Cards
|
src/Utility.hs
|
bsd-3-clause
|
queryHand (Or q r) v = queryHand q v || queryHand r v
| 58
|
queryHand (Or q r) v = queryHand q v || queryHand r v
| 58
|
queryHand (Or q r) v = queryHand q v || queryHand r v
| 58
| false
| false
| 0
| 7
| 17
| 33
| 15
| 18
| null | null |
mettekou/ghc
|
compiler/coreSyn/CoreSyn.hs
|
bsd-3-clause
|
-- | Returns @True@ for value arguments, false for type args
-- NB: coercions are value arguments (zero width, to be sure,
-- like State#, but still value args).
isValArg :: Expr b -> Bool
isValArg e = not (isTypeArg e)
| 219
|
isValArg :: Expr b -> Bool
isValArg e = not (isTypeArg e)
| 57
|
isValArg e = not (isTypeArg e)
| 30
| true
| true
| 0
| 7
| 40
| 39
| 18
| 21
| null | null |
themoritz/cabal
|
cabal-install/Distribution/Client/Config.hs
|
bsd-3-clause
|
-- | The required threshold of root key signatures for hackage.haskell.org
--
defaultHackageRemoteRepoKeyThreshold :: Int
defaultHackageRemoteRepoKeyThreshold = 3
| 162
|
defaultHackageRemoteRepoKeyThreshold :: Int
defaultHackageRemoteRepoKeyThreshold = 3
| 84
|
defaultHackageRemoteRepoKeyThreshold = 3
| 40
| true
| true
| 0
| 4
| 17
| 13
| 8
| 5
| null | null |
unisonweb/platform
|
parser-typechecker/src/Unison/Codebase/SqliteCodebase/Conversions.hs
|
mit
|
term2to1 :: forall m. Monad m => Hash -> (Hash -> m V1.Reference.Size) -> (V2.Reference -> m CT.ConstructorType) -> V2.Term.Term V2.Symbol -> m (V1.Term.Term V1.Symbol Ann)
term2to1 h lookupSize lookupCT tm =
V1.ABT.transformM (termF2to1 h lookupSize lookupCT)
. V1.ABT.vmap symbol2to1
. V1.ABT.amap (const Ann.External)
$ abt2to1 tm
where
termF2to1 :: forall m a. Monad m => Hash -> (Hash -> m V1.Reference.Size) -> (V2.Reference -> m CT.ConstructorType) -> V2.Term.F V2.Symbol a -> m (V1.Term.F V1.Symbol Ann Ann a)
termF2to1 h lookupSize lookupCT = go
where
go :: V2.Term.F V2.Symbol a -> m (V1.Term.F V1.Symbol Ann Ann a)
go = \case
V2.Term.Int i -> pure $ V1.Term.Int i
V2.Term.Nat n -> pure $ V1.Term.Nat n
V2.Term.Float d -> pure $ V1.Term.Float d
V2.Term.Boolean b -> pure $ V1.Term.Boolean b
V2.Term.Text t -> pure $ V1.Term.Text t
V2.Term.Char c -> pure $ V1.Term.Char c
V2.Term.Ref r -> V1.Term.Ref <$> rreference2to1 h lookupSize r
V2.Term.Constructor r i ->
V1.Term.Constructor <$> reference2to1 lookupSize r <*> pure (fromIntegral i)
V2.Term.Request r i ->
V1.Term.Request <$> reference2to1 lookupSize r <*> pure (fromIntegral i)
V2.Term.Handle a a4 -> pure $ V1.Term.Handle a a4
V2.Term.App a a4 -> pure $ V1.Term.App a a4
V2.Term.Ann a t2 -> V1.Term.Ann a <$> ttype2to1 lookupSize t2
V2.Term.List sa -> pure $ V1.Term.List sa
V2.Term.If a a4 a5 -> pure $ V1.Term.If a a4 a5
V2.Term.And a a4 -> pure $ V1.Term.And a a4
V2.Term.Or a a4 -> pure $ V1.Term.Or a a4
V2.Term.Lam a -> pure $ V1.Term.Lam a
V2.Term.LetRec as a -> pure $ V1.Term.LetRec False as a
V2.Term.Let a a4 -> pure $ V1.Term.Let False a a4
V2.Term.Match a cases -> V1.Term.Match a <$> traverse goCase cases
V2.Term.TermLink rr -> V1.Term.TermLink <$> rreferent2to1 h lookupSize lookupCT rr
V2.Term.TypeLink r -> V1.Term.TypeLink <$> reference2to1 lookupSize r
goCase = \case
V2.Term.MatchCase pat cond body ->
V1.Term.MatchCase <$> (goPat pat) <*> pure cond <*> pure body
goPat = \case
V2.Term.PUnbound -> pure $ V1.Pattern.Unbound a
V2.Term.PVar -> pure $ V1.Pattern.Var a
V2.Term.PBoolean b -> pure $ V1.Pattern.Boolean a b
V2.Term.PInt i -> pure $ V1.Pattern.Int a i
V2.Term.PNat n -> pure $ V1.Pattern.Nat a n
V2.Term.PFloat d -> pure $ V1.Pattern.Float a d
V2.Term.PText t -> pure $ V1.Pattern.Text a t
V2.Term.PChar c -> pure $ V1.Pattern.Char a c
V2.Term.PConstructor r i ps ->
V1.Pattern.Constructor a <$> reference2to1 lookupSize r <*> pure i <*> (traverse goPat ps)
V2.Term.PAs p -> V1.Pattern.As a <$> goPat p
V2.Term.PEffectPure p -> V1.Pattern.EffectPure a <$> goPat p
V2.Term.PEffectBind r i ps p -> V1.Pattern.EffectBind a <$> reference2to1 lookupSize r <*> pure i <*> traverse goPat ps <*> goPat p
V2.Term.PSequenceLiteral ps -> V1.Pattern.SequenceLiteral a <$> traverse goPat ps
V2.Term.PSequenceOp p1 op p2 -> V1.Pattern.SequenceOp a <$> goPat p1 <*> pure (goOp op) <*> goPat p2
goOp = \case
V2.Term.PCons -> V1.Pattern.Cons
V2.Term.PSnoc -> V1.Pattern.Snoc
V2.Term.PConcat -> V1.Pattern.Concat
a = Ann.External
| 3,535
|
term2to1 :: forall m. Monad m => Hash -> (Hash -> m V1.Reference.Size) -> (V2.Reference -> m CT.ConstructorType) -> V2.Term.Term V2.Symbol -> m (V1.Term.Term V1.Symbol Ann)
term2to1 h lookupSize lookupCT tm =
V1.ABT.transformM (termF2to1 h lookupSize lookupCT)
. V1.ABT.vmap symbol2to1
. V1.ABT.amap (const Ann.External)
$ abt2to1 tm
where
termF2to1 :: forall m a. Monad m => Hash -> (Hash -> m V1.Reference.Size) -> (V2.Reference -> m CT.ConstructorType) -> V2.Term.F V2.Symbol a -> m (V1.Term.F V1.Symbol Ann Ann a)
termF2to1 h lookupSize lookupCT = go
where
go :: V2.Term.F V2.Symbol a -> m (V1.Term.F V1.Symbol Ann Ann a)
go = \case
V2.Term.Int i -> pure $ V1.Term.Int i
V2.Term.Nat n -> pure $ V1.Term.Nat n
V2.Term.Float d -> pure $ V1.Term.Float d
V2.Term.Boolean b -> pure $ V1.Term.Boolean b
V2.Term.Text t -> pure $ V1.Term.Text t
V2.Term.Char c -> pure $ V1.Term.Char c
V2.Term.Ref r -> V1.Term.Ref <$> rreference2to1 h lookupSize r
V2.Term.Constructor r i ->
V1.Term.Constructor <$> reference2to1 lookupSize r <*> pure (fromIntegral i)
V2.Term.Request r i ->
V1.Term.Request <$> reference2to1 lookupSize r <*> pure (fromIntegral i)
V2.Term.Handle a a4 -> pure $ V1.Term.Handle a a4
V2.Term.App a a4 -> pure $ V1.Term.App a a4
V2.Term.Ann a t2 -> V1.Term.Ann a <$> ttype2to1 lookupSize t2
V2.Term.List sa -> pure $ V1.Term.List sa
V2.Term.If a a4 a5 -> pure $ V1.Term.If a a4 a5
V2.Term.And a a4 -> pure $ V1.Term.And a a4
V2.Term.Or a a4 -> pure $ V1.Term.Or a a4
V2.Term.Lam a -> pure $ V1.Term.Lam a
V2.Term.LetRec as a -> pure $ V1.Term.LetRec False as a
V2.Term.Let a a4 -> pure $ V1.Term.Let False a a4
V2.Term.Match a cases -> V1.Term.Match a <$> traverse goCase cases
V2.Term.TermLink rr -> V1.Term.TermLink <$> rreferent2to1 h lookupSize lookupCT rr
V2.Term.TypeLink r -> V1.Term.TypeLink <$> reference2to1 lookupSize r
goCase = \case
V2.Term.MatchCase pat cond body ->
V1.Term.MatchCase <$> (goPat pat) <*> pure cond <*> pure body
goPat = \case
V2.Term.PUnbound -> pure $ V1.Pattern.Unbound a
V2.Term.PVar -> pure $ V1.Pattern.Var a
V2.Term.PBoolean b -> pure $ V1.Pattern.Boolean a b
V2.Term.PInt i -> pure $ V1.Pattern.Int a i
V2.Term.PNat n -> pure $ V1.Pattern.Nat a n
V2.Term.PFloat d -> pure $ V1.Pattern.Float a d
V2.Term.PText t -> pure $ V1.Pattern.Text a t
V2.Term.PChar c -> pure $ V1.Pattern.Char a c
V2.Term.PConstructor r i ps ->
V1.Pattern.Constructor a <$> reference2to1 lookupSize r <*> pure i <*> (traverse goPat ps)
V2.Term.PAs p -> V1.Pattern.As a <$> goPat p
V2.Term.PEffectPure p -> V1.Pattern.EffectPure a <$> goPat p
V2.Term.PEffectBind r i ps p -> V1.Pattern.EffectBind a <$> reference2to1 lookupSize r <*> pure i <*> traverse goPat ps <*> goPat p
V2.Term.PSequenceLiteral ps -> V1.Pattern.SequenceLiteral a <$> traverse goPat ps
V2.Term.PSequenceOp p1 op p2 -> V1.Pattern.SequenceOp a <$> goPat p1 <*> pure (goOp op) <*> goPat p2
goOp = \case
V2.Term.PCons -> V1.Pattern.Cons
V2.Term.PSnoc -> V1.Pattern.Snoc
V2.Term.PConcat -> V1.Pattern.Concat
a = Ann.External
| 3,535
|
term2to1 h lookupSize lookupCT tm =
V1.ABT.transformM (termF2to1 h lookupSize lookupCT)
. V1.ABT.vmap symbol2to1
. V1.ABT.amap (const Ann.External)
$ abt2to1 tm
where
termF2to1 :: forall m a. Monad m => Hash -> (Hash -> m V1.Reference.Size) -> (V2.Reference -> m CT.ConstructorType) -> V2.Term.F V2.Symbol a -> m (V1.Term.F V1.Symbol Ann Ann a)
termF2to1 h lookupSize lookupCT = go
where
go :: V2.Term.F V2.Symbol a -> m (V1.Term.F V1.Symbol Ann Ann a)
go = \case
V2.Term.Int i -> pure $ V1.Term.Int i
V2.Term.Nat n -> pure $ V1.Term.Nat n
V2.Term.Float d -> pure $ V1.Term.Float d
V2.Term.Boolean b -> pure $ V1.Term.Boolean b
V2.Term.Text t -> pure $ V1.Term.Text t
V2.Term.Char c -> pure $ V1.Term.Char c
V2.Term.Ref r -> V1.Term.Ref <$> rreference2to1 h lookupSize r
V2.Term.Constructor r i ->
V1.Term.Constructor <$> reference2to1 lookupSize r <*> pure (fromIntegral i)
V2.Term.Request r i ->
V1.Term.Request <$> reference2to1 lookupSize r <*> pure (fromIntegral i)
V2.Term.Handle a a4 -> pure $ V1.Term.Handle a a4
V2.Term.App a a4 -> pure $ V1.Term.App a a4
V2.Term.Ann a t2 -> V1.Term.Ann a <$> ttype2to1 lookupSize t2
V2.Term.List sa -> pure $ V1.Term.List sa
V2.Term.If a a4 a5 -> pure $ V1.Term.If a a4 a5
V2.Term.And a a4 -> pure $ V1.Term.And a a4
V2.Term.Or a a4 -> pure $ V1.Term.Or a a4
V2.Term.Lam a -> pure $ V1.Term.Lam a
V2.Term.LetRec as a -> pure $ V1.Term.LetRec False as a
V2.Term.Let a a4 -> pure $ V1.Term.Let False a a4
V2.Term.Match a cases -> V1.Term.Match a <$> traverse goCase cases
V2.Term.TermLink rr -> V1.Term.TermLink <$> rreferent2to1 h lookupSize lookupCT rr
V2.Term.TypeLink r -> V1.Term.TypeLink <$> reference2to1 lookupSize r
goCase = \case
V2.Term.MatchCase pat cond body ->
V1.Term.MatchCase <$> (goPat pat) <*> pure cond <*> pure body
goPat = \case
V2.Term.PUnbound -> pure $ V1.Pattern.Unbound a
V2.Term.PVar -> pure $ V1.Pattern.Var a
V2.Term.PBoolean b -> pure $ V1.Pattern.Boolean a b
V2.Term.PInt i -> pure $ V1.Pattern.Int a i
V2.Term.PNat n -> pure $ V1.Pattern.Nat a n
V2.Term.PFloat d -> pure $ V1.Pattern.Float a d
V2.Term.PText t -> pure $ V1.Pattern.Text a t
V2.Term.PChar c -> pure $ V1.Pattern.Char a c
V2.Term.PConstructor r i ps ->
V1.Pattern.Constructor a <$> reference2to1 lookupSize r <*> pure i <*> (traverse goPat ps)
V2.Term.PAs p -> V1.Pattern.As a <$> goPat p
V2.Term.PEffectPure p -> V1.Pattern.EffectPure a <$> goPat p
V2.Term.PEffectBind r i ps p -> V1.Pattern.EffectBind a <$> reference2to1 lookupSize r <*> pure i <*> traverse goPat ps <*> goPat p
V2.Term.PSequenceLiteral ps -> V1.Pattern.SequenceLiteral a <$> traverse goPat ps
V2.Term.PSequenceOp p1 op p2 -> V1.Pattern.SequenceOp a <$> goPat p1 <*> pure (goOp op) <*> goPat p2
goOp = \case
V2.Term.PCons -> V1.Pattern.Cons
V2.Term.PSnoc -> V1.Pattern.Snoc
V2.Term.PConcat -> V1.Pattern.Concat
a = Ann.External
| 3,362
| false
| true
| 4
| 15
| 999
| 1,409
| 702
| 707
| null | null |
green-haskell/ghc
|
testsuite/tests/typecheck/should_compile/T2497.hs
|
bsd-3-clause
|
foo x = x
| 9
|
foo x = x
| 9
|
foo x = x
| 9
| false
| false
| 1
| 5
| 3
| 13
| 4
| 9
| null | null |
vdweegen/UvA-Software_Testing
|
Lab3/Willem/Exercise.hs
|
gpl-3.0
|
prop_cnf_equiv :: Form -> Bool
prop_cnf_equiv f = equiv (toCNF f) f
| 67
|
prop_cnf_equiv :: Form -> Bool
prop_cnf_equiv f = equiv (toCNF f) f
| 67
|
prop_cnf_equiv f = equiv (toCNF f) f
| 36
| false
| true
| 0
| 7
| 11
| 29
| 14
| 15
| null | null |
vito/atomo
|
src/Atomo/Format/Parser.hs
|
bsd-3-clause
|
segment :: Parser Segment
segment = choice
[ sString
, sInteger
, sHex
, sOctal
, sBinary
, sRadix
, sFloat
, sExponent
, sGeneral
, sCharacterOrCapitalize
, sAsString
, sAny
, sPluralize
, sLowercase
, sUppercase
, sSkip
, sIndirection
, sIterate
, sBreak
, sConditional
, sJustify
]
| 372
|
segment :: Parser Segment
segment = choice
[ sString
, sInteger
, sHex
, sOctal
, sBinary
, sRadix
, sFloat
, sExponent
, sGeneral
, sCharacterOrCapitalize
, sAsString
, sAny
, sPluralize
, sLowercase
, sUppercase
, sSkip
, sIndirection
, sIterate
, sBreak
, sConditional
, sJustify
]
| 372
|
segment = choice
[ sString
, sInteger
, sHex
, sOctal
, sBinary
, sRadix
, sFloat
, sExponent
, sGeneral
, sCharacterOrCapitalize
, sAsString
, sAny
, sPluralize
, sLowercase
, sUppercase
, sSkip
, sIndirection
, sIterate
, sBreak
, sConditional
, sJustify
]
| 346
| false
| true
| 0
| 5
| 137
| 80
| 50
| 30
| null | null |
forsyde/forsyde-atom
|
src/ForSyDe/Atom/MoC/CT/Lib.hs
|
bsd-3-clause
|
comb34 = MoC.comb34
| 19
|
comb34 = MoC.comb34
| 19
|
comb34 = MoC.comb34
| 19
| false
| false
| 1
| 6
| 2
| 12
| 4
| 8
| null | null |
JacquesCarette/literate-scientific-software
|
code/drasil-example/Drasil/SSP/Unitals.hs
|
bsd-2-clause
|
surfAngle = uc' "beta_i" (cn "surface angles")
"the angles between the surface of each slice and the horizontal"
(vec lBeta) degree
| 135
|
surfAngle = uc' "beta_i" (cn "surface angles")
"the angles between the surface of each slice and the horizontal"
(vec lBeta) degree
| 135
|
surfAngle = uc' "beta_i" (cn "surface angles")
"the angles between the surface of each slice and the horizontal"
(vec lBeta) degree
| 135
| false
| false
| 1
| 6
| 24
| 37
| 14
| 23
| null | null |
ksaveljev/hake-2
|
src/Game/GameTarget.hs
|
bsd-3-clause
|
useTargetChangeLevel :: EntUse
useTargetChangeLevel =
GenericEntUse "use_target_changelevel" $ \_ _ _ -> do
io (putStrLn "GameTarget.useTargetChangeLevel") >> undefined -- TODO
| 182
|
useTargetChangeLevel :: EntUse
useTargetChangeLevel =
GenericEntUse "use_target_changelevel" $ \_ _ _ -> do
io (putStrLn "GameTarget.useTargetChangeLevel") >> undefined -- TODO
| 182
|
useTargetChangeLevel =
GenericEntUse "use_target_changelevel" $ \_ _ _ -> do
io (putStrLn "GameTarget.useTargetChangeLevel") >> undefined -- TODO
| 151
| false
| true
| 0
| 12
| 25
| 44
| 22
| 22
| null | null |
beni55/hermit
|
src/HERMIT/GHC.hs
|
bsd-2-clause
|
--------------------------------------------------------------------------
-- | Determine if a 'Var' is not an element of a 'VarSet'.
notElemVarSet :: Var -> VarSet -> Bool
notElemVarSet v vs = not (v `elemVarSet` vs)
| 218
|
notElemVarSet :: Var -> VarSet -> Bool
notElemVarSet v vs = not (v `elemVarSet` vs)
| 83
|
notElemVarSet v vs = not (v `elemVarSet` vs)
| 44
| true
| true
| 0
| 7
| 29
| 38
| 21
| 17
| null | null |
JoeyEremondi/utrecht-apa-p1
|
src/Transform/AddDefaultImports.hs
|
bsd-3-clause
|
-- DESCRIPTION OF DEFAULT IMPORTS
(==>) :: a -> b -> (a,b)
(==>) = (,)
| 71
|
(==>) :: a -> b -> (a,b)
(==>) = (,)
| 36
|
(==>) = (,)
| 11
| true
| true
| 0
| 7
| 15
| 33
| 21
| 12
| null | null |
lukexi/ghc
|
libraries/base/Debug/Trace.hs
|
bsd-3-clause
|
-- $tracing
--
-- The 'trace', 'traceShow' and 'traceIO' functions print messages to an output
-- stream. They are intended for \"printf debugging\", that is: tracing the flow
-- of execution and printing interesting values.
-- The usual output stream is 'System.IO.stderr'. For Windows GUI applications
-- (that have no stderr) the output is directed to the Windows debug console.
-- Some implementations of these functions may decorate the string that\'s
-- output to indicate that you\'re tracing.
-- | The 'traceIO' function outputs the trace message from the IO monad.
-- This sequences the output with respect to other IO actions.
--
-- /Since: 4.5.0.0/
traceIO :: String -> IO ()
traceIO msg = do
withCString "%s\n" $ \cfmt -> do
-- NB: debugBelch can't deal with null bytes, so filter them
-- out so we don't accidentally truncate the message. See Trac #9395
let (nulls, msg') = partition (=='\0') msg
withCString msg' $ \cmsg ->
debugBelch cfmt cmsg
when (not (null nulls)) $
withCString "WARNING: previous trace message had null bytes" $ \cmsg ->
debugBelch cfmt cmsg
-- don't use debugBelch() directly, because we cannot call varargs functions
-- using the FFI.
| 1,227
|
traceIO :: String -> IO ()
traceIO msg = do
withCString "%s\n" $ \cfmt -> do
-- NB: debugBelch can't deal with null bytes, so filter them
-- out so we don't accidentally truncate the message. See Trac #9395
let (nulls, msg') = partition (=='\0') msg
withCString msg' $ \cmsg ->
debugBelch cfmt cmsg
when (not (null nulls)) $
withCString "WARNING: previous trace message had null bytes" $ \cmsg ->
debugBelch cfmt cmsg
-- don't use debugBelch() directly, because we cannot call varargs functions
-- using the FFI.
| 565
|
traceIO msg = do
withCString "%s\n" $ \cfmt -> do
-- NB: debugBelch can't deal with null bytes, so filter them
-- out so we don't accidentally truncate the message. See Trac #9395
let (nulls, msg') = partition (=='\0') msg
withCString msg' $ \cmsg ->
debugBelch cfmt cmsg
when (not (null nulls)) $
withCString "WARNING: previous trace message had null bytes" $ \cmsg ->
debugBelch cfmt cmsg
-- don't use debugBelch() directly, because we cannot call varargs functions
-- using the FFI.
| 538
| true
| true
| 0
| 17
| 248
| 139
| 75
| 64
| null | null |
jchmrt/btjchm
|
Beschrijver.hs
|
mit
|
beschrijf '`' = "een accent grave"
| 34
|
beschrijf '`' = "een accent grave"
| 34
|
beschrijf '`' = "een accent grave"
| 34
| false
| false
| 0
| 5
| 5
| 9
| 4
| 5
| null | null |
haskell-opengl/OpenGLRaw
|
src/Graphics/GL/Functions/F14.hs
|
bsd-3-clause
|
ptr_glIndexPointerListIBM :: FunPtr (GLenum -> GLint -> Ptr (Ptr a) -> GLint -> IO ())
ptr_glIndexPointerListIBM = unsafePerformIO $ getCommand "glIndexPointerListIBM"
| 167
|
ptr_glIndexPointerListIBM :: FunPtr (GLenum -> GLint -> Ptr (Ptr a) -> GLint -> IO ())
ptr_glIndexPointerListIBM = unsafePerformIO $ getCommand "glIndexPointerListIBM"
| 167
|
ptr_glIndexPointerListIBM = unsafePerformIO $ getCommand "glIndexPointerListIBM"
| 80
| false
| true
| 0
| 12
| 20
| 54
| 26
| 28
| null | null |
romanb/amazonka
|
amazonka-storagegateway/gen/Network/AWS/StorageGateway/ActivateGateway.hs
|
mpl-2.0
|
agrGatewayARN :: Lens' ActivateGatewayResponse (Maybe Text)
agrGatewayARN = lens _agrGatewayARN (\s a -> s { _agrGatewayARN = a })
| 130
|
agrGatewayARN :: Lens' ActivateGatewayResponse (Maybe Text)
agrGatewayARN = lens _agrGatewayARN (\s a -> s { _agrGatewayARN = a })
| 130
|
agrGatewayARN = lens _agrGatewayARN (\s a -> s { _agrGatewayARN = a })
| 70
| false
| true
| 1
| 9
| 18
| 50
| 24
| 26
| null | null |
wdanilo/haskell-language-c
|
src/Language/C/Syntax/Ops.hs
|
bsd-3-clause
|
isLogicOp :: CBinaryOp -> Bool
isLogicOp op = op `elem` [ CLndOp, CLorOp ]
| 74
|
isLogicOp :: CBinaryOp -> Bool
isLogicOp op = op `elem` [ CLndOp, CLorOp ]
| 74
|
isLogicOp op = op `elem` [ CLndOp, CLorOp ]
| 43
| false
| true
| 0
| 6
| 13
| 30
| 17
| 13
| null | null |
bendmorris/biophylo
|
Bio/Phylo/IO/Newick.hs
|
mit
|
newick_regex = B.intercalate (B.pack "|") [B.concat [B.pack "(", regex, B.pack ")"] | regex <- token_regex]
| 107
|
newick_regex = B.intercalate (B.pack "|") [B.concat [B.pack "(", regex, B.pack ")"] | regex <- token_regex]
| 107
|
newick_regex = B.intercalate (B.pack "|") [B.concat [B.pack "(", regex, B.pack ")"] | regex <- token_regex]
| 107
| false
| false
| 0
| 10
| 14
| 56
| 28
| 28
| null | null |
Lykos/Sara
|
src/lib/Sara/Parser/Parser.hs
|
gpl-3.0
|
function :: Parser ParserDeclaration
function = addNodeMeta $ S.Function <$> Sara.Parser.Parser.signature <*> bracedExpression
| 126
|
function :: Parser ParserDeclaration
function = addNodeMeta $ S.Function <$> Sara.Parser.Parser.signature <*> bracedExpression
| 126
|
function = addNodeMeta $ S.Function <$> Sara.Parser.Parser.signature <*> bracedExpression
| 89
| false
| true
| 0
| 8
| 12
| 32
| 17
| 15
| null | null |
benwbooth/cleo
|
cleo.hs
|
mit
|
parseBacktickQuoted :: Parser String
parseBacktickQuoted = do
char '`'
x <- many $ noneOf "`\n" <|> try (string "``" >> return '`')
char '`'
return x
<?> "Backquoted Operator"
| 193
|
parseBacktickQuoted :: Parser String
parseBacktickQuoted = do
char '`'
x <- many $ noneOf "`\n" <|> try (string "``" >> return '`')
char '`'
return x
<?> "Backquoted Operator"
| 193
|
parseBacktickQuoted = do
char '`'
x <- many $ noneOf "`\n" <|> try (string "``" >> return '`')
char '`'
return x
<?> "Backquoted Operator"
| 156
| false
| true
| 2
| 12
| 46
| 72
| 30
| 42
| null | null |
eugenkiss/loopgotowhile
|
tests/Language/LoopGotoWhile/Loop/Strict/Tests.hs
|
bsd-3-clause
|
testAssignment1 :: Assertion
testAssignment1
= runProgram' [] "x0 := x1 + 1"
@?= 1
| 91
|
testAssignment1 :: Assertion
testAssignment1
= runProgram' [] "x0 := x1 + 1"
@?= 1
| 91
|
testAssignment1
= runProgram' [] "x0 := x1 + 1"
@?= 1
| 62
| false
| true
| 2
| 6
| 22
| 30
| 13
| 17
| null | null |
aisamanra/matterhorn
|
src/Draw/Main.hs
|
bsd-3-clause
|
renderCurrentChannelDisplay :: ChatState -> HighlightSet -> Widget Name
renderCurrentChannelDisplay st hs = header <=> messages
where
header = withDefAttr channelHeaderAttr $
padRight Max $
renderChannelHeader st hs chan
messages = padTop Max $ padRight (Pad 1) body
body = chatText
chatText = case appMode st of
ChannelScroll ->
-- n.b., In this mode, the output is cached and scrolled
-- via the viewport. This means that newly received
-- messages are *not* displayed, but this preserves the
-- stability of the scrolling, which provides a better
-- user experience.
viewport (ChannelMessages cId) Vertical $
cached (ChannelMessages cId) $
vBox $ (withDefAttr loadMoreAttr $ hCenter $
str "<< Press C-b to load more messages >>") :
(toList $ renderSingleMessage st hs editCutoff <$> channelMessages)
MessageSelect ->
renderMessagesWithSelect (st^.csMessageSelect) channelMessages
MessageSelectDeleteConfirm ->
renderMessagesWithSelect (st^.csMessageSelect) channelMessages
_ -> renderLastMessages $ reverseMessages channelMessages
renderMessagesWithSelect (MessageSelectState selMsgId) msgs =
-- In this case, we want to fill the message list with messages
-- but use the post ID as a cursor. To do this efficiently we
-- only want to render enough messages to fill the screen.
--
-- If the message area is H rows high, this actually renders at
-- most 2H rows' worth of messages and then does the appropriate
-- cropping. This way we can simplify the math needed to figure
-- out how to crop while bounding the number of messages we
-- render around the cursor.
--
-- First, we sanity-check the application state because under
-- some conditions, the selected message might be gone (e.g.
-- deleted).
let (s, (before, after)) = splitMessages selMsgId msgs
in case s of
Nothing -> renderLastMessages before
Just m ->
unsafeRenderMessageSelection (m, (before, after)) (renderSingleMessage st hs Nothing)
cutoff = getNewMessageCutoff cId st
editCutoff = getEditedMessageCutoff cId st
channelMessages =
insertTransitions (getMessageListing cId st)
cutoff
(getDateFormat st)
(st ^. timeZone)
renderLastMessages :: RetrogradeMessages -> Widget Name
renderLastMessages msgs =
Widget Greedy Greedy $ do
ctx <- getContext
let targetHeight = ctx^.availHeightL
renderBuild = render1HLimit (flip Vty.vertJoin) targetHeight
img <- foldM renderBuild Vty.emptyImage msgs
return $ emptyResult & imageL .~ (Vty.cropTop targetHeight img)
relaxHeight c = c & availHeightL .~ (max maxMessageHeight (c^.availHeightL))
render1HLimit fjoin lim img msg
| Vty.imageHeight img >= lim = return img
| otherwise = fjoin img <$> render1 msg
render1 msg = case msg^.mDeleted of
True -> return Vty.emptyImage
False -> do
r <- withReaderT relaxHeight $
render $ padRight Max $
renderSingleMessage st hs editCutoff msg
return $ r^.imageL
cId = st^.csCurrentChannelId
chan = st^.csCurrentChannel
| 3,632
|
renderCurrentChannelDisplay :: ChatState -> HighlightSet -> Widget Name
renderCurrentChannelDisplay st hs = header <=> messages
where
header = withDefAttr channelHeaderAttr $
padRight Max $
renderChannelHeader st hs chan
messages = padTop Max $ padRight (Pad 1) body
body = chatText
chatText = case appMode st of
ChannelScroll ->
-- n.b., In this mode, the output is cached and scrolled
-- via the viewport. This means that newly received
-- messages are *not* displayed, but this preserves the
-- stability of the scrolling, which provides a better
-- user experience.
viewport (ChannelMessages cId) Vertical $
cached (ChannelMessages cId) $
vBox $ (withDefAttr loadMoreAttr $ hCenter $
str "<< Press C-b to load more messages >>") :
(toList $ renderSingleMessage st hs editCutoff <$> channelMessages)
MessageSelect ->
renderMessagesWithSelect (st^.csMessageSelect) channelMessages
MessageSelectDeleteConfirm ->
renderMessagesWithSelect (st^.csMessageSelect) channelMessages
_ -> renderLastMessages $ reverseMessages channelMessages
renderMessagesWithSelect (MessageSelectState selMsgId) msgs =
-- In this case, we want to fill the message list with messages
-- but use the post ID as a cursor. To do this efficiently we
-- only want to render enough messages to fill the screen.
--
-- If the message area is H rows high, this actually renders at
-- most 2H rows' worth of messages and then does the appropriate
-- cropping. This way we can simplify the math needed to figure
-- out how to crop while bounding the number of messages we
-- render around the cursor.
--
-- First, we sanity-check the application state because under
-- some conditions, the selected message might be gone (e.g.
-- deleted).
let (s, (before, after)) = splitMessages selMsgId msgs
in case s of
Nothing -> renderLastMessages before
Just m ->
unsafeRenderMessageSelection (m, (before, after)) (renderSingleMessage st hs Nothing)
cutoff = getNewMessageCutoff cId st
editCutoff = getEditedMessageCutoff cId st
channelMessages =
insertTransitions (getMessageListing cId st)
cutoff
(getDateFormat st)
(st ^. timeZone)
renderLastMessages :: RetrogradeMessages -> Widget Name
renderLastMessages msgs =
Widget Greedy Greedy $ do
ctx <- getContext
let targetHeight = ctx^.availHeightL
renderBuild = render1HLimit (flip Vty.vertJoin) targetHeight
img <- foldM renderBuild Vty.emptyImage msgs
return $ emptyResult & imageL .~ (Vty.cropTop targetHeight img)
relaxHeight c = c & availHeightL .~ (max maxMessageHeight (c^.availHeightL))
render1HLimit fjoin lim img msg
| Vty.imageHeight img >= lim = return img
| otherwise = fjoin img <$> render1 msg
render1 msg = case msg^.mDeleted of
True -> return Vty.emptyImage
False -> do
r <- withReaderT relaxHeight $
render $ padRight Max $
renderSingleMessage st hs editCutoff msg
return $ r^.imageL
cId = st^.csCurrentChannelId
chan = st^.csCurrentChannel
| 3,632
|
renderCurrentChannelDisplay st hs = header <=> messages
where
header = withDefAttr channelHeaderAttr $
padRight Max $
renderChannelHeader st hs chan
messages = padTop Max $ padRight (Pad 1) body
body = chatText
chatText = case appMode st of
ChannelScroll ->
-- n.b., In this mode, the output is cached and scrolled
-- via the viewport. This means that newly received
-- messages are *not* displayed, but this preserves the
-- stability of the scrolling, which provides a better
-- user experience.
viewport (ChannelMessages cId) Vertical $
cached (ChannelMessages cId) $
vBox $ (withDefAttr loadMoreAttr $ hCenter $
str "<< Press C-b to load more messages >>") :
(toList $ renderSingleMessage st hs editCutoff <$> channelMessages)
MessageSelect ->
renderMessagesWithSelect (st^.csMessageSelect) channelMessages
MessageSelectDeleteConfirm ->
renderMessagesWithSelect (st^.csMessageSelect) channelMessages
_ -> renderLastMessages $ reverseMessages channelMessages
renderMessagesWithSelect (MessageSelectState selMsgId) msgs =
-- In this case, we want to fill the message list with messages
-- but use the post ID as a cursor. To do this efficiently we
-- only want to render enough messages to fill the screen.
--
-- If the message area is H rows high, this actually renders at
-- most 2H rows' worth of messages and then does the appropriate
-- cropping. This way we can simplify the math needed to figure
-- out how to crop while bounding the number of messages we
-- render around the cursor.
--
-- First, we sanity-check the application state because under
-- some conditions, the selected message might be gone (e.g.
-- deleted).
let (s, (before, after)) = splitMessages selMsgId msgs
in case s of
Nothing -> renderLastMessages before
Just m ->
unsafeRenderMessageSelection (m, (before, after)) (renderSingleMessage st hs Nothing)
cutoff = getNewMessageCutoff cId st
editCutoff = getEditedMessageCutoff cId st
channelMessages =
insertTransitions (getMessageListing cId st)
cutoff
(getDateFormat st)
(st ^. timeZone)
renderLastMessages :: RetrogradeMessages -> Widget Name
renderLastMessages msgs =
Widget Greedy Greedy $ do
ctx <- getContext
let targetHeight = ctx^.availHeightL
renderBuild = render1HLimit (flip Vty.vertJoin) targetHeight
img <- foldM renderBuild Vty.emptyImage msgs
return $ emptyResult & imageL .~ (Vty.cropTop targetHeight img)
relaxHeight c = c & availHeightL .~ (max maxMessageHeight (c^.availHeightL))
render1HLimit fjoin lim img msg
| Vty.imageHeight img >= lim = return img
| otherwise = fjoin img <$> render1 msg
render1 msg = case msg^.mDeleted of
True -> return Vty.emptyImage
False -> do
r <- withReaderT relaxHeight $
render $ padRight Max $
renderSingleMessage st hs editCutoff msg
return $ r^.imageL
cId = st^.csCurrentChannelId
chan = st^.csCurrentChannel
| 3,560
| false
| true
| 18
| 14
| 1,185
| 719
| 340
| 379
| null | null |
sdiehl/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
fromIntegerClassOpKey, minusClassOpKey, fromRationalClassOpKey,
enumFromClassOpKey, enumFromThenClassOpKey, enumFromToClassOpKey,
enumFromThenToClassOpKey, eqClassOpKey, geClassOpKey, negateClassOpKey,
bindMClassOpKey, thenMClassOpKey, returnMClassOpKey, fmapClassOpKey
:: Unique
fromIntegerClassOpKey = mkPreludeMiscIdUnique 160
| 353
|
fromIntegerClassOpKey, minusClassOpKey, fromRationalClassOpKey,
enumFromClassOpKey, enumFromThenClassOpKey, enumFromToClassOpKey,
enumFromThenToClassOpKey, eqClassOpKey, geClassOpKey, negateClassOpKey,
bindMClassOpKey, thenMClassOpKey, returnMClassOpKey, fmapClassOpKey
:: Unique
fromIntegerClassOpKey = mkPreludeMiscIdUnique 160
| 353
|
fromIntegerClassOpKey = mkPreludeMiscIdUnique 160
| 57
| false
| true
| 0
| 5
| 43
| 40
| 33
| 7
| null | null |
ford-prefect/haskell-gi
|
lib/Data/GI/CodeGen/GtkDoc.hs
|
lgpl-2.1
|
-- | Parse a signal name, of the form
-- > #Object::signal
--
-- === __Examples__
-- >>> parseOnly (parseSignal <* endOfInput) "#GtkButton::activate"
-- Right (SymbolRef (SignalRef "GtkButton" "activate"))
parseSignal :: Parser Token
parseSignal = do
_ <- char '#'
obj <- parseCIdent
_ <- string "::"
signal <- signalOrPropName
return (SymbolRef (SignalRef obj signal))
-- | Parse a property name, of the form
-- > #Object:property
--
-- === __Examples__
-- >>> parseOnly (parseProperty <* endOfInput) "#GtkButton:always-show-image"
-- Right (SymbolRef (PropertyRef "GtkButton" "always-show-image"))
| 610
|
parseSignal :: Parser Token
parseSignal = do
_ <- char '#'
obj <- parseCIdent
_ <- string "::"
signal <- signalOrPropName
return (SymbolRef (SignalRef obj signal))
-- | Parse a property name, of the form
-- > #Object:property
--
-- === __Examples__
-- >>> parseOnly (parseProperty <* endOfInput) "#GtkButton:always-show-image"
-- Right (SymbolRef (PropertyRef "GtkButton" "always-show-image"))
| 404
|
parseSignal = do
_ <- char '#'
obj <- parseCIdent
_ <- string "::"
signal <- signalOrPropName
return (SymbolRef (SignalRef obj signal))
-- | Parse a property name, of the form
-- > #Object:property
--
-- === __Examples__
-- >>> parseOnly (parseProperty <* endOfInput) "#GtkButton:always-show-image"
-- Right (SymbolRef (PropertyRef "GtkButton" "always-show-image"))
| 376
| true
| true
| 0
| 11
| 94
| 80
| 42
| 38
| null | null |
grnet/snf-ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
-- | One "all" entry in a CPU list means CPU pinning is off
cpuPinningOff :: [Int]
cpuPinningOff = [cpuPinningAllVal]
| 117
|
cpuPinningOff :: [Int]
cpuPinningOff = [cpuPinningAllVal]
| 57
|
cpuPinningOff = [cpuPinningAllVal]
| 34
| true
| true
| 0
| 7
| 19
| 25
| 12
| 13
| null | null |
sdiehl/ghc
|
compiler/GHC/Cmm/Type.hs
|
bsd-3-clause
|
vec4 = vec 4
| 13
|
vec4 = vec 4
| 13
|
vec4 = vec 4
| 13
| false
| false
| 1
| 5
| 4
| 13
| 4
| 9
| null | null |
JoeyEremondi/elm-pattern-effects
|
src/Generate/JavaScript/Expression.hs
|
bsd-3-clause
|
isBlock :: Code -> Bool
isBlock code =
case code of
JsBlock _ -> True
JsExpr _ -> False
| 97
|
isBlock :: Code -> Bool
isBlock code =
case code of
JsBlock _ -> True
JsExpr _ -> False
| 97
|
isBlock code =
case code of
JsBlock _ -> True
JsExpr _ -> False
| 73
| false
| true
| 0
| 8
| 28
| 40
| 19
| 21
| null | null |
ekmett/data-lens-fd
|
Data/Lens.hs
|
bsd-3-clause
|
Lens f != b = do
StoreT (Identity h) _ <- gets f
put (h $! b)
return b
| 76
|
Lens f != b = do
StoreT (Identity h) _ <- gets f
put (h $! b)
return b
| 76
|
Lens f != b = do
StoreT (Identity h) _ <- gets f
put (h $! b)
return b
| 76
| false
| false
| 0
| 10
| 24
| 55
| 23
| 32
| null | null |
sopvop/cabal
|
Cabal/tests/UnitTests/Distribution/Version.hs
|
bsd-3-clause
|
adjacentVersions :: Version -> Version -> Bool
adjacentVersions (Version v1 _) (Version v2 _) = v1 ++ [0] == v2
|| v2 ++ [0] == v1
| 176
|
adjacentVersions :: Version -> Version -> Bool
adjacentVersions (Version v1 _) (Version v2 _) = v1 ++ [0] == v2
|| v2 ++ [0] == v1
| 176
|
adjacentVersions (Version v1 _) (Version v2 _) = v1 ++ [0] == v2
|| v2 ++ [0] == v1
| 129
| false
| true
| 0
| 10
| 71
| 72
| 35
| 37
| null | null |
kazu-yamamoto/network-uri
|
tests/uri001.hs
|
bsd-3-clause
|
testURIRef001 = testURIRef AbsRf "http://example.org/aaa/bbb#ccc"
| 65
|
testURIRef001 = testURIRef AbsRf "http://example.org/aaa/bbb#ccc"
| 65
|
testURIRef001 = testURIRef AbsRf "http://example.org/aaa/bbb#ccc"
| 65
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
awbraunstein/you-ate-my-fractal
|
src/Fractals.hs
|
mit
|
colorFromValue' :: Colorize
colorFromValue' x
| x > defaultMaxIteration = Color 255 255 255
| otherwise = Color (realToFrac x) (realToFrac x) (realToFrac x)
| 164
|
colorFromValue' :: Colorize
colorFromValue' x
| x > defaultMaxIteration = Color 255 255 255
| otherwise = Color (realToFrac x) (realToFrac x) (realToFrac x)
| 164
|
colorFromValue' x
| x > defaultMaxIteration = Color 255 255 255
| otherwise = Color (realToFrac x) (realToFrac x) (realToFrac x)
| 136
| false
| true
| 1
| 8
| 31
| 63
| 30
| 33
| null | null |
athanclark/Idris-dev
|
src/Idris/AbsSyntaxTree.hs
|
bsd-3-clause
|
mapPTermFC f g (PUnquote t) = PUnquote (mapPTermFC f g t)
| 57
|
mapPTermFC f g (PUnquote t) = PUnquote (mapPTermFC f g t)
| 57
|
mapPTermFC f g (PUnquote t) = PUnquote (mapPTermFC f g t)
| 57
| false
| false
| 0
| 7
| 10
| 35
| 15
| 20
| null | null |
pavelfatin/ninety-nine
|
haskell/p03.hs
|
gpl-3.0
|
f1 (_:xs) n
| n < 1 = error "Index out of bound"
| otherwise = f1 xs (n - 1)
| 84
|
f1 (_:xs) n
| n < 1 = error "Index out of bound"
| otherwise = f1 xs (n - 1)
| 84
|
f1 (_:xs) n
| n < 1 = error "Index out of bound"
| otherwise = f1 xs (n - 1)
| 84
| false
| false
| 2
| 8
| 28
| 50
| 24
| 26
| null | null |
verement/etamoo
|
src/MOO/Types.hs
|
bsd-3-clause
|
error2text E_RANGE = "Range error"
| 36
|
error2text E_RANGE = "Range error"
| 36
|
error2text E_RANGE = "Range error"
| 36
| false
| false
| 0
| 5
| 6
| 9
| 4
| 5
| null | null |
fmapfmapfmap/amazonka
|
amazonka-elasticache/gen/Network/AWS/ElastiCache/PurchaseReservedCacheNodesOffering.hs
|
mpl-2.0
|
-- | The ID of the reserved cache node offering to purchase.
--
-- Example: 438012d3-4052-4cc7-b2e3-8d3372e0e706
prcnoReservedCacheNodesOfferingId :: Lens' PurchaseReservedCacheNodesOffering Text
prcnoReservedCacheNodesOfferingId = lens _prcnoReservedCacheNodesOfferingId (\ s a -> s{_prcnoReservedCacheNodesOfferingId = a})
| 324
|
prcnoReservedCacheNodesOfferingId :: Lens' PurchaseReservedCacheNodesOffering Text
prcnoReservedCacheNodesOfferingId = lens _prcnoReservedCacheNodesOfferingId (\ s a -> s{_prcnoReservedCacheNodesOfferingId = a})
| 211
|
prcnoReservedCacheNodesOfferingId = lens _prcnoReservedCacheNodesOfferingId (\ s a -> s{_prcnoReservedCacheNodesOfferingId = a})
| 128
| true
| true
| 0
| 9
| 31
| 42
| 24
| 18
| null | null |
csabahruska/gpipe-quake3
|
BSP.hs
|
bsd-3-clause
|
-- ^ Stores the level vertices
lumpDrawIndices = 11 :: Int
| 59
|
lumpDrawIndices = 11 :: Int
| 28
|
lumpDrawIndices = 11 :: Int
| 28
| true
| false
| 0
| 4
| 11
| 10
| 6
| 4
| null | null |
bordaigorl/jamesbound
|
src/Language/PiCalc/Parser.hs
|
gpl-2.0
|
parsePrefix = (tauSym >> return Tau)
<|> do { x <- name; (op, msgs) <- parseInOut; return $ op x msgs}
<?> "prefix"
| 138
|
parsePrefix = (tauSym >> return Tau)
<|> do { x <- name; (op, msgs) <- parseInOut; return $ op x msgs}
<?> "prefix"
| 138
|
parsePrefix = (tauSym >> return Tau)
<|> do { x <- name; (op, msgs) <- parseInOut; return $ op x msgs}
<?> "prefix"
| 138
| false
| false
| 0
| 10
| 45
| 60
| 31
| 29
| null | null |
fffej/HS-Poker
|
LookupPatternMatch.hs
|
bsd-3-clause
|
getValueFromProduct 1021269 = 4458
| 34
|
getValueFromProduct 1021269 = 4458
| 34
|
getValueFromProduct 1021269 = 4458
| 34
| 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.