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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
denisenkom/hsmssql
|
Database/Mssql/Statement.hs
|
mit
|
convertVal (TdsVarChar collation bs) = SqlString $ E.decodeStrictByteString (getCharSet collation) bs
| 101
|
convertVal (TdsVarChar collation bs) = SqlString $ E.decodeStrictByteString (getCharSet collation) bs
| 101
|
convertVal (TdsVarChar collation bs) = SqlString $ E.decodeStrictByteString (getCharSet collation) bs
| 101
| false
| false
| 0
| 8
| 10
| 34
| 16
| 18
| null | null |
sdiehl/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
genericClassNames :: [Name]
genericClassNames = [genClassName, gen1ClassName]
| 77
|
genericClassNames :: [Name]
genericClassNames = [genClassName, gen1ClassName]
| 77
|
genericClassNames = [genClassName, gen1ClassName]
| 49
| false
| true
| 0
| 5
| 6
| 20
| 12
| 8
| null | null |
awpr/xensynth
|
System.hs
|
mit
|
generateWav :: (FilePath, Composition) -> IO ()
generateWav (path, comp) = do
n <- writeFile simpleWavInfo path $ toBuffer $ synthesize 44100 $ interp comp
putStrLn $ path ++ ": " ++ show n ++ " samples"
| 211
|
generateWav :: (FilePath, Composition) -> IO ()
generateWav (path, comp) = do
n <- writeFile simpleWavInfo path $ toBuffer $ synthesize 44100 $ interp comp
putStrLn $ path ++ ": " ++ show n ++ " samples"
| 211
|
generateWav (path, comp) = do
n <- writeFile simpleWavInfo path $ toBuffer $ synthesize 44100 $ interp comp
putStrLn $ path ++ ": " ++ show n ++ " samples"
| 163
| false
| true
| 0
| 11
| 44
| 87
| 42
| 45
| null | null |
cfredric/arithmoi
|
test-suite/Math/NumberTheory/GCD/LowLevelTests.hs
|
mit
|
-- | Check that 'gcdInt' matches 'gcd'.
gcdIntProperty :: Int -> Int -> Bool
gcdIntProperty a b = gcdInt a b == gcd a b
| 119
|
gcdIntProperty :: Int -> Int -> Bool
gcdIntProperty a b = gcdInt a b == gcd a b
| 79
|
gcdIntProperty a b = gcdInt a b == gcd a b
| 42
| true
| true
| 0
| 6
| 24
| 39
| 19
| 20
| null | null |
spechub/Hets
|
CSMOF/Parser.hs
|
gpl-2.0
|
createProperty :: Metamodel -> Map.Map String String -> Class -> Element -> Property
createProperty metamodel keyMap cla el =
let lowe = parseIntegerAttribute el ownedAttributeLowerK
uppe = parseIntegerAttribute el ownedAttributeUpperK
name = parseStringAttribute el ownedAttributeNameK
typeEl = parsePropertyType keyMap metamodel el
souName = typeEl
tarName = classSuperType cla
opp = parsePropertyOpposite keyMap metamodel el tarName souName
namedElement = NamedElement { namedElementName = name
, namedElementOwner = metamodel
, namedElementSubClasses = TTypedElement {
getTypeElement = typedElement }
}
typedElement = TypedElement { typedElementSuper = namedElement
, typedElementType = typeEl
, typedElementSubClasses = property
}
property = Property { propertySuper = typedElement
, multiplicityElement = MultiplicityElement {
lower = lowe
, upper = uppe
, multiplicityElementSubClasses = property }
, opposite = opp
, propertyClass = cla } in property
| 1,462
|
createProperty :: Metamodel -> Map.Map String String -> Class -> Element -> Property
createProperty metamodel keyMap cla el =
let lowe = parseIntegerAttribute el ownedAttributeLowerK
uppe = parseIntegerAttribute el ownedAttributeUpperK
name = parseStringAttribute el ownedAttributeNameK
typeEl = parsePropertyType keyMap metamodel el
souName = typeEl
tarName = classSuperType cla
opp = parsePropertyOpposite keyMap metamodel el tarName souName
namedElement = NamedElement { namedElementName = name
, namedElementOwner = metamodel
, namedElementSubClasses = TTypedElement {
getTypeElement = typedElement }
}
typedElement = TypedElement { typedElementSuper = namedElement
, typedElementType = typeEl
, typedElementSubClasses = property
}
property = Property { propertySuper = typedElement
, multiplicityElement = MultiplicityElement {
lower = lowe
, upper = uppe
, multiplicityElementSubClasses = property }
, opposite = opp
, propertyClass = cla } in property
| 1,462
|
createProperty metamodel keyMap cla el =
let lowe = parseIntegerAttribute el ownedAttributeLowerK
uppe = parseIntegerAttribute el ownedAttributeUpperK
name = parseStringAttribute el ownedAttributeNameK
typeEl = parsePropertyType keyMap metamodel el
souName = typeEl
tarName = classSuperType cla
opp = parsePropertyOpposite keyMap metamodel el tarName souName
namedElement = NamedElement { namedElementName = name
, namedElementOwner = metamodel
, namedElementSubClasses = TTypedElement {
getTypeElement = typedElement }
}
typedElement = TypedElement { typedElementSuper = namedElement
, typedElementType = typeEl
, typedElementSubClasses = property
}
property = Property { propertySuper = typedElement
, multiplicityElement = MultiplicityElement {
lower = lowe
, upper = uppe
, multiplicityElementSubClasses = property }
, opposite = opp
, propertyClass = cla } in property
| 1,377
| false
| true
| 0
| 12
| 631
| 234
| 130
| 104
| null | null |
ghc-android/ghc
|
testsuite/tests/ghci/should_run/ghcirun004.hs
|
bsd-3-clause
|
3331 = 3330
| 11
|
3331 = 3330
| 11
|
3331 = 3330
| 11
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
bitemyapp/stitch
|
bench/Main.hs
|
bsd-3-clause
|
main :: IO ()
main = defaultMain
[ bgroup "css"
[ bench "basic" $ nf renderCSS example
, bench "compressed" $ nf (renderCSSWith compressed) example ] ]
| 161
|
main :: IO ()
main = defaultMain
[ bgroup "css"
[ bench "basic" $ nf renderCSS example
, bench "compressed" $ nf (renderCSSWith compressed) example ] ]
| 161
|
main = defaultMain
[ bgroup "css"
[ bench "basic" $ nf renderCSS example
, bench "compressed" $ nf (renderCSSWith compressed) example ] ]
| 147
| false
| true
| 0
| 11
| 36
| 63
| 30
| 33
| null | null |
genos/online_problems
|
advent_of_code_2016/day10/src/Main.hs
|
mit
|
ij = is ^. to Deq.popFront ^?! _Just . _2 ^. to Deq.first ^?! _Just
| 67
|
ij = is ^. to Deq.popFront ^?! _Just . _2 ^. to Deq.first ^?! _Just
| 67
|
ij = is ^. to Deq.popFront ^?! _Just . _2 ^. to Deq.first ^?! _Just
| 67
| false
| false
| 0
| 11
| 14
| 36
| 17
| 19
| null | null |
zaxtax/hakaru
|
haskell/Language/Hakaru/Parser/Parser.hs
|
bsd-3-clause
|
type_fun :: Parser TypeAST'
type_fun =
chainr1
( try type_app
<|> try type_var
<|> parens type_fun)
(TypeFun <$ reservedOp "->")
| 169
|
type_fun :: Parser TypeAST'
type_fun =
chainr1
( try type_app
<|> try type_var
<|> parens type_fun)
(TypeFun <$ reservedOp "->")
| 169
|
type_fun =
chainr1
( try type_app
<|> try type_var
<|> parens type_fun)
(TypeFun <$ reservedOp "->")
| 141
| false
| true
| 0
| 9
| 60
| 49
| 23
| 26
| null | null |
timthelion/fenfire
|
Fenfire/URN5.hs
|
gpl-2.0
|
newURIMaker :: IO URIMaker
newURIMaker = do rand <- sequence [randomRIO (0,63) | _ <- [1..27::Int]]
let chars = ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9'] ++ "+-"
ref <- newIORef 1
return ("urn:urn-5:" ++ map (chars !!) rand, ref)
| 277
|
newURIMaker :: IO URIMaker
newURIMaker = do rand <- sequence [randomRIO (0,63) | _ <- [1..27::Int]]
let chars = ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9'] ++ "+-"
ref <- newIORef 1
return ("urn:urn-5:" ++ map (chars !!) rand, ref)
| 277
|
newURIMaker = do rand <- sequence [randomRIO (0,63) | _ <- [1..27::Int]]
let chars = ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9'] ++ "+-"
ref <- newIORef 1
return ("urn:urn-5:" ++ map (chars !!) rand, ref)
| 250
| false
| true
| 0
| 13
| 88
| 123
| 63
| 60
| null | null |
brendanhay/gogol
|
gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs
|
mpl-2.0
|
-- | Filter that describes which sites are visible to the user profile.
aupfSiteFilter :: Lens' AccountUserProFile (Maybe ObjectFilter)
aupfSiteFilter
= lens _aupfSiteFilter
(\ s a -> s{_aupfSiteFilter = a})
| 215
|
aupfSiteFilter :: Lens' AccountUserProFile (Maybe ObjectFilter)
aupfSiteFilter
= lens _aupfSiteFilter
(\ s a -> s{_aupfSiteFilter = a})
| 143
|
aupfSiteFilter
= lens _aupfSiteFilter
(\ s a -> s{_aupfSiteFilter = a})
| 79
| true
| true
| 1
| 9
| 37
| 52
| 25
| 27
| null | null |
nickbart1980/pandoc
|
src/Text/Pandoc/Readers/HTML.hs
|
gpl-2.0
|
pRawHtmlBlock :: TagParser Blocks
pRawHtmlBlock = do
raw <- pHtmlBlock "script" <|> pHtmlBlock "style" <|> pRawTag
parseRaw <- getOption readerParseRaw
if parseRaw && not (null raw)
then return $ B.rawBlock "html" raw
else return mempty
| 252
|
pRawHtmlBlock :: TagParser Blocks
pRawHtmlBlock = do
raw <- pHtmlBlock "script" <|> pHtmlBlock "style" <|> pRawTag
parseRaw <- getOption readerParseRaw
if parseRaw && not (null raw)
then return $ B.rawBlock "html" raw
else return mempty
| 252
|
pRawHtmlBlock = do
raw <- pHtmlBlock "script" <|> pHtmlBlock "style" <|> pRawTag
parseRaw <- getOption readerParseRaw
if parseRaw && not (null raw)
then return $ B.rawBlock "html" raw
else return mempty
| 218
| false
| true
| 0
| 11
| 50
| 83
| 38
| 45
| null | null |
brendanhay/gogol
|
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'LiveChatSuperStickerDetails' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lcssdSuperStickerMetadata'
--
-- * 'lcssdAmountMicros'
--
-- * 'lcssdAmountDisplayString'
--
-- * 'lcssdCurrency'
--
-- * 'lcssdTier'
liveChatSuperStickerDetails
:: LiveChatSuperStickerDetails
liveChatSuperStickerDetails =
LiveChatSuperStickerDetails'
{ _lcssdSuperStickerMetadata = Nothing
, _lcssdAmountMicros = Nothing
, _lcssdAmountDisplayString = Nothing
, _lcssdCurrency = Nothing
, _lcssdTier = Nothing
}
| 629
|
liveChatSuperStickerDetails
:: LiveChatSuperStickerDetails
liveChatSuperStickerDetails =
LiveChatSuperStickerDetails'
{ _lcssdSuperStickerMetadata = Nothing
, _lcssdAmountMicros = Nothing
, _lcssdAmountDisplayString = Nothing
, _lcssdCurrency = Nothing
, _lcssdTier = Nothing
}
| 307
|
liveChatSuperStickerDetails =
LiveChatSuperStickerDetails'
{ _lcssdSuperStickerMetadata = Nothing
, _lcssdAmountMicros = Nothing
, _lcssdAmountDisplayString = Nothing
, _lcssdCurrency = Nothing
, _lcssdTier = Nothing
}
| 244
| true
| true
| 0
| 6
| 106
| 56
| 40
| 16
| null | null |
mudphone/HaskellBook
|
src/Nine.hs
|
mit
|
myElem :: Eq a => a -> [a] -> Bool
myElem _ [] = False
| 54
|
myElem :: Eq a => a -> [a] -> Bool
myElem _ [] = False
| 54
|
myElem _ [] = False
| 19
| false
| true
| 0
| 8
| 14
| 36
| 18
| 18
| null | null |
triplepointfive/hogldev
|
tutorial21/LightingTechnique.hs
|
mit
|
uniformVertex3 :: UniformLocation -> Vertex3 GLfloat -> IO ()
uniformVertex3 loc (Vertex3 x y z) = uniformVec loc $= [x, y, z]
| 126
|
uniformVertex3 :: UniformLocation -> Vertex3 GLfloat -> IO ()
uniformVertex3 loc (Vertex3 x y z) = uniformVec loc $= [x, y, z]
| 126
|
uniformVertex3 loc (Vertex3 x y z) = uniformVec loc $= [x, y, z]
| 64
| false
| true
| 0
| 8
| 21
| 63
| 30
| 33
| null | null |
thoughtpolice/binary-serialise-cbor
|
tests/ReferenceImpl.hs
|
bsd-3-clause
|
decodeTagged :: UInt -> Decoder Term
decodeTagged tag | fromUInt tag == 2 = do
MT2_ByteString _ bs <- decodeToken
let !n = integerFromBytes bs
return (TBigInt n)
| 173
|
decodeTagged :: UInt -> Decoder Term
decodeTagged tag | fromUInt tag == 2 = do
MT2_ByteString _ bs <- decodeToken
let !n = integerFromBytes bs
return (TBigInt n)
| 173
|
decodeTagged tag | fromUInt tag == 2 = do
MT2_ByteString _ bs <- decodeToken
let !n = integerFromBytes bs
return (TBigInt n)
| 136
| false
| true
| 0
| 11
| 39
| 72
| 30
| 42
| null | null |
CindyLinz/Haskell.js
|
trans/src/Desugar/List.hs
|
mit
|
deListPromoted (PromotedList l bool type0) = PromotedList (id l) (id bool) (fmap (deListType) type0)
| 100
|
deListPromoted (PromotedList l bool type0) = PromotedList (id l) (id bool) (fmap (deListType) type0)
| 100
|
deListPromoted (PromotedList l bool type0) = PromotedList (id l) (id bool) (fmap (deListType) type0)
| 100
| false
| false
| 0
| 8
| 13
| 49
| 24
| 25
| null | null |
meiersi/scyther-proof
|
src/Scyther/Equalities.hs
|
gpl-3.0
|
------------------------------------------------------------------------------
-- Pretty Printing
------------------------------------------------------------------------------
-- Helper functions for pretty printing
---------------------------------------
ppEq :: Doc -> (a -> Doc) -> (b -> Doc) -> (a, b) -> Doc
ppEq sym pp1 pp2 (x1, x2) = pp1 x1 <-> sym <-> pp2 x2
| 369
|
ppEq :: Doc -> (a -> Doc) -> (b -> Doc) -> (a, b) -> Doc
ppEq sym pp1 pp2 (x1, x2) = pp1 x1 <-> sym <-> pp2 x2
| 110
|
ppEq sym pp1 pp2 (x1, x2) = pp1 x1 <-> sym <-> pp2 x2
| 53
| true
| true
| 0
| 9
| 43
| 81
| 45
| 36
| null | null |
snapframework/heist
|
test/suite/Heist/TestCommon.hs
|
bsd-3-clause
|
hoistMaybe :: Monad m => Maybe a -> MaybeT m a
hoistMaybe = MaybeT . return
| 75
|
hoistMaybe :: Monad m => Maybe a -> MaybeT m a
hoistMaybe = MaybeT . return
| 75
|
hoistMaybe = MaybeT . return
| 28
| false
| true
| 1
| 8
| 15
| 41
| 17
| 24
| null | null |
glutamate/tnutils
|
hsbibtex.hs
|
bsd-3-clause
|
grammaticalList :: [String] -> String
grammaticalList [] = []
| 61
|
grammaticalList :: [String] -> String
grammaticalList [] = []
| 61
|
grammaticalList [] = []
| 23
| false
| true
| 0
| 6
| 8
| 25
| 13
| 12
| null | null |
bitemyapp/ghc
|
compiler/hsSyn/HsExpr.hs
|
bsd-3-clause
|
matchContextErrString (StmtCtxt MonadComp) = ptext (sLit "monad comprehension")
| 87
|
matchContextErrString (StmtCtxt MonadComp) = ptext (sLit "monad comprehension")
| 87
|
matchContextErrString (StmtCtxt MonadComp) = ptext (sLit "monad comprehension")
| 87
| false
| false
| 0
| 7
| 15
| 24
| 11
| 13
| null | null |
thielema/wxhaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcTypes.hs
|
lgpl-2.1
|
withArrayObjectResult :: (Ptr (Ptr a) -> IO CInt) -> IO [Object a]
withArrayObjectResult f
= do clen <- f nullPtr
let len = fromCInt clen
if (len <= 0)
then return []
else allocaArray len $ \carr ->
do f carr
ps <- peekArray len carr
return (map objectFromPtr ps)
| 340
|
withArrayObjectResult :: (Ptr (Ptr a) -> IO CInt) -> IO [Object a]
withArrayObjectResult f
= do clen <- f nullPtr
let len = fromCInt clen
if (len <= 0)
then return []
else allocaArray len $ \carr ->
do f carr
ps <- peekArray len carr
return (map objectFromPtr ps)
| 340
|
withArrayObjectResult f
= do clen <- f nullPtr
let len = fromCInt clen
if (len <= 0)
then return []
else allocaArray len $ \carr ->
do f carr
ps <- peekArray len carr
return (map objectFromPtr ps)
| 273
| false
| true
| 0
| 14
| 126
| 135
| 62
| 73
| null | null |
Teaspot-Studio/metagraph
|
src/Data/Metagraph/Internal/Types.hs
|
bsd-3-clause
|
-- | Helper to check if the flag is undirected
isUndirected :: Directed -> Bool
isUndirected Undirected = True
| 110
|
isUndirected :: Directed -> Bool
isUndirected Undirected = True
| 63
|
isUndirected Undirected = True
| 30
| true
| true
| 0
| 5
| 18
| 19
| 10
| 9
| null | null |
liyanchang/scheme-in-haskell
|
src/chp6.hs
|
mit
|
eqv [(DottedList xs x), (DottedList ys y)] = eqv [List $ xs ++ [x], List $ ys ++ [y]]
| 85
|
eqv [(DottedList xs x), (DottedList ys y)] = eqv [List $ xs ++ [x], List $ ys ++ [y]]
| 85
|
eqv [(DottedList xs x), (DottedList ys y)] = eqv [List $ xs ++ [x], List $ ys ++ [y]]
| 85
| false
| false
| 0
| 8
| 18
| 63
| 33
| 30
| null | null |
joeyadams/haskell-stm-tlist
|
examples/TChan.hs
|
bsd-3-clause
|
isEmptyTChan :: TChan a -> STM Bool
isEmptyTChan TChan{..} =
readTVar readEnd >>= TList.null
| 96
|
isEmptyTChan :: TChan a -> STM Bool
isEmptyTChan TChan{..} =
readTVar readEnd >>= TList.null
| 96
|
isEmptyTChan TChan{..} =
readTVar readEnd >>= TList.null
| 60
| false
| true
| 0
| 7
| 17
| 39
| 18
| 21
| null | null |
shimmercat/second-transfer
|
hs-src/SecondTransfer/TLS/Botan.hs
|
bsd-3-clause
|
unencryptChannelData :: TLSServerIO a => BotanTLSContext -> a -> IO BotanSession
unencryptChannelData botan_ctx tls_data = do
let
fctx = botan_ctx ^. cppSide_BTC
tls_io_callbacks <- handshake tls_data
data_came_mvar <- newEmptyMVar
handshake_completed_mvar <- newEmptyMVar
problem_mvar <- newEmptyMVar
selected_protocol_mvar <- newEmptyMVar
active_mvar <- newMVar ()
tls_channel_ioref <- newIORef (error "")
avail_data_ioref <- newIORef ""
write_lock_mvar <- newMVar ()
let
new_botan_pad = BotanPad {
-- Callbacks with encrypted data
_encryptedSide_BP = tls_io_callbacks
-- Pointer to the C-side Botan context.
, _tlsChannel_BP = tls_channel_ioref
-- The two variables below are notification vars for data flowing
-- in each of the two directions
, _availableData_BP = avail_data_ioref
, _dataCame_BP = data_came_mvar
-- Signals that the handshake has completed
, _handshakeCompleted_BP = handshake_completed_mvar
-- Exclusive lock for writing and interacting with Botan
, _writeLock_BP = write_lock_mvar
, _selectedProtocol_BP = selected_protocol_mvar
-- Signal to read-write pumps that there has been a problem, and that
-- no normal client data should be transported.
, _problem_BP = problem_mvar
-- Full by default, when the connection is active, otherwise it
-- is empty (closeBotan empties this variable.)
, _active_BP = active_mvar
}
--tls_pull_data_action = tls_io_callbacks ^. bestEffortPullAction_IOC
tls_channel_ptr <- withForeignPtr fctx $ \ x -> iocba_new_tls_server_channel x
-- tls_channel_fptr <- newForeignPtr iocba_delete_server_channel
tls_channel_fptr <- newForeignPtr_ tls_channel_ptr
writeIORef tls_channel_ioref tls_channel_fptr
result <- newIORef new_botan_pad
_ <- mkWeakIORef result $ do
closeBotan new_botan_pad
-- freeStablePtr botan_pad_stable_ref
-- Create the pump thread
_ <- forkIOExc "BotanPump" (encryptedToBotan new_botan_pad)
return $ BotanSession result
| 2,283
|
unencryptChannelData :: TLSServerIO a => BotanTLSContext -> a -> IO BotanSession
unencryptChannelData botan_ctx tls_data = do
let
fctx = botan_ctx ^. cppSide_BTC
tls_io_callbacks <- handshake tls_data
data_came_mvar <- newEmptyMVar
handshake_completed_mvar <- newEmptyMVar
problem_mvar <- newEmptyMVar
selected_protocol_mvar <- newEmptyMVar
active_mvar <- newMVar ()
tls_channel_ioref <- newIORef (error "")
avail_data_ioref <- newIORef ""
write_lock_mvar <- newMVar ()
let
new_botan_pad = BotanPad {
-- Callbacks with encrypted data
_encryptedSide_BP = tls_io_callbacks
-- Pointer to the C-side Botan context.
, _tlsChannel_BP = tls_channel_ioref
-- The two variables below are notification vars for data flowing
-- in each of the two directions
, _availableData_BP = avail_data_ioref
, _dataCame_BP = data_came_mvar
-- Signals that the handshake has completed
, _handshakeCompleted_BP = handshake_completed_mvar
-- Exclusive lock for writing and interacting with Botan
, _writeLock_BP = write_lock_mvar
, _selectedProtocol_BP = selected_protocol_mvar
-- Signal to read-write pumps that there has been a problem, and that
-- no normal client data should be transported.
, _problem_BP = problem_mvar
-- Full by default, when the connection is active, otherwise it
-- is empty (closeBotan empties this variable.)
, _active_BP = active_mvar
}
--tls_pull_data_action = tls_io_callbacks ^. bestEffortPullAction_IOC
tls_channel_ptr <- withForeignPtr fctx $ \ x -> iocba_new_tls_server_channel x
-- tls_channel_fptr <- newForeignPtr iocba_delete_server_channel
tls_channel_fptr <- newForeignPtr_ tls_channel_ptr
writeIORef tls_channel_ioref tls_channel_fptr
result <- newIORef new_botan_pad
_ <- mkWeakIORef result $ do
closeBotan new_botan_pad
-- freeStablePtr botan_pad_stable_ref
-- Create the pump thread
_ <- forkIOExc "BotanPump" (encryptedToBotan new_botan_pad)
return $ BotanSession result
| 2,283
|
unencryptChannelData botan_ctx tls_data = do
let
fctx = botan_ctx ^. cppSide_BTC
tls_io_callbacks <- handshake tls_data
data_came_mvar <- newEmptyMVar
handshake_completed_mvar <- newEmptyMVar
problem_mvar <- newEmptyMVar
selected_protocol_mvar <- newEmptyMVar
active_mvar <- newMVar ()
tls_channel_ioref <- newIORef (error "")
avail_data_ioref <- newIORef ""
write_lock_mvar <- newMVar ()
let
new_botan_pad = BotanPad {
-- Callbacks with encrypted data
_encryptedSide_BP = tls_io_callbacks
-- Pointer to the C-side Botan context.
, _tlsChannel_BP = tls_channel_ioref
-- The two variables below are notification vars for data flowing
-- in each of the two directions
, _availableData_BP = avail_data_ioref
, _dataCame_BP = data_came_mvar
-- Signals that the handshake has completed
, _handshakeCompleted_BP = handshake_completed_mvar
-- Exclusive lock for writing and interacting with Botan
, _writeLock_BP = write_lock_mvar
, _selectedProtocol_BP = selected_protocol_mvar
-- Signal to read-write pumps that there has been a problem, and that
-- no normal client data should be transported.
, _problem_BP = problem_mvar
-- Full by default, when the connection is active, otherwise it
-- is empty (closeBotan empties this variable.)
, _active_BP = active_mvar
}
--tls_pull_data_action = tls_io_callbacks ^. bestEffortPullAction_IOC
tls_channel_ptr <- withForeignPtr fctx $ \ x -> iocba_new_tls_server_channel x
-- tls_channel_fptr <- newForeignPtr iocba_delete_server_channel
tls_channel_fptr <- newForeignPtr_ tls_channel_ptr
writeIORef tls_channel_ioref tls_channel_fptr
result <- newIORef new_botan_pad
_ <- mkWeakIORef result $ do
closeBotan new_botan_pad
-- freeStablePtr botan_pad_stable_ref
-- Create the pump thread
_ <- forkIOExc "BotanPump" (encryptedToBotan new_botan_pad)
return $ BotanSession result
| 2,200
| false
| true
| 0
| 11
| 629
| 312
| 155
| 157
| null | null |
anchor/openstack-api
|
lib/OpenStack/Keystone.hs
|
bsd-3-clause
|
keystoneMethods :: String -> Either String KeystoneMethods
keystoneMethods url = do
baseUrl <- parseBaseUrl url
let (requestToken' :<|>
listDomains' :<|>
createProject' :<|>
deleteProject' :<|>
createUser' :<|>
deleteUser') = client keystoneApi
requestToken req = coerce $ do
(status,body,ct,res) <- requestToken' req "POST" baseUrl
unless (status == 201) $ throwError $ FailureResponse (Status status "") ct body
case lookup "X-Subject-Token" $ responseHeaders res of
Nothing -> throwError $ DecodeFailure "X-Subject-Token not present" ct body
Just x -> return $ TokenId x
listDomains token =
coerce $ listDomains' (Just token) baseUrl
createProject token req =
coerce $ createProject' req (Just token) baseUrl
deleteProject token pid =
coerce $ deleteProject' pid (Just token) baseUrl
createUser token req =
coerce $ createUser' req (Just token) baseUrl
deleteUser token user =
coerce $ deleteUser' user (Just token) baseUrl
return KeystoneMethods{..}
| 1,186
|
keystoneMethods :: String -> Either String KeystoneMethods
keystoneMethods url = do
baseUrl <- parseBaseUrl url
let (requestToken' :<|>
listDomains' :<|>
createProject' :<|>
deleteProject' :<|>
createUser' :<|>
deleteUser') = client keystoneApi
requestToken req = coerce $ do
(status,body,ct,res) <- requestToken' req "POST" baseUrl
unless (status == 201) $ throwError $ FailureResponse (Status status "") ct body
case lookup "X-Subject-Token" $ responseHeaders res of
Nothing -> throwError $ DecodeFailure "X-Subject-Token not present" ct body
Just x -> return $ TokenId x
listDomains token =
coerce $ listDomains' (Just token) baseUrl
createProject token req =
coerce $ createProject' req (Just token) baseUrl
deleteProject token pid =
coerce $ deleteProject' pid (Just token) baseUrl
createUser token req =
coerce $ createUser' req (Just token) baseUrl
deleteUser token user =
coerce $ deleteUser' user (Just token) baseUrl
return KeystoneMethods{..}
| 1,186
|
keystoneMethods url = do
baseUrl <- parseBaseUrl url
let (requestToken' :<|>
listDomains' :<|>
createProject' :<|>
deleteProject' :<|>
createUser' :<|>
deleteUser') = client keystoneApi
requestToken req = coerce $ do
(status,body,ct,res) <- requestToken' req "POST" baseUrl
unless (status == 201) $ throwError $ FailureResponse (Status status "") ct body
case lookup "X-Subject-Token" $ responseHeaders res of
Nothing -> throwError $ DecodeFailure "X-Subject-Token not present" ct body
Just x -> return $ TokenId x
listDomains token =
coerce $ listDomains' (Just token) baseUrl
createProject token req =
coerce $ createProject' req (Just token) baseUrl
deleteProject token pid =
coerce $ deleteProject' pid (Just token) baseUrl
createUser token req =
coerce $ createUser' req (Just token) baseUrl
deleteUser token user =
coerce $ deleteUser' user (Just token) baseUrl
return KeystoneMethods{..}
| 1,127
| false
| true
| 0
| 17
| 366
| 335
| 159
| 176
| null | null |
caioariede/tpll
|
src/Tpll/Tokenizer.hs
|
mit
|
-- | Get a token for the given string
--
-- Examples:
--
-- >>> getToken "{{ foo }}" 1
-- Just (Variable {content = "foo", line = 1, raw = "{{ foo }}"})
--
-- >>> getToken "{# bar #}" 1
-- Just (Comment {content = "bar", line = 1, raw = "{# bar #}"})
--
-- >>> getToken "{% x y z %}" 1
-- Just (Tag {content = "x y z", line = 1, raw = "{% x y z %}"})
getToken :: String -> Int -> Maybe Token
getToken text ln =
case take 2 text of
"{{" ->
Just Variable { content = tagText text, line = ln, raw = text }
"{#" ->
Just Comment { content = tagText text, line = ln, raw = text }
"{%" ->
Just Tag { content = tagText text, line = ln, raw = text }
_ ->
Nothing
-- | Split tokens at given token part
--
-- Examples:
--
-- >>> let a = Variable { content = "foo", line = 1, raw = "{{ foo }}" }
-- >>> let b = Tag { content = "x", line = 1, raw = "{% x %}" }
-- >>> let c = Variable { content = "bar", line = 2, raw = "{{ bar }}" }
-- >>> let d = Text { content = "y", line = 2, raw = "" }
-- >>>
-- >>> let tokens = [a, b, c, d]
-- >>> let ([a], [c, d]) = splitTokensAt "x|bar" tokens
| 1,160
|
getToken :: String -> Int -> Maybe Token
getToken text ln =
case take 2 text of
"{{" ->
Just Variable { content = tagText text, line = ln, raw = text }
"{#" ->
Just Comment { content = tagText text, line = ln, raw = text }
"{%" ->
Just Tag { content = tagText text, line = ln, raw = text }
_ ->
Nothing
-- | Split tokens at given token part
--
-- Examples:
--
-- >>> let a = Variable { content = "foo", line = 1, raw = "{{ foo }}" }
-- >>> let b = Tag { content = "x", line = 1, raw = "{% x %}" }
-- >>> let c = Variable { content = "bar", line = 2, raw = "{{ bar }}" }
-- >>> let d = Text { content = "y", line = 2, raw = "" }
-- >>>
-- >>> let tokens = [a, b, c, d]
-- >>> let ([a], [c, d]) = splitTokensAt "x|bar" tokens
| 809
|
getToken text ln =
case take 2 text of
"{{" ->
Just Variable { content = tagText text, line = ln, raw = text }
"{#" ->
Just Comment { content = tagText text, line = ln, raw = text }
"{%" ->
Just Tag { content = tagText text, line = ln, raw = text }
_ ->
Nothing
-- | Split tokens at given token part
--
-- Examples:
--
-- >>> let a = Variable { content = "foo", line = 1, raw = "{{ foo }}" }
-- >>> let b = Tag { content = "x", line = 1, raw = "{% x %}" }
-- >>> let c = Variable { content = "bar", line = 2, raw = "{{ bar }}" }
-- >>> let d = Text { content = "y", line = 2, raw = "" }
-- >>>
-- >>> let tokens = [a, b, c, d]
-- >>> let ([a], [c, d]) = splitTokensAt "x|bar" tokens
| 768
| true
| true
| 9
| 7
| 344
| 93
| 71
| 22
| null | null |
Soostone/blaze-markup-haste
|
src/Text/Blaze/Renderer/String.hs
|
bsd-3-clause
|
escapeMarkupEntities (c:cs) k = case c of
'<' -> '&' : 'l' : 't' : ';' : escapeMarkupEntities cs k
'>' -> '&' : 'g' : 't' : ';' : escapeMarkupEntities cs k
'&' -> '&' : 'a' : 'm' : 'p' : ';' : escapeMarkupEntities cs k
'"' -> '&' : 'q' : 'u' : 'o' : 't' : ';' : escapeMarkupEntities cs k
'\'' -> '&' : '#' : '3' : '9' : ';' : escapeMarkupEntities cs k
x -> x : escapeMarkupEntities cs k
-- | Render a 'ChoiceString'.
--
| 519
|
escapeMarkupEntities (c:cs) k = case c of
'<' -> '&' : 'l' : 't' : ';' : escapeMarkupEntities cs k
'>' -> '&' : 'g' : 't' : ';' : escapeMarkupEntities cs k
'&' -> '&' : 'a' : 'm' : 'p' : ';' : escapeMarkupEntities cs k
'"' -> '&' : 'q' : 'u' : 'o' : 't' : ';' : escapeMarkupEntities cs k
'\'' -> '&' : '#' : '3' : '9' : ';' : escapeMarkupEntities cs k
x -> x : escapeMarkupEntities cs k
-- | Render a 'ChoiceString'.
--
| 519
|
escapeMarkupEntities (c:cs) k = case c of
'<' -> '&' : 'l' : 't' : ';' : escapeMarkupEntities cs k
'>' -> '&' : 'g' : 't' : ';' : escapeMarkupEntities cs k
'&' -> '&' : 'a' : 'm' : 'p' : ';' : escapeMarkupEntities cs k
'"' -> '&' : 'q' : 'u' : 'o' : 't' : ';' : escapeMarkupEntities cs k
'\'' -> '&' : '#' : '3' : '9' : ';' : escapeMarkupEntities cs k
x -> x : escapeMarkupEntities cs k
-- | Render a 'ChoiceString'.
--
| 519
| false
| false
| 6
| 11
| 192
| 201
| 93
| 108
| null | null |
luzhuomi/cpp-obs
|
Language/C/Obfuscate/CFG.hs
|
apache-2.0
|
-- ^ get all variable from an expression, split them into lval and rval variables
getVarsFromExp :: AST.CExpression a -> ([Ident], [Ident])
getVarsFromExp (AST.CAssign AST.CAssignOp e1 e2 _) =
let (lvars1, rvars1) = getVarsFromLHS e1
(lvars2, rvars2) = getVarsFromExp e2
in (lvars1 +*+ lvars2, rvars1 +*+ rvars2)
| 324
|
getVarsFromExp :: AST.CExpression a -> ([Ident], [Ident])
getVarsFromExp (AST.CAssign AST.CAssignOp e1 e2 _) =
let (lvars1, rvars1) = getVarsFromLHS e1
(lvars2, rvars2) = getVarsFromExp e2
in (lvars1 +*+ lvars2, rvars1 +*+ rvars2)
| 242
|
getVarsFromExp (AST.CAssign AST.CAssignOp e1 e2 _) =
let (lvars1, rvars1) = getVarsFromLHS e1
(lvars2, rvars2) = getVarsFromExp e2
in (lvars1 +*+ lvars2, rvars1 +*+ rvars2)
| 184
| true
| true
| 0
| 9
| 58
| 102
| 54
| 48
| null | null |
elginer/Obelisk
|
Language/Obelisk/TypeChecker/Typed.hs
|
gpl-3.0
|
-- | Type unification. Can one type be unified with another? If not, report an error.
unify_types :: QType -> QType -> CodeFragment -> Maybe TypeError
unify_types ty1 ty2 cf =
if ty1 == ty2
then Nothing
else Just $ WrongType ty1 ty2 cf
| 253
|
unify_types :: QType -> QType -> CodeFragment -> Maybe TypeError
unify_types ty1 ty2 cf =
if ty1 == ty2
then Nothing
else Just $ WrongType ty1 ty2 cf
| 164
|
unify_types ty1 ty2 cf =
if ty1 == ty2
then Nothing
else Just $ WrongType ty1 ty2 cf
| 99
| true
| true
| 0
| 8
| 61
| 57
| 29
| 28
| null | null |
4e6/sandbox
|
haskell/Sandbox/Util.hs
|
mit
|
sliding_ 0 _ _ = []
| 20
|
sliding_ 0 _ _ = []
| 20
|
sliding_ 0 _ _ = []
| 20
| false
| false
| 0
| 5
| 6
| 15
| 7
| 8
| null | null |
hargettp/courier
|
src/Network/RPC/Typed.hs
|
mit
|
hear :: (Serialize a, Serialize r) => Endpoint -> Name -> Method -> IO (a,Reply r)
hear endpoint name method = do
(caller,rid,args) <- selectMessage endpoint $ typedMethodSelector method
return (args, reply caller rid)
where
reply caller rid result =
sendMessage endpoint caller $ encode $ Response rid name $ encode result
{-|
Same as 'hear', except return 'Nothing' if no request received within the specified
timeout (measured in microseconds), or return a 'Just' instance containing both the
method arguments and a 'Reply' function useful for sending the reply.
-}
| 585
|
hear :: (Serialize a, Serialize r) => Endpoint -> Name -> Method -> IO (a,Reply r)
hear endpoint name method = do
(caller,rid,args) <- selectMessage endpoint $ typedMethodSelector method
return (args, reply caller rid)
where
reply caller rid result =
sendMessage endpoint caller $ encode $ Response rid name $ encode result
{-|
Same as 'hear', except return 'Nothing' if no request received within the specified
timeout (measured in microseconds), or return a 'Just' instance containing both the
method arguments and a 'Reply' function useful for sending the reply.
-}
| 585
|
hear endpoint name method = do
(caller,rid,args) <- selectMessage endpoint $ typedMethodSelector method
return (args, reply caller rid)
where
reply caller rid result =
sendMessage endpoint caller $ encode $ Response rid name $ encode result
{-|
Same as 'hear', except return 'Nothing' if no request received within the specified
timeout (measured in microseconds), or return a 'Just' instance containing both the
method arguments and a 'Reply' function useful for sending the reply.
-}
| 502
| false
| true
| 0
| 11
| 106
| 146
| 70
| 76
| null | null |
mpickering/hackage-server
|
Distribution/Server/Framework/HappstackUtils.hs
|
bsd-3-clause
|
howContentType :: ContentType -> String
showContentType (ContentType x y ps) = x ++ "/" ++ y ++ showParameters ps
| 114
|
showContentType :: ContentType -> String
showContentType (ContentType x y ps) = x ++ "/" ++ y ++ showParameters ps
| 114
|
showContentType (ContentType x y ps) = x ++ "/" ++ y ++ showParameters ps
| 73
| false
| true
| 0
| 7
| 19
| 43
| 21
| 22
| null | null |
josefs/autosar
|
oldARSim/ARSim.hs
|
bsd-3-clause
|
say (RD _ res) (RInst a n c ex (Read _ cont)) = [RInst a n c ex (cont res)]
| 89
|
say (RD _ res) (RInst a n c ex (Read _ cont)) = [RInst a n c ex (cont res)]
| 89
|
say (RD _ res) (RInst a n c ex (Read _ cont)) = [RInst a n c ex (cont res)]
| 89
| false
| false
| 1
| 9
| 33
| 64
| 30
| 34
| null | null |
shlevy/ghc
|
compiler/cmm/PprC.hs
|
bsd-3-clause
|
castDoubleToWord64Array :: STUArray s Int Double -> ST s (STUArray s Int Word64)
castDoubleToWord64Array = U.castSTUArray
| 121
|
castDoubleToWord64Array :: STUArray s Int Double -> ST s (STUArray s Int Word64)
castDoubleToWord64Array = U.castSTUArray
| 121
|
castDoubleToWord64Array = U.castSTUArray
| 40
| false
| true
| 0
| 9
| 15
| 45
| 20
| 25
| null | null |
jwiegley/ghc-release
|
compiler/llvmGen/LlvmCodeGen/Base.hs
|
gpl-3.0
|
-- | Llvm Function type for Cmm function
llvmFunTy :: LiveGlobalRegs -> LlvmM LlvmType
llvmFunTy live = return . LMFunction =<< llvmFunSig' live (fsLit "a") ExternallyVisible
| 174
|
llvmFunTy :: LiveGlobalRegs -> LlvmM LlvmType
llvmFunTy live = return . LMFunction =<< llvmFunSig' live (fsLit "a") ExternallyVisible
| 133
|
llvmFunTy live = return . LMFunction =<< llvmFunSig' live (fsLit "a") ExternallyVisible
| 87
| true
| true
| 0
| 8
| 25
| 43
| 21
| 22
| null | null |
maple-shaft/HaskellTetris
|
src/HGame.hs
|
mit
|
animateLines :: HGame -> HGame
animateLines old = old { activeBoard = b { settledBlocks = newAnimatedSettledBlocks } }
where b = activeBoard old
clearableBlocks = L.concat $ findCompleteLines b
brightenedBlocks = L.map (\x -> x { blockColor = light $ blockColor x }) clearableBlocks
newAnimatedSettledBlocks = L.foldr (\x acc -> M.insert (coordinate x) x acc) (settledBlocks b) brightenedBlocks
| 420
|
animateLines :: HGame -> HGame
animateLines old = old { activeBoard = b { settledBlocks = newAnimatedSettledBlocks } }
where b = activeBoard old
clearableBlocks = L.concat $ findCompleteLines b
brightenedBlocks = L.map (\x -> x { blockColor = light $ blockColor x }) clearableBlocks
newAnimatedSettledBlocks = L.foldr (\x acc -> M.insert (coordinate x) x acc) (settledBlocks b) brightenedBlocks
| 420
|
animateLines old = old { activeBoard = b { settledBlocks = newAnimatedSettledBlocks } }
where b = activeBoard old
clearableBlocks = L.concat $ findCompleteLines b
brightenedBlocks = L.map (\x -> x { blockColor = light $ blockColor x }) clearableBlocks
newAnimatedSettledBlocks = L.foldr (\x acc -> M.insert (coordinate x) x acc) (settledBlocks b) brightenedBlocks
| 389
| false
| true
| 3
| 12
| 84
| 140
| 73
| 67
| null | null |
kelnage/tamarin-prover
|
lib/theory/src/Theory.hs
|
gpl-3.0
|
-- | Add intruder proof rules to left cache.
addIntrRuleACsDiffLeft :: [IntrRuleAC] -> OpenDiffTheory -> OpenDiffTheory
addIntrRuleACsDiffLeft rs' thy = modify (diffThyCacheLeft) (\rs -> nub $ rs ++ rs') thy
| 207
|
addIntrRuleACsDiffLeft :: [IntrRuleAC] -> OpenDiffTheory -> OpenDiffTheory
addIntrRuleACsDiffLeft rs' thy = modify (diffThyCacheLeft) (\rs -> nub $ rs ++ rs') thy
| 162
|
addIntrRuleACsDiffLeft rs' thy = modify (diffThyCacheLeft) (\rs -> nub $ rs ++ rs') thy
| 87
| true
| true
| 0
| 9
| 29
| 59
| 30
| 29
| null | null |
jean-edouard/manager
|
disksync/Types.hs
|
gpl-2.0
|
stringOfReason ImageFailAccessDenied = "access-denied"
| 54
|
stringOfReason ImageFailAccessDenied = "access-denied"
| 54
|
stringOfReason ImageFailAccessDenied = "access-denied"
| 54
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
portnov/integration-server
|
THIS/Templates/Text.hs
|
lgpl-3.0
|
renderItem o vars (Lookup dict key def) = do
keyR <- renderItem o vars key
case lookupYaml o vars dict keyR def of
Left _ -> return def
Right val -> return val
| 184
|
renderItem o vars (Lookup dict key def) = do
keyR <- renderItem o vars key
case lookupYaml o vars dict keyR def of
Left _ -> return def
Right val -> return val
| 184
|
renderItem o vars (Lookup dict key def) = do
keyR <- renderItem o vars key
case lookupYaml o vars dict keyR def of
Left _ -> return def
Right val -> return val
| 184
| false
| false
| 0
| 10
| 57
| 79
| 35
| 44
| null | null |
Gabriel439/Haskell-Dhall-Library
|
dhall-openapi/openapi-to-dhall/Main.hs
|
bsd-3-clause
|
main :: IO ()
main = do
GHC.IO.Encoding.setLocaleEncoding System.IO.utf8
Options{..} <- Options.Applicative.execParser parserInfoOptions
let duplicateHandler =
if skipDuplicates
then skipDuplicatesHandler
else preferStableResource
-- Get the Definitions
defs <-
if crd then do
crdFile <- eitherDecodeFileStrict filename
case crdFile of
Left e -> do
fail $ "Unable to decode the CRD file. " <> show e
Right s -> do
case Convert.toDefinition s of
Left text -> do
fail (Text.unpack text)
Right result -> do
return (Data.Map.fromList [result])
else do
swaggerFile <- decodeFileStrict filename
case swaggerFile of
Nothing -> fail "Unable to decode the Swagger file"
Just (Swagger{..}) -> pure definitions
let fix m = Data.Map.adjust patchCyclicImports (ModelName m)
let fixedDefs =
-- TODO: find a better way to deal with this cyclic import
( fix "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps"
. fix "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps"
. fix "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps.dhall"
) defs
-- Convert to Dhall types in a Map
let types = Convert.toTypes prefixMap (Convert.pathSplitter splits) preferNaturalInt natIntExceptions fixedDefs
-- Output to types
Directory.createDirectoryIfMissing True "types"
for_ (Data.Map.toList types) $ \(ModelName name, expr) -> do
let path = "./types" </> unpack name <> ".dhall"
writeDhall path expr
-- Convert from Dhall types to defaults
let defaults = Data.Map.mapMaybeWithKey (Convert.toDefault prefixMap fixedDefs) types
-- Output to defaults
Directory.createDirectoryIfMissing True "defaults"
for_ (Data.Map.toList defaults) $ \(ModelName name, expr) -> do
let path = "./defaults" </> unpack name <> ".dhall"
writeDhall path expr
let mkEmbedField = Dhall.makeRecordField . Dhall.Embed
let toSchema (ModelName key) _ _ =
Dhall.RecordLit
[ ("Type", mkEmbedField (Convert.mkImport prefixMap ["types", ".."] (key <> ".dhall")))
, ("default", mkEmbedField (Convert.mkImport prefixMap ["defaults", ".."] (key <> ".dhall")))
]
let schemas = Data.Map.intersectionWithKey toSchema types defaults
let package =
Combine
mempty
Nothing
(Embed (Convert.mkImport prefixMap [ ] "schemas.dhall"))
(RecordLit
[ ( "IntOrString"
, Dhall.makeRecordField $ Field (Embed (Convert.mkImport prefixMap [ ] "types.dhall")) $ Dhall.makeFieldSelection "IntOrString"
)
, ( "NatOrString"
, Dhall.makeRecordField $ Field (Embed (Convert.mkImport prefixMap [ ] "types.dhall")) $ Dhall.makeFieldSelection "NatOrString"
)
, ( "Resource", mkEmbedField (Convert.mkImport prefixMap [ ] "typesUnion.dhall"))
]
)
-- Output schemas that combine both the types and defaults
Directory.createDirectoryIfMissing True "schemas"
for_ (Data.Map.toList schemas) $ \(ModelName name, expr) -> do
let path = "./schemas" </> unpack name <> ".dhall"
writeDhall path expr
-- Output the types record, the defaults record, and the giant union type
let getImportsMap = Convert.getImportsMap prefixMap duplicateHandler objectNames
makeRecordMap = Dhall.Map.mapMaybe (Just . Dhall.makeRecordField)
objectNames = Data.Map.keys types
typesMap = getImportsMap "types" $ Data.Map.keys types
defaultsMap = getImportsMap "defaults" $ Data.Map.keys defaults
schemasMap = getImportsMap "schemas" $ Data.Map.keys schemas
typesRecordPath = "./types.dhall"
typesUnionPath = "./typesUnion.dhall"
defaultsRecordPath = "./defaults.dhall"
schemasRecordPath = "./schemas.dhall"
packageRecordPath = "./package.dhall"
writeDhall typesUnionPath (Dhall.Union $ fmap Just typesMap)
writeDhall typesRecordPath (Dhall.RecordLit $ makeRecordMap typesMap)
writeDhall defaultsRecordPath (Dhall.RecordLit $ makeRecordMap defaultsMap)
writeDhall schemasRecordPath (Dhall.RecordLit $ makeRecordMap schemasMap)
writeDhall packageRecordPath package
| 4,487
|
main :: IO ()
main = do
GHC.IO.Encoding.setLocaleEncoding System.IO.utf8
Options{..} <- Options.Applicative.execParser parserInfoOptions
let duplicateHandler =
if skipDuplicates
then skipDuplicatesHandler
else preferStableResource
-- Get the Definitions
defs <-
if crd then do
crdFile <- eitherDecodeFileStrict filename
case crdFile of
Left e -> do
fail $ "Unable to decode the CRD file. " <> show e
Right s -> do
case Convert.toDefinition s of
Left text -> do
fail (Text.unpack text)
Right result -> do
return (Data.Map.fromList [result])
else do
swaggerFile <- decodeFileStrict filename
case swaggerFile of
Nothing -> fail "Unable to decode the Swagger file"
Just (Swagger{..}) -> pure definitions
let fix m = Data.Map.adjust patchCyclicImports (ModelName m)
let fixedDefs =
-- TODO: find a better way to deal with this cyclic import
( fix "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps"
. fix "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps"
. fix "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps.dhall"
) defs
-- Convert to Dhall types in a Map
let types = Convert.toTypes prefixMap (Convert.pathSplitter splits) preferNaturalInt natIntExceptions fixedDefs
-- Output to types
Directory.createDirectoryIfMissing True "types"
for_ (Data.Map.toList types) $ \(ModelName name, expr) -> do
let path = "./types" </> unpack name <> ".dhall"
writeDhall path expr
-- Convert from Dhall types to defaults
let defaults = Data.Map.mapMaybeWithKey (Convert.toDefault prefixMap fixedDefs) types
-- Output to defaults
Directory.createDirectoryIfMissing True "defaults"
for_ (Data.Map.toList defaults) $ \(ModelName name, expr) -> do
let path = "./defaults" </> unpack name <> ".dhall"
writeDhall path expr
let mkEmbedField = Dhall.makeRecordField . Dhall.Embed
let toSchema (ModelName key) _ _ =
Dhall.RecordLit
[ ("Type", mkEmbedField (Convert.mkImport prefixMap ["types", ".."] (key <> ".dhall")))
, ("default", mkEmbedField (Convert.mkImport prefixMap ["defaults", ".."] (key <> ".dhall")))
]
let schemas = Data.Map.intersectionWithKey toSchema types defaults
let package =
Combine
mempty
Nothing
(Embed (Convert.mkImport prefixMap [ ] "schemas.dhall"))
(RecordLit
[ ( "IntOrString"
, Dhall.makeRecordField $ Field (Embed (Convert.mkImport prefixMap [ ] "types.dhall")) $ Dhall.makeFieldSelection "IntOrString"
)
, ( "NatOrString"
, Dhall.makeRecordField $ Field (Embed (Convert.mkImport prefixMap [ ] "types.dhall")) $ Dhall.makeFieldSelection "NatOrString"
)
, ( "Resource", mkEmbedField (Convert.mkImport prefixMap [ ] "typesUnion.dhall"))
]
)
-- Output schemas that combine both the types and defaults
Directory.createDirectoryIfMissing True "schemas"
for_ (Data.Map.toList schemas) $ \(ModelName name, expr) -> do
let path = "./schemas" </> unpack name <> ".dhall"
writeDhall path expr
-- Output the types record, the defaults record, and the giant union type
let getImportsMap = Convert.getImportsMap prefixMap duplicateHandler objectNames
makeRecordMap = Dhall.Map.mapMaybe (Just . Dhall.makeRecordField)
objectNames = Data.Map.keys types
typesMap = getImportsMap "types" $ Data.Map.keys types
defaultsMap = getImportsMap "defaults" $ Data.Map.keys defaults
schemasMap = getImportsMap "schemas" $ Data.Map.keys schemas
typesRecordPath = "./types.dhall"
typesUnionPath = "./typesUnion.dhall"
defaultsRecordPath = "./defaults.dhall"
schemasRecordPath = "./schemas.dhall"
packageRecordPath = "./package.dhall"
writeDhall typesUnionPath (Dhall.Union $ fmap Just typesMap)
writeDhall typesRecordPath (Dhall.RecordLit $ makeRecordMap typesMap)
writeDhall defaultsRecordPath (Dhall.RecordLit $ makeRecordMap defaultsMap)
writeDhall schemasRecordPath (Dhall.RecordLit $ makeRecordMap schemasMap)
writeDhall packageRecordPath package
| 4,487
|
main = do
GHC.IO.Encoding.setLocaleEncoding System.IO.utf8
Options{..} <- Options.Applicative.execParser parserInfoOptions
let duplicateHandler =
if skipDuplicates
then skipDuplicatesHandler
else preferStableResource
-- Get the Definitions
defs <-
if crd then do
crdFile <- eitherDecodeFileStrict filename
case crdFile of
Left e -> do
fail $ "Unable to decode the CRD file. " <> show e
Right s -> do
case Convert.toDefinition s of
Left text -> do
fail (Text.unpack text)
Right result -> do
return (Data.Map.fromList [result])
else do
swaggerFile <- decodeFileStrict filename
case swaggerFile of
Nothing -> fail "Unable to decode the Swagger file"
Just (Swagger{..}) -> pure definitions
let fix m = Data.Map.adjust patchCyclicImports (ModelName m)
let fixedDefs =
-- TODO: find a better way to deal with this cyclic import
( fix "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps"
. fix "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps"
. fix "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps.dhall"
) defs
-- Convert to Dhall types in a Map
let types = Convert.toTypes prefixMap (Convert.pathSplitter splits) preferNaturalInt natIntExceptions fixedDefs
-- Output to types
Directory.createDirectoryIfMissing True "types"
for_ (Data.Map.toList types) $ \(ModelName name, expr) -> do
let path = "./types" </> unpack name <> ".dhall"
writeDhall path expr
-- Convert from Dhall types to defaults
let defaults = Data.Map.mapMaybeWithKey (Convert.toDefault prefixMap fixedDefs) types
-- Output to defaults
Directory.createDirectoryIfMissing True "defaults"
for_ (Data.Map.toList defaults) $ \(ModelName name, expr) -> do
let path = "./defaults" </> unpack name <> ".dhall"
writeDhall path expr
let mkEmbedField = Dhall.makeRecordField . Dhall.Embed
let toSchema (ModelName key) _ _ =
Dhall.RecordLit
[ ("Type", mkEmbedField (Convert.mkImport prefixMap ["types", ".."] (key <> ".dhall")))
, ("default", mkEmbedField (Convert.mkImport prefixMap ["defaults", ".."] (key <> ".dhall")))
]
let schemas = Data.Map.intersectionWithKey toSchema types defaults
let package =
Combine
mempty
Nothing
(Embed (Convert.mkImport prefixMap [ ] "schemas.dhall"))
(RecordLit
[ ( "IntOrString"
, Dhall.makeRecordField $ Field (Embed (Convert.mkImport prefixMap [ ] "types.dhall")) $ Dhall.makeFieldSelection "IntOrString"
)
, ( "NatOrString"
, Dhall.makeRecordField $ Field (Embed (Convert.mkImport prefixMap [ ] "types.dhall")) $ Dhall.makeFieldSelection "NatOrString"
)
, ( "Resource", mkEmbedField (Convert.mkImport prefixMap [ ] "typesUnion.dhall"))
]
)
-- Output schemas that combine both the types and defaults
Directory.createDirectoryIfMissing True "schemas"
for_ (Data.Map.toList schemas) $ \(ModelName name, expr) -> do
let path = "./schemas" </> unpack name <> ".dhall"
writeDhall path expr
-- Output the types record, the defaults record, and the giant union type
let getImportsMap = Convert.getImportsMap prefixMap duplicateHandler objectNames
makeRecordMap = Dhall.Map.mapMaybe (Just . Dhall.makeRecordField)
objectNames = Data.Map.keys types
typesMap = getImportsMap "types" $ Data.Map.keys types
defaultsMap = getImportsMap "defaults" $ Data.Map.keys defaults
schemasMap = getImportsMap "schemas" $ Data.Map.keys schemas
typesRecordPath = "./types.dhall"
typesUnionPath = "./typesUnion.dhall"
defaultsRecordPath = "./defaults.dhall"
schemasRecordPath = "./schemas.dhall"
packageRecordPath = "./package.dhall"
writeDhall typesUnionPath (Dhall.Union $ fmap Just typesMap)
writeDhall typesRecordPath (Dhall.RecordLit $ makeRecordMap typesMap)
writeDhall defaultsRecordPath (Dhall.RecordLit $ makeRecordMap defaultsMap)
writeDhall schemasRecordPath (Dhall.RecordLit $ makeRecordMap schemasMap)
writeDhall packageRecordPath package
| 4,473
| false
| true
| 1
| 25
| 1,126
| 1,097
| 532
| 565
| null | null |
Forec/learn
|
2017.1/haskell-interpreter/h2lang.hs
|
mit
|
calc "<=" (Value v1') (Value v2') = Boolean (v1' <= v2')
| 60
|
calc "<=" (Value v1') (Value v2') = Boolean (v1' <= v2')
| 60
|
calc "<=" (Value v1') (Value v2') = Boolean (v1' <= v2')
| 60
| false
| false
| 0
| 7
| 14
| 35
| 17
| 18
| null | null |
unisonweb/platform
|
parser-typechecker/src/Unison/CommandLine/InputPattern.hs
|
mit
|
argType :: InputPattern -> Int -> Maybe ArgumentType
argType ip i = go (i, args ip) where
-- Strategy: all of these input patterns take some number of arguments.
-- If it takes no arguments, then don't autocomplete.
go (_, []) = Nothing
-- If requesting the 0th of >=1 arguments, return it.
go (0, (_, t) : _) = Just t
-- Vararg parameters should appear at the end of the arg list, and work for
-- any later argument number.
go (_, [(ZeroPlus, t)]) = Just t
go (_, [(OnePlus, t)]) = Just t
-- Optional parameters only work at position 0, under this countdown scheme.
go (_, [(Optional, _)]) = Nothing
-- If requesting a later parameter, decrement and drop one.
go (n, (Required, _) : args) = go (n - 1, args)
-- The argument list spec is invalid if something follows optional or vararg
go _ = error $ "Input pattern " <> show (patternName ip)
<> " has an invalid argument list: " <> (show . fmap fst) (args ip)
| 944
|
argType :: InputPattern -> Int -> Maybe ArgumentType
argType ip i = go (i, args ip) where
-- Strategy: all of these input patterns take some number of arguments.
-- If it takes no arguments, then don't autocomplete.
go (_, []) = Nothing
-- If requesting the 0th of >=1 arguments, return it.
go (0, (_, t) : _) = Just t
-- Vararg parameters should appear at the end of the arg list, and work for
-- any later argument number.
go (_, [(ZeroPlus, t)]) = Just t
go (_, [(OnePlus, t)]) = Just t
-- Optional parameters only work at position 0, under this countdown scheme.
go (_, [(Optional, _)]) = Nothing
-- If requesting a later parameter, decrement and drop one.
go (n, (Required, _) : args) = go (n - 1, args)
-- The argument list spec is invalid if something follows optional or vararg
go _ = error $ "Input pattern " <> show (patternName ip)
<> " has an invalid argument list: " <> (show . fmap fst) (args ip)
| 944
|
argType ip i = go (i, args ip) where
-- Strategy: all of these input patterns take some number of arguments.
-- If it takes no arguments, then don't autocomplete.
go (_, []) = Nothing
-- If requesting the 0th of >=1 arguments, return it.
go (0, (_, t) : _) = Just t
-- Vararg parameters should appear at the end of the arg list, and work for
-- any later argument number.
go (_, [(ZeroPlus, t)]) = Just t
go (_, [(OnePlus, t)]) = Just t
-- Optional parameters only work at position 0, under this countdown scheme.
go (_, [(Optional, _)]) = Nothing
-- If requesting a later parameter, decrement and drop one.
go (n, (Required, _) : args) = go (n - 1, args)
-- The argument list spec is invalid if something follows optional or vararg
go _ = error $ "Input pattern " <> show (patternName ip)
<> " has an invalid argument list: " <> (show . fmap fst) (args ip)
| 891
| false
| true
| 0
| 10
| 209
| 255
| 142
| 113
| null | null |
cstrahan/nikki
|
src/Distribution/AutoUpdate.hs
|
lgpl-3.0
|
withBackup :: Application -> (Prose -> IO ()) -> DeployPath
-> ErrorT String IO a -> ErrorT String IO a
withBackup app logCommand (DeployPath deployPath) action = do
deployedFiles <- io $ sort <$> getDirectoryRealContents deployPath
tmpDir <- io $ createTempDirectory deployPath "temporaryBackup"
let backup :: ErrorT String IO ()
backup = do
forM_ deployedFiles $ \ f ->
rename (deployPath </> f) (tmpDir </> f)
restore :: ErrorT String IO ()
restore = do
io $ logCommand (p "restoring backup")
forM_ deployedFiles $ \ f -> do
let dest = deployPath </> f
io $ removeIfExists dest
rename (tmpDir </> f) dest
backup
result <- catchError
(action `onException` restore)
(\ errorMessage -> restore >> throwError errorMessage)
return result
where
-- | renaming directories and files
rename :: FilePath -> FilePath -> ErrorT String IO ()
rename src dest = do
isFile <- io $ doesFileExist src
isDirectory <- io $ doesDirectoryExist src
if isFile then
io $ renameFile src dest
else if isDirectory then
io $ renameDirectory src dest
else
throwError ("file not found: " ++ src)
-- | installs the update
| 1,374
|
withBackup :: Application -> (Prose -> IO ()) -> DeployPath
-> ErrorT String IO a -> ErrorT String IO a
withBackup app logCommand (DeployPath deployPath) action = do
deployedFiles <- io $ sort <$> getDirectoryRealContents deployPath
tmpDir <- io $ createTempDirectory deployPath "temporaryBackup"
let backup :: ErrorT String IO ()
backup = do
forM_ deployedFiles $ \ f ->
rename (deployPath </> f) (tmpDir </> f)
restore :: ErrorT String IO ()
restore = do
io $ logCommand (p "restoring backup")
forM_ deployedFiles $ \ f -> do
let dest = deployPath </> f
io $ removeIfExists dest
rename (tmpDir </> f) dest
backup
result <- catchError
(action `onException` restore)
(\ errorMessage -> restore >> throwError errorMessage)
return result
where
-- | renaming directories and files
rename :: FilePath -> FilePath -> ErrorT String IO ()
rename src dest = do
isFile <- io $ doesFileExist src
isDirectory <- io $ doesDirectoryExist src
if isFile then
io $ renameFile src dest
else if isDirectory then
io $ renameDirectory src dest
else
throwError ("file not found: " ++ src)
-- | installs the update
| 1,374
|
withBackup app logCommand (DeployPath deployPath) action = do
deployedFiles <- io $ sort <$> getDirectoryRealContents deployPath
tmpDir <- io $ createTempDirectory deployPath "temporaryBackup"
let backup :: ErrorT String IO ()
backup = do
forM_ deployedFiles $ \ f ->
rename (deployPath </> f) (tmpDir </> f)
restore :: ErrorT String IO ()
restore = do
io $ logCommand (p "restoring backup")
forM_ deployedFiles $ \ f -> do
let dest = deployPath </> f
io $ removeIfExists dest
rename (tmpDir </> f) dest
backup
result <- catchError
(action `onException` restore)
(\ errorMessage -> restore >> throwError errorMessage)
return result
where
-- | renaming directories and files
rename :: FilePath -> FilePath -> ErrorT String IO ()
rename src dest = do
isFile <- io $ doesFileExist src
isDirectory <- io $ doesDirectoryExist src
if isFile then
io $ renameFile src dest
else if isDirectory then
io $ renameDirectory src dest
else
throwError ("file not found: " ++ src)
-- | installs the update
| 1,266
| false
| true
| 0
| 19
| 464
| 405
| 194
| 211
| null | null |
rvion/ride
|
jetpack/src/Codec/Archive/Tar/Entry/AsTar.hs
|
bsd-3-clause
|
-- tar_executableFilePermissions :: Permissions
tar_executableFilePermissions = I.executableFilePermissions
| 107
|
tar_executableFilePermissions = I.executableFilePermissions
| 59
|
tar_executableFilePermissions = I.executableFilePermissions
| 59
| true
| false
| 0
| 5
| 6
| 9
| 5
| 4
| null | null |
juanbono/my-scheme
|
src/Parser.hs
|
bsd-3-clause
|
parseCharacter :: Parser LispVal
parseCharacter = do _ <- string "#\\"
s <- many letter
(return . Character) $ case map toLower s of
"spaces" -> ' '
"" -> ' '
"newline" -> '\n'
[x] -> x
-- Parseo de tipos numericos
| 449
|
parseCharacter :: Parser LispVal
parseCharacter = do _ <- string "#\\"
s <- many letter
(return . Character) $ case map toLower s of
"spaces" -> ' '
"" -> ' '
"newline" -> '\n'
[x] -> x
-- Parseo de tipos numericos
| 449
|
parseCharacter = do _ <- string "#\\"
s <- many letter
(return . Character) $ case map toLower s of
"spaces" -> ' '
"" -> ' '
"newline" -> '\n'
[x] -> x
-- Parseo de tipos numericos
| 416
| false
| true
| 0
| 12
| 277
| 92
| 42
| 50
| null | null |
frontrowed/stratosphere
|
library-gen/Stratosphere/ResourceProperties/ElasticLoadBalancingLoadBalancerHealthCheck.hs
|
mit
|
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-health-check.html#cfn-elb-healthcheck-interval
elblbhcInterval :: Lens' ElasticLoadBalancingLoadBalancerHealthCheck (Val Text)
elblbhcInterval = lens _elasticLoadBalancingLoadBalancerHealthCheckInterval (\s a -> s { _elasticLoadBalancingLoadBalancerHealthCheckInterval = a })
| 365
|
elblbhcInterval :: Lens' ElasticLoadBalancingLoadBalancerHealthCheck (Val Text)
elblbhcInterval = lens _elasticLoadBalancingLoadBalancerHealthCheckInterval (\s a -> s { _elasticLoadBalancingLoadBalancerHealthCheckInterval = a })
| 228
|
elblbhcInterval = lens _elasticLoadBalancingLoadBalancerHealthCheckInterval (\s a -> s { _elasticLoadBalancingLoadBalancerHealthCheckInterval = a })
| 148
| true
| true
| 1
| 9
| 21
| 51
| 25
| 26
| null | null |
ttylec/positive-maps
|
HPositive.hs
|
gpl-2.0
|
addCounts :: [HVec] -> [(HVec, [Int])]
addCounts vs = map (\x -> (x, counts x)) $ vs
where
n = round . sqrt . fromIntegral . dim $ head vs
counts x = map ((partialTraceCheck x) . (basis n)) $ [1..n]
partialTraceCheck x y
| (magnitude $ unitalTrace (proj x) (proj y)) > 0 = 1
| otherwise = 0
-- Interface
| 357
|
addCounts :: [HVec] -> [(HVec, [Int])]
addCounts vs = map (\x -> (x, counts x)) $ vs
where
n = round . sqrt . fromIntegral . dim $ head vs
counts x = map ((partialTraceCheck x) . (basis n)) $ [1..n]
partialTraceCheck x y
| (magnitude $ unitalTrace (proj x) (proj y)) > 0 = 1
| otherwise = 0
-- Interface
| 357
|
addCounts vs = map (\x -> (x, counts x)) $ vs
where
n = round . sqrt . fromIntegral . dim $ head vs
counts x = map ((partialTraceCheck x) . (basis n)) $ [1..n]
partialTraceCheck x y
| (magnitude $ unitalTrace (proj x) (proj y)) > 0 = 1
| otherwise = 0
-- Interface
| 318
| false
| true
| 4
| 13
| 115
| 188
| 92
| 96
| null | null |
haroldcarr/learn-haskell-coq-ml-etc
|
haskell/topic/type-level/2019-04-travis-whitaker-discovering-datakinds-at-runtime/src/HC1.hs
|
unlicense
|
h1'' = it "h1''" $ (mkN 1 :: Either Text (N 1)) `shouldBe` Right (N 1)
| 73
|
h1'' = it "h1''" $ (mkN 1 :: Either Text (N 1)) `shouldBe` Right (N 1)
| 73
|
h1'' = it "h1''" $ (mkN 1 :: Either Text (N 1)) `shouldBe` Right (N 1)
| 73
| false
| false
| 1
| 10
| 18
| 51
| 24
| 27
| null | null |
jozefg/f2js
|
src/Language/F2JS/CodeGen.hs
|
mit
|
atom (LitAtom l) = mkLit (lit l)
| 32
|
atom (LitAtom l) = mkLit (lit l)
| 32
|
atom (LitAtom l) = mkLit (lit l)
| 32
| false
| false
| 0
| 6
| 6
| 25
| 11
| 14
| null | null |
raichoo/Idris-dev
|
src/Idris/AbsSyntaxTree.hs
|
bsd-3-clause
|
eInfoNames :: ElabInfo -> [Name]
eInfoNames info = map fst (params info) ++ M.keys (inblock info)
| 97
|
eInfoNames :: ElabInfo -> [Name]
eInfoNames info = map fst (params info) ++ M.keys (inblock info)
| 97
|
eInfoNames info = map fst (params info) ++ M.keys (inblock info)
| 64
| false
| true
| 0
| 8
| 15
| 47
| 23
| 24
| null | null |
Cognimeta/cognimeta-utils
|
src/Cgm/Data/LongWord.hs
|
apache-2.0
|
word128BE = Word128
| 19
|
word128BE = Word128
| 19
|
word128BE = Word128
| 19
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
agentm/project-m36
|
src/lib/ProjectM36/Client.hs
|
unlicense
|
headTransactionId sessionId conn@(RemoteConnection _) = remoteCall conn (RetrieveHeadTransactionId sessionId)
| 109
|
headTransactionId sessionId conn@(RemoteConnection _) = remoteCall conn (RetrieveHeadTransactionId sessionId)
| 109
|
headTransactionId sessionId conn@(RemoteConnection _) = remoteCall conn (RetrieveHeadTransactionId sessionId)
| 109
| false
| false
| 0
| 8
| 8
| 31
| 15
| 16
| null | null |
eniac314/wizzard
|
src/WorldUpdates.hs
|
gpl-3.0
|
addShark :: Int -> Seed -> World -> World
addShark n s w =
let lnd = getTiles w
m1 = slow 15 [[Being Shark1]]
m2 = slow 15 [[Being Shark2]]
m3 = slow 15 [[Being Shark3]]
m4 = slow 25 [[Being Shark4]]
f = m1 ++ m2 ++ m3 ++ m4
in addRandom w f (\ind -> (Water Deep2) == (getGround (lnd § ind))) n s False
| 337
|
addShark :: Int -> Seed -> World -> World
addShark n s w =
let lnd = getTiles w
m1 = slow 15 [[Being Shark1]]
m2 = slow 15 [[Being Shark2]]
m3 = slow 15 [[Being Shark3]]
m4 = slow 25 [[Being Shark4]]
f = m1 ++ m2 ++ m3 ++ m4
in addRandom w f (\ind -> (Water Deep2) == (getGround (lnd § ind))) n s False
| 337
|
addShark n s w =
let lnd = getTiles w
m1 = slow 15 [[Being Shark1]]
m2 = slow 15 [[Being Shark2]]
m3 = slow 15 [[Being Shark3]]
m4 = slow 25 [[Being Shark4]]
f = m1 ++ m2 ++ m3 ++ m4
in addRandom w f (\ind -> (Water Deep2) == (getGround (lnd § ind))) n s False
| 295
| false
| true
| 0
| 12
| 102
| 189
| 94
| 95
| null | null |
fpco/minghc
|
minghc-post-install.hs
|
mit
|
handleArg
:: FilePath -- ^ 7z.exe
-> FilePath -- ^ command line argument
-> IO ()
handleArg sevenz arg = do
putStrLn $ show (sevenz, arg, base, ext)
case ext of
".7z" -> un7z base sevenz arg
".xz" -> do
un7z (takeDirectory base) sevenz arg
handleArg sevenz base
".tar" -> un7z (takeDirectory base) sevenz arg
_ -> error $ "handleArg: " ++ show (sevenz, arg, base, ext)
where
(base, ext) = splitExtension arg
| 489
|
handleArg
:: FilePath -- ^ 7z.exe
-> FilePath -- ^ command line argument
-> IO ()
handleArg sevenz arg = do
putStrLn $ show (sevenz, arg, base, ext)
case ext of
".7z" -> un7z base sevenz arg
".xz" -> do
un7z (takeDirectory base) sevenz arg
handleArg sevenz base
".tar" -> un7z (takeDirectory base) sevenz arg
_ -> error $ "handleArg: " ++ show (sevenz, arg, base, ext)
where
(base, ext) = splitExtension arg
| 489
|
handleArg sevenz arg = do
putStrLn $ show (sevenz, arg, base, ext)
case ext of
".7z" -> un7z base sevenz arg
".xz" -> do
un7z (takeDirectory base) sevenz arg
handleArg sevenz base
".tar" -> un7z (takeDirectory base) sevenz arg
_ -> error $ "handleArg: " ++ show (sevenz, arg, base, ext)
where
(base, ext) = splitExtension arg
| 395
| false
| true
| 0
| 14
| 154
| 173
| 85
| 88
| null | null |
nomeata/ghc
|
compiler/cmm/CmmOpt.hs
|
bsd-3-clause
|
-- Fold label(+/-)offset into a CmmLit where possible
cmmMachOpFoldM _ (MO_Add _) [CmmLit (CmmLabel lbl), CmmLit (CmmInt i rep)]
= Just $ CmmLit (CmmLabelOff lbl (fromIntegral (narrowU rep i)))
| 196
|
cmmMachOpFoldM _ (MO_Add _) [CmmLit (CmmLabel lbl), CmmLit (CmmInt i rep)]
= Just $ CmmLit (CmmLabelOff lbl (fromIntegral (narrowU rep i)))
| 141
|
cmmMachOpFoldM _ (MO_Add _) [CmmLit (CmmLabel lbl), CmmLit (CmmInt i rep)]
= Just $ CmmLit (CmmLabelOff lbl (fromIntegral (narrowU rep i)))
| 141
| true
| false
| 0
| 12
| 31
| 75
| 37
| 38
| null | null |
boundedvariation/Freecell
|
solver.hs
|
mit
|
treeSolverDF :: Board -> Solution
treeSolverDF = Solution
. map sourceMove
. reverse
. head
. filter (solvedBoard . gameBoard . head)
. flatten
. buildTree
| 179
|
treeSolverDF :: Board -> Solution
treeSolverDF = Solution
. map sourceMove
. reverse
. head
. filter (solvedBoard . gameBoard . head)
. flatten
. buildTree
| 179
|
treeSolverDF = Solution
. map sourceMove
. reverse
. head
. filter (solvedBoard . gameBoard . head)
. flatten
. buildTree
| 145
| false
| true
| 0
| 11
| 49
| 56
| 28
| 28
| null | null |
scott-fleischman/greek-grammar
|
haskell/greek-grammar/src/Data/Unicode/DecomposeChar.hs
|
mit
|
decomposeChar '\x2F8F1' = "\x6B54"
| 34
|
decomposeChar '\x2F8F1' = "\x6B54"
| 34
|
decomposeChar '\x2F8F1' = "\x6B54"
| 34
| false
| false
| 0
| 4
| 3
| 10
| 4
| 6
| null | null |
mgrebenets/hackerrank
|
alg/strings/two-two.hs
|
mit
|
powers m = map (2^) [0..m]
| 26
|
powers m = map (2^) [0..m]
| 26
|
powers m = map (2^) [0..m]
| 26
| false
| false
| 0
| 6
| 5
| 23
| 12
| 11
| null | null |
samvher/translatethenews
|
app/TTN/Model/Translation.hs
|
mit
|
entTranslation :: Entity Translation -> Translation
entTranslation (Entity _ t) = t
| 83
|
entTranslation :: Entity Translation -> Translation
entTranslation (Entity _ t) = t
| 83
|
entTranslation (Entity _ t) = t
| 31
| false
| true
| 0
| 6
| 11
| 33
| 15
| 18
| null | null |
alexbiehl/hoop
|
hadoop-protos/src/Hadoop/Protos/DataTransferProtos/OpWriteBlockProto/BlockConstructionStage.hs
|
mit
|
toMaybe'Enum 7 = Prelude'.Just TRANSFER_RBW
| 43
|
toMaybe'Enum 7 = Prelude'.Just TRANSFER_RBW
| 43
|
toMaybe'Enum 7 = Prelude'.Just TRANSFER_RBW
| 43
| false
| false
| 1
| 6
| 4
| 17
| 6
| 11
| null | null |
sdiehl/ghc
|
compiler/GHC/Hs/Expr.hs
|
bsd-3-clause
|
matchSeparator CaseAlt = text "->"
| 40
|
matchSeparator CaseAlt = text "->"
| 40
|
matchSeparator CaseAlt = text "->"
| 40
| false
| false
| 0
| 5
| 10
| 12
| 5
| 7
| null | null |
lywaterman/erlang-haskell-interface
|
src/Foreign/Erlang/OTP/Mnesia.hs
|
gpl-3.0
|
dirtyAllKeys :: MBox -> String -> String -> IO ErlType
dirtyAllKeys mbox node tab = mnesia mbox node "dirty_all_keys" [ErlAtom tab]
| 131
|
dirtyAllKeys :: MBox -> String -> String -> IO ErlType
dirtyAllKeys mbox node tab = mnesia mbox node "dirty_all_keys" [ErlAtom tab]
| 131
|
dirtyAllKeys mbox node tab = mnesia mbox node "dirty_all_keys" [ErlAtom tab]
| 76
| false
| true
| 0
| 8
| 20
| 52
| 24
| 28
| null | null |
sgillespie/ghc
|
compiler/hsSyn/HsExpr.hs
|
bsd-3-clause
|
ppr_expr (HsStatic _ e)
= hsep [text "static", pprParendLExpr e]
| 66
|
ppr_expr (HsStatic _ e)
= hsep [text "static", pprParendLExpr e]
| 66
|
ppr_expr (HsStatic _ e)
= hsep [text "static", pprParendLExpr e]
| 66
| false
| false
| 0
| 7
| 11
| 32
| 15
| 17
| null | null |
sydow/ireal
|
Data/Number/IReal/FAD.hs
|
bsd-3-clause
|
rchain f f' g = r where r = mkDif (f (val g)) (df 1 g * f' r)
| 61
|
rchain f f' g = r where r = mkDif (f (val g)) (df 1 g * f' r)
| 61
|
rchain f f' g = r where r = mkDif (f (val g)) (df 1 g * f' r)
| 61
| false
| false
| 0
| 11
| 18
| 53
| 25
| 28
| null | null |
jchmrt/btjchm
|
Parsers.hs
|
mit
|
switchCase :: Char -> Char
switchCase x
| isUpper x = toLower x
| isLower x = toUpper x
| otherwise = x
| 109
|
switchCase :: Char -> Char
switchCase x
| isUpper x = toLower x
| isLower x = toUpper x
| otherwise = x
| 109
|
switchCase x
| isUpper x = toLower x
| isLower x = toUpper x
| otherwise = x
| 82
| false
| true
| 2
| 8
| 28
| 51
| 23
| 28
| null | null |
yunomu/nicodicbot
|
src/RssParser.hs
|
bsd-3-clause
|
tag :: ByteString -> Parser a -> Parser a
tag str p = do
inFix $ A.string $ BC.concat ["<", str]
many space
inFix $ A.string ">"
ret <- p
inFix $ A.string $ BC.concat ["</", str, ">"]
next
return ret
| 227
|
tag :: ByteString -> Parser a -> Parser a
tag str p = do
inFix $ A.string $ BC.concat ["<", str]
many space
inFix $ A.string ">"
ret <- p
inFix $ A.string $ BC.concat ["</", str, ">"]
next
return ret
| 227
|
tag str p = do
inFix $ A.string $ BC.concat ["<", str]
many space
inFix $ A.string ">"
ret <- p
inFix $ A.string $ BC.concat ["</", str, ">"]
next
return ret
| 185
| false
| true
| 0
| 9
| 68
| 115
| 53
| 62
| null | null |
grandpascorpion/canon
|
Math/NumberTheory/Canon/Internals.hs
|
gpl-3.0
|
divisionError, divByZeroError, zeroDivZeroError, negativeLogError :: String
divisionError = "For this function, the dividend must be a multiple of the divisor."
| 163
|
divisionError, divByZeroError, zeroDivZeroError, negativeLogError :: String
divisionError = "For this function, the dividend must be a multiple of the divisor."
| 163
|
divisionError = "For this function, the dividend must be a multiple of the divisor."
| 87
| false
| true
| 3
| 5
| 22
| 25
| 12
| 13
| null | null |
ozgurakgun/Idris-dev
|
src/Idris/Core/TT.hs
|
bsd-3-clause
|
constIsType (Ch _) = False
| 26
|
constIsType (Ch _) = False
| 26
|
constIsType (Ch _) = False
| 26
| false
| false
| 0
| 6
| 4
| 16
| 7
| 9
| null | null |
pharaun/hComicFetcher
|
src/Sites/FreakAngels.hs
|
gpl-3.0
|
bookNameToComicTag ("Visual Archive: Book Four", url) = ((US.toString url), False, ComicTag "Freak Angels" Nothing (Just $ UnitTag [StandAlone $ Digit 4 Nothing Nothing Nothing] Nothing) Nothing Nothing)
| 203
|
bookNameToComicTag ("Visual Archive: Book Four", url) = ((US.toString url), False, ComicTag "Freak Angels" Nothing (Just $ UnitTag [StandAlone $ Digit 4 Nothing Nothing Nothing] Nothing) Nothing Nothing)
| 203
|
bookNameToComicTag ("Visual Archive: Book Four", url) = ((US.toString url), False, ComicTag "Freak Angels" Nothing (Just $ UnitTag [StandAlone $ Digit 4 Nothing Nothing Nothing] Nothing) Nothing Nothing)
| 203
| false
| false
| 0
| 12
| 26
| 71
| 37
| 34
| null | null |
brendanhay/gogol
|
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'FreeListingsProgramStatusRegionStatus' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'flpsrsEnhancedEligibilityStatus'
--
-- * 'flpsrsDisApprovalDate'
--
-- * 'flpsrsReviewIssues'
--
-- * 'flpsrsReviewEligibilityStatus'
--
-- * 'flpsrsIneligibilityReason'
--
-- * 'flpsrsRegionCodes'
--
-- * 'flpsrsEligibilityStatus'
freeListingsProgramStatusRegionStatus
:: FreeListingsProgramStatusRegionStatus
freeListingsProgramStatusRegionStatus =
FreeListingsProgramStatusRegionStatus'
{ _flpsrsEnhancedEligibilityStatus = Nothing
, _flpsrsDisApprovalDate = Nothing
, _flpsrsReviewIssues = Nothing
, _flpsrsReviewEligibilityStatus = Nothing
, _flpsrsIneligibilityReason = Nothing
, _flpsrsRegionCodes = Nothing
, _flpsrsEligibilityStatus = Nothing
}
| 889
|
freeListingsProgramStatusRegionStatus
:: FreeListingsProgramStatusRegionStatus
freeListingsProgramStatusRegionStatus =
FreeListingsProgramStatusRegionStatus'
{ _flpsrsEnhancedEligibilityStatus = Nothing
, _flpsrsDisApprovalDate = Nothing
, _flpsrsReviewIssues = Nothing
, _flpsrsReviewEligibilityStatus = Nothing
, _flpsrsIneligibilityReason = Nothing
, _flpsrsRegionCodes = Nothing
, _flpsrsEligibilityStatus = Nothing
}
| 459
|
freeListingsProgramStatusRegionStatus =
FreeListingsProgramStatusRegionStatus'
{ _flpsrsEnhancedEligibilityStatus = Nothing
, _flpsrsDisApprovalDate = Nothing
, _flpsrsReviewIssues = Nothing
, _flpsrsReviewEligibilityStatus = Nothing
, _flpsrsIneligibilityReason = Nothing
, _flpsrsRegionCodes = Nothing
, _flpsrsEligibilityStatus = Nothing
}
| 376
| true
| true
| 1
| 7
| 130
| 79
| 53
| 26
| null | null |
evanrinehart/lowgl
|
Graphics/GL/Low/Common.hs
|
bsd-2-clause
|
attachmentPointForImageFormat :: ImageFormat -> GLenum
attachmentPointForImageFormat format = case format of
RGB -> GL_COLOR_ATTACHMENT0
RGBA -> GL_COLOR_ATTACHMENT0
Alpha -> GL_COLOR_ATTACHMENT0
Luminance -> GL_COLOR_ATTACHMENT0
LuminanceAlpha -> GL_COLOR_ATTACHMENT0
Depth24 -> GL_DEPTH_ATTACHMENT
Depth24Stencil8 -> GL_DEPTH_STENCIL_ATTACHMENT
| 408
|
attachmentPointForImageFormat :: ImageFormat -> GLenum
attachmentPointForImageFormat format = case format of
RGB -> GL_COLOR_ATTACHMENT0
RGBA -> GL_COLOR_ATTACHMENT0
Alpha -> GL_COLOR_ATTACHMENT0
Luminance -> GL_COLOR_ATTACHMENT0
LuminanceAlpha -> GL_COLOR_ATTACHMENT0
Depth24 -> GL_DEPTH_ATTACHMENT
Depth24Stencil8 -> GL_DEPTH_STENCIL_ATTACHMENT
| 408
|
attachmentPointForImageFormat format = case format of
RGB -> GL_COLOR_ATTACHMENT0
RGBA -> GL_COLOR_ATTACHMENT0
Alpha -> GL_COLOR_ATTACHMENT0
Luminance -> GL_COLOR_ATTACHMENT0
LuminanceAlpha -> GL_COLOR_ATTACHMENT0
Depth24 -> GL_DEPTH_ATTACHMENT
Depth24Stencil8 -> GL_DEPTH_STENCIL_ATTACHMENT
| 353
| false
| true
| 0
| 7
| 93
| 64
| 32
| 32
| null | null |
eryx67/haskell-libtorrent
|
src/Network/Libtorrent/TorrentHandle.hs
|
bsd-3-clause
|
clearPieceDeadlines :: MonadIO m => TorrentHandle -> m ()
clearPieceDeadlines ho =
liftIO . withPtr ho $ \hoPtr ->
checkError [except| { $(torrent_handle * hoPtr)->clear_piece_deadlines(); } |]
| 198
|
clearPieceDeadlines :: MonadIO m => TorrentHandle -> m ()
clearPieceDeadlines ho =
liftIO . withPtr ho $ \hoPtr ->
checkError [except| { $(torrent_handle * hoPtr)->clear_piece_deadlines(); } |]
| 198
|
clearPieceDeadlines ho =
liftIO . withPtr ho $ \hoPtr ->
checkError [except| { $(torrent_handle * hoPtr)->clear_piece_deadlines(); } |]
| 139
| false
| true
| 0
| 8
| 31
| 53
| 27
| 26
| null | null |
oldmanmike/ghc
|
compiler/types/Type.hs
|
bsd-3-clause
|
isStrLitTy (LitTy (StrTyLit s)) = Just s
| 40
|
isStrLitTy (LitTy (StrTyLit s)) = Just s
| 40
|
isStrLitTy (LitTy (StrTyLit s)) = Just s
| 40
| false
| false
| 0
| 8
| 6
| 25
| 11
| 14
| null | null |
seckcoder/lang-learn
|
haskell/lambda-calculus/src/test.hs
|
unlicense
|
demo_Either_Monad = do
print (isPasswordValid "0aaaaa")
print (isPasswordValid "aaaaaa")
print (isPasswordValid "0aaaa")
| 126
|
demo_Either_Monad = do
print (isPasswordValid "0aaaaa")
print (isPasswordValid "aaaaaa")
print (isPasswordValid "0aaaa")
| 126
|
demo_Either_Monad = do
print (isPasswordValid "0aaaaa")
print (isPasswordValid "aaaaaa")
print (isPasswordValid "0aaaa")
| 126
| false
| false
| 0
| 9
| 17
| 42
| 18
| 24
| null | null |
EricYT/Haskell
|
src/baby.hs
|
apache-2.0
|
doubleSmallNumber' x = (if x > 100 then x else x*2) + 1
| 55
|
doubleSmallNumber' x = (if x > 100 then x else x*2) + 1
| 55
|
doubleSmallNumber' x = (if x > 100 then x else x*2) + 1
| 55
| false
| false
| 0
| 8
| 12
| 32
| 17
| 15
| null | null |
harrisi/on-being-better
|
list-expansion/Haskell/course/src/Course/Cheque.hs
|
cc0-1.0
|
fromChar '5' =
Full Five
| 26
|
fromChar '5' =
Full Five
| 26
|
fromChar '5' =
Full Five
| 26
| false
| false
| 1
| 5
| 6
| 16
| 5
| 11
| null | null |
hvr/jhc
|
src/E/Lint.hs
|
mit
|
-- all transformation routines assume they are being passed a correct program, and only check the output
transformProgram :: MonadIO m => TransformParms Program -> Program -> m Program
transformProgram TransformParms { transformIterate = IterateMax n } prog | n <= 0 = return prog
| 282
|
transformProgram :: MonadIO m => TransformParms Program -> Program -> m Program
transformProgram TransformParms { transformIterate = IterateMax n } prog | n <= 0 = return prog
| 175
|
transformProgram TransformParms { transformIterate = IterateMax n } prog | n <= 0 = return prog
| 95
| true
| true
| 0
| 9
| 46
| 63
| 29
| 34
| null | null |
fmapfmapfmap/amazonka
|
amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'ProductCode' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pcProductCodeType'
--
-- * 'pcProductCodeId'
productCode
:: ProductCode
productCode =
ProductCode'
{ _pcProductCodeType = Nothing
, _pcProductCodeId = Nothing
}
| 352
|
productCode
:: ProductCode
productCode =
ProductCode'
{ _pcProductCodeType = Nothing
, _pcProductCodeId = Nothing
}
| 135
|
productCode =
ProductCode'
{ _pcProductCodeType = Nothing
, _pcProductCodeId = Nothing
}
| 104
| true
| true
| 0
| 6
| 72
| 32
| 22
| 10
| null | null |
shockkolate/containers
|
Data/Map/Base.hs
|
bsd-3-clause
|
-- | /O(1)/. The number of elements in the map.
--
-- > size empty == 0
-- > size (singleton 1 'a') == 1
-- > size (fromList([(1,'a'), (2,'c'), (3,'b')])) == 3
size :: Map k a -> Int
size Tip = 0
| 265
|
size :: Map k a -> Int
size Tip = 0
| 48
|
size Tip = 0
| 25
| true
| true
| 0
| 6
| 113
| 28
| 16
| 12
| null | null |
urbanslug/ghc
|
compiler/ghci/ByteCodeInstr.hs
|
bsd-3-clause
|
bciStackUse :: BCInstr -> Word
bciStackUse STKCHECK{} = 0
| 68
|
bciStackUse :: BCInstr -> Word
bciStackUse STKCHECK{} = 0
| 68
|
bciStackUse STKCHECK{} = 0
| 37
| false
| true
| 2
| 5
| 19
| 24
| 12
| 12
| null | null |
NKMR6194/carrot
|
src/Tokenize.hs
|
mit
|
tokenize ('/':xs) = DivOpToken:tokenize(xs)
| 44
|
tokenize ('/':xs) = DivOpToken:tokenize(xs)
| 44
|
tokenize ('/':xs) = DivOpToken:tokenize(xs)
| 44
| false
| false
| 0
| 7
| 4
| 27
| 13
| 14
| null | null |
bgamari/text
|
src/Data/Text/Array.hs
|
bsd-2-clause
|
empty :: Array
empty = runST (new 0 >>= unsafeFreeze)
| 53
|
empty :: Array
empty = runST (new 0 >>= unsafeFreeze)
| 53
|
empty = runST (new 0 >>= unsafeFreeze)
| 38
| false
| true
| 0
| 8
| 9
| 24
| 12
| 12
| null | null |
tomwadeson/adventofcode
|
06.hs
|
mit
|
parseInstructions :: ReadP [Instruction]
parseInstructions =
sepBy (parseToggle <|> parseTurnOn <|> parseTurnOff) $ satisfy (`elem` "\r\n\t ")
| 145
|
parseInstructions :: ReadP [Instruction]
parseInstructions =
sepBy (parseToggle <|> parseTurnOn <|> parseTurnOff) $ satisfy (`elem` "\r\n\t ")
| 145
|
parseInstructions =
sepBy (parseToggle <|> parseTurnOn <|> parseTurnOff) $ satisfy (`elem` "\r\n\t ")
| 104
| false
| true
| 0
| 9
| 19
| 44
| 24
| 20
| null | null |
diogob/pg-recorder
|
app/Main.hs
|
bsd-3-clause
|
main :: IO ()
main = do
hSetBuffering stdout LineBuffering
hSetBuffering stdin LineBuffering
hSetBuffering stderr NoBuffering
conf <- readOptions
let poolSettings = (10, 10, toS $ configDatabase conf)
dispatcher = dispatcherFunction conf
notificationHandler <- dbNotificationHandler poolSettings dispatcher
putStrLn $ "Listening for notification on " <> configDatabase conf <> " using dispatcher: " <> dispatcher
listenSession conf notificationHandler
| 475
|
main :: IO ()
main = do
hSetBuffering stdout LineBuffering
hSetBuffering stdin LineBuffering
hSetBuffering stderr NoBuffering
conf <- readOptions
let poolSettings = (10, 10, toS $ configDatabase conf)
dispatcher = dispatcherFunction conf
notificationHandler <- dbNotificationHandler poolSettings dispatcher
putStrLn $ "Listening for notification on " <> configDatabase conf <> " using dispatcher: " <> dispatcher
listenSession conf notificationHandler
| 475
|
main = do
hSetBuffering stdout LineBuffering
hSetBuffering stdin LineBuffering
hSetBuffering stderr NoBuffering
conf <- readOptions
let poolSettings = (10, 10, toS $ configDatabase conf)
dispatcher = dispatcherFunction conf
notificationHandler <- dbNotificationHandler poolSettings dispatcher
putStrLn $ "Listening for notification on " <> configDatabase conf <> " using dispatcher: " <> dispatcher
listenSession conf notificationHandler
| 461
| false
| true
| 0
| 12
| 80
| 122
| 55
| 67
| null | null |
FranklinChen/hugs98-plus-Sep2006
|
packages/GLUT/examples/BOGLGP/Chapter03/Polygons.hs
|
bsd-3-clause
|
parseOptions :: [String] -> IO Options
parseOptions args = do
let (optsActions, nonOptions, errs) = getOpt Permute options args
unless (null nonOptions && null errs) (dieWith errs)
foldl (>>=) (return startOpt) optsActions
| 231
|
parseOptions :: [String] -> IO Options
parseOptions args = do
let (optsActions, nonOptions, errs) = getOpt Permute options args
unless (null nonOptions && null errs) (dieWith errs)
foldl (>>=) (return startOpt) optsActions
| 231
|
parseOptions args = do
let (optsActions, nonOptions, errs) = getOpt Permute options args
unless (null nonOptions && null errs) (dieWith errs)
foldl (>>=) (return startOpt) optsActions
| 192
| false
| true
| 0
| 10
| 40
| 95
| 46
| 49
| null | null |
sapek/pandoc
|
src/Text/Pandoc/Readers/HTML.hs
|
gpl-2.0
|
isSpecial '\8217' = True
| 24
|
isSpecial '\8217' = True
| 24
|
isSpecial '\8217' = True
| 24
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
brendanhay/gogol
|
gogol-pagespeed/gen/Network/Google/PageSpeed/Types/Product.hs
|
mpl-2.0
|
-- | The value that should be displayed on the UI for this audit.
larvDisplayValue :: Lens' LighthouseAuditResultV5 (Maybe Text)
larvDisplayValue
= lens _larvDisplayValue
(\ s a -> s{_larvDisplayValue = a})
| 214
|
larvDisplayValue :: Lens' LighthouseAuditResultV5 (Maybe Text)
larvDisplayValue
= lens _larvDisplayValue
(\ s a -> s{_larvDisplayValue = a})
| 148
|
larvDisplayValue
= lens _larvDisplayValue
(\ s a -> s{_larvDisplayValue = a})
| 85
| true
| true
| 1
| 9
| 38
| 51
| 25
| 26
| null | null |
spinda/liquidhaskell
|
src/Language/Haskell/Liquid/Constraint/Types.hs
|
bsd-3-clause
|
pprCGInfo _cgi
= text "*********** Constraint Information ***********"
| 73
|
pprCGInfo _cgi
= text "*********** Constraint Information ***********"
| 73
|
pprCGInfo _cgi
= text "*********** Constraint Information ***********"
| 73
| false
| false
| 0
| 5
| 10
| 12
| 5
| 7
| null | null |
forflo/gCodeMusic
|
gcode_music.hs
|
gpl-3.0
|
generateGCode n@(TwoNote (note1, note2, duration)) preferences =
let (axisLenMapping, feedrate) =
getLF [X, Y] [note1, note2] preferences duration
in "G1 " ++ translateAxisLenMapping axisLenMapping
++ "F"
++ show feedrate
++ " ; " ++ show n
++ "\n"
| 280
|
generateGCode n@(TwoNote (note1, note2, duration)) preferences =
let (axisLenMapping, feedrate) =
getLF [X, Y] [note1, note2] preferences duration
in "G1 " ++ translateAxisLenMapping axisLenMapping
++ "F"
++ show feedrate
++ " ; " ++ show n
++ "\n"
| 280
|
generateGCode n@(TwoNote (note1, note2, duration)) preferences =
let (axisLenMapping, feedrate) =
getLF [X, Y] [note1, note2] preferences duration
in "G1 " ++ translateAxisLenMapping axisLenMapping
++ "F"
++ show feedrate
++ " ; " ++ show n
++ "\n"
| 280
| false
| false
| 0
| 13
| 69
| 101
| 52
| 49
| null | null |
gust/feature-creature
|
feature-creature/backend/app/Main.hs
|
mit
|
stdOutLogger Development = logStdoutDev
| 39
|
stdOutLogger Development = logStdoutDev
| 39
|
stdOutLogger Development = logStdoutDev
| 39
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
pxqr/intset
|
tests/Main.hs
|
bsd-3-clause
|
prop_mapLessSize :: IntSet -> Bool
prop_mapLessSize s = size (S.map (`div` 2) s) <= size s
| 90
|
prop_mapLessSize :: IntSet -> Bool
prop_mapLessSize s = size (S.map (`div` 2) s) <= size s
| 90
|
prop_mapLessSize s = size (S.map (`div` 2) s) <= size s
| 55
| false
| true
| 0
| 9
| 15
| 44
| 23
| 21
| null | null |
randrade23/html-render
|
src/HTMLRender/HTMLParser.hs
|
mit
|
customParse :: Parser Value -> String -> Value
customParse f str = case parse f "test" str of
Left err -> error (show err)
Right val -> val
| 148
|
customParse :: Parser Value -> String -> Value
customParse f str = case parse f "test" str of
Left err -> error (show err)
Right val -> val
| 147
|
customParse f str = case parse f "test" str of
Left err -> error (show err)
Right val -> val
| 100
| false
| true
| 0
| 10
| 36
| 65
| 30
| 35
| null | null |
christiaanb/ghc
|
compiler/main/Packages.hs
|
bsd-3-clause
|
listVisibleModuleNames :: DynFlags -> [ModuleName]
listVisibleModuleNames dflags =
map fst (filter visible (Map.toList (moduleNameDb (pkgState dflags))))
where visible (_, ms) = any (\(MD o _) -> originVisible o) (Map.elems ms)
-- | Find all the 'PackageConfig' in both the preload packages from 'DynFlags' and corresponding to the list of
-- 'PackageConfig's
| 366
|
listVisibleModuleNames :: DynFlags -> [ModuleName]
listVisibleModuleNames dflags =
map fst (filter visible (Map.toList (moduleNameDb (pkgState dflags))))
where visible (_, ms) = any (\(MD o _) -> originVisible o) (Map.elems ms)
-- | Find all the 'PackageConfig' in both the preload packages from 'DynFlags' and corresponding to the list of
-- 'PackageConfig's
| 366
|
listVisibleModuleNames dflags =
map fst (filter visible (Map.toList (moduleNameDb (pkgState dflags))))
where visible (_, ms) = any (\(MD o _) -> originVisible o) (Map.elems ms)
-- | Find all the 'PackageConfig' in both the preload packages from 'DynFlags' and corresponding to the list of
-- 'PackageConfig's
| 315
| false
| true
| 0
| 12
| 57
| 110
| 55
| 55
| null | null |
YueLiPicasso/unification
|
MMAlgoA .Buggy.hs
|
gpl-3.0
|
--step a) any t = x -> x = t where x is a vriable and t is not variable
---------------------------------------------------------------------------------
swapConditionMet :: FOTE -> Bool
swapConditionMet (left, right) = (isVariable right) && ((not . isVariable) left)
| 267
|
swapConditionMet :: FOTE -> Bool
swapConditionMet (left, right) = (isVariable right) && ((not . isVariable) left)
| 113
|
swapConditionMet (left, right) = (isVariable right) && ((not . isVariable) left)
| 80
| true
| true
| 0
| 10
| 36
| 55
| 28
| 27
| null | null |
merijn/lambda-except
|
AST.hs
|
bsd-3-clause
|
abstractPat
:: (HasName a, Monad f)
=> SimplePat Name
-> f a
-> Scope (Named ()) f a
abstractPat WildP{} = abstract (const Nothing)
| 147
|
abstractPat
:: (HasName a, Monad f)
=> SimplePat Name
-> f a
-> Scope (Named ()) f a
abstractPat WildP{} = abstract (const Nothing)
| 147
|
abstractPat WildP{} = abstract (const Nothing)
| 46
| false
| true
| 0
| 11
| 39
| 71
| 34
| 37
| null | null |
reflex-frp/reflex-dom
|
reflex-dom-core/src/Reflex/Dom/Main.hs
|
bsd-3-clause
|
runImmediateWidgetWithHeadAndBody
:: ( (forall c. Widget () c -> FloatingWidget () c) -- "Append to head"
-> (forall c. Widget () c -> FloatingWidget () c) -- "Append to body"
-> FloatingWidget () ()
)
-> JSM ()
runImmediateWidgetWithHeadAndBody app = withJSContextSingletonMono $ \jsSing -> do
globalDoc <- currentDocumentUnchecked
headElement <- getHeadUnchecked globalDoc
bodyElement <- getBodyUnchecked globalDoc
headFragment <- createDocumentFragment globalDoc
bodyFragment <- createDocumentFragment globalDoc
(events, fc) <- liftIO . attachImmediateWidget $ \hydrationMode events -> do
(postBuild, postBuildTriggerRef) <- newEventWithTriggerRef
let go :: forall c. DOM.DocumentFragment -> Widget () c -> FloatingWidget () c
go df w = do
unreadyChildren <- liftIO $ newIORef 0
delayed <- liftIO $ newIORef $ pure ()
let builderEnv = HydrationDomBuilderEnv
{ _hydrationDomBuilderEnv_document = globalDoc
, _hydrationDomBuilderEnv_parent = Left $ toNode df
, _hydrationDomBuilderEnv_unreadyChildren = unreadyChildren
, _hydrationDomBuilderEnv_commitAction = pure () --TODO: possibly `replaceElementContents n f`
, _hydrationDomBuilderEnv_hydrationMode = hydrationMode
, _hydrationDomBuilderEnv_switchover = never
, _hydrationDomBuilderEnv_delayed = delayed
}
lift $ runHydrationDomBuilderT w builderEnv events
runWithJSContextSingleton (runPostBuildT (runTriggerEventT (app (go headFragment) (go bodyFragment)) events) postBuild) jsSing
return (events, postBuildTriggerRef)
replaceElementContents headElement headFragment
replaceElementContents bodyElement bodyFragment
liftIO $ processAsyncEvents events fc
-- | Warning: `mainWidgetWithHead'` is provided only as performance tweak. It is expected to disappear in future releases.
| 1,967
|
runImmediateWidgetWithHeadAndBody
:: ( (forall c. Widget () c -> FloatingWidget () c) -- "Append to head"
-> (forall c. Widget () c -> FloatingWidget () c) -- "Append to body"
-> FloatingWidget () ()
)
-> JSM ()
runImmediateWidgetWithHeadAndBody app = withJSContextSingletonMono $ \jsSing -> do
globalDoc <- currentDocumentUnchecked
headElement <- getHeadUnchecked globalDoc
bodyElement <- getBodyUnchecked globalDoc
headFragment <- createDocumentFragment globalDoc
bodyFragment <- createDocumentFragment globalDoc
(events, fc) <- liftIO . attachImmediateWidget $ \hydrationMode events -> do
(postBuild, postBuildTriggerRef) <- newEventWithTriggerRef
let go :: forall c. DOM.DocumentFragment -> Widget () c -> FloatingWidget () c
go df w = do
unreadyChildren <- liftIO $ newIORef 0
delayed <- liftIO $ newIORef $ pure ()
let builderEnv = HydrationDomBuilderEnv
{ _hydrationDomBuilderEnv_document = globalDoc
, _hydrationDomBuilderEnv_parent = Left $ toNode df
, _hydrationDomBuilderEnv_unreadyChildren = unreadyChildren
, _hydrationDomBuilderEnv_commitAction = pure () --TODO: possibly `replaceElementContents n f`
, _hydrationDomBuilderEnv_hydrationMode = hydrationMode
, _hydrationDomBuilderEnv_switchover = never
, _hydrationDomBuilderEnv_delayed = delayed
}
lift $ runHydrationDomBuilderT w builderEnv events
runWithJSContextSingleton (runPostBuildT (runTriggerEventT (app (go headFragment) (go bodyFragment)) events) postBuild) jsSing
return (events, postBuildTriggerRef)
replaceElementContents headElement headFragment
replaceElementContents bodyElement bodyFragment
liftIO $ processAsyncEvents events fc
-- | Warning: `mainWidgetWithHead'` is provided only as performance tweak. It is expected to disappear in future releases.
| 1,967
|
runImmediateWidgetWithHeadAndBody app = withJSContextSingletonMono $ \jsSing -> do
globalDoc <- currentDocumentUnchecked
headElement <- getHeadUnchecked globalDoc
bodyElement <- getBodyUnchecked globalDoc
headFragment <- createDocumentFragment globalDoc
bodyFragment <- createDocumentFragment globalDoc
(events, fc) <- liftIO . attachImmediateWidget $ \hydrationMode events -> do
(postBuild, postBuildTriggerRef) <- newEventWithTriggerRef
let go :: forall c. DOM.DocumentFragment -> Widget () c -> FloatingWidget () c
go df w = do
unreadyChildren <- liftIO $ newIORef 0
delayed <- liftIO $ newIORef $ pure ()
let builderEnv = HydrationDomBuilderEnv
{ _hydrationDomBuilderEnv_document = globalDoc
, _hydrationDomBuilderEnv_parent = Left $ toNode df
, _hydrationDomBuilderEnv_unreadyChildren = unreadyChildren
, _hydrationDomBuilderEnv_commitAction = pure () --TODO: possibly `replaceElementContents n f`
, _hydrationDomBuilderEnv_hydrationMode = hydrationMode
, _hydrationDomBuilderEnv_switchover = never
, _hydrationDomBuilderEnv_delayed = delayed
}
lift $ runHydrationDomBuilderT w builderEnv events
runWithJSContextSingleton (runPostBuildT (runTriggerEventT (app (go headFragment) (go bodyFragment)) events) postBuild) jsSing
return (events, postBuildTriggerRef)
replaceElementContents headElement headFragment
replaceElementContents bodyElement bodyFragment
liftIO $ processAsyncEvents events fc
-- | Warning: `mainWidgetWithHead'` is provided only as performance tweak. It is expected to disappear in future releases.
| 1,732
| false
| true
| 0
| 26
| 437
| 446
| 218
| 228
| null | null |
sdiehl/ghc
|
compiler/GHC/StgToCmm/Monad.hs
|
bsd-3-clause
|
getThisPackage :: FCode UnitId
getThisPackage = liftM thisPackage getDynFlags
| 77
|
getThisPackage :: FCode UnitId
getThisPackage = liftM thisPackage getDynFlags
| 77
|
getThisPackage = liftM thisPackage getDynFlags
| 46
| false
| true
| 1
| 5
| 8
| 22
| 9
| 13
| null | null |
vikraman/ghc
|
compiler/types/Coercion.hs
|
bsd-3-clause
|
seqCo (CoherenceCo co1 co2) = seqCo co1 `seq` seqCo co2
| 59
|
seqCo (CoherenceCo co1 co2) = seqCo co1 `seq` seqCo co2
| 59
|
seqCo (CoherenceCo co1 co2) = seqCo co1 `seq` seqCo co2
| 59
| false
| false
| 0
| 7
| 13
| 29
| 14
| 15
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.