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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
abailly/haskell-synthesizer | SoundIO.hs | gpl-3.0 | prompt = do putStr "> "
hFlush stdout
-- | Command-loop is another monadic computation, this time in the IO monad. | 127 | prompt = do putStr "> "
hFlush stdout
-- | Command-loop is another monadic computation, this time in the IO monad. | 127 | prompt = do putStr "> "
hFlush stdout
-- | Command-loop is another monadic computation, this time in the IO monad. | 127 | false | false | 1 | 8 | 33 | 23 | 8 | 15 | null | null |
RefactoringTools/HaRe | test/testdata/TypeUtils/TypeSigs.hs | bsd-3-clause | a,b,c::Int->Integer->Char
a x y = undefined | 44 | a,b,c::Int->Integer->Char
a x y = undefined | 43 | a x y = undefined | 17 | false | true | 2 | 6 | 6 | 34 | 16 | 18 | null | null |
Chobbes/Juicy.Pixels | src/Codec/Picture/Saving.hs | bsd-3-clause | imageToBitmap (ImageCMYK8 img) = encodeBitmap (convertImage img :: Image PixelRGB8) | 84 | imageToBitmap (ImageCMYK8 img) = encodeBitmap (convertImage img :: Image PixelRGB8) | 84 | imageToBitmap (ImageCMYK8 img) = encodeBitmap (convertImage img :: Image PixelRGB8) | 84 | false | false | 0 | 7 | 10 | 30 | 14 | 16 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/GT_5.hs | mit | primCmpNat (Succ x) Zero = GT | 29 | primCmpNat (Succ x) Zero = GT | 29 | primCmpNat (Succ x) Zero = GT | 29 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
ladinu/cs457 | src/Ex01Calendar.hs | mit | leftAligned r = head r == 0 | 28 | leftAligned r = head r == 0 | 28 | leftAligned r = head r == 0 | 28 | false | false | 0 | 6 | 7 | 16 | 7 | 9 | null | null |
DaMSL/K3 | src/Language/K3/Codegen/Haskell.hs | apache-2.0 | -- TODO
expression' (tag -> ESelf) = undefined | 46 | expression' (tag -> ESelf) = undefined | 38 | expression' (tag -> ESelf) = undefined | 38 | true | false | 0 | 7 | 7 | 17 | 9 | 8 | null | null |
GaloisInc/halvm-ghc | compiler/main/DynFlags.hs | bsd-3-clause | addCmdlineFramework f d = d { cmdlineFrameworks = f : cmdlineFrameworks d} | 74 | addCmdlineFramework f d = d { cmdlineFrameworks = f : cmdlineFrameworks d} | 74 | addCmdlineFramework f d = d { cmdlineFrameworks = f : cmdlineFrameworks d} | 74 | false | false | 0 | 8 | 11 | 26 | 13 | 13 | null | null |
suhailshergill/hakaru | Language/Hakaru/Inference.hs | bsd-3-clause | mcmc :: (Mochastic repr, Integrate repr, Lambda repr,
a ~ Expect' a, Order_ a, Backward a a)
=> (forall repr'. (Mochastic repr') => repr' a -> repr' ('HMeasure a))
-> (forall repr'. (Mochastic repr') => repr' ('HMeasure a))
-> repr ('HFun a ('HMeasure a))
mcmc proposal target =
let_ (mh proposal target) $ \f ->
lam $ \old ->
app f old `bind` \new_ratio ->
unpair new_ratio $ \new ratio ->
bern (min_ 1 ratio) `bind` \accept ->
dirac (if_ accept new old) | 496 | mcmc :: (Mochastic repr, Integrate repr, Lambda repr,
a ~ Expect' a, Order_ a, Backward a a)
=> (forall repr'. (Mochastic repr') => repr' a -> repr' ('HMeasure a))
-> (forall repr'. (Mochastic repr') => repr' ('HMeasure a))
-> repr ('HFun a ('HMeasure a))
mcmc proposal target =
let_ (mh proposal target) $ \f ->
lam $ \old ->
app f old `bind` \new_ratio ->
unpair new_ratio $ \new ratio ->
bern (min_ 1 ratio) `bind` \accept ->
dirac (if_ accept new old) | 496 | mcmc proposal target =
let_ (mh proposal target) $ \f ->
lam $ \old ->
app f old `bind` \new_ratio ->
unpair new_ratio $ \new ratio ->
bern (min_ 1 ratio) `bind` \accept ->
dirac (if_ accept new old) | 219 | false | true | 0 | 17 | 123 | 249 | 127 | 122 | null | null |
GaloisInc/halvm-ghc | compiler/coreSyn/CoreSyn.hs | bsd-3-clause | tickishCanSplit _ = False | 26 | tickishCanSplit _ = False | 26 | tickishCanSplit _ = False | 26 | false | false | 0 | 4 | 4 | 10 | 4 | 6 | null | null |
rleshchinskiy/vector | Data/Vector/Fusion/Bundle/Monadic.hs | bsd-3-clause | zipWithM f Bundle{sElems = sa, sSize = na}
Bundle{sElems = sb, sSize = nb} = fromStream (S.zipWithM f sa sb) (smaller na nb) | 135 | zipWithM f Bundle{sElems = sa, sSize = na}
Bundle{sElems = sb, sSize = nb} = fromStream (S.zipWithM f sa sb) (smaller na nb) | 135 | zipWithM f Bundle{sElems = sa, sSize = na}
Bundle{sElems = sb, sSize = nb} = fromStream (S.zipWithM f sa sb) (smaller na nb) | 135 | false | false | 0 | 8 | 33 | 68 | 36 | 32 | null | null |
jordanemedlock/fungen | Graphics/UI/Fungen/Map.hs | bsd-3-clause | getTileSpecialAttribute:: Tile t -> t
getTileSpecialAttribute (_,_,_,t) = t | 76 | getTileSpecialAttribute:: Tile t -> t
getTileSpecialAttribute (_,_,_,t) = t | 75 | getTileSpecialAttribute (_,_,_,t) = t | 37 | false | true | 0 | 8 | 9 | 40 | 19 | 21 | null | null |
sgillespie/ghc | compiler/rename/RnBinds.hs | bsd-3-clause | renameSig ctxt sig@(FixSig (FixitySig vs f))
= do { new_vs <- mapM (lookupSigOccRn ctxt sig) vs
; return (FixSig (FixitySig new_vs f), emptyFVs) } | 157 | renameSig ctxt sig@(FixSig (FixitySig vs f))
= do { new_vs <- mapM (lookupSigOccRn ctxt sig) vs
; return (FixSig (FixitySig new_vs f), emptyFVs) } | 157 | renameSig ctxt sig@(FixSig (FixitySig vs f))
= do { new_vs <- mapM (lookupSigOccRn ctxt sig) vs
; return (FixSig (FixitySig new_vs f), emptyFVs) } | 157 | false | false | 0 | 11 | 34 | 74 | 37 | 37 | null | null |
karknu/rws | src/IcmpV6.hs | bsd-3-clause | testValidParse :: String -> (IcmpV6 -> Bool) -> Bool
testValidParse str fn =
case parse (dummyParsePacket icmpV6Decl) "packet parse" str of
Left err -> trace (show err) False
Right val -> fn $ testIcmpV6Pkt val | 227 | testValidParse :: String -> (IcmpV6 -> Bool) -> Bool
testValidParse str fn =
case parse (dummyParsePacket icmpV6Decl) "packet parse" str of
Left err -> trace (show err) False
Right val -> fn $ testIcmpV6Pkt val | 227 | testValidParse str fn =
case parse (dummyParsePacket icmpV6Decl) "packet parse" str of
Left err -> trace (show err) False
Right val -> fn $ testIcmpV6Pkt val | 174 | false | true | 0 | 10 | 51 | 89 | 41 | 48 | null | null |
shayan-najd/HsParser | Language/Haskell/Syntax/HsUtils.hs | gpl-3.0 | mkAnonWildCardTy :: HsType id
mkAnonWildCardTy = HsWildCardTy AnonWildCard | 74 | mkAnonWildCardTy :: HsType id
mkAnonWildCardTy = HsWildCardTy AnonWildCard | 74 | mkAnonWildCardTy = HsWildCardTy AnonWildCard | 44 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
urbanslug/ghc | compiler/llvmGen/LlvmCodeGen/Data.hs | bsd-3-clause | genData (CmmUninitialised bytes)
= return $ LMUninitType (LMArray bytes i8) | 79 | genData (CmmUninitialised bytes)
= return $ LMUninitType (LMArray bytes i8) | 79 | genData (CmmUninitialised bytes)
= return $ LMUninitType (LMArray bytes i8) | 79 | false | false | 0 | 8 | 13 | 30 | 14 | 16 | null | null |
jyrimatti/alava | src-lib/TypeCheck.hs | mit | tcTerm env (Pos sourcePos term) expected = tcTerm (extendSourceLocation sourcePos env) term expected | 100 | tcTerm env (Pos sourcePos term) expected = tcTerm (extendSourceLocation sourcePos env) term expected | 100 | tcTerm env (Pos sourcePos term) expected = tcTerm (extendSourceLocation sourcePos env) term expected | 100 | false | false | 0 | 7 | 12 | 38 | 17 | 21 | null | null |
josuf107/Adverb | Adverb/Common.hs | gpl-3.0 | frightfully = id | 16 | frightfully = id | 16 | frightfully = id | 16 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
ezyang/ghc | compiler/rename/RnUtils.hs | bsd-3-clause | bindLocalNames :: [Name] -> RnM a -> RnM a
bindLocalNames names enclosed_scope
= do { lcl_env <- getLclEnv
; let th_level = thLevel (tcl_th_ctxt lcl_env)
th_bndrs' = extendNameEnvList (tcl_th_bndrs lcl_env)
[ (n, (NotTopLevel, th_level)) | n <- names ]
rdr_env' = extendLocalRdrEnvList (tcl_rdr lcl_env) names
; setLclEnv (lcl_env { tcl_th_bndrs = th_bndrs'
, tcl_rdr = rdr_env' })
enclosed_scope } | 522 | bindLocalNames :: [Name] -> RnM a -> RnM a
bindLocalNames names enclosed_scope
= do { lcl_env <- getLclEnv
; let th_level = thLevel (tcl_th_ctxt lcl_env)
th_bndrs' = extendNameEnvList (tcl_th_bndrs lcl_env)
[ (n, (NotTopLevel, th_level)) | n <- names ]
rdr_env' = extendLocalRdrEnvList (tcl_rdr lcl_env) names
; setLclEnv (lcl_env { tcl_th_bndrs = th_bndrs'
, tcl_rdr = rdr_env' })
enclosed_scope } | 522 | bindLocalNames names enclosed_scope
= do { lcl_env <- getLclEnv
; let th_level = thLevel (tcl_th_ctxt lcl_env)
th_bndrs' = extendNameEnvList (tcl_th_bndrs lcl_env)
[ (n, (NotTopLevel, th_level)) | n <- names ]
rdr_env' = extendLocalRdrEnvList (tcl_rdr lcl_env) names
; setLclEnv (lcl_env { tcl_th_bndrs = th_bndrs'
, tcl_rdr = rdr_env' })
enclosed_scope } | 479 | false | true | 0 | 13 | 182 | 142 | 75 | 67 | null | null |
brendanhay/gogol | gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs | mpl-2.0 | lcmlrNextPageToken :: Lens' LiveChatMessageListResponse (Maybe Text)
lcmlrNextPageToken
= lens _lcmlrNextPageToken
(\ s a -> s{_lcmlrNextPageToken = a}) | 160 | lcmlrNextPageToken :: Lens' LiveChatMessageListResponse (Maybe Text)
lcmlrNextPageToken
= lens _lcmlrNextPageToken
(\ s a -> s{_lcmlrNextPageToken = a}) | 160 | lcmlrNextPageToken
= lens _lcmlrNextPageToken
(\ s a -> s{_lcmlrNextPageToken = a}) | 91 | false | true | 0 | 9 | 24 | 47 | 24 | 23 | null | null |
leepike/copilot-core | src/Copilot/Compile/Header/C99.hs | bsd-3-clause | ppExternalFunction :: ExtFun -> Doc
ppExternalFunction
ExtFun
{ externFunName = name
, externFunType = t
, externFunArgs = args } =
text (typeSpec (UType t)) <+> text name <>
text "(" <> ppArgs args <> text ");"
where
ppArgs :: [UExpr] -> Doc
ppArgs = hcat . intersperse (text ",") . map ppArg
ppArg :: UExpr -> Doc
ppArg UExpr { uExprType = t1 } = text (typeSpec (UType t1))
-------------------------------------------------------------------------------- | 499 | ppExternalFunction :: ExtFun -> Doc
ppExternalFunction
ExtFun
{ externFunName = name
, externFunType = t
, externFunArgs = args } =
text (typeSpec (UType t)) <+> text name <>
text "(" <> ppArgs args <> text ");"
where
ppArgs :: [UExpr] -> Doc
ppArgs = hcat . intersperse (text ",") . map ppArg
ppArg :: UExpr -> Doc
ppArg UExpr { uExprType = t1 } = text (typeSpec (UType t1))
-------------------------------------------------------------------------------- | 499 | ppExternalFunction
ExtFun
{ externFunName = name
, externFunType = t
, externFunArgs = args } =
text (typeSpec (UType t)) <+> text name <>
text "(" <> ppArgs args <> text ");"
where
ppArgs :: [UExpr] -> Doc
ppArgs = hcat . intersperse (text ",") . map ppArg
ppArg :: UExpr -> Doc
ppArg UExpr { uExprType = t1 } = text (typeSpec (UType t1))
-------------------------------------------------------------------------------- | 463 | false | true | 0 | 13 | 113 | 165 | 83 | 82 | null | null |
benjumanji/hs-snuffle | src/Main.hs | gpl-3.0 | withSnuffle :: (Bool -> Bool -> FilePath -> IO ()) -- ^ run snuffle options
-> Snuffle -- ^ configured options
-> IO ()
withSnuffle f (Snuffle deps own path) = f deps own path | 227 | withSnuffle :: (Bool -> Bool -> FilePath -> IO ()) -- ^ run snuffle options
-> Snuffle -- ^ configured options
-> IO ()
withSnuffle f (Snuffle deps own path) = f deps own path | 227 | withSnuffle f (Snuffle deps own path) = f deps own path | 55 | false | true | 0 | 11 | 86 | 68 | 34 | 34 | null | null |
olorin/amazonka | amazonka-storagegateway/gen/Network/AWS/StorageGateway/DeleteVolume.hs | mpl-2.0 | -- | Creates a value of 'DeleteVolumeResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dvrsVolumeARN'
--
-- * 'dvrsResponseStatus'
deleteVolumeResponse
:: Int -- ^ 'dvrsResponseStatus'
-> DeleteVolumeResponse
deleteVolumeResponse pResponseStatus_ =
DeleteVolumeResponse'
{ _dvrsVolumeARN = Nothing
, _dvrsResponseStatus = pResponseStatus_
} | 458 | deleteVolumeResponse
:: Int -- ^ 'dvrsResponseStatus'
-> DeleteVolumeResponse
deleteVolumeResponse pResponseStatus_ =
DeleteVolumeResponse'
{ _dvrsVolumeARN = Nothing
, _dvrsResponseStatus = pResponseStatus_
} | 233 | deleteVolumeResponse pResponseStatus_ =
DeleteVolumeResponse'
{ _dvrsVolumeARN = Nothing
, _dvrsResponseStatus = pResponseStatus_
} | 147 | true | true | 0 | 7 | 82 | 49 | 28 | 21 | null | null |
urbanslug/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | -- Error module
assertErrorName :: Name
assertErrorName = varQual gHC_IO_Exception (fsLit "assertError") assertErrorIdKey | 126 | assertErrorName :: Name
assertErrorName = varQual gHC_IO_Exception (fsLit "assertError") assertErrorIdKey | 110 | assertErrorName = varQual gHC_IO_Exception (fsLit "assertError") assertErrorIdKey | 83 | true | true | 0 | 7 | 17 | 25 | 13 | 12 | null | null |
noraesae/euler | src/Problem38.hs | bsd-3-clause | pandigitalNumbers :: [Int] -> [Int]
pandigitalNumbers [a] = [a] | 63 | pandigitalNumbers :: [Int] -> [Int]
pandigitalNumbers [a] = [a] | 63 | pandigitalNumbers [a] = [a] | 27 | false | true | 0 | 8 | 8 | 36 | 18 | 18 | null | null |
fpco/wai-middleware-consul | src/Network/Wai/Middleware/Consul.hs | mit | setConsulPort :: PortNumber -> ConsulSettings -> ConsulSettings
setConsulPort a b = b { csPort = a } | 100 | setConsulPort :: PortNumber -> ConsulSettings -> ConsulSettings
setConsulPort a b = b { csPort = a } | 100 | setConsulPort a b = b { csPort = a } | 36 | false | true | 0 | 6 | 16 | 32 | 17 | 15 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Map.Internal.hs | bsd-3-clause | dropWhileAntitone p (Bin _ kx x l r)
| p kx = dropWhileAntitone p r
| otherwise = link kx x (dropWhileAntitone p l) r | 121 | dropWhileAntitone p (Bin _ kx x l r)
| p kx = dropWhileAntitone p r
| otherwise = link kx x (dropWhileAntitone p l) r | 121 | dropWhileAntitone p (Bin _ kx x l r)
| p kx = dropWhileAntitone p r
| otherwise = link kx x (dropWhileAntitone p l) r | 121 | false | false | 0 | 8 | 28 | 73 | 30 | 43 | null | null |
bitemyapp/hlint | data/Default.hs | bsd-3-clause | error = not (elem x y) ==> notElem x y | 38 | error = not (elem x y) ==> notElem x y | 38 | error = not (elem x y) ==> notElem x y | 38 | false | false | 1 | 7 | 9 | 29 | 12 | 17 | null | null |
whittle/crunchbase | Data/API/CrunchBase/Person.hs | mit | mkFirm :: Value -> Parser S.SearchResult
mkFirm v@(Object o) = o .: "type_of_entity" >>= flip mkFirm' v | 103 | mkFirm :: Value -> Parser S.SearchResult
mkFirm v@(Object o) = o .: "type_of_entity" >>= flip mkFirm' v | 103 | mkFirm v@(Object o) = o .: "type_of_entity" >>= flip mkFirm' v | 62 | false | true | 0 | 8 | 16 | 45 | 22 | 23 | null | null |
andorp/hs-bluesnap | src/Bluesnap/API/Request.hs | gpl-3.0 | elementMandatory :: XMLParser Xsd.Boolean
elementMandatory = parseSchemaType "mandatory" | 88 | elementMandatory :: XMLParser Xsd.Boolean
elementMandatory = parseSchemaType "mandatory" | 88 | elementMandatory = parseSchemaType "mandatory" | 46 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/utils/Pretty.hs | bsd-3-clause | aboveNest (TextBeside s sl p) g k q = textBeside_ s sl rest
where
!k1 = k -# sl
rest = case p of
Empty -> nilAboveNest g k1 q
_ -> aboveNest p g k1 q | 363 | aboveNest (TextBeside s sl p) g k q = textBeside_ s sl rest
where
!k1 = k -# sl
rest = case p of
Empty -> nilAboveNest g k1 q
_ -> aboveNest p g k1 q | 363 | aboveNest (TextBeside s sl p) g k q = textBeside_ s sl rest
where
!k1 = k -# sl
rest = case p of
Empty -> nilAboveNest g k1 q
_ -> aboveNest p g k1 q | 363 | false | false | 0 | 10 | 250 | 82 | 39 | 43 | null | null |
leshchevds/ganeti | src/Ganeti/WConfd/Core.hs | bsd-2-clause | -- ** Temporary reservations related functions
dropAllReservations :: ClientId -> WConfdMonad ()
dropAllReservations cid =
modifyTempResState (const $ T.dropAllReservations cid) | 180 | dropAllReservations :: ClientId -> WConfdMonad ()
dropAllReservations cid =
modifyTempResState (const $ T.dropAllReservations cid) | 132 | dropAllReservations cid =
modifyTempResState (const $ T.dropAllReservations cid) | 82 | true | true | 0 | 9 | 22 | 39 | 19 | 20 | null | null |
siddhanathan/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | ordClass_RDR = nameRdrName ordClassName | 50 | ordClass_RDR = nameRdrName ordClassName | 50 | ordClass_RDR = nameRdrName ordClassName | 50 | false | false | 0 | 5 | 14 | 9 | 4 | 5 | null | null |
jwiegley/ghc-release | utils/haddock/src/Haddock/Backends/Xhtml/Decl.hs | gpl-3.0 | ppr_mono_ty _ (HsCoreTy {}) _ _ = error "ppr_mono_ty HsCoreTy" | 76 | ppr_mono_ty _ (HsCoreTy {}) _ _ = error "ppr_mono_ty HsCoreTy" | 76 | ppr_mono_ty _ (HsCoreTy {}) _ _ = error "ppr_mono_ty HsCoreTy" | 76 | false | false | 0 | 7 | 23 | 25 | 12 | 13 | null | null |
termite2/tsl | Internal/ISpec.hs | bsd-3-clause | twidth (SInt _ w) = w | 24 | twidth (SInt _ w) = w | 24 | twidth (SInt _ w) = w | 24 | false | false | 0 | 6 | 8 | 18 | 8 | 10 | null | null |
seereason/ghcjs | test/rts/weak/weak001.hs | mit | test4 :: IO ()
test4 = do
putStrLn "# test4"
x <- newIORef "x"
wx <- mkWeakIORef x (putStrLn "wx finalized")
putStrLn . ("1: " ++) =<< readIORef x
delay
putStrLn . ("2: " ++) =<< readIORef x
-- finalization should happen here
delay
putStrLn "done" | 265 | test4 :: IO ()
test4 = do
putStrLn "# test4"
x <- newIORef "x"
wx <- mkWeakIORef x (putStrLn "wx finalized")
putStrLn . ("1: " ++) =<< readIORef x
delay
putStrLn . ("2: " ++) =<< readIORef x
-- finalization should happen here
delay
putStrLn "done" | 265 | test4 = do
putStrLn "# test4"
x <- newIORef "x"
wx <- mkWeakIORef x (putStrLn "wx finalized")
putStrLn . ("1: " ++) =<< readIORef x
delay
putStrLn . ("2: " ++) =<< readIORef x
-- finalization should happen here
delay
putStrLn "done" | 250 | false | true | 0 | 10 | 63 | 99 | 45 | 54 | null | null |
sol/depends | test/ConfigSpec.hs | mit | main :: IO ()
main = hspec spec | 31 | main :: IO ()
main = hspec spec | 31 | main = hspec spec | 17 | false | true | 1 | 6 | 7 | 22 | 9 | 13 | null | null |
nikivazou/verified_string_matching | src/Proofs/shiftNewIndices.hs | bsd-3-clause | -------------------------------------------------------------------------------
---------- Lemmata on Shifting Indices ---------------------------------------
-------------------------------------------------------------------------------
{-@ shiftNewIndices
:: xi:RString
-> yi:RString
-> zi:RString
-> tg:{RString | stringLen yi < stringLen tg }
-> { append (makeNewIndices xi (yi <+> zi) tg) (map (shiftStringRight tg xi (yi <+> zi)) (makeNewIndices yi zi tg))
== append (map (castGoodIndexRight tg (xi <+> yi) zi) (makeNewIndices xi yi tg)) (makeNewIndices (xi <+> yi) zi tg)
}
@-}
shiftNewIndices :: RString -> RString -> RString -> RString -> Proof
shiftNewIndices xi yi zi tg
| stringLen tg < 2
= append (makeNewIndices xi yzi tg) (map (shiftStringRight tg xi yzi) (makeNewIndices yi zi tg))
==. append N (map (shiftStringRight tg xi yzi) N)
==. map (shiftStringRight tg xi yzi) N
==. N
==. append N N
==. append (makeNewIndices xi yi tg) (makeNewIndices xyi zi tg)
==. append (map (castGoodIndexRight tg xyi zi) (makeNewIndices xi yi tg)) (makeNewIndices xyi zi tg)
? mapCastId tg xyi zi (makeNewIndices xi yi tg)
*** QED
where
yzi = yi <+> zi
xyi = xi <+> yi
xyziL = xyi <+> zi | 1,267 | shiftNewIndices :: RString -> RString -> RString -> RString -> Proof
shiftNewIndices xi yi zi tg
| stringLen tg < 2
= append (makeNewIndices xi yzi tg) (map (shiftStringRight tg xi yzi) (makeNewIndices yi zi tg))
==. append N (map (shiftStringRight tg xi yzi) N)
==. map (shiftStringRight tg xi yzi) N
==. N
==. append N N
==. append (makeNewIndices xi yi tg) (makeNewIndices xyi zi tg)
==. append (map (castGoodIndexRight tg xyi zi) (makeNewIndices xi yi tg)) (makeNewIndices xyi zi tg)
? mapCastId tg xyi zi (makeNewIndices xi yi tg)
*** QED
where
yzi = yi <+> zi
xyi = xi <+> yi
xyziL = xyi <+> zi | 650 | shiftNewIndices xi yi zi tg
| stringLen tg < 2
= append (makeNewIndices xi yzi tg) (map (shiftStringRight tg xi yzi) (makeNewIndices yi zi tg))
==. append N (map (shiftStringRight tg xi yzi) N)
==. map (shiftStringRight tg xi yzi) N
==. N
==. append N N
==. append (makeNewIndices xi yi tg) (makeNewIndices xyi zi tg)
==. append (map (castGoodIndexRight tg xyi zi) (makeNewIndices xi yi tg)) (makeNewIndices xyi zi tg)
? mapCastId tg xyi zi (makeNewIndices xi yi tg)
*** QED
where
yzi = yi <+> zi
xyi = xi <+> yi
xyziL = xyi <+> zi | 581 | true | true | 10 | 15 | 256 | 306 | 147 | 159 | null | null |
audetto/andsoft | haskell/payoff.hs | gpl-3.0 | main = putStrLn (showLinear f) | 30 | main = putStrLn (showLinear f) | 30 | main = putStrLn (showLinear f) | 30 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
wdanilo/container | src/Data/Container/Class.hs | apache-2.0 | elems = withTransFunc (fmap2 runIdentity) elemsM | 53 | elems = withTransFunc (fmap2 runIdentity) elemsM | 53 | elems = withTransFunc (fmap2 runIdentity) elemsM | 53 | false | false | 0 | 7 | 10 | 17 | 8 | 9 | null | null |
JacksonGariety/earthmacs-hs | src/Buffer.hs | bsd-3-clause | eof :: Buffer -> Int
eof buffer = length $ buffer^.lns | 54 | eof :: Buffer -> Int
eof buffer = length $ buffer^.lns | 54 | eof buffer = length $ buffer^.lns | 33 | false | true | 0 | 6 | 10 | 30 | 14 | 16 | null | null |
bergmark/hakyll | src/Hakyll/Core/Compiler/Require.hs | bsd-3-clause | --------------------------------------------------------------------------------
loadAllSnapshots :: (Binary a, Typeable a)
=> Pattern -> Snapshot -> Compiler [Item a]
loadAllSnapshots pattern snapshot = do
matching <- getMatches pattern
mapM (\i -> loadSnapshot i snapshot) matching
-------------------------------------------------------------------------------- | 391 | loadAllSnapshots :: (Binary a, Typeable a)
=> Pattern -> Snapshot -> Compiler [Item a]
loadAllSnapshots pattern snapshot = do
matching <- getMatches pattern
mapM (\i -> loadSnapshot i snapshot) matching
-------------------------------------------------------------------------------- | 310 | loadAllSnapshots pattern snapshot = do
matching <- getMatches pattern
mapM (\i -> loadSnapshot i snapshot) matching
-------------------------------------------------------------------------------- | 206 | true | true | 0 | 10 | 58 | 81 | 40 | 41 | null | null |
bergey/hscache | src/Cache.hs | bsd-3-clause | dryrun :: GHC -> [Text] -> Sh Text
dryrun ghc args = do
cleanSandbox
writeDryrunNix ghc
errExit False $ do
let cabalCmd = "cabal install --dry-run --constraint 'transformers installed' " <> T.intercalate " " args
frozen <- run "nix-shell" ["dryrun.nix", "--command", cabalCmd]
ex <- lastExitCode
case ex of
0 -> return frozen
2 -> do
echo_err "nix-shell failed with Exit Code 2; What does it mean?"
return frozen
seriousErr -> do
echo_err $ "nix-shell failed with Exit Code " <> T.pack (show seriousErr)
exit 1
-- load at compile time from the .nix in the source | 688 | dryrun :: GHC -> [Text] -> Sh Text
dryrun ghc args = do
cleanSandbox
writeDryrunNix ghc
errExit False $ do
let cabalCmd = "cabal install --dry-run --constraint 'transformers installed' " <> T.intercalate " " args
frozen <- run "nix-shell" ["dryrun.nix", "--command", cabalCmd]
ex <- lastExitCode
case ex of
0 -> return frozen
2 -> do
echo_err "nix-shell failed with Exit Code 2; What does it mean?"
return frozen
seriousErr -> do
echo_err $ "nix-shell failed with Exit Code " <> T.pack (show seriousErr)
exit 1
-- load at compile time from the .nix in the source | 688 | dryrun ghc args = do
cleanSandbox
writeDryrunNix ghc
errExit False $ do
let cabalCmd = "cabal install --dry-run --constraint 'transformers installed' " <> T.intercalate " " args
frozen <- run "nix-shell" ["dryrun.nix", "--command", cabalCmd]
ex <- lastExitCode
case ex of
0 -> return frozen
2 -> do
echo_err "nix-shell failed with Exit Code 2; What does it mean?"
return frozen
seriousErr -> do
echo_err $ "nix-shell failed with Exit Code " <> T.pack (show seriousErr)
exit 1
-- load at compile time from the .nix in the source | 653 | false | true | 0 | 18 | 221 | 166 | 75 | 91 | null | null |
quantum-dan/HasKnowledge | Handler/Quiz.hs | mit | getAvailableQuizzes :: Maybe (Key User) -> Handler [Entity Quiz]
getAvailableQuizzes mUserId = case mUserId of
Nothing -> getPublicQuizzes
Just userId -> runDB $ do
shared <- selectList [SharedQuizUserId ==. userId] []
let ownedFilter = [QuizUserId ==. userId]
let sharedQuizIds = map (sharedQuizQuizId . entityVal) shared
let ownedOrSharedFilter = foldr (||.) ownedFilter $ map (\id -> [QuizId ==. id]) sharedQuizIds
let availableFilter = ownedOrSharedFilter ||. [QuizPublicAccess ==. True]
selectList availableFilter [] | 549 | getAvailableQuizzes :: Maybe (Key User) -> Handler [Entity Quiz]
getAvailableQuizzes mUserId = case mUserId of
Nothing -> getPublicQuizzes
Just userId -> runDB $ do
shared <- selectList [SharedQuizUserId ==. userId] []
let ownedFilter = [QuizUserId ==. userId]
let sharedQuizIds = map (sharedQuizQuizId . entityVal) shared
let ownedOrSharedFilter = foldr (||.) ownedFilter $ map (\id -> [QuizId ==. id]) sharedQuizIds
let availableFilter = ownedOrSharedFilter ||. [QuizPublicAccess ==. True]
selectList availableFilter [] | 549 | getAvailableQuizzes mUserId = case mUserId of
Nothing -> getPublicQuizzes
Just userId -> runDB $ do
shared <- selectList [SharedQuizUserId ==. userId] []
let ownedFilter = [QuizUserId ==. userId]
let sharedQuizIds = map (sharedQuizQuizId . entityVal) shared
let ownedOrSharedFilter = foldr (||.) ownedFilter $ map (\id -> [QuizId ==. id]) sharedQuizIds
let availableFilter = ownedOrSharedFilter ||. [QuizPublicAccess ==. True]
selectList availableFilter [] | 484 | false | true | 3 | 20 | 97 | 180 | 88 | 92 | null | null |
aelve/guide | back/src/Guide/Database/Import.hs | bsd-3-clause | -- | Load categories and deleted categories from acid state to postgres
-- and check if they are equal.
--
-- NOTE: It loads categories and categoriesDeleted fields of GlobalState only.
loadIntoPostgres :: Config -> IO ()
loadIntoPostgres config@Config{..} = withLogger config $ \logger -> do
withDB (pure ()) $ \db -> do
globalState <- dbQuery logger db GetGlobalState
postgresLoader logger globalState | 413 | loadIntoPostgres :: Config -> IO ()
loadIntoPostgres config@Config{..} = withLogger config $ \logger -> do
withDB (pure ()) $ \db -> do
globalState <- dbQuery logger db GetGlobalState
postgresLoader logger globalState | 227 | loadIntoPostgres config@Config{..} = withLogger config $ \logger -> do
withDB (pure ()) $ \db -> do
globalState <- dbQuery logger db GetGlobalState
postgresLoader logger globalState | 191 | true | true | 0 | 14 | 71 | 93 | 46 | 47 | null | null |
tonymorris/geo-gpx | src/Data/Geo/GPX/Type/Degrees.hs | bsd-3-clause | runDegrees ::
Degrees
-> Double
runDegrees (Degrees d) =
d | 64 | runDegrees ::
Degrees
-> Double
runDegrees (Degrees d) =
d | 64 | runDegrees (Degrees d) =
d | 28 | false | true | 0 | 9 | 15 | 26 | 12 | 14 | null | null |
owainlewis/slack | src/Network/Slack/Api.hs | mit | endpoints :: M.Map Endpoint String
endpoints = M.unionsWith (<>) allEndpoints
where
allEndpoints =
[ authEndpoints
, channelEndpoints
, chatEndpoints
, emojiEndpoints
, fileEndpoints
, groupEndpoints
, imEndpoints
, oauthEndpoints
, rtmEndpoints
, searchEndpoints
, starsEndpoints
, teamEndpoints
, userEndpoints
] | 404 | endpoints :: M.Map Endpoint String
endpoints = M.unionsWith (<>) allEndpoints
where
allEndpoints =
[ authEndpoints
, channelEndpoints
, chatEndpoints
, emojiEndpoints
, fileEndpoints
, groupEndpoints
, imEndpoints
, oauthEndpoints
, rtmEndpoints
, searchEndpoints
, starsEndpoints
, teamEndpoints
, userEndpoints
] | 404 | endpoints = M.unionsWith (<>) allEndpoints
where
allEndpoints =
[ authEndpoints
, channelEndpoints
, chatEndpoints
, emojiEndpoints
, fileEndpoints
, groupEndpoints
, imEndpoints
, oauthEndpoints
, rtmEndpoints
, searchEndpoints
, starsEndpoints
, teamEndpoints
, userEndpoints
] | 369 | false | true | 1 | 6 | 129 | 78 | 44 | 34 | null | null |
rahulmutt/ghcvm | compiler/Eta/BasicTypes/Module.hs | bsd-3-clause | plusModuleEnv :: ModuleEnv a -> ModuleEnv a -> ModuleEnv a
plusModuleEnv (ModuleEnv e1) (ModuleEnv e2) = ModuleEnv (Map.union e1 e2) | 132 | plusModuleEnv :: ModuleEnv a -> ModuleEnv a -> ModuleEnv a
plusModuleEnv (ModuleEnv e1) (ModuleEnv e2) = ModuleEnv (Map.union e1 e2) | 132 | plusModuleEnv (ModuleEnv e1) (ModuleEnv e2) = ModuleEnv (Map.union e1 e2) | 73 | false | true | 0 | 8 | 19 | 58 | 27 | 31 | null | null |
gafiatulin/codewars | src/2 kyu/AlgebraicIsomorphism.hs | mit | isoSymm :: ISO (ISO a b) (ISO b a)
isoSymm = (symm, symm) | 57 | isoSymm :: ISO (ISO a b) (ISO b a)
isoSymm = (symm, symm) | 57 | isoSymm = (symm, symm) | 22 | false | true | 0 | 8 | 12 | 44 | 21 | 23 | null | null |
rebeccaskinner/advent_of_code_2016 | day2/solution.hs | apache-2.0 | parseInstr 'R' = Right R | 24 | parseInstr 'R' = Right R | 24 | parseInstr 'R' = Right R | 24 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
z0isch/lambda-hive | src/SlackBot/HiveBot.hs | bsd-3-clause | gameStart Player2 gs@(cid,submitter) = do
userState.gameStates %= Map.alter (const $ Just (WaitingForPlayerToMove, initGS)) gs
sendMessage (Id cid) $ "<@" <> submitter <> ">: Your turn." | 190 | gameStart Player2 gs@(cid,submitter) = do
userState.gameStates %= Map.alter (const $ Just (WaitingForPlayerToMove, initGS)) gs
sendMessage (Id cid) $ "<@" <> submitter <> ">: Your turn." | 190 | gameStart Player2 gs@(cid,submitter) = do
userState.gameStates %= Map.alter (const $ Just (WaitingForPlayerToMove, initGS)) gs
sendMessage (Id cid) $ "<@" <> submitter <> ">: Your turn." | 190 | false | false | 0 | 12 | 28 | 76 | 38 | 38 | null | null |
siddhanathan/ghc | compiler/nativeGen/SPARC/Ppr.hs | bsd-3-clause | pprInstr (SRL reg1 ri reg2) = pprRegRIReg (sLit "srl") False reg1 ri reg2 | 76 | pprInstr (SRL reg1 ri reg2) = pprRegRIReg (sLit "srl") False reg1 ri reg2 | 76 | pprInstr (SRL reg1 ri reg2) = pprRegRIReg (sLit "srl") False reg1 ri reg2 | 76 | false | false | 0 | 7 | 15 | 36 | 17 | 19 | null | null |
imalsogreg/hackage-matrix-builder | src/Api/Queue.hs | gpl-3.0 | list :: ListHandler Root
list = mkListing jsonO handler
where
handler :: Range -> ExceptT Reason_ Root [QueueItem]
handler r = listRange r <$> liftIO Q.list | 166 | list :: ListHandler Root
list = mkListing jsonO handler
where
handler :: Range -> ExceptT Reason_ Root [QueueItem]
handler r = listRange r <$> liftIO Q.list | 166 | list = mkListing jsonO handler
where
handler :: Range -> ExceptT Reason_ Root [QueueItem]
handler r = listRange r <$> liftIO Q.list | 141 | false | true | 1 | 7 | 35 | 64 | 29 | 35 | null | null |
tobsan/yane | CPUHelpers.hs | gpl-3.0 | {-| Fetches absolute address and adds register y.
-}
absoluteY :: (NesCPU m) => m Address
absoluteY = absolute <+> (transform <$> getY) | 136 | absoluteY :: (NesCPU m) => m Address
absoluteY = absolute <+> (transform <$> getY) | 82 | absoluteY = absolute <+> (transform <$> getY) | 45 | true | true | 0 | 8 | 23 | 41 | 20 | 21 | null | null |
Heather/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | implicitNamesIn :: [Name] -> IState -> PTerm -> [Name]
implicitNamesIn uvars ist tm
= let (imps, fns) = execState (ni 0 [] tm) ([], []) in
nub imps \\ nub fns
where
addImp n = do (imps, fns) <- get
put (n : imps, fns)
addFn n = do (imps, fns) <- get
put (imps, n: fns)
notCAF [] = False
notCAF (PExp _ _ _ _ : _) = True
notCAF (_ : xs) = notCAF xs
notHidden (n, _) = case getAccessibility n of
Hidden -> False
Private -> False
_ -> True
getAccessibility n
= case lookupDefAccExact n False (tt_ctxt ist) of
Just (n,t) -> t
_ -> Public
ni 0 env (PRef _ _ n@(NS _ _))
| not (n `elem` env)
-- Never implicitly bind if there's a namespace
= addFn n
ni 0 env (PRef _ _ n)
| not (n `elem` env) && implicitable n || n `elem` uvars = addImp n
ni 0 env (PApp _ f@(PRef _ _ n) as)
| n `elem` uvars = do ni 0 env f
mapM_ (ni 0 env . getTm) as
| otherwise = do case lookupTy n (tt_ctxt ist) of
[] -> return ()
_ -> addFn n
mapM_ (ni 0 env . getTm) as
ni 0 env (PApp _ f as) = do ni 0 env f
mapM_ (ni 0 env . getTm) as
ni 0 env (PAppBind _ f as) = do ni 0 env f
mapM_ (ni 0 env . getTm) as
ni 0 env (PCase _ c os) = do ni 0 env c
-- names in 'os', not counting the names bound in the cases
mapM_ (ni 0 env . snd) os
(imps, fns) <- get
put ([] ,[])
mapM_ (ni 0 env . fst) os
(impsfst, _) <- get
put (nub imps \\ nub impsfst, fns)
ni 0 env (PIfThenElse _ c t f) = mapM_ (ni 0 env) [c, t, f]
ni 0 env (PLam fc n _ ty sc) = do ni 0 env ty; ni 0 (n:env) sc
ni 0 env (PPi p n _ ty sc) = do ni 0 env ty; ni 0 (n:env) sc
ni 0 env (PLet fc n _ ty val sc) = do ni 0 env ty;
ni 0 env val; ni 0 (n:env) sc
ni 0 env (PRewrite _ _ l r _) = do ni 0 env l; ni 0 env r
ni 0 env (PTyped l r) = do ni 0 env l; ni 0 env r
ni 0 env (PPair _ _ _ l r) = do ni 0 env l; ni 0 env r
ni 0 env (PDPair _ _ _ (PRef _ _ n) t r) = do ni 0 env t; ni 0 (n:env) r
ni 0 env (PDPair _ _ _ l t r) = do ni 0 env l
ni 0 env t
ni 0 env r
ni 0 env (PAlternative ns a as) = mapM_ (ni 0 env) as
ni 0 env (PHidden tm) = ni 0 env tm
ni 0 env (PUnifyLog tm) = ni 0 env tm
ni 0 env (PDisamb _ tm) = ni 0 env tm
ni 0 env (PNoImplicits tm) = ni 0 env tm
ni i env (PQuasiquote tm ty) = do ni (i + 1) env tm
maybe (return ()) (ni i env) ty
ni i env (PUnquote tm) = ni (i - 1) env tm
ni i env tm = mapM_ (ni i env) (children tm)
-- Return names which are free in the given term. | 3,504 | implicitNamesIn :: [Name] -> IState -> PTerm -> [Name]
implicitNamesIn uvars ist tm
= let (imps, fns) = execState (ni 0 [] tm) ([], []) in
nub imps \\ nub fns
where
addImp n = do (imps, fns) <- get
put (n : imps, fns)
addFn n = do (imps, fns) <- get
put (imps, n: fns)
notCAF [] = False
notCAF (PExp _ _ _ _ : _) = True
notCAF (_ : xs) = notCAF xs
notHidden (n, _) = case getAccessibility n of
Hidden -> False
Private -> False
_ -> True
getAccessibility n
= case lookupDefAccExact n False (tt_ctxt ist) of
Just (n,t) -> t
_ -> Public
ni 0 env (PRef _ _ n@(NS _ _))
| not (n `elem` env)
-- Never implicitly bind if there's a namespace
= addFn n
ni 0 env (PRef _ _ n)
| not (n `elem` env) && implicitable n || n `elem` uvars = addImp n
ni 0 env (PApp _ f@(PRef _ _ n) as)
| n `elem` uvars = do ni 0 env f
mapM_ (ni 0 env . getTm) as
| otherwise = do case lookupTy n (tt_ctxt ist) of
[] -> return ()
_ -> addFn n
mapM_ (ni 0 env . getTm) as
ni 0 env (PApp _ f as) = do ni 0 env f
mapM_ (ni 0 env . getTm) as
ni 0 env (PAppBind _ f as) = do ni 0 env f
mapM_ (ni 0 env . getTm) as
ni 0 env (PCase _ c os) = do ni 0 env c
-- names in 'os', not counting the names bound in the cases
mapM_ (ni 0 env . snd) os
(imps, fns) <- get
put ([] ,[])
mapM_ (ni 0 env . fst) os
(impsfst, _) <- get
put (nub imps \\ nub impsfst, fns)
ni 0 env (PIfThenElse _ c t f) = mapM_ (ni 0 env) [c, t, f]
ni 0 env (PLam fc n _ ty sc) = do ni 0 env ty; ni 0 (n:env) sc
ni 0 env (PPi p n _ ty sc) = do ni 0 env ty; ni 0 (n:env) sc
ni 0 env (PLet fc n _ ty val sc) = do ni 0 env ty;
ni 0 env val; ni 0 (n:env) sc
ni 0 env (PRewrite _ _ l r _) = do ni 0 env l; ni 0 env r
ni 0 env (PTyped l r) = do ni 0 env l; ni 0 env r
ni 0 env (PPair _ _ _ l r) = do ni 0 env l; ni 0 env r
ni 0 env (PDPair _ _ _ (PRef _ _ n) t r) = do ni 0 env t; ni 0 (n:env) r
ni 0 env (PDPair _ _ _ l t r) = do ni 0 env l
ni 0 env t
ni 0 env r
ni 0 env (PAlternative ns a as) = mapM_ (ni 0 env) as
ni 0 env (PHidden tm) = ni 0 env tm
ni 0 env (PUnifyLog tm) = ni 0 env tm
ni 0 env (PDisamb _ tm) = ni 0 env tm
ni 0 env (PNoImplicits tm) = ni 0 env tm
ni i env (PQuasiquote tm ty) = do ni (i + 1) env tm
maybe (return ()) (ni i env) ty
ni i env (PUnquote tm) = ni (i - 1) env tm
ni i env tm = mapM_ (ni i env) (children tm)
-- Return names which are free in the given term. | 3,504 | implicitNamesIn uvars ist tm
= let (imps, fns) = execState (ni 0 [] tm) ([], []) in
nub imps \\ nub fns
where
addImp n = do (imps, fns) <- get
put (n : imps, fns)
addFn n = do (imps, fns) <- get
put (imps, n: fns)
notCAF [] = False
notCAF (PExp _ _ _ _ : _) = True
notCAF (_ : xs) = notCAF xs
notHidden (n, _) = case getAccessibility n of
Hidden -> False
Private -> False
_ -> True
getAccessibility n
= case lookupDefAccExact n False (tt_ctxt ist) of
Just (n,t) -> t
_ -> Public
ni 0 env (PRef _ _ n@(NS _ _))
| not (n `elem` env)
-- Never implicitly bind if there's a namespace
= addFn n
ni 0 env (PRef _ _ n)
| not (n `elem` env) && implicitable n || n `elem` uvars = addImp n
ni 0 env (PApp _ f@(PRef _ _ n) as)
| n `elem` uvars = do ni 0 env f
mapM_ (ni 0 env . getTm) as
| otherwise = do case lookupTy n (tt_ctxt ist) of
[] -> return ()
_ -> addFn n
mapM_ (ni 0 env . getTm) as
ni 0 env (PApp _ f as) = do ni 0 env f
mapM_ (ni 0 env . getTm) as
ni 0 env (PAppBind _ f as) = do ni 0 env f
mapM_ (ni 0 env . getTm) as
ni 0 env (PCase _ c os) = do ni 0 env c
-- names in 'os', not counting the names bound in the cases
mapM_ (ni 0 env . snd) os
(imps, fns) <- get
put ([] ,[])
mapM_ (ni 0 env . fst) os
(impsfst, _) <- get
put (nub imps \\ nub impsfst, fns)
ni 0 env (PIfThenElse _ c t f) = mapM_ (ni 0 env) [c, t, f]
ni 0 env (PLam fc n _ ty sc) = do ni 0 env ty; ni 0 (n:env) sc
ni 0 env (PPi p n _ ty sc) = do ni 0 env ty; ni 0 (n:env) sc
ni 0 env (PLet fc n _ ty val sc) = do ni 0 env ty;
ni 0 env val; ni 0 (n:env) sc
ni 0 env (PRewrite _ _ l r _) = do ni 0 env l; ni 0 env r
ni 0 env (PTyped l r) = do ni 0 env l; ni 0 env r
ni 0 env (PPair _ _ _ l r) = do ni 0 env l; ni 0 env r
ni 0 env (PDPair _ _ _ (PRef _ _ n) t r) = do ni 0 env t; ni 0 (n:env) r
ni 0 env (PDPair _ _ _ l t r) = do ni 0 env l
ni 0 env t
ni 0 env r
ni 0 env (PAlternative ns a as) = mapM_ (ni 0 env) as
ni 0 env (PHidden tm) = ni 0 env tm
ni 0 env (PUnifyLog tm) = ni 0 env tm
ni 0 env (PDisamb _ tm) = ni 0 env tm
ni 0 env (PNoImplicits tm) = ni 0 env tm
ni i env (PQuasiquote tm ty) = do ni (i + 1) env tm
maybe (return ()) (ni i env) ty
ni i env (PUnquote tm) = ni (i - 1) env tm
ni i env tm = mapM_ (ni i env) (children tm)
-- Return names which are free in the given term. | 3,449 | false | true | 0 | 13 | 1,786 | 1,551 | 751 | 800 | null | null |
jrahm/DuckTest | src/DuckTest/Infer/Functions.hs | bsd-2-clause | {- This function will take a Python function and infer the type
- of this function. The type infered from this function is
- of the type [args] -> return type. All the types are in a
- structural format -}
inferTypeForFunction :: InternalState a -> Statement a -> DuckTest a PyType
inferTypeForFunction state (Fun (Ident name _) params _ body _) =
{- Get a list of the names of the parameters to the function. For
- each of those parameters, try to infer the type of each.
-
- Return type is not yet able to be inferred. This is a TODO -}
let parameterIdentifiers :: [String]
parameterIdentifiers = map (tryGetIdentifier "") params
returnType = Any -- cannot yet infer return type
newstate = addVariableType name (Functional (map (const ("",Any)) params) Any) state
in
flip Functional returnType <$>
(zip parameterIdentifiers <$>
mapM (toAny <.< flip (inferTypeForVariable newstate) body) parameterIdentifiers)
where {- We don't want arguments to be void -}
toAny Void = Any
toAny t = t | 1,114 | inferTypeForFunction :: InternalState a -> Statement a -> DuckTest a PyType
inferTypeForFunction state (Fun (Ident name _) params _ body _) =
{- Get a list of the names of the parameters to the function. For
- each of those parameters, try to infer the type of each.
-
- Return type is not yet able to be inferred. This is a TODO -}
let parameterIdentifiers :: [String]
parameterIdentifiers = map (tryGetIdentifier "") params
returnType = Any -- cannot yet infer return type
newstate = addVariableType name (Functional (map (const ("",Any)) params) Any) state
in
flip Functional returnType <$>
(zip parameterIdentifiers <$>
mapM (toAny <.< flip (inferTypeForVariable newstate) body) parameterIdentifiers)
where {- We don't want arguments to be void -}
toAny Void = Any
toAny t = t | 905 | inferTypeForFunction state (Fun (Ident name _) params _ body _) =
{- Get a list of the names of the parameters to the function. For
- each of those parameters, try to infer the type of each.
-
- Return type is not yet able to be inferred. This is a TODO -}
let parameterIdentifiers :: [String]
parameterIdentifiers = map (tryGetIdentifier "") params
returnType = Any -- cannot yet infer return type
newstate = addVariableType name (Functional (map (const ("",Any)) params) Any) state
in
flip Functional returnType <$>
(zip parameterIdentifiers <$>
mapM (toAny <.< flip (inferTypeForVariable newstate) body) parameterIdentifiers)
where {- We don't want arguments to be void -}
toAny Void = Any
toAny t = t | 829 | true | true | 1 | 16 | 296 | 197 | 99 | 98 | null | null |
iblech/blaze-html | website/site.hs | bsd-3-clause | config :: Configuration
config = defaultConfiguration
{ deployCommand = "rsync --checksum -ave 'ssh -p 2222' \
\_site/* jaspervdj@jaspervdj.be:jaspervdj.be/blaze"
} | 194 | config :: Configuration
config = defaultConfiguration
{ deployCommand = "rsync --checksum -ave 'ssh -p 2222' \
\_site/* jaspervdj@jaspervdj.be:jaspervdj.be/blaze"
} | 194 | config = defaultConfiguration
{ deployCommand = "rsync --checksum -ave 'ssh -p 2222' \
\_site/* jaspervdj@jaspervdj.be:jaspervdj.be/blaze"
} | 170 | false | true | 0 | 7 | 48 | 29 | 13 | 16 | null | null |
sgillespie/ghc | compiler/utils/Outputable.hs | bsd-3-clause | ---------------------
-- Put a name in parens if it's an operator
pprPrefixVar :: Bool -> SDoc -> SDoc
pprPrefixVar is_operator pp_v
| is_operator = parens pp_v
| otherwise = pp_v | 185 | pprPrefixVar :: Bool -> SDoc -> SDoc
pprPrefixVar is_operator pp_v
| is_operator = parens pp_v
| otherwise = pp_v | 119 | pprPrefixVar is_operator pp_v
| is_operator = parens pp_v
| otherwise = pp_v | 82 | true | true | 1 | 7 | 35 | 43 | 21 | 22 | null | null |
mcschroeder/ghc | compiler/hsSyn/HsDecls.hs | bsd-3-clause | lvectDeclName (L _ (HsVectTypeOut _ tycon _)) = getName tycon | 68 | lvectDeclName (L _ (HsVectTypeOut _ tycon _)) = getName tycon | 68 | lvectDeclName (L _ (HsVectTypeOut _ tycon _)) = getName tycon | 68 | false | false | 0 | 9 | 16 | 30 | 14 | 16 | null | null |
gbataille/pandoc | tests/Tests/Helpers.hs | gpl-2.0 | test :: (ToString a, ToString b, ToString c)
=> (a -> b) -- ^ function to test
-> String -- ^ name of test case
-> (a, c) -- ^ (input, expected value)
-> Test
test fn name (input, expected) =
testCase name $ assertBool msg (actual' == expected')
where msg = nl ++ dashes "input" ++ nl ++ input' ++ nl ++
dashes "result" ++ nl ++
unlines (map vividize diff) ++
dashes ""
nl = "\n"
input' = toString input
actual' = lines $ toString $ fn input
expected' = lines $ toString expected
diff = getDiff expected' actual'
dashes "" = replicate 72 '-'
dashes x = replicate (72 - length x - 5) '-' ++ " " ++ x ++ " ---" | 772 | test :: (ToString a, ToString b, ToString c)
=> (a -> b) -- ^ function to test
-> String -- ^ name of test case
-> (a, c) -- ^ (input, expected value)
-> Test
test fn name (input, expected) =
testCase name $ assertBool msg (actual' == expected')
where msg = nl ++ dashes "input" ++ nl ++ input' ++ nl ++
dashes "result" ++ nl ++
unlines (map vividize diff) ++
dashes ""
nl = "\n"
input' = toString input
actual' = lines $ toString $ fn input
expected' = lines $ toString expected
diff = getDiff expected' actual'
dashes "" = replicate 72 '-'
dashes x = replicate (72 - length x - 5) '-' ++ " " ++ x ++ " ---" | 772 | test fn name (input, expected) =
testCase name $ assertBool msg (actual' == expected')
where msg = nl ++ dashes "input" ++ nl ++ input' ++ nl ++
dashes "result" ++ nl ++
unlines (map vividize diff) ++
dashes ""
nl = "\n"
input' = toString input
actual' = lines $ toString $ fn input
expected' = lines $ toString expected
diff = getDiff expected' actual'
dashes "" = replicate 72 '-'
dashes x = replicate (72 - length x - 5) '-' ++ " " ++ x ++ " ---" | 586 | false | true | 10 | 12 | 289 | 279 | 130 | 149 | null | null |
monostable/haskell-kicad-data | Data/Kicad/PcbnewExpr/Parse.hs | mit | asPcbnewPad :: [SExpr] -> Either String PcbnewItem
asPcbnewPad (n:t:s:xs) = interpretNumber
where
interpretNumber = case n of
(Atom _ num) -> interpretType defaultPcbnewPad {padNumber = num}
_ -> expecting "string designating pad number" n
interpretType :: PcbnewItem -> Either String PcbnewItem
interpretType pad = case t of
(Atom _ str) -> case strToPadType str of
Just d -> interpretShape pad {padType = d}
Nothing ->
expecting "pad type (e.g. 'smd')" t
_ -> expecting "pad type string (e.g. 'smd')" t
interpretShape :: PcbnewItem -> Either String PcbnewItem
interpretShape pad = case s of
(Atom _ str) -> case strToPadShape str of
Just d -> interpretRest xs pad {padShape = d}
Nothing ->
expecting "pad shape (e.g. 'circle')" s
_ -> expecting "pad shape string (e.g. 'circle')" s
interpretRest :: [SExpr] -> PcbnewItem -> Either String PcbnewItem
interpretRest [] pad = Right pad
interpretRest (sx:sxs) pad = case fromSExpr sx of
Left err -> Left err
Right (PcbnewExprAttribute (PcbnewAt d))
-> interpretRest sxs pad {itemAt = d}
Right (PcbnewExprAttribute (PcbnewLayers d))
-> interpretRest sxs pad {padLayers = d}
Right (PcbnewExprAttribute (PcbnewSize d))
-> interpretRest sxs pad {itemSize = d}
Right (PcbnewExprAttribute a@(PcbnewDrill _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewRectDelta _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewMaskMargin _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewPasteMarginRatio _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewPasteMargin _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewClearance _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewZoneConnect _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewThermalWidth _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewThermalGap _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewRoundrectRratio _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewDieLength _))
-> pushToAttrs sxs a pad
_ -> expecting "at, size, drill, layers , margins etc. or nothing" sx
pushToAttrs sxs a pad = interpretRest sxs (over padAttributes (++[a]) pad) | 2,885 | asPcbnewPad :: [SExpr] -> Either String PcbnewItem
asPcbnewPad (n:t:s:xs) = interpretNumber
where
interpretNumber = case n of
(Atom _ num) -> interpretType defaultPcbnewPad {padNumber = num}
_ -> expecting "string designating pad number" n
interpretType :: PcbnewItem -> Either String PcbnewItem
interpretType pad = case t of
(Atom _ str) -> case strToPadType str of
Just d -> interpretShape pad {padType = d}
Nothing ->
expecting "pad type (e.g. 'smd')" t
_ -> expecting "pad type string (e.g. 'smd')" t
interpretShape :: PcbnewItem -> Either String PcbnewItem
interpretShape pad = case s of
(Atom _ str) -> case strToPadShape str of
Just d -> interpretRest xs pad {padShape = d}
Nothing ->
expecting "pad shape (e.g. 'circle')" s
_ -> expecting "pad shape string (e.g. 'circle')" s
interpretRest :: [SExpr] -> PcbnewItem -> Either String PcbnewItem
interpretRest [] pad = Right pad
interpretRest (sx:sxs) pad = case fromSExpr sx of
Left err -> Left err
Right (PcbnewExprAttribute (PcbnewAt d))
-> interpretRest sxs pad {itemAt = d}
Right (PcbnewExprAttribute (PcbnewLayers d))
-> interpretRest sxs pad {padLayers = d}
Right (PcbnewExprAttribute (PcbnewSize d))
-> interpretRest sxs pad {itemSize = d}
Right (PcbnewExprAttribute a@(PcbnewDrill _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewRectDelta _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewMaskMargin _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewPasteMarginRatio _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewPasteMargin _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewClearance _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewZoneConnect _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewThermalWidth _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewThermalGap _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewRoundrectRratio _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewDieLength _))
-> pushToAttrs sxs a pad
_ -> expecting "at, size, drill, layers , margins etc. or nothing" sx
pushToAttrs sxs a pad = interpretRest sxs (over padAttributes (++[a]) pad) | 2,885 | asPcbnewPad (n:t:s:xs) = interpretNumber
where
interpretNumber = case n of
(Atom _ num) -> interpretType defaultPcbnewPad {padNumber = num}
_ -> expecting "string designating pad number" n
interpretType :: PcbnewItem -> Either String PcbnewItem
interpretType pad = case t of
(Atom _ str) -> case strToPadType str of
Just d -> interpretShape pad {padType = d}
Nothing ->
expecting "pad type (e.g. 'smd')" t
_ -> expecting "pad type string (e.g. 'smd')" t
interpretShape :: PcbnewItem -> Either String PcbnewItem
interpretShape pad = case s of
(Atom _ str) -> case strToPadShape str of
Just d -> interpretRest xs pad {padShape = d}
Nothing ->
expecting "pad shape (e.g. 'circle')" s
_ -> expecting "pad shape string (e.g. 'circle')" s
interpretRest :: [SExpr] -> PcbnewItem -> Either String PcbnewItem
interpretRest [] pad = Right pad
interpretRest (sx:sxs) pad = case fromSExpr sx of
Left err -> Left err
Right (PcbnewExprAttribute (PcbnewAt d))
-> interpretRest sxs pad {itemAt = d}
Right (PcbnewExprAttribute (PcbnewLayers d))
-> interpretRest sxs pad {padLayers = d}
Right (PcbnewExprAttribute (PcbnewSize d))
-> interpretRest sxs pad {itemSize = d}
Right (PcbnewExprAttribute a@(PcbnewDrill _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewRectDelta _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewMaskMargin _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewPasteMarginRatio _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewPasteMargin _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewClearance _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewZoneConnect _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewThermalWidth _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewThermalGap _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewRoundrectRratio _))
-> pushToAttrs sxs a pad
Right (PcbnewExprAttribute a@(PcbnewDieLength _))
-> pushToAttrs sxs a pad
_ -> expecting "at, size, drill, layers , margins etc. or nothing" sx
pushToAttrs sxs a pad = interpretRest sxs (over padAttributes (++[a]) pad) | 2,834 | false | true | 0 | 13 | 1,005 | 829 | 406 | 423 | null | null |
ndmitchell/shake | src/Development/Ninja/All.hs | bsd-3-clause | bsProgFiles = BS.pack "PROGRAM FILES" | 37 | bsProgFiles = BS.pack "PROGRAM FILES" | 37 | bsProgFiles = BS.pack "PROGRAM FILES" | 37 | false | false | 0 | 6 | 4 | 11 | 5 | 6 | null | null |
wilbowma/accelerate | Data/Array/Accelerate/Interpreter.hs | bsd-3-clause | scanrOp :: forall e. (e -> e -> e)
-> e
-> Delayed (Vector e)
-> Delayed (Vector e)
scanrOp f e (DelayedArray sh rf)
= delay $ adata `seq` Array ((), n + 1) adata
where
n = size sh
f' = Sugar.sinkFromElt2 f
--
(adata, _) = runArrayData $ do
arr <- newArrayData (n + 1)
final <- traverse arr n (Sugar.fromElt e)
writeArrayData arr 0 final
return (arr, undefined)
traverse :: MutableArrayData s (Sugar.EltRepr e) -> Int -> (Sugar.EltRepr e) -> ST s (Sugar.EltRepr e)
traverse arr i v
| i == 0 = return v
| otherwise = do
writeArrayData arr i v
traverse arr (i - 1) (f' v (rf ((), i))) | 773 | scanrOp :: forall e. (e -> e -> e)
-> e
-> Delayed (Vector e)
-> Delayed (Vector e)
scanrOp f e (DelayedArray sh rf)
= delay $ adata `seq` Array ((), n + 1) adata
where
n = size sh
f' = Sugar.sinkFromElt2 f
--
(adata, _) = runArrayData $ do
arr <- newArrayData (n + 1)
final <- traverse arr n (Sugar.fromElt e)
writeArrayData arr 0 final
return (arr, undefined)
traverse :: MutableArrayData s (Sugar.EltRepr e) -> Int -> (Sugar.EltRepr e) -> ST s (Sugar.EltRepr e)
traverse arr i v
| i == 0 = return v
| otherwise = do
writeArrayData arr i v
traverse arr (i - 1) (f' v (rf ((), i))) | 773 | scanrOp f e (DelayedArray sh rf)
= delay $ adata `seq` Array ((), n + 1) adata
where
n = size sh
f' = Sugar.sinkFromElt2 f
--
(adata, _) = runArrayData $ do
arr <- newArrayData (n + 1)
final <- traverse arr n (Sugar.fromElt e)
writeArrayData arr 0 final
return (arr, undefined)
traverse :: MutableArrayData s (Sugar.EltRepr e) -> Int -> (Sugar.EltRepr e) -> ST s (Sugar.EltRepr e)
traverse arr i v
| i == 0 = return v
| otherwise = do
writeArrayData arr i v
traverse arr (i - 1) (f' v (rf ((), i))) | 665 | false | true | 2 | 14 | 307 | 337 | 164 | 173 | null | null |
robertjlooby/scotty-story-board | app/views/AuthViews.hs | mit | login :: ByteString -> S.ActionM ()
login googleLoginUrl = Layouts.app $ do
H.div ! class_ "container" $ do
H.div ! class_ "row" $ do
H.div ! class_ "six columns" $ do
h2 "Login"
p . (a ! (href . unsafeByteStringValue $ googleLoginUrl)) $ "Login with Google" | 314 | login :: ByteString -> S.ActionM ()
login googleLoginUrl = Layouts.app $ do
H.div ! class_ "container" $ do
H.div ! class_ "row" $ do
H.div ! class_ "six columns" $ do
h2 "Login"
p . (a ! (href . unsafeByteStringValue $ googleLoginUrl)) $ "Login with Google" | 314 | login googleLoginUrl = Layouts.app $ do
H.div ! class_ "container" $ do
H.div ! class_ "row" $ do
H.div ! class_ "six columns" $ do
h2 "Login"
p . (a ! (href . unsafeByteStringValue $ googleLoginUrl)) $ "Login with Google" | 278 | false | true | 0 | 23 | 101 | 114 | 53 | 61 | null | null |
input-output-hk/cardano-sl | core/test/Test/Pos/Core/ExampleHelpers.hs | apache-2.0 | feedPMWithRequiresMagic :: (ProtocolMagic -> H.Gen a) -> H.Gen a
feedPMWithRequiresMagic genA = do
pm <- flip ProtocolMagic RequiresMagic <$> genProtocolMagicId
genA pm | 176 | feedPMWithRequiresMagic :: (ProtocolMagic -> H.Gen a) -> H.Gen a
feedPMWithRequiresMagic genA = do
pm <- flip ProtocolMagic RequiresMagic <$> genProtocolMagicId
genA pm | 176 | feedPMWithRequiresMagic genA = do
pm <- flip ProtocolMagic RequiresMagic <$> genProtocolMagicId
genA pm | 111 | false | true | 0 | 9 | 29 | 57 | 26 | 31 | null | null |
brendanhay/gogol | gogol-appengine/gen/Network/Google/Resource/AppEngine/Apps/AuthorizedCertificates/Delete.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
aacdUploadType :: Lens' AppsAuthorizedCertificatesDelete (Maybe Text)
aacdUploadType
= lens _aacdUploadType
(\ s a -> s{_aacdUploadType = a}) | 220 | aacdUploadType :: Lens' AppsAuthorizedCertificatesDelete (Maybe Text)
aacdUploadType
= lens _aacdUploadType
(\ s a -> s{_aacdUploadType = a}) | 149 | aacdUploadType
= lens _aacdUploadType
(\ s a -> s{_aacdUploadType = a}) | 79 | true | true | 1 | 9 | 34 | 52 | 25 | 27 | null | null |
dmp1ce/Haskell-Programming-Exercises | Chapter 28/simpleQueueSingle.hs | unlicense | empty :: Queue a
empty = Queue [] | 33 | empty :: Queue a
empty = Queue [] | 33 | empty = Queue [] | 16 | false | true | 0 | 6 | 7 | 25 | 10 | 15 | null | null |
tomlokhorst/language-cil | src/Language/Cil/Build.hs | bsd-3-clause | ldlen :: MethodDecl
ldlen = OpCode $ Ldlen | 42 | ldlen :: MethodDecl
ldlen = OpCode $ Ldlen | 42 | ldlen = OpCode $ Ldlen | 22 | false | true | 2 | 6 | 7 | 23 | 9 | 14 | null | null |
urbanslug/ghc | libraries/base/tests/enum01.hs | bsd-3-clause | mayBomb x = catch x (\(ErrorCall e) -> putStrLn ("error " ++ show e))
`catch` (\e -> putStrLn ("Fail: " ++ show (e :: SomeException))) | 137 | mayBomb x = catch x (\(ErrorCall e) -> putStrLn ("error " ++ show e))
`catch` (\e -> putStrLn ("Fail: " ++ show (e :: SomeException))) | 137 | mayBomb x = catch x (\(ErrorCall e) -> putStrLn ("error " ++ show e))
`catch` (\e -> putStrLn ("Fail: " ++ show (e :: SomeException))) | 137 | false | false | 0 | 13 | 27 | 78 | 40 | 38 | null | null |
anthonyrgreen/redditDigest | src/HtmlCreator.hs | bsd-3-clause | noBulletPointsCSS :: Css
noBulletPointsCSS = ul ? listStyleType none | 68 | noBulletPointsCSS :: Css
noBulletPointsCSS = ul ? listStyleType none | 68 | noBulletPointsCSS = ul ? listStyleType none | 43 | false | true | 0 | 6 | 8 | 24 | 10 | 14 | null | null |
abakst/liquidhaskell | benchmarks/base-4.5.1.0/Data/HashTable.hs | bsd-3-clause | -- index of bucket within table.
bucketIndex :: Int32 -> Int32 -> Int32
bucketIndex mask h = h .&. mask | 103 | bucketIndex :: Int32 -> Int32 -> Int32
bucketIndex mask h = h .&. mask | 70 | bucketIndex mask h = h .&. mask | 31 | true | true | 2 | 8 | 19 | 37 | 17 | 20 | null | null |
forste/haReFork | tools/hs2stratego/PropDecorate2Stratego2.hs | bsd-3-clause | --transDec :: (IsSpecialName i,PrintableOp i) => HsDeclI i -> D
transDec (Dec d) =
prop (transD transId transExp transPat transLocalDecs transType transContext transTlhs)
(transPD transId transOAssertion transPredicate)
d | 243 | transDec (Dec d) =
prop (transD transId transExp transPat transLocalDecs transType transContext transTlhs)
(transPD transId transOAssertion transPredicate)
d | 179 | transDec (Dec d) =
prop (transD transId transExp transPat transLocalDecs transType transContext transTlhs)
(transPD transId transOAssertion transPredicate)
d | 179 | true | false | 0 | 7 | 49 | 51 | 25 | 26 | null | null |
seronic/diagramtests | diagramstest.hs | gpl-2.0 | c:: Diagram B
c = hcat $ invisHead (map d' (take 7 (iterate (/magicConstant) 1))) | 81 | c:: Diagram B
c = hcat $ invisHead (map d' (take 7 (iterate (/magicConstant) 1))) | 81 | c = hcat $ invisHead (map d' (take 7 (iterate (/magicConstant) 1))) | 67 | false | true | 1 | 13 | 14 | 53 | 25 | 28 | null | null |
shlevy/ghc | compiler/nativeGen/X86/Ppr.hs | bsd-3-clause | pprGInstr (GMUL fmt src1 src2 dst) = pprFormatRegRegReg (sLit "gmul") fmt src1 src2 dst | 87 | pprGInstr (GMUL fmt src1 src2 dst) = pprFormatRegRegReg (sLit "gmul") fmt src1 src2 dst | 87 | pprGInstr (GMUL fmt src1 src2 dst) = pprFormatRegRegReg (sLit "gmul") fmt src1 src2 dst | 87 | false | false | 0 | 7 | 13 | 39 | 18 | 21 | null | null |
mettekou/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | pprCtO HoleOrigin = text "a use of" <+> quotes (text "_") | 68 | pprCtO HoleOrigin = text "a use of" <+> quotes (text "_") | 68 | pprCtO HoleOrigin = text "a use of" <+> quotes (text "_") | 68 | false | false | 0 | 8 | 21 | 26 | 11 | 15 | null | null |
Philonous/hs-stun | source/Network/Stun/MappedAddress.hs | mit | xorAddress _ _ = error "xorAddress does not work on SockAddrUnix" | 65 | xorAddress _ _ = error "xorAddress does not work on SockAddrUnix" | 65 | xorAddress _ _ = error "xorAddress does not work on SockAddrUnix" | 65 | false | false | 0 | 5 | 10 | 14 | 6 | 8 | null | null |
ilyasergey/GHC-XAppFix | compiler/nativeGen/PPC/Ppr.hs | bsd-3-clause | pprInstr platform (SLW reg1 reg2 ri) = pprLogic platform (sLit "slw") reg1 reg2 (limitShiftRI ri) | 97 | pprInstr platform (SLW reg1 reg2 ri) = pprLogic platform (sLit "slw") reg1 reg2 (limitShiftRI ri) | 97 | pprInstr platform (SLW reg1 reg2 ri) = pprLogic platform (sLit "slw") reg1 reg2 (limitShiftRI ri) | 97 | false | false | 0 | 7 | 14 | 44 | 21 | 23 | null | null |
bollu/symengine.hs-1 | src/Symengine/NumberTheory.hs | mit | factorial :: Int -> BasicSym
factorial n = unsafePerformIO $ do
fact <- basicsym_new
with fact (\fact -> ntheory_factorial_ffi fact (fromIntegral n))
return fact
-- FFI Bindings
-- gcd, lcm | 195 | factorial :: Int -> BasicSym
factorial n = unsafePerformIO $ do
fact <- basicsym_new
with fact (\fact -> ntheory_factorial_ffi fact (fromIntegral n))
return fact
-- FFI Bindings
-- gcd, lcm | 195 | factorial n = unsafePerformIO $ do
fact <- basicsym_new
with fact (\fact -> ntheory_factorial_ffi fact (fromIntegral n))
return fact
-- FFI Bindings
-- gcd, lcm | 166 | false | true | 0 | 13 | 35 | 64 | 31 | 33 | null | null |
meiersi-11ce/stack | src/Stack/Types/Config.hs | bsd-3-clause | parsePvpBounds :: Text -> Either String PvpBounds
parsePvpBounds t =
case Map.lookup t m of
Nothing -> Left $ "Invalid PVP bounds: " ++ T.unpack t
Just x -> Right x
where
m = Map.fromList $ map (pvpBoundsText &&& id) [minBound..maxBound] | 263 | parsePvpBounds :: Text -> Either String PvpBounds
parsePvpBounds t =
case Map.lookup t m of
Nothing -> Left $ "Invalid PVP bounds: " ++ T.unpack t
Just x -> Right x
where
m = Map.fromList $ map (pvpBoundsText &&& id) [minBound..maxBound] | 263 | parsePvpBounds t =
case Map.lookup t m of
Nothing -> Left $ "Invalid PVP bounds: " ++ T.unpack t
Just x -> Right x
where
m = Map.fromList $ map (pvpBoundsText &&& id) [minBound..maxBound] | 213 | false | true | 0 | 10 | 66 | 96 | 46 | 50 | null | null |
Happstack/happstack-hsp | src/HSP/Google/Analytics.hs | bsd-3-clause | -- | create the google analytics asynchronous tracking script tag
--
-- This uses the now dubbed 'classic google analytics'
--
-- NOTE: you must put this right before the \<\/head\> tag
-- see also: universalAnalytics
analyticsAsync :: (XMLGenerator m, StringType m ~ Text) =>
UACCT -- ^ web property ID (looks like: @UA-XXXXX-X@)
-> GenXML m
analyticsAsync (UACCT uacct) = [hsx|
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<% pack uacct %>']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script> |] | 937 | analyticsAsync :: (XMLGenerator m, StringType m ~ Text) =>
UACCT -- ^ web property ID (looks like: @UA-XXXXX-X@)
-> GenXML m
analyticsAsync (UACCT uacct) = [hsx|
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<% pack uacct %>']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script> |] | 719 | analyticsAsync (UACCT uacct) = [hsx|
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<% pack uacct %>']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script> |] | 557 | true | true | 0 | 8 | 209 | 58 | 34 | 24 | null | null |
jaalonso/I1M-Cod-Temas | src/Tema_21/PolOperaciones.hs | gpl-2.0 | -- ---------------------------------------------------------------------
-- Generador de polinomios --
-- ---------------------------------------------------------------------
-- (genPol n) es un generador de polinomios. Por ejemplo,
-- λ> sample (genPol 1)
-- 7*x^9 + 9*x^8 + 10*x^7 + -14*x^5 + -15*x^2 + -10
-- -4*x^8 + 2*x
-- -8*x^9 + 4*x^8 + 2*x^6 + 4*x^5 + -6*x^4 + 5*x^2 + -8*x
-- -9*x^9 + x^5 + -7
-- 8*x^10 + -9*x^7 + 7*x^6 + 9*x^5 + 10*x^3 + -1*x^2
-- 7*x^10 + 5*x^9 + -5
-- -8*x^10 + -7
-- -5*x
-- 5*x^10 + 4*x^4 + -3
-- 3*x^3 + -4
-- 10*x
genPol :: (Arbitrary a, Num a, Eq a) => Int -> Gen (Polinomio a)
genPol 0 = return polCero | 720 | genPol :: (Arbitrary a, Num a, Eq a) => Int -> Gen (Polinomio a)
genPol 0 = return polCero | 90 | genPol 0 = return polCero | 25 | true | true | 0 | 9 | 194 | 71 | 42 | 29 | null | null |
svenssonjoel/ObsidianGFX | Obsidian/Exp.hs | bsd-3-clause | expToIExpGeneral (UnOp ATan e) = IFunCall "atan" [expToIExp e] (typeOf e) | 79 | expToIExpGeneral (UnOp ATan e) = IFunCall "atan" [expToIExp e] (typeOf e) | 79 | expToIExpGeneral (UnOp ATan e) = IFunCall "atan" [expToIExp e] (typeOf e) | 79 | false | false | 0 | 7 | 16 | 36 | 17 | 19 | null | null |
mikeplus64/repl | src/Language/Haskell/Repl.hs | mit | overHead :: (a -> a) -> [a] -> [a]
overHead f xs' = case xs' of
x:xs -> f x : xs
_ -> []
| 102 | overHead :: (a -> a) -> [a] -> [a]
overHead f xs' = case xs' of
x:xs -> f x : xs
_ -> []
| 102 | overHead f xs' = case xs' of
x:xs -> f x : xs
_ -> []
| 67 | false | true | 0 | 9 | 38 | 66 | 34 | 32 | null | null |
egaburov/funstuff | Haskell/tytag/l04.hs | apache-2.0 | sprintf :: FPr String b -> b
sprintf (FPr fmt) = fmt id | 55 | sprintf :: FPr String b -> b
sprintf (FPr fmt) = fmt id | 55 | sprintf (FPr fmt) = fmt id | 26 | false | true | 0 | 9 | 12 | 38 | 16 | 22 | null | null |
Undeterminant/config-home-gui | home/.xmonad/xmonad.hs | cc0-1.0 | myKeyHome4 Colemak = xK_t | 28 | myKeyHome4 Colemak = xK_t | 28 | myKeyHome4 Colemak = xK_t | 28 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
keithodulaigh/Hets | RelationalScheme/Keywords.hs | gpl-2.0 | rsDateId :: Id
rsDateId = stringToId rsDate | 43 | rsDateId :: Id
rsDateId = stringToId rsDate | 43 | rsDateId = stringToId rsDate | 28 | false | true | 0 | 6 | 6 | 21 | 8 | 13 | null | null |
parapluu/encore | src/back/CodeGen/Expr.hs | bsd-3-clause | newParty _ = error "Expr.hs: node is not 'PartyPar'" | 52 | newParty _ = error "Expr.hs: node is not 'PartyPar'" | 52 | newParty _ = error "Expr.hs: node is not 'PartyPar'" | 52 | false | false | 0 | 4 | 8 | 13 | 5 | 8 | null | null |
ku-fpg/lambda-bridge | Network/LambdaBridge/Board.hs | bsd-3-clause | rxStateMachine v (BusWrite 1 w) (Go,x) = do
ok <- tryPutMVar v w
return ((),(NoGo,if ok then x + 1
else x)) | 190 | rxStateMachine v (BusWrite 1 w) (Go,x) = do
ok <- tryPutMVar v w
return ((),(NoGo,if ok then x + 1
else x)) | 190 | rxStateMachine v (BusWrite 1 w) (Go,x) = do
ok <- tryPutMVar v w
return ((),(NoGo,if ok then x + 1
else x)) | 190 | false | false | 0 | 11 | 104 | 72 | 37 | 35 | null | null |
brianshourd/adventOfCode2015 | src/Day14.hs | mit | run :: IO ()
run = do
putStrLn "Day 14 results: "
input <- readFile "inputs/day14.txt"
putStrLn $ " " ++ show (day14 input)
putStrLn $ " " ++ show (day14' input) | 179 | run :: IO ()
run = do
putStrLn "Day 14 results: "
input <- readFile "inputs/day14.txt"
putStrLn $ " " ++ show (day14 input)
putStrLn $ " " ++ show (day14' input) | 179 | run = do
putStrLn "Day 14 results: "
input <- readFile "inputs/day14.txt"
putStrLn $ " " ++ show (day14 input)
putStrLn $ " " ++ show (day14' input) | 166 | false | true | 0 | 11 | 49 | 78 | 33 | 45 | null | null |
NotBrianZach/postgrest | src/PostgREST/App.hs | mit | splitKeyValue :: BS.ByteString -> (BS.ByteString, BS.ByteString)
splitKeyValue kv = (k, BS.tail v)
where (k, v) = BS.break (== '=') kv | 136 | splitKeyValue :: BS.ByteString -> (BS.ByteString, BS.ByteString)
splitKeyValue kv = (k, BS.tail v)
where (k, v) = BS.break (== '=') kv | 136 | splitKeyValue kv = (k, BS.tail v)
where (k, v) = BS.break (== '=') kv | 71 | false | true | 0 | 7 | 21 | 66 | 36 | 30 | null | null |
iblumenfeld/cryptol | src/Cryptol/Parser/ParserUtils.hs | bsd-3-clause | numLit x = panic "[Parser] numLit" ["invalid numeric literal", show x] | 70 | numLit x = panic "[Parser] numLit" ["invalid numeric literal", show x] | 70 | numLit x = panic "[Parser] numLit" ["invalid numeric literal", show x] | 70 | false | false | 1 | 7 | 10 | 28 | 11 | 17 | null | null |
danse/haskellers | tests/Handler/Admin.hs | bsd-2-clause | postUnblockR :: UserId -> Handler ()
postUnblockR = adminHelper UserBlocked False "User has been unblocked" | 107 | postUnblockR :: UserId -> Handler ()
postUnblockR = adminHelper UserBlocked False "User has been unblocked" | 107 | postUnblockR = adminHelper UserBlocked False "User has been unblocked" | 70 | false | true | 0 | 8 | 14 | 32 | 14 | 18 | null | null |
vikraman/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | -- | Check whether a type constructor is the constructor for parallel arrays
isPArrTyCon :: TyCon -> Bool
isPArrTyCon tc = tyConName tc == parrTyConName | 156 | isPArrTyCon :: TyCon -> Bool
isPArrTyCon tc = tyConName tc == parrTyConName | 79 | isPArrTyCon tc = tyConName tc == parrTyConName | 47 | true | true | 0 | 6 | 28 | 26 | 13 | 13 | null | null |
adinapoli/api-tools | tests/Data/API/Test/DSL.hs | bsd-3-clause | example :: API
example = map ThNode
[ APINode "IsoS" "simple String newtype defn" ""
(SpNewtype $ SpecNewtype BTstring Nothing) Nothing
, APINode "IsoB" "simple Bool newtype defn" ""
(SpNewtype $ SpecNewtype BTbool Nothing) Nothing
, APINode "IsoI" "simple Int newtype defn" ""
(SpNewtype $ SpecNewtype BTint Nothing) Nothing
, APINode "Foo" "a test defn" "bAr_" (SpRecord $ SpecRecord
[ (,) "Baz" (FieldType (TyBasic BTbool) False Nothing "just a bool")
, (,) "Qux" (FieldType (TyBasic BTint) False Nothing "just an int")
]) Nothing
, APINode "Wibble" "another test defn" "dro" (SpUnion $ SpecUnion
[ (,) "wubble" (TyList $ TyName "Foo", "list of Foo")
, (,) "flubble" (TyBasic BTstring , "a string" )
]) Nothing
, APINode "Enumer" "enum test defn" "enm" (SpEnum $ SpecEnum
[ ("wubble", "")
, ("flubble", "")
]) Nothing
] | 1,002 | example :: API
example = map ThNode
[ APINode "IsoS" "simple String newtype defn" ""
(SpNewtype $ SpecNewtype BTstring Nothing) Nothing
, APINode "IsoB" "simple Bool newtype defn" ""
(SpNewtype $ SpecNewtype BTbool Nothing) Nothing
, APINode "IsoI" "simple Int newtype defn" ""
(SpNewtype $ SpecNewtype BTint Nothing) Nothing
, APINode "Foo" "a test defn" "bAr_" (SpRecord $ SpecRecord
[ (,) "Baz" (FieldType (TyBasic BTbool) False Nothing "just a bool")
, (,) "Qux" (FieldType (TyBasic BTint) False Nothing "just an int")
]) Nothing
, APINode "Wibble" "another test defn" "dro" (SpUnion $ SpecUnion
[ (,) "wubble" (TyList $ TyName "Foo", "list of Foo")
, (,) "flubble" (TyBasic BTstring , "a string" )
]) Nothing
, APINode "Enumer" "enum test defn" "enm" (SpEnum $ SpecEnum
[ ("wubble", "")
, ("flubble", "")
]) Nothing
] | 1,002 | example = map ThNode
[ APINode "IsoS" "simple String newtype defn" ""
(SpNewtype $ SpecNewtype BTstring Nothing) Nothing
, APINode "IsoB" "simple Bool newtype defn" ""
(SpNewtype $ SpecNewtype BTbool Nothing) Nothing
, APINode "IsoI" "simple Int newtype defn" ""
(SpNewtype $ SpecNewtype BTint Nothing) Nothing
, APINode "Foo" "a test defn" "bAr_" (SpRecord $ SpecRecord
[ (,) "Baz" (FieldType (TyBasic BTbool) False Nothing "just a bool")
, (,) "Qux" (FieldType (TyBasic BTint) False Nothing "just an int")
]) Nothing
, APINode "Wibble" "another test defn" "dro" (SpUnion $ SpecUnion
[ (,) "wubble" (TyList $ TyName "Foo", "list of Foo")
, (,) "flubble" (TyBasic BTstring , "a string" )
]) Nothing
, APINode "Enumer" "enum test defn" "enm" (SpEnum $ SpecEnum
[ ("wubble", "")
, ("flubble", "")
]) Nothing
] | 987 | false | true | 0 | 16 | 312 | 286 | 149 | 137 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/src/Data/Unicode/DecomposeChar.hs | mit | decomposeChar '\xFA43' = "\x6691" | 33 | decomposeChar '\xFA43' = "\x6691" | 33 | decomposeChar '\xFA43' = "\x6691" | 33 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
kojiromike/Idris-dev | src/IRTS/JavaScript/AST.hs | bsd-3-clause | jsAst2Text (JsArray l) =
T.concat ["[", T.intercalate ", " (map jsAst2Text l), "]"] | 85 | jsAst2Text (JsArray l) =
T.concat ["[", T.intercalate ", " (map jsAst2Text l), "]"] | 85 | jsAst2Text (JsArray l) =
T.concat ["[", T.intercalate ", " (map jsAst2Text l), "]"] | 85 | false | false | 0 | 9 | 14 | 44 | 22 | 22 | null | null |
ktvoelker/AParsec | src/Text/Parsec/Applicative/BNF.hs | gpl-3.0 | showsSepBy :: Bool -> [ShowS] -> ShowS -> ShowS
showsSepBy _ [] _ = id | 70 | showsSepBy :: Bool -> [ShowS] -> ShowS -> ShowS
showsSepBy _ [] _ = id | 70 | showsSepBy _ [] _ = id | 22 | false | true | 0 | 10 | 14 | 41 | 19 | 22 | null | null |
Khady/Functional-Programming | codes/do_notation1.hs | unlicense | do1test = do
c <- getChar
putChar 'x'
putChar c
putChar '\n' | 77 | do1test = do
c <- getChar
putChar 'x'
putChar c
putChar '\n' | 77 | do1test = do
c <- getChar
putChar 'x'
putChar c
putChar '\n' | 77 | false | false | 0 | 7 | 28 | 31 | 12 | 19 | null | null |
BartMassey/mc-level | Find.hs | bsd-3-clause | filterByEnch :: Find -> Item -> Bool
filterByEnch tree item =
let qualList = (findItemQuals tree) in
if null qualList then
True
else
if null (extractEnchantments item) then
any (filterByEnch tree) (extractContainedItems item)
else
all filterByEnchInner (extractEnchantments item) ||
any (filterByEnch tree) (extractContainedItems item)
where
filterByEnchInner ItemEnchantment {enchantmentId = itemEnchId, enchantmentLevel = itemEnchLvl} =
all filterByQuals (findItemQuals tree)
where
filterByQuals ItemQualEnch {itemQualEnchId = enchId, itemQualEnchAttrs = qualEnchAttrs} =
if enchId == itemEnchId &&
all filterByEnchAttrs qualEnchAttrs then
True
else
False
where
filterByEnchAttrs (ItemQualLevel rel) =
if (rel itemEnchLvl) then
True
else
False | 1,278 | filterByEnch :: Find -> Item -> Bool
filterByEnch tree item =
let qualList = (findItemQuals tree) in
if null qualList then
True
else
if null (extractEnchantments item) then
any (filterByEnch tree) (extractContainedItems item)
else
all filterByEnchInner (extractEnchantments item) ||
any (filterByEnch tree) (extractContainedItems item)
where
filterByEnchInner ItemEnchantment {enchantmentId = itemEnchId, enchantmentLevel = itemEnchLvl} =
all filterByQuals (findItemQuals tree)
where
filterByQuals ItemQualEnch {itemQualEnchId = enchId, itemQualEnchAttrs = qualEnchAttrs} =
if enchId == itemEnchId &&
all filterByEnchAttrs qualEnchAttrs then
True
else
False
where
filterByEnchAttrs (ItemQualLevel rel) =
if (rel itemEnchLvl) then
True
else
False | 1,278 | filterByEnch tree item =
let qualList = (findItemQuals tree) in
if null qualList then
True
else
if null (extractEnchantments item) then
any (filterByEnch tree) (extractContainedItems item)
else
all filterByEnchInner (extractEnchantments item) ||
any (filterByEnch tree) (extractContainedItems item)
where
filterByEnchInner ItemEnchantment {enchantmentId = itemEnchId, enchantmentLevel = itemEnchLvl} =
all filterByQuals (findItemQuals tree)
where
filterByQuals ItemQualEnch {itemQualEnchId = enchId, itemQualEnchAttrs = qualEnchAttrs} =
if enchId == itemEnchId &&
all filterByEnchAttrs qualEnchAttrs then
True
else
False
where
filterByEnchAttrs (ItemQualLevel rel) =
if (rel itemEnchLvl) then
True
else
False | 1,241 | false | true | 0 | 13 | 624 | 230 | 118 | 112 | null | null |
hverr/lxdfile | src/System/LXD/LXDFile/Utils/Line.hs | gpl-3.0 | unsafeStringToLine :: String -> Line
unsafeStringToLine = unsafeTextToLine . pack | 81 | unsafeStringToLine :: String -> Line
unsafeStringToLine = unsafeTextToLine . pack | 81 | unsafeStringToLine = unsafeTextToLine . pack | 44 | false | true | 0 | 7 | 9 | 26 | 11 | 15 | null | null |
albertov/behave-hs | test/Arbitrary.hs | bsd-3-clause | bearing :: Gen Azimuth
bearing = fmap (*~degree) (choose (0,359)) | 66 | bearing :: Gen Azimuth
bearing = fmap (*~degree) (choose (0,359)) | 66 | bearing = fmap (*~degree) (choose (0,359)) | 43 | false | true | 0 | 8 | 10 | 35 | 19 | 16 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.