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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
iblumenfeld/cryptol | src/Cryptol/Transform/Specialize.hs | bsd-3-clause | -- Specializer -----------------------------------------------------------------
-- | Add a `where` clause to the given expression containing
-- type-specialized versions of all functions called (transitively) by
-- the body of the expression.
specialize :: Expr -> M.ModuleCmd Expr
specialize expr modEnv = run $ do
let extDgs = allDeclGroups modEnv
let (tparams, expr') = destETAbs expr
spec' <- specializeEWhere expr' extDgs
return (foldr ETAbs spec' tparams)
where
run = M.runModuleT modEnv . fmap fst . runSpecT Map.empty | 539 | specialize :: Expr -> M.ModuleCmd Expr
specialize expr modEnv = run $ do
let extDgs = allDeclGroups modEnv
let (tparams, expr') = destETAbs expr
spec' <- specializeEWhere expr' extDgs
return (foldr ETAbs spec' tparams)
where
run = M.runModuleT modEnv . fmap fst . runSpecT Map.empty | 294 | specialize expr modEnv = run $ do
let extDgs = allDeclGroups modEnv
let (tparams, expr') = destETAbs expr
spec' <- specializeEWhere expr' extDgs
return (foldr ETAbs spec' tparams)
where
run = M.runModuleT modEnv . fmap fst . runSpecT Map.empty | 255 | true | true | 1 | 11 | 86 | 128 | 58 | 70 | null | null |
silky/csound-expression | src/Csound/Control/Sf.hs | bsd-3-clause | genSfMsg :: (SigSpace a, Sigs a) => SfFun a -> Sf -> D -> Msg -> SE a
genSfMsg play sf sustain msg = return $ mul env $ play (veloc msg) (notnum msg) 1 1 sf
where env = sfEnv sustain (veloc msg / 127) | 204 | genSfMsg :: (SigSpace a, Sigs a) => SfFun a -> Sf -> D -> Msg -> SE a
genSfMsg play sf sustain msg = return $ mul env $ play (veloc msg) (notnum msg) 1 1 sf
where env = sfEnv sustain (veloc msg / 127) | 204 | genSfMsg play sf sustain msg = return $ mul env $ play (veloc msg) (notnum msg) 1 1 sf
where env = sfEnv sustain (veloc msg / 127) | 134 | false | true | 1 | 10 | 49 | 124 | 56 | 68 | null | null |
beni55/hermit | src/HERMIT/Kernel.hs | bsd-2-clause | msg (Always s) = Just s | 23 | msg (Always s) = Just s | 23 | msg (Always s) = Just s | 23 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
kadena-io/pact | src/Pact/Types/ExpParser.hs | bsd-3-clause | list' :: ListDelimiter -> ExpParse s (ListExp Info,Exp Info)
list' d = list >>= \l@(ListExp{..},_) ->
if _listDelimiter == d then commit >> return l
else expected $ enlist d (\(s,e)->unpack(s<>"list"<>e)) | 208 | list' :: ListDelimiter -> ExpParse s (ListExp Info,Exp Info)
list' d = list >>= \l@(ListExp{..},_) ->
if _listDelimiter == d then commit >> return l
else expected $ enlist d (\(s,e)->unpack(s<>"list"<>e)) | 208 | list' d = list >>= \l@(ListExp{..},_) ->
if _listDelimiter == d then commit >> return l
else expected $ enlist d (\(s,e)->unpack(s<>"list"<>e)) | 147 | false | true | 0 | 15 | 34 | 115 | 61 | 54 | null | null |
uuhan/Idris-dev | src/IRTS/JavaScript/AST.hs | bsd-3-clause | jsStmt2Text (JsFun name args body) =
T.concat
[ "function "
, name
, "("
, T.intercalate ", " args
, "){\n"
, indent $ jsStmt2Text body
, "}\n"
] | 179 | jsStmt2Text (JsFun name args body) =
T.concat
[ "function "
, name
, "("
, T.intercalate ", " args
, "){\n"
, indent $ jsStmt2Text body
, "}\n"
] | 179 | jsStmt2Text (JsFun name args body) =
T.concat
[ "function "
, name
, "("
, T.intercalate ", " args
, "){\n"
, indent $ jsStmt2Text body
, "}\n"
] | 179 | false | false | 0 | 7 | 62 | 59 | 31 | 28 | null | null |
wereHamster/github-influx-bridge | Main.hs | mit | influxConfig :: Manager -> IO (Maybe (Config, Text))
influxConfig httpManager = runMaybeT $ do
uri <- MaybeT $ lookupEnv "INFLUXDB"
URI{..} <- MaybeT $ return $ parseURI uri
URIAuth{..} <- MaybeT $ return $ uriAuthority
(username, password) <- MaybeT $ case T.splitOn ":" (T.pack $ init uriUserInfo) of
[a,b] -> return $ Just (a,b)
_ -> return Nothing
port <- MaybeT $ return $ Just $ case uriPort of
(':':x) -> fromMaybe 8086 $ readMay x
_ -> 8086
serverPool <- MaybeT $ Just <$> newServerPool
(Server (T.pack uriRegName) port False)
[]
config <- MaybeT $ return $ Just $ Config
(Credentials username password)
serverPool
httpManager
-- Check to make sure the db is not an empty string.
db <- MaybeT $ return $ case tail uriPath of
[] -> Nothing
x -> Just x
MaybeT $ return $ Just (config, T.pack db) | 939 | influxConfig :: Manager -> IO (Maybe (Config, Text))
influxConfig httpManager = runMaybeT $ do
uri <- MaybeT $ lookupEnv "INFLUXDB"
URI{..} <- MaybeT $ return $ parseURI uri
URIAuth{..} <- MaybeT $ return $ uriAuthority
(username, password) <- MaybeT $ case T.splitOn ":" (T.pack $ init uriUserInfo) of
[a,b] -> return $ Just (a,b)
_ -> return Nothing
port <- MaybeT $ return $ Just $ case uriPort of
(':':x) -> fromMaybe 8086 $ readMay x
_ -> 8086
serverPool <- MaybeT $ Just <$> newServerPool
(Server (T.pack uriRegName) port False)
[]
config <- MaybeT $ return $ Just $ Config
(Credentials username password)
serverPool
httpManager
-- Check to make sure the db is not an empty string.
db <- MaybeT $ return $ case tail uriPath of
[] -> Nothing
x -> Just x
MaybeT $ return $ Just (config, T.pack db) | 939 | influxConfig httpManager = runMaybeT $ do
uri <- MaybeT $ lookupEnv "INFLUXDB"
URI{..} <- MaybeT $ return $ parseURI uri
URIAuth{..} <- MaybeT $ return $ uriAuthority
(username, password) <- MaybeT $ case T.splitOn ":" (T.pack $ init uriUserInfo) of
[a,b] -> return $ Just (a,b)
_ -> return Nothing
port <- MaybeT $ return $ Just $ case uriPort of
(':':x) -> fromMaybe 8086 $ readMay x
_ -> 8086
serverPool <- MaybeT $ Just <$> newServerPool
(Server (T.pack uriRegName) port False)
[]
config <- MaybeT $ return $ Just $ Config
(Credentials username password)
serverPool
httpManager
-- Check to make sure the db is not an empty string.
db <- MaybeT $ return $ case tail uriPath of
[] -> Nothing
x -> Just x
MaybeT $ return $ Just (config, T.pack db) | 886 | false | true | 0 | 16 | 280 | 366 | 176 | 190 | null | null |
unisonweb/platform | parser-typechecker/src/Unison/Codebase/Editor/HandleInput.hs | mit | showTodoOutput
:: Action' m v PPE.PrettyPrintEnvDecl
-- ^ Action that fetches the pretty print env. It's expensive because it
-- involves looking up historical names, so only call it if necessary.
-> Patch
-> Names0
-> Action' m v ()
showTodoOutput getPpe patch names0 = do
todo <- checkTodo patch names0
if TO.noConflicts todo && TO.noEdits todo
then respond NoConflictsOrEdits
else do
numberedArgs .=
(Text.unpack . Reference.toText . view _2 <$>
fst (TO.todoFrontierDependents todo))
ppe <- getPpe
respond $ TodoOutput ppe todo | 596 | showTodoOutput
:: Action' m v PPE.PrettyPrintEnvDecl
-- ^ Action that fetches the pretty print env. It's expensive because it
-- involves looking up historical names, so only call it if necessary.
-> Patch
-> Names0
-> Action' m v ()
showTodoOutput getPpe patch names0 = do
todo <- checkTodo patch names0
if TO.noConflicts todo && TO.noEdits todo
then respond NoConflictsOrEdits
else do
numberedArgs .=
(Text.unpack . Reference.toText . view _2 <$>
fst (TO.todoFrontierDependents todo))
ppe <- getPpe
respond $ TodoOutput ppe todo | 596 | showTodoOutput getPpe patch names0 = do
todo <- checkTodo patch names0
if TO.noConflicts todo && TO.noEdits todo
then respond NoConflictsOrEdits
else do
numberedArgs .=
(Text.unpack . Reference.toText . view _2 <$>
fst (TO.todoFrontierDependents todo))
ppe <- getPpe
respond $ TodoOutput ppe todo | 344 | false | true | 0 | 17 | 147 | 154 | 71 | 83 | null | null |
trskop/hs-not-found | not-found/src/Control/Monad/Utils.hs | bsd-3-clause | -- | Flipped version of '>.>'.
(<.<) :: Monad m => (a -> b -> m c) -> (a -> m b) -> a -> m c
(<.<) = flip (>.>) | 111 | (<.<) :: Monad m => (a -> b -> m c) -> (a -> m b) -> a -> m c
(<.<) = flip (>.>) | 80 | (<.<) = flip (>.>) | 18 | true | true | 0 | 10 | 30 | 67 | 36 | 31 | null | null |
GaloisInc/ivory | ivory-opts/src/Ivory/Opts/SanityCheck.hs | bsd-3-clause | -- Not an imported type, but we don't need hte type here.
structs m = [ (nm, Imported)
| (I.Struct nm _) <- getVisible I.modStructs m ] | 155 | structs m = [ (nm, Imported)
| (I.Struct nm _) <- getVisible I.modStructs m ] | 97 | structs m = [ (nm, Imported)
| (I.Struct nm _) <- getVisible I.modStructs m ] | 97 | true | false | 0 | 10 | 46 | 44 | 23 | 21 | null | null |
Rathcke/uni | ap/advanced programming/exam/src/subs/ParserTest.hs | gpl-3.0 | testSucc1 :: Test
testSucc1 = TestCase (do parsedFile <- parseFile "tests/scope.js"
assertEqual "description"
simpleScopeAST $ show parsedFile) | 207 | testSucc1 :: Test
testSucc1 = TestCase (do parsedFile <- parseFile "tests/scope.js"
assertEqual "description"
simpleScopeAST $ show parsedFile) | 207 | testSucc1 = TestCase (do parsedFile <- parseFile "tests/scope.js"
assertEqual "description"
simpleScopeAST $ show parsedFile) | 189 | false | true | 0 | 10 | 80 | 42 | 19 | 23 | null | null |
vdweegen/UvA-Software_Testing | Lab1/Final/Exercises.hs | gpl-3.0 | isMaster = checkCardFormat [[51..55], [2221..2720]] [16] | 57 | isMaster = checkCardFormat [[51..55], [2221..2720]] [16] | 57 | isMaster = checkCardFormat [[51..55], [2221..2720]] [16] | 57 | false | false | 0 | 7 | 6 | 30 | 17 | 13 | null | null |
TimRichter/Idris-dev | src/Idris/DSL.hs | bsd-3-clause | mkTTName :: FC -> Name -> PTerm
mkTTName fc n =
let mkList fc [] = PRef fc [] (sNS (sUN "Nil") ["List", "Prelude"])
mkList fc (x:xs) = PApp fc (PRef fc [] (sNS (sUN "::") ["List", "Prelude"]))
[ pexp (stringC x)
, pexp (mkList fc xs)]
stringC = PConstant fc . Str . str
intC = PConstant fc . I
reflm n = sNS (sUN n) ["Reflection", "Language"]
in case n of
UN nm -> PApp fc (PRef fc [] (reflm "UN")) [ pexp (stringC nm)]
NS nm ns -> PApp fc (PRef fc [] (reflm "NS")) [ pexp (mkTTName fc nm)
, pexp (mkList fc ns)]
MN i nm -> PApp fc (PRef fc [] (reflm "MN")) [ pexp (intC i)
, pexp (stringC nm)]
_ -> error "Invalid name from user syntax for DSL name" | 919 | mkTTName :: FC -> Name -> PTerm
mkTTName fc n =
let mkList fc [] = PRef fc [] (sNS (sUN "Nil") ["List", "Prelude"])
mkList fc (x:xs) = PApp fc (PRef fc [] (sNS (sUN "::") ["List", "Prelude"]))
[ pexp (stringC x)
, pexp (mkList fc xs)]
stringC = PConstant fc . Str . str
intC = PConstant fc . I
reflm n = sNS (sUN n) ["Reflection", "Language"]
in case n of
UN nm -> PApp fc (PRef fc [] (reflm "UN")) [ pexp (stringC nm)]
NS nm ns -> PApp fc (PRef fc [] (reflm "NS")) [ pexp (mkTTName fc nm)
, pexp (mkList fc ns)]
MN i nm -> PApp fc (PRef fc [] (reflm "MN")) [ pexp (intC i)
, pexp (stringC nm)]
_ -> error "Invalid name from user syntax for DSL name" | 919 | mkTTName fc n =
let mkList fc [] = PRef fc [] (sNS (sUN "Nil") ["List", "Prelude"])
mkList fc (x:xs) = PApp fc (PRef fc [] (sNS (sUN "::") ["List", "Prelude"]))
[ pexp (stringC x)
, pexp (mkList fc xs)]
stringC = PConstant fc . Str . str
intC = PConstant fc . I
reflm n = sNS (sUN n) ["Reflection", "Language"]
in case n of
UN nm -> PApp fc (PRef fc [] (reflm "UN")) [ pexp (stringC nm)]
NS nm ns -> PApp fc (PRef fc [] (reflm "NS")) [ pexp (mkTTName fc nm)
, pexp (mkList fc ns)]
MN i nm -> PApp fc (PRef fc [] (reflm "MN")) [ pexp (intC i)
, pexp (stringC nm)]
_ -> error "Invalid name from user syntax for DSL name" | 887 | false | true | 0 | 15 | 406 | 389 | 192 | 197 | null | null |
tidalcycles/tidal-midi | Sound/Tidal/MIDI/Tetra.hs | gpl-3.0 | (breath, breath_p) = pF "breath" (Just 0.5) | 43 | (breath, breath_p) = pF "breath" (Just 0.5) | 43 | (breath, breath_p) = pF "breath" (Just 0.5) | 43 | false | false | 0 | 7 | 6 | 24 | 12 | 12 | null | null |
rrnewton/hgdata_trash | src/Crypto/GnuPG.hs | mit | encryptLbs ::
[Recipient] -- ^ The recipients for encryption.
-> LBS.ByteString -- ^ The plain data.
-> IO LBS.ByteString -- ^ The encrypted data.
encryptLbs recipients input =
do
(hIn, hOut, _, _) <- runInteractiveProcess
"gpg"
(
[
"--encrypt"
, "--quiet"
, "--batch"
]
++
concatMap (\r -> ["--recipient", r]) recipients
)
Nothing
Nothing
consumeInput LBS.hPutStr hIn input
LBS.hGetContents hOut
-- | Consume the input stream. | 552 | encryptLbs ::
[Recipient] -- ^ The recipients for encryption.
-> LBS.ByteString -- ^ The plain data.
-> IO LBS.ByteString
encryptLbs recipients input =
do
(hIn, hOut, _, _) <- runInteractiveProcess
"gpg"
(
[
"--encrypt"
, "--quiet"
, "--batch"
]
++
concatMap (\r -> ["--recipient", r]) recipients
)
Nothing
Nothing
consumeInput LBS.hPutStr hIn input
LBS.hGetContents hOut
-- | Consume the input stream. | 526 | encryptLbs recipients input =
do
(hIn, hOut, _, _) <- runInteractiveProcess
"gpg"
(
[
"--encrypt"
, "--quiet"
, "--batch"
]
++
concatMap (\r -> ["--recipient", r]) recipients
)
Nothing
Nothing
consumeInput LBS.hPutStr hIn input
LBS.hGetContents hOut
-- | Consume the input stream. | 384 | true | true | 0 | 14 | 190 | 122 | 65 | 57 | null | null |
tuturto/space-privateers | GameDefinition/Content/TileKind.hs | bsd-3-clause | pillar = TileKind
{ tsymbol = 'O'
, tname = "rock"
, tfreq = [ ("cachable", 70)
, ("legendLit", 100), ("legendDark", 100)
, ("noiseSet", 100), ("skirmishSet", 5)
, ("battleSet", 250) ]
, tcolor = BrWhite
, tcolor2 = defFG
, tfeature = []
} | 308 | pillar = TileKind
{ tsymbol = 'O'
, tname = "rock"
, tfreq = [ ("cachable", 70)
, ("legendLit", 100), ("legendDark", 100)
, ("noiseSet", 100), ("skirmishSet", 5)
, ("battleSet", 250) ]
, tcolor = BrWhite
, tcolor2 = defFG
, tfeature = []
} | 308 | pillar = TileKind
{ tsymbol = 'O'
, tname = "rock"
, tfreq = [ ("cachable", 70)
, ("legendLit", 100), ("legendDark", 100)
, ("noiseSet", 100), ("skirmishSet", 5)
, ("battleSet", 250) ]
, tcolor = BrWhite
, tcolor2 = defFG
, tfeature = []
} | 308 | false | false | 0 | 9 | 112 | 104 | 66 | 38 | null | null |
ndmitchell/nsis | src/Development/NSIS/Plugins/WinMessages.hs | bsd-3-clause | stm_ONLY_THIS_NAME = 0x00000008 | 40 | stm_ONLY_THIS_NAME = 0x00000008 | 40 | stm_ONLY_THIS_NAME = 0x00000008 | 40 | false | false | 0 | 4 | 11 | 6 | 3 | 3 | null | null |
nkoep/dotfiles | xmonad/.xmonad/xmonad.hs | apache-2.0 | shrinkRect p (Rectangle x y w h) =
Rectangle (x+fi p) (y+fi p) (w-2*fi p) (h-2*fi p) | 88 | shrinkRect p (Rectangle x y w h) =
Rectangle (x+fi p) (y+fi p) (w-2*fi p) (h-2*fi p) | 88 | shrinkRect p (Rectangle x y w h) =
Rectangle (x+fi p) (y+fi p) (w-2*fi p) (h-2*fi p) | 88 | false | false | 0 | 8 | 20 | 80 | 39 | 41 | null | null |
brendanhay/gogol | gogol-adexchangebuyer2/gen/Network/Google/AdExchangeBuyer2/Types/Product.hs | mpl-2.0 | -- | The negotiable terms of the deal.
proTerms :: Lens' Product (Maybe DealTerms)
proTerms = lens _proTerms (\ s a -> s{_proTerms = a}) | 136 | proTerms :: Lens' Product (Maybe DealTerms)
proTerms = lens _proTerms (\ s a -> s{_proTerms = a}) | 97 | proTerms = lens _proTerms (\ s a -> s{_proTerms = a}) | 53 | true | true | 2 | 9 | 24 | 55 | 25 | 30 | null | null |
mb21/qua-kit | libs/hs/luci-connect/examples/AddingNumbersService.hs | mit | main :: IO ()
main = runReallySimpleLuciClient () $ do
yield $ registerMessage 14
awaitForever calculate
where
calculate (MsgRun token "AddingNumbers" pams _)
= case fromJSON (Object pams) of
Success (RunCalculate x y) ->
yield $ MsgResult token (resultJSON [ "sum" .= (x + y) ]) []
Error err ->
yield $ MsgError token $ "Cannot parse run message: " <> pack err
calculate msg@(MsgRun token _ _ _) =
yield $ MsgError token $ "Unexpected run message " <> showJSON (toJSON . fst $ makeMessage msg)
calculate msg = logInfoN $ "Ignoring message " <> showJSON (toJSON . fst $ makeMessage msg) | 673 | main :: IO ()
main = runReallySimpleLuciClient () $ do
yield $ registerMessage 14
awaitForever calculate
where
calculate (MsgRun token "AddingNumbers" pams _)
= case fromJSON (Object pams) of
Success (RunCalculate x y) ->
yield $ MsgResult token (resultJSON [ "sum" .= (x + y) ]) []
Error err ->
yield $ MsgError token $ "Cannot parse run message: " <> pack err
calculate msg@(MsgRun token _ _ _) =
yield $ MsgError token $ "Unexpected run message " <> showJSON (toJSON . fst $ makeMessage msg)
calculate msg = logInfoN $ "Ignoring message " <> showJSON (toJSON . fst $ makeMessage msg) | 673 | main = runReallySimpleLuciClient () $ do
yield $ registerMessage 14
awaitForever calculate
where
calculate (MsgRun token "AddingNumbers" pams _)
= case fromJSON (Object pams) of
Success (RunCalculate x y) ->
yield $ MsgResult token (resultJSON [ "sum" .= (x + y) ]) []
Error err ->
yield $ MsgError token $ "Cannot parse run message: " <> pack err
calculate msg@(MsgRun token _ _ _) =
yield $ MsgError token $ "Unexpected run message " <> showJSON (toJSON . fst $ makeMessage msg)
calculate msg = logInfoN $ "Ignoring message " <> showJSON (toJSON . fst $ makeMessage msg) | 659 | false | true | 4 | 15 | 189 | 257 | 116 | 141 | null | null |
harendra-kumar/asyncly | benchmark/BaseStreams.hs | bsd-3-clause | benchFold :: NFData b
=> String -> (t IO Int -> IO b) -> (Int -> t IO Int) -> Benchmark
benchFold name f src = bench name $ nfIO $ randomRIO (1,1) >>= f . src | 162 | benchFold :: NFData b
=> String -> (t IO Int -> IO b) -> (Int -> t IO Int) -> Benchmark
benchFold name f src = bench name $ nfIO $ randomRIO (1,1) >>= f . src | 162 | benchFold name f src = bench name $ nfIO $ randomRIO (1,1) >>= f . src | 70 | false | true | 0 | 11 | 40 | 92 | 45 | 47 | null | null |
ikirill/ComputationalMathematics | Cube/Permutation.hs | gpl-3.0 | power n p | n < 0 = power (-n) (inv p)
| otherwise = loop n p
where
loop :: Int -> Perm -> Perm
loop 1 p = p
loop 15 p = loop 3 (loop 5 p)
loop n p = let s = power (n `div` 2) (square p) in
if even n then s else mul s p
-- | Return which multiplications will be done by the power algorithm. | 334 | power n p | n < 0 = power (-n) (inv p)
| otherwise = loop n p
where
loop :: Int -> Perm -> Perm
loop 1 p = p
loop 15 p = loop 3 (loop 5 p)
loop n p = let s = power (n `div` 2) (square p) in
if even n then s else mul s p
-- | Return which multiplications will be done by the power algorithm. | 334 | power n p | n < 0 = power (-n) (inv p)
| otherwise = loop n p
where
loop :: Int -> Perm -> Perm
loop 1 p = p
loop 15 p = loop 3 (loop 5 p)
loop n p = let s = power (n `div` 2) (square p) in
if even n then s else mul s p
-- | Return which multiplications will be done by the power algorithm. | 334 | false | false | 2 | 11 | 118 | 179 | 80 | 99 | null | null |
vincenthz/cryptonite | Crypto/PubKey/DH.hs | bsd-3-clause | -- | generate params from a specific generator (2 or 5 are common values)
-- we generate a safe prime (a prime number of the form 2p+1 where p is also prime)
generateParams :: MonadRandom m =>
Int -- ^ number of bits
-> Integer -- ^ generator
-> m Params
generateParams bits generator =
(\p -> Params p generator bits) <$> generateSafePrime bits | 429 | generateParams :: MonadRandom m =>
Int -- ^ number of bits
-> Integer -- ^ generator
-> m Params
generateParams bits generator =
(\p -> Params p generator bits) <$> generateSafePrime bits | 271 | generateParams bits generator =
(\p -> Params p generator bits) <$> generateSafePrime bits | 94 | true | true | 0 | 8 | 147 | 60 | 31 | 29 | null | null |
brendanhay/gogol | gogol-serviceconsumermanagement/gen/Network/Google/ServiceConsumerManagement/Types/Product.hs | mpl-2.0 | -- | The fully qualified message name.
tName :: Lens' Type (Maybe Text)
tName = lens _tName (\ s a -> s{_tName = a}) | 116 | tName :: Lens' Type (Maybe Text)
tName = lens _tName (\ s a -> s{_tName = a}) | 77 | tName = lens _tName (\ s a -> s{_tName = a}) | 44 | true | true | 0 | 9 | 23 | 46 | 25 | 21 | null | null |
taktoa/hskpipe | src/Compile.hs | gpl-3.0 | typeCheck (ESub a b) = typeCheck' [(a, TNumber), (b, TNumber)] TNumber | 75 | typeCheck (ESub a b) = typeCheck' [(a, TNumber), (b, TNumber)] TNumber | 75 | typeCheck (ESub a b) = typeCheck' [(a, TNumber), (b, TNumber)] TNumber | 75 | false | false | 0 | 7 | 15 | 41 | 22 | 19 | null | null |
fmthoma/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | exprStats (Coercion c) = coStats c | 37 | exprStats (Coercion c) = coStats c | 37 | exprStats (Coercion c) = coStats c | 37 | false | false | 0 | 6 | 8 | 19 | 8 | 11 | null | null |
gbaz/cabal | Cabal/Distribution/Simple/Utils.hs | bsd-3-clause | -- | More detail on the operation of some action.
--
-- We display these messages when the verbosity level is 'verbose'
--
info :: Verbosity -> String -> IO ()
info verbosity msg =
when (verbosity >= verbose) $
putStr (wrapText msg) | 238 | info :: Verbosity -> String -> IO ()
info verbosity msg =
when (verbosity >= verbose) $
putStr (wrapText msg) | 115 | info verbosity msg =
when (verbosity >= verbose) $
putStr (wrapText msg) | 78 | true | true | 0 | 8 | 48 | 56 | 29 | 27 | null | null |
HIPERFIT/futhark | src/Language/Futhark/TypeChecker/Terms.hs | isc | fixOverloadedTypes :: Names -> TermTypeM ()
fixOverloadedTypes tyvars_at_toplevel =
getConstraints >>= mapM_ fixOverloaded . M.toList . M.map snd
where
fixOverloaded (v, Overloaded ots usage)
| Signed Int32 `elem` ots = do
unify usage (Scalar (TypeVar () Nonunique (typeName v) [])) $
Scalar $ Prim $ Signed Int32
when (v `S.member` tyvars_at_toplevel) $
warn usage "Defaulting ambiguous type to i32."
| FloatType Float64 `elem` ots = do
unify usage (Scalar (TypeVar () Nonunique (typeName v) [])) $
Scalar $ Prim $ FloatType Float64
when (v `S.member` tyvars_at_toplevel) $
warn usage "Defaulting ambiguous type to f64."
| otherwise =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type is ambiguous (could be one of" <+> commasep (map ppr ots) <> ")."
</> "Add a type annotation to disambiguate the type."
fixOverloaded (_, NoConstraint _ usage) =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type of expression is ambiguous."
</> "Add a type annotation to disambiguate the type."
fixOverloaded (_, Equality usage) =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type is ambiguous (must be equality type)."
</> "Add a type annotation to disambiguate the type."
fixOverloaded (_, HasFields fs usage) =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type is ambiguous. Must be record with fields:"
</> indent 2 (stack $ map field $ M.toList fs)
</> "Add a type annotation to disambiguate the type."
where
field (l, t) = ppr l <> colon <+> align (ppr t)
fixOverloaded (_, HasConstrs cs usage) =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type is ambiguous (must be a sum type with constructors:"
<+> ppr (Sum cs) <> ")."
</> "Add a type annotation to disambiguate the type."
fixOverloaded (v, Size Nothing usage) =
typeError usage mempty $ "Size" <+> pquote (pprName v) <+> "is ambiguous.\n"
fixOverloaded _ = pure () | 2,172 | fixOverloadedTypes :: Names -> TermTypeM ()
fixOverloadedTypes tyvars_at_toplevel =
getConstraints >>= mapM_ fixOverloaded . M.toList . M.map snd
where
fixOverloaded (v, Overloaded ots usage)
| Signed Int32 `elem` ots = do
unify usage (Scalar (TypeVar () Nonunique (typeName v) [])) $
Scalar $ Prim $ Signed Int32
when (v `S.member` tyvars_at_toplevel) $
warn usage "Defaulting ambiguous type to i32."
| FloatType Float64 `elem` ots = do
unify usage (Scalar (TypeVar () Nonunique (typeName v) [])) $
Scalar $ Prim $ FloatType Float64
when (v `S.member` tyvars_at_toplevel) $
warn usage "Defaulting ambiguous type to f64."
| otherwise =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type is ambiguous (could be one of" <+> commasep (map ppr ots) <> ")."
</> "Add a type annotation to disambiguate the type."
fixOverloaded (_, NoConstraint _ usage) =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type of expression is ambiguous."
</> "Add a type annotation to disambiguate the type."
fixOverloaded (_, Equality usage) =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type is ambiguous (must be equality type)."
</> "Add a type annotation to disambiguate the type."
fixOverloaded (_, HasFields fs usage) =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type is ambiguous. Must be record with fields:"
</> indent 2 (stack $ map field $ M.toList fs)
</> "Add a type annotation to disambiguate the type."
where
field (l, t) = ppr l <> colon <+> align (ppr t)
fixOverloaded (_, HasConstrs cs usage) =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type is ambiguous (must be a sum type with constructors:"
<+> ppr (Sum cs) <> ")."
</> "Add a type annotation to disambiguate the type."
fixOverloaded (v, Size Nothing usage) =
typeError usage mempty $ "Size" <+> pquote (pprName v) <+> "is ambiguous.\n"
fixOverloaded _ = pure () | 2,172 | fixOverloadedTypes tyvars_at_toplevel =
getConstraints >>= mapM_ fixOverloaded . M.toList . M.map snd
where
fixOverloaded (v, Overloaded ots usage)
| Signed Int32 `elem` ots = do
unify usage (Scalar (TypeVar () Nonunique (typeName v) [])) $
Scalar $ Prim $ Signed Int32
when (v `S.member` tyvars_at_toplevel) $
warn usage "Defaulting ambiguous type to i32."
| FloatType Float64 `elem` ots = do
unify usage (Scalar (TypeVar () Nonunique (typeName v) [])) $
Scalar $ Prim $ FloatType Float64
when (v `S.member` tyvars_at_toplevel) $
warn usage "Defaulting ambiguous type to f64."
| otherwise =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type is ambiguous (could be one of" <+> commasep (map ppr ots) <> ")."
</> "Add a type annotation to disambiguate the type."
fixOverloaded (_, NoConstraint _ usage) =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type of expression is ambiguous."
</> "Add a type annotation to disambiguate the type."
fixOverloaded (_, Equality usage) =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type is ambiguous (must be equality type)."
</> "Add a type annotation to disambiguate the type."
fixOverloaded (_, HasFields fs usage) =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type is ambiguous. Must be record with fields:"
</> indent 2 (stack $ map field $ M.toList fs)
</> "Add a type annotation to disambiguate the type."
where
field (l, t) = ppr l <> colon <+> align (ppr t)
fixOverloaded (_, HasConstrs cs usage) =
typeError usage mempty . withIndexLink "ambiguous-type" $
"Type is ambiguous (must be a sum type with constructors:"
<+> ppr (Sum cs) <> ")."
</> "Add a type annotation to disambiguate the type."
fixOverloaded (v, Size Nothing usage) =
typeError usage mempty $ "Size" <+> pquote (pprName v) <+> "is ambiguous.\n"
fixOverloaded _ = pure () | 2,128 | false | true | 25 | 18 | 584 | 634 | 289 | 345 | null | null |
kojiromike/Idris-dev | src/Idris/Core/Elaborate.hs | bsd-3-clause | simplify :: Elab' aux ()
simplify = processTactic' Simplify | 59 | simplify :: Elab' aux ()
simplify = processTactic' Simplify | 59 | simplify = processTactic' Simplify | 34 | false | true | 0 | 7 | 8 | 27 | 11 | 16 | null | null |
graninas/Andromeda | src/Andromeda/Simulator/Actions.hs | bsd-3-clause | setEnabled tvProduce = liftIO $ atomically $ writeTVar tvProduce True | 69 | setEnabled tvProduce = liftIO $ atomically $ writeTVar tvProduce True | 69 | setEnabled tvProduce = liftIO $ atomically $ writeTVar tvProduce True | 69 | false | false | 1 | 6 | 9 | 25 | 10 | 15 | null | null |
ChristianBertram/tic-tac-toe | AI.hs | mit | maximumFst :: Ord a => [(a, b)] -> (a, b)
maximumFst [] = error "empty list" | 76 | maximumFst :: Ord a => [(a, b)] -> (a, b)
maximumFst [] = error "empty list" | 76 | maximumFst [] = error "empty list" | 34 | false | true | 0 | 8 | 15 | 45 | 24 | 21 | null | null |
anniecherk/pyschocnf | app/SystemTester.hs | bsd-3-clause | -- this is either (==) or (<)
doTestKandN :: (Int -> Int -> Bool) -> String -> IO String
doTestKandN eqOrLessThan file = do
result <- readFile file
let nSetVars = read (splitOneOf "_./" file !! 1) ::Int --- lord have mercy lord have mercy lord have mercy
let k = read (splitOneOf "_./" file !! 3) ::Int -- this makes assumptions about how the generateKofN formats file names...
return $ validate $ testResultKandN result k nSetVars eqOrLessThan | 460 | doTestKandN :: (Int -> Int -> Bool) -> String -> IO String
doTestKandN eqOrLessThan file = do
result <- readFile file
let nSetVars = read (splitOneOf "_./" file !! 1) ::Int --- lord have mercy lord have mercy lord have mercy
let k = read (splitOneOf "_./" file !! 3) ::Int -- this makes assumptions about how the generateKofN formats file names...
return $ validate $ testResultKandN result k nSetVars eqOrLessThan | 430 | doTestKandN eqOrLessThan file = do
result <- readFile file
let nSetVars = read (splitOneOf "_./" file !! 1) ::Int --- lord have mercy lord have mercy lord have mercy
let k = read (splitOneOf "_./" file !! 3) ::Int -- this makes assumptions about how the generateKofN formats file names...
return $ validate $ testResultKandN result k nSetVars eqOrLessThan | 371 | true | true | 0 | 14 | 93 | 130 | 62 | 68 | null | null |
jgm/pandoc-types | src/Text/Pandoc/Arbitrary.hs | bsd-3-clause | arbTableFoot :: Int -> Gen TableFoot
arbTableFoot n = do
rs <- choose (0, 5)
TableFoot <$> arbAttr <*> vectorOf rs (arbRow n) | 133 | arbTableFoot :: Int -> Gen TableFoot
arbTableFoot n = do
rs <- choose (0, 5)
TableFoot <$> arbAttr <*> vectorOf rs (arbRow n) | 133 | arbTableFoot n = do
rs <- choose (0, 5)
TableFoot <$> arbAttr <*> vectorOf rs (arbRow n) | 96 | false | true | 0 | 11 | 30 | 63 | 29 | 34 | null | null |
sdiehl/ghc | libraries/base/GHC/Event/Manager.hs | bsd-3-clause | -- | Create a new event manager.
new :: IO EventManager
new = newWith =<< newDefaultBackend | 91 | new :: IO EventManager
new = newWith =<< newDefaultBackend | 58 | new = newWith =<< newDefaultBackend | 35 | true | true | 1 | 6 | 15 | 23 | 10 | 13 | null | null |
Paow/encore | src/types/Typechecker/TypeError.hs | bsd-3-clause | validUseOfBreak (_:bt) = validUseOfBreak bt | 43 | validUseOfBreak (_:bt) = validUseOfBreak bt | 43 | validUseOfBreak (_:bt) = validUseOfBreak bt | 43 | false | false | 0 | 7 | 4 | 19 | 9 | 10 | null | null |
tismith/tlisp | write-yourself-a-scheme/listings/listing8.hs | mit | unpackBool :: LispVal -> ThrowsError Bool
unpackBool (Bool b) = return b | 72 | unpackBool :: LispVal -> ThrowsError Bool
unpackBool (Bool b) = return b | 72 | unpackBool (Bool b) = return b | 30 | false | true | 0 | 6 | 11 | 34 | 15 | 19 | null | null |
pparkkin/eta | compiler/ETA/DeSugar/Coverage.hs | bsd-3-clause | isGoodBreakExpr (HsMultiIf {}) = True | 37 | isGoodBreakExpr (HsMultiIf {}) = True | 37 | isGoodBreakExpr (HsMultiIf {}) = True | 37 | false | false | 0 | 6 | 4 | 17 | 8 | 9 | null | null |
flyingleafe/parser-gen | src/GrammarProcessing.hs | bsd-3-clause | checkLL1 ∷ ParserGrammar → GrammarTable → GrammarTable → Either String ()
checkLL1 gr first follow = do
forM_ (M.toList gr) $ \(nt, ParserRule _ _ rules) → do
let rulePairs = makePairs rules
forM_ rulePairs $ \(a, b) → do
let fstA = getFIRST first a
fstB = getFIRST first b
if (fstA ∩ fstB ≢ []) ∨ (("EPSILON" ∈ fstA) ∧ (getList follow nt ∩ fstB ≢ []))
then fail $ "Grammar is not LL(1): problem with rules (" ++ nt ++ " -> " ++ show a ++ "), (" ++ nt ++ " -> " ++ show b ++ ") " ++ show (fstA ∩ fstB)
else return () | 560 | checkLL1 ∷ ParserGrammar → GrammarTable → GrammarTable → Either String ()
checkLL1 gr first follow = do
forM_ (M.toList gr) $ \(nt, ParserRule _ _ rules) → do
let rulePairs = makePairs rules
forM_ rulePairs $ \(a, b) → do
let fstA = getFIRST first a
fstB = getFIRST first b
if (fstA ∩ fstB ≢ []) ∨ (("EPSILON" ∈ fstA) ∧ (getList follow nt ∩ fstB ≢ []))
then fail $ "Grammar is not LL(1): problem with rules (" ++ nt ++ " -> " ++ show a ++ "), (" ++ nt ++ " -> " ++ show b ++ ") " ++ show (fstA ∩ fstB)
else return () | 560 | checkLL1 gr first follow = do
forM_ (M.toList gr) $ \(nt, ParserRule _ _ rules) → do
let rulePairs = makePairs rules
forM_ rulePairs $ \(a, b) → do
let fstA = getFIRST first a
fstB = getFIRST first b
if (fstA ∩ fstB ≢ []) ∨ (("EPSILON" ∈ fstA) ∧ (getList follow nt ∩ fstB ≢ []))
then fail $ "Grammar is not LL(1): problem with rules (" ++ nt ++ " -> " ++ show a ++ "), (" ++ nt ++ " -> " ++ show b ++ ") " ++ show (fstA ∩ fstB)
else return () | 486 | false | true | 0 | 25 | 155 | 251 | 124 | 127 | null | null |
mrkkrp/stack | src/Stack/Config.hs | bsd-3-clause | loadMiniConfig :: Config -> MiniConfig
loadMiniConfig config =
let ghcVariant = fromMaybe GHCStandard (configGHCVariant0 config)
in MiniConfig ghcVariant config | 169 | loadMiniConfig :: Config -> MiniConfig
loadMiniConfig config =
let ghcVariant = fromMaybe GHCStandard (configGHCVariant0 config)
in MiniConfig ghcVariant config | 169 | loadMiniConfig config =
let ghcVariant = fromMaybe GHCStandard (configGHCVariant0 config)
in MiniConfig ghcVariant config | 130 | false | true | 0 | 11 | 27 | 45 | 21 | 24 | null | null |
ganeti/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | hvUseGuestAgent :: String
hvUseGuestAgent = "use_guest_agent" | 61 | hvUseGuestAgent :: String
hvUseGuestAgent = "use_guest_agent" | 61 | hvUseGuestAgent = "use_guest_agent" | 35 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
tolysz/dsp | DSP/Filter/FIR/FIR.hs | gpl-2.0 | h3 :: Array Int Double
h3 = listArray (0,4) [ 1, 2, 3, -2, -1 ] | 63 | h3 :: Array Int Double
h3 = listArray (0,4) [ 1, 2, 3, -2, -1 ] | 63 | h3 = listArray (0,4) [ 1, 2, 3, -2, -1 ] | 40 | false | true | 0 | 7 | 15 | 46 | 26 | 20 | null | null |
FranklinChen/write-you-a-haskell | chapter7/poly_constraints/src/Infer.hs | mit | -- Unification solver
solver :: Unifier -> Solve Subst
solver (su, cs) =
case cs of
[] -> return su
((t1, t2): cs0) -> do
su1 <- unifies t1 t2
solver (su1 `compose` su, apply su1 cs0) | 206 | solver :: Unifier -> Solve Subst
solver (su, cs) =
case cs of
[] -> return su
((t1, t2): cs0) -> do
su1 <- unifies t1 t2
solver (su1 `compose` su, apply su1 cs0) | 184 | solver (su, cs) =
case cs of
[] -> return su
((t1, t2): cs0) -> do
su1 <- unifies t1 t2
solver (su1 `compose` su, apply su1 cs0) | 151 | true | true | 2 | 10 | 59 | 99 | 50 | 49 | null | null |
hspec/hspec | hspec-core/src/Test/Hspec/Core/Compat.hs | mit | sortOn :: Ord b => (a -> b) -> [a] -> [a]
sortOn f =
map snd . sortBy (comparing fst) . map (\x -> let y = f x in y `seq` (y, x)) | 131 | sortOn :: Ord b => (a -> b) -> [a] -> [a]
sortOn f =
map snd . sortBy (comparing fst) . map (\x -> let y = f x in y `seq` (y, x)) | 131 | sortOn f =
map snd . sortBy (comparing fst) . map (\x -> let y = f x in y `seq` (y, x)) | 89 | false | true | 1 | 13 | 36 | 105 | 52 | 53 | null | null |
brendanhay/gogol | gogol-classroom/gen/Network/Google/Classroom/Types/Product.hs | mpl-2.0 | -- | YouTube video material.
mYouTubeVideo :: Lens' Material (Maybe YouTubeVideo)
mYouTubeVideo
= lens _mYouTubeVideo
(\ s a -> s{_mYouTubeVideo = a}) | 158 | mYouTubeVideo :: Lens' Material (Maybe YouTubeVideo)
mYouTubeVideo
= lens _mYouTubeVideo
(\ s a -> s{_mYouTubeVideo = a}) | 129 | mYouTubeVideo
= lens _mYouTubeVideo
(\ s a -> s{_mYouTubeVideo = a}) | 76 | true | true | 2 | 9 | 29 | 55 | 25 | 30 | null | null |
vaibhav276/haskell_cs194_assignments | polymorphism/Calc.hs | mit | eval (Add e1 e2) = (eval e1) + (eval e2) | 40 | eval (Add e1 e2) = (eval e1) + (eval e2) | 40 | eval (Add e1 e2) = (eval e1) + (eval e2) | 40 | false | false | 0 | 7 | 9 | 34 | 16 | 18 | null | null |
uduki/hsQt | Qtc/Enums/Gui/QFileDialog.hs | bsd-2-clause | eAccept :: DialogLabel
eAccept
= ieDialogLabel $ 3 | 52 | eAccept :: DialogLabel
eAccept
= ieDialogLabel $ 3 | 52 | eAccept
= ieDialogLabel $ 3 | 29 | false | true | 0 | 6 | 9 | 18 | 8 | 10 | null | null |
lingxiao/CIS700 | depricated/CountMinSketch2.hs | bsd-3-clause | maxi = 30 :: Event | 30 | maxi = 30 :: Event | 30 | maxi = 30 :: Event | 30 | false | false | 0 | 4 | 16 | 9 | 5 | 4 | null | null |
nomeata/list-fusion-lab | ListImpls/BaseFrom76.hs | bsd-3-clause | head :: [a] -> a
head (x:_) = x | 64 | head :: [a] -> a
head (x:_) = x | 64 | head (x:_) = x | 28 | false | true | 0 | 6 | 41 | 29 | 15 | 14 | null | null |
considerate/progp | Haskell/merge.hs | mit | merge xs [] = xs | 16 | merge xs [] = xs | 16 | merge xs [] = xs | 16 | false | false | 0 | 6 | 4 | 13 | 6 | 7 | null | null |
christiaanb/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | voidPrimTyConKey = mkPreludeTyConUnique 57 | 65 | voidPrimTyConKey = mkPreludeTyConUnique 57 | 65 | voidPrimTyConKey = mkPreludeTyConUnique 57 | 65 | false | false | 0 | 5 | 26 | 9 | 4 | 5 | null | null |
brendanhay/gogol | gogol-games-management/gen/Network/Google/GamesManagement/Types/Product.hs | mpl-2.0 | -- | Uniquely identifies the type of this resource. Value is always the fixed
-- string \`gamesManagement#playerScoreResetAllResponse\`.
psrarKind :: Lens' PlayerScoreResetAllResponse (Maybe Text)
psrarKind
= lens _psrarKind (\ s a -> s{_psrarKind = a}) | 255 | psrarKind :: Lens' PlayerScoreResetAllResponse (Maybe Text)
psrarKind
= lens _psrarKind (\ s a -> s{_psrarKind = a}) | 118 | psrarKind
= lens _psrarKind (\ s a -> s{_psrarKind = a}) | 58 | true | true | 1 | 9 | 35 | 53 | 26 | 27 | null | null |
joachifm/pwcrypt | src/pwcrypt.hs | mit | getPassword :: String -> Line.InputT IO SB.ByteString
getPassword p = fromString . fromMaybe "" <$> Line.getPassword (Just '*') p | 129 | getPassword :: String -> Line.InputT IO SB.ByteString
getPassword p = fromString . fromMaybe "" <$> Line.getPassword (Just '*') p | 129 | getPassword p = fromString . fromMaybe "" <$> Line.getPassword (Just '*') p | 75 | false | true | 0 | 8 | 18 | 51 | 24 | 27 | null | null |
ezyang/ghc | compiler/deSugar/DsBinds.hs | bsd-3-clause | decomposeRuleLhs :: [Var] -> CoreExpr -> Either SDoc ([Var], Id, [CoreExpr])
-- (decomposeRuleLhs bndrs lhs) takes apart the LHS of a RULE,
-- The 'bndrs' are the quantified binders of the rules, but decomposeRuleLhs
-- may add some extra dictionary binders (see Note [Free dictionaries])
--
-- Returns an error message if the LHS isn't of the expected shape
-- Note [Decomposing the left-hand side of a RULE]
decomposeRuleLhs orig_bndrs orig_lhs
| not (null unbound) -- Check for things unbound on LHS
-- See Note [Unused spec binders]
= Left (vcat (map dead_msg unbound))
| Var funId <- fun2
, Just con <- isDataConId_maybe funId
= Left (constructor_msg con) -- See Note [No RULES on datacons]
| Just (fn_id, args) <- decompose fun2 args2
, let extra_bndrs = mk_extra_bndrs fn_id args
= -- pprTrace "decmposeRuleLhs" (vcat [ text "orig_bndrs:" <+> ppr orig_bndrs
-- , text "orig_lhs:" <+> ppr orig_lhs
-- , text "lhs1:" <+> ppr lhs1
-- , text "extra_dict_bndrs:" <+> ppr extra_dict_bndrs
-- , text "fn_id:" <+> ppr fn_id
-- , text "args:" <+> ppr args]) $
Right (orig_bndrs ++ extra_bndrs, fn_id, args)
| otherwise
= Left bad_shape_msg
where
lhs1 = drop_dicts orig_lhs
lhs2 = simpleOptExpr lhs1 -- See Note [Simplify rule LHS]
(fun2,args2) = collectArgs lhs2
lhs_fvs = exprFreeVars lhs2
unbound = filterOut (`elemVarSet` lhs_fvs) orig_bndrs
orig_bndr_set = mkVarSet orig_bndrs
-- Add extra tyvar binders: Note [Free tyvars in rule LHS]
-- and extra dict binders: Note [Free dictionaries in rule LHS]
mk_extra_bndrs fn_id args
= toposortTyVars unbound_tvs ++ unbound_dicts
where
unbound_tvs = [ v | v <- unbound_vars, isTyVar v ]
unbound_dicts = [ mkLocalId (localiseName (idName d)) (idType d)
| d <- unbound_vars, isDictId d ]
unbound_vars = [ v | v <- exprsFreeVarsList args
, not (v `elemVarSet` orig_bndr_set)
, not (v == fn_id) ]
-- fn_id: do not quantify over the function itself, which may
-- itself be a dictionary (in pathological cases, Trac #10251)
decompose (Var fn_id) args
| not (fn_id `elemVarSet` orig_bndr_set)
= Just (fn_id, args)
decompose _ _ = Nothing
bad_shape_msg = hang (text "RULE left-hand side too complicated to desugar")
2 (vcat [ text "Optimised lhs:" <+> ppr lhs2
, text "Orig lhs:" <+> ppr orig_lhs])
dead_msg bndr = hang (sep [ text "Forall'd" <+> pp_bndr bndr
, text "is not bound in RULE lhs"])
2 (vcat [ text "Orig bndrs:" <+> ppr orig_bndrs
, text "Orig lhs:" <+> ppr orig_lhs
, text "optimised lhs:" <+> ppr lhs2 ])
pp_bndr bndr
| isTyVar bndr = text "type variable" <+> quotes (ppr bndr)
| Just pred <- evVarPred_maybe bndr = text "constraint" <+> quotes (ppr pred)
| otherwise = text "variable" <+> quotes (ppr bndr)
constructor_msg con = vcat
[ text "A constructor," <+> ppr con <>
text ", appears as outermost match in RULE lhs."
, text "This rule will be ignored." ]
drop_dicts :: CoreExpr -> CoreExpr
drop_dicts e
= wrap_lets needed bnds body
where
needed = orig_bndr_set `minusVarSet` exprFreeVars body
(bnds, body) = split_lets (occurAnalyseExpr e)
-- The occurAnalyseExpr drops dead bindings which is
-- crucial to ensure that every binding is used later;
-- which in turn makes wrap_lets work right
split_lets :: CoreExpr -> ([(DictId,CoreExpr)], CoreExpr)
split_lets (Let (NonRec d r) body)
| isDictId d
= ((d,r):bs, body')
where (bs, body') = split_lets body
-- handle "unlifted lets" too, needed for "map/coerce"
split_lets (Case r d _ [(DEFAULT, _, body)])
| isCoVar d
= ((d,r):bs, body')
where (bs, body') = split_lets body
split_lets e = ([], e)
wrap_lets :: VarSet -> [(DictId,CoreExpr)] -> CoreExpr -> CoreExpr
wrap_lets _ [] body = body
wrap_lets needed ((d, r) : bs) body
| rhs_fvs `intersectsVarSet` needed = mkCoreLet (NonRec d r) (wrap_lets needed' bs body)
| otherwise = wrap_lets needed bs body
where
rhs_fvs = exprFreeVars r
needed' = (needed `minusVarSet` rhs_fvs) `extendVarSet` d
{-
Note [Decomposing the left-hand side of a RULE]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are several things going on here.
* drop_dicts: see Note [Drop dictionary bindings on rule LHS]
* simpleOptExpr: see Note [Simplify rule LHS]
* extra_dict_bndrs: see Note [Free dictionaries]
Note [Free tyvars on rule LHS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
data T a = C
foo :: T a -> Int
foo C = 1
{-# RULES "myrule" foo C = 1 #-}
After type checking the LHS becomes (foo alpha (C alpha)), where alpha
is an unbound meta-tyvar. The zonker in TcHsSyn is careful not to
turn the free alpha into Any (as it usually does). Instead it turns it
into a TyVar 'a'. See TcHsSyn Note [Zonking the LHS of a RULE].
Now we must quantify over that 'a'. It's /really/ inconvenient to do that
in the zonker, because the HsExpr data type is very large. But it's /easy/
to do it here in the desugarer.
Moreover, we have to do something rather similar for dictionaries;
see Note [Free dictionaries on rule LHS]. So that's why we look for
type variables free on the LHS, and quantify over them.
Note [Free dictionaries on rule LHS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When the LHS of a specialisation rule, (/\as\ds. f es) has a free dict,
which is presumably in scope at the function definition site, we can quantify
over it too. *Any* dict with that type will do.
So for example when you have
f :: Eq a => a -> a
f = <rhs>
... SPECIALISE f :: Int -> Int ...
Then we get the SpecPrag
SpecPrag (f Int dInt)
And from that we want the rule
RULE forall dInt. f Int dInt = f_spec
f_spec = let f = <rhs> in f Int dInt
But be careful! That dInt might be GHC.Base.$fOrdInt, which is an External
Name, and you can't bind them in a lambda or forall without getting things
confused. Likewise it might have an InlineRule or something, which would be
utterly bogus. So we really make a fresh Id, with the same unique and type
as the old one, but with an Internal name and no IdInfo.
Note [Drop dictionary bindings on rule LHS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drop_dicts drops dictionary bindings on the LHS where possible.
E.g. let d:Eq [Int] = $fEqList $fEqInt in f d
--> f d
Reasoning here is that there is only one d:Eq [Int], and so we can
quantify over it. That makes 'd' free in the LHS, but that is later
picked up by extra_dict_bndrs (Note [Dead spec binders]).
NB 1: We can only drop the binding if the RHS doesn't bind
one of the orig_bndrs, which we assume occur on RHS.
Example
f :: (Eq a) => b -> a -> a
{-# SPECIALISE f :: Eq a => b -> [a] -> [a] #-}
Here we want to end up with
RULE forall d:Eq a. f ($dfEqList d) = f_spec d
Of course, the ($dfEqlist d) in the pattern makes it less likely
to match, but there is no other way to get d:Eq a
NB 2: We do drop_dicts *before* simplOptEpxr, so that we expect all
the evidence bindings to be wrapped around the outside of the
LHS. (After simplOptExpr they'll usually have been inlined.)
dsHsWrapper does dependency analysis, so that civilised ones
will be simple NonRec bindings. We don't handle recursive
dictionaries!
NB3: In the common case of a non-overloaded, but perhaps-polymorphic
specialisation, we don't need to bind *any* dictionaries for use
in the RHS. For example (Trac #8331)
{-# SPECIALIZE INLINE useAbstractMonad :: ReaderST s Int #-}
useAbstractMonad :: MonadAbstractIOST m => m Int
Here, deriving (MonadAbstractIOST (ReaderST s)) is a lot of code
but the RHS uses no dictionaries, so we want to end up with
RULE forall s (d :: MonadAbstractIOST (ReaderT s)).
useAbstractMonad (ReaderT s) d = $suseAbstractMonad s
Trac #8848 is a good example of where there are some interesting
dictionary bindings to discard.
The drop_dicts algorithm is based on these observations:
* Given (let d = rhs in e) where d is a DictId,
matching 'e' will bind e's free variables.
* So we want to keep the binding if one of the needed variables (for
which we need a binding) is in fv(rhs) but not already in fv(e).
* The "needed variables" are simply the orig_bndrs. Consider
f :: (Eq a, Show b) => a -> b -> String
... SPECIALISE f :: (Show b) => Int -> b -> String ...
Then orig_bndrs includes the *quantified* dictionaries of the type
namely (dsb::Show b), but not the one for Eq Int
So we work inside out, applying the above criterion at each step.
Note [Simplify rule LHS]
~~~~~~~~~~~~~~~~~~~~~~~~
simplOptExpr occurrence-analyses and simplifies the LHS:
(a) Inline any remaining dictionary bindings (which hopefully
occur just once)
(b) Substitute trivial lets, so that they don't get in the way.
Note that we substitute the function too; we might
have this as a LHS: let f71 = M.f Int in f71
(c) Do eta reduction. To see why, consider the fold/build rule,
which without simplification looked like:
fold k z (build (/\a. g a)) ==> ...
This doesn't match unless you do eta reduction on the build argument.
Similarly for a LHS like
augment g (build h)
we do not want to get
augment (\a. g a) (build h)
otherwise we don't match when given an argument like
augment (\a. h a a) (build h)
Note [Matching seqId]
~~~~~~~~~~~~~~~~~~~
The desugarer turns (seq e r) into (case e of _ -> r), via a special-case hack
and this code turns it back into an application of seq!
See Note [Rules for seq] in MkId for the details.
Note [Unused spec binders]
~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
f :: a -> a
... SPECIALISE f :: Eq a => a -> a ...
It's true that this *is* a more specialised type, but the rule
we get is something like this:
f_spec d = f
RULE: f = f_spec d
Note that the rule is bogus, because it mentions a 'd' that is
not bound on the LHS! But it's a silly specialisation anyway, because
the constraint is unused. We could bind 'd' to (error "unused")
but it seems better to reject the program because it's almost certainly
a mistake. That's what the isDeadBinder call detects.
Note [No RULES on datacons]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Previously, `RULES` like
"JustNothing" forall x . Just x = Nothing
were allowed. Simon Peyton Jones says this seems to have been a
mistake, that such rules have never been supported intentionally,
and that he doesn't know if they can break in horrible ways.
Furthermore, Ben Gamari and Reid Barton are considering trying to
detect the presence of "static data" that the simplifier doesn't
need to traverse at all. Such rules do not play well with that.
So for now, we ban them altogether as requested by #13290. See also #7398.
************************************************************************
* *
Desugaring evidence
* *
************************************************************************
-} | 12,019 | decomposeRuleLhs :: [Var] -> CoreExpr -> Either SDoc ([Var], Id, [CoreExpr])
decomposeRuleLhs orig_bndrs orig_lhs
| not (null unbound) -- Check for things unbound on LHS
-- See Note [Unused spec binders]
= Left (vcat (map dead_msg unbound))
| Var funId <- fun2
, Just con <- isDataConId_maybe funId
= Left (constructor_msg con) -- See Note [No RULES on datacons]
| Just (fn_id, args) <- decompose fun2 args2
, let extra_bndrs = mk_extra_bndrs fn_id args
= -- pprTrace "decmposeRuleLhs" (vcat [ text "orig_bndrs:" <+> ppr orig_bndrs
-- , text "orig_lhs:" <+> ppr orig_lhs
-- , text "lhs1:" <+> ppr lhs1
-- , text "extra_dict_bndrs:" <+> ppr extra_dict_bndrs
-- , text "fn_id:" <+> ppr fn_id
-- , text "args:" <+> ppr args]) $
Right (orig_bndrs ++ extra_bndrs, fn_id, args)
| otherwise
= Left bad_shape_msg
where
lhs1 = drop_dicts orig_lhs
lhs2 = simpleOptExpr lhs1 -- See Note [Simplify rule LHS]
(fun2,args2) = collectArgs lhs2
lhs_fvs = exprFreeVars lhs2
unbound = filterOut (`elemVarSet` lhs_fvs) orig_bndrs
orig_bndr_set = mkVarSet orig_bndrs
-- Add extra tyvar binders: Note [Free tyvars in rule LHS]
-- and extra dict binders: Note [Free dictionaries in rule LHS]
mk_extra_bndrs fn_id args
= toposortTyVars unbound_tvs ++ unbound_dicts
where
unbound_tvs = [ v | v <- unbound_vars, isTyVar v ]
unbound_dicts = [ mkLocalId (localiseName (idName d)) (idType d)
| d <- unbound_vars, isDictId d ]
unbound_vars = [ v | v <- exprsFreeVarsList args
, not (v `elemVarSet` orig_bndr_set)
, not (v == fn_id) ]
-- fn_id: do not quantify over the function itself, which may
-- itself be a dictionary (in pathological cases, Trac #10251)
decompose (Var fn_id) args
| not (fn_id `elemVarSet` orig_bndr_set)
= Just (fn_id, args)
decompose _ _ = Nothing
bad_shape_msg = hang (text "RULE left-hand side too complicated to desugar")
2 (vcat [ text "Optimised lhs:" <+> ppr lhs2
, text "Orig lhs:" <+> ppr orig_lhs])
dead_msg bndr = hang (sep [ text "Forall'd" <+> pp_bndr bndr
, text "is not bound in RULE lhs"])
2 (vcat [ text "Orig bndrs:" <+> ppr orig_bndrs
, text "Orig lhs:" <+> ppr orig_lhs
, text "optimised lhs:" <+> ppr lhs2 ])
pp_bndr bndr
| isTyVar bndr = text "type variable" <+> quotes (ppr bndr)
| Just pred <- evVarPred_maybe bndr = text "constraint" <+> quotes (ppr pred)
| otherwise = text "variable" <+> quotes (ppr bndr)
constructor_msg con = vcat
[ text "A constructor," <+> ppr con <>
text ", appears as outermost match in RULE lhs."
, text "This rule will be ignored." ]
drop_dicts :: CoreExpr -> CoreExpr
drop_dicts e
= wrap_lets needed bnds body
where
needed = orig_bndr_set `minusVarSet` exprFreeVars body
(bnds, body) = split_lets (occurAnalyseExpr e)
-- The occurAnalyseExpr drops dead bindings which is
-- crucial to ensure that every binding is used later;
-- which in turn makes wrap_lets work right
split_lets :: CoreExpr -> ([(DictId,CoreExpr)], CoreExpr)
split_lets (Let (NonRec d r) body)
| isDictId d
= ((d,r):bs, body')
where (bs, body') = split_lets body
-- handle "unlifted lets" too, needed for "map/coerce"
split_lets (Case r d _ [(DEFAULT, _, body)])
| isCoVar d
= ((d,r):bs, body')
where (bs, body') = split_lets body
split_lets e = ([], e)
wrap_lets :: VarSet -> [(DictId,CoreExpr)] -> CoreExpr -> CoreExpr
wrap_lets _ [] body = body
wrap_lets needed ((d, r) : bs) body
| rhs_fvs `intersectsVarSet` needed = mkCoreLet (NonRec d r) (wrap_lets needed' bs body)
| otherwise = wrap_lets needed bs body
where
rhs_fvs = exprFreeVars r
needed' = (needed `minusVarSet` rhs_fvs) `extendVarSet` d
{-
Note [Decomposing the left-hand side of a RULE]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are several things going on here.
* drop_dicts: see Note [Drop dictionary bindings on rule LHS]
* simpleOptExpr: see Note [Simplify rule LHS]
* extra_dict_bndrs: see Note [Free dictionaries]
Note [Free tyvars on rule LHS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
data T a = C
foo :: T a -> Int
foo C = 1
{-# RULES "myrule" foo C = 1 #-}
After type checking the LHS becomes (foo alpha (C alpha)), where alpha
is an unbound meta-tyvar. The zonker in TcHsSyn is careful not to
turn the free alpha into Any (as it usually does). Instead it turns it
into a TyVar 'a'. See TcHsSyn Note [Zonking the LHS of a RULE].
Now we must quantify over that 'a'. It's /really/ inconvenient to do that
in the zonker, because the HsExpr data type is very large. But it's /easy/
to do it here in the desugarer.
Moreover, we have to do something rather similar for dictionaries;
see Note [Free dictionaries on rule LHS]. So that's why we look for
type variables free on the LHS, and quantify over them.
Note [Free dictionaries on rule LHS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When the LHS of a specialisation rule, (/\as\ds. f es) has a free dict,
which is presumably in scope at the function definition site, we can quantify
over it too. *Any* dict with that type will do.
So for example when you have
f :: Eq a => a -> a
f = <rhs>
... SPECIALISE f :: Int -> Int ...
Then we get the SpecPrag
SpecPrag (f Int dInt)
And from that we want the rule
RULE forall dInt. f Int dInt = f_spec
f_spec = let f = <rhs> in f Int dInt
But be careful! That dInt might be GHC.Base.$fOrdInt, which is an External
Name, and you can't bind them in a lambda or forall without getting things
confused. Likewise it might have an InlineRule or something, which would be
utterly bogus. So we really make a fresh Id, with the same unique and type
as the old one, but with an Internal name and no IdInfo.
Note [Drop dictionary bindings on rule LHS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drop_dicts drops dictionary bindings on the LHS where possible.
E.g. let d:Eq [Int] = $fEqList $fEqInt in f d
--> f d
Reasoning here is that there is only one d:Eq [Int], and so we can
quantify over it. That makes 'd' free in the LHS, but that is later
picked up by extra_dict_bndrs (Note [Dead spec binders]).
NB 1: We can only drop the binding if the RHS doesn't bind
one of the orig_bndrs, which we assume occur on RHS.
Example
f :: (Eq a) => b -> a -> a
{-# SPECIALISE f :: Eq a => b -> [a] -> [a] #-}
Here we want to end up with
RULE forall d:Eq a. f ($dfEqList d) = f_spec d
Of course, the ($dfEqlist d) in the pattern makes it less likely
to match, but there is no other way to get d:Eq a
NB 2: We do drop_dicts *before* simplOptEpxr, so that we expect all
the evidence bindings to be wrapped around the outside of the
LHS. (After simplOptExpr they'll usually have been inlined.)
dsHsWrapper does dependency analysis, so that civilised ones
will be simple NonRec bindings. We don't handle recursive
dictionaries!
NB3: In the common case of a non-overloaded, but perhaps-polymorphic
specialisation, we don't need to bind *any* dictionaries for use
in the RHS. For example (Trac #8331)
{-# SPECIALIZE INLINE useAbstractMonad :: ReaderST s Int #-}
useAbstractMonad :: MonadAbstractIOST m => m Int
Here, deriving (MonadAbstractIOST (ReaderST s)) is a lot of code
but the RHS uses no dictionaries, so we want to end up with
RULE forall s (d :: MonadAbstractIOST (ReaderT s)).
useAbstractMonad (ReaderT s) d = $suseAbstractMonad s
Trac #8848 is a good example of where there are some interesting
dictionary bindings to discard.
The drop_dicts algorithm is based on these observations:
* Given (let d = rhs in e) where d is a DictId,
matching 'e' will bind e's free variables.
* So we want to keep the binding if one of the needed variables (for
which we need a binding) is in fv(rhs) but not already in fv(e).
* The "needed variables" are simply the orig_bndrs. Consider
f :: (Eq a, Show b) => a -> b -> String
... SPECIALISE f :: (Show b) => Int -> b -> String ...
Then orig_bndrs includes the *quantified* dictionaries of the type
namely (dsb::Show b), but not the one for Eq Int
So we work inside out, applying the above criterion at each step.
Note [Simplify rule LHS]
~~~~~~~~~~~~~~~~~~~~~~~~
simplOptExpr occurrence-analyses and simplifies the LHS:
(a) Inline any remaining dictionary bindings (which hopefully
occur just once)
(b) Substitute trivial lets, so that they don't get in the way.
Note that we substitute the function too; we might
have this as a LHS: let f71 = M.f Int in f71
(c) Do eta reduction. To see why, consider the fold/build rule,
which without simplification looked like:
fold k z (build (/\a. g a)) ==> ...
This doesn't match unless you do eta reduction on the build argument.
Similarly for a LHS like
augment g (build h)
we do not want to get
augment (\a. g a) (build h)
otherwise we don't match when given an argument like
augment (\a. h a a) (build h)
Note [Matching seqId]
~~~~~~~~~~~~~~~~~~~
The desugarer turns (seq e r) into (case e of _ -> r), via a special-case hack
and this code turns it back into an application of seq!
See Note [Rules for seq] in MkId for the details.
Note [Unused spec binders]
~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
f :: a -> a
... SPECIALISE f :: Eq a => a -> a ...
It's true that this *is* a more specialised type, but the rule
we get is something like this:
f_spec d = f
RULE: f = f_spec d
Note that the rule is bogus, because it mentions a 'd' that is
not bound on the LHS! But it's a silly specialisation anyway, because
the constraint is unused. We could bind 'd' to (error "unused")
but it seems better to reject the program because it's almost certainly
a mistake. That's what the isDeadBinder call detects.
Note [No RULES on datacons]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Previously, `RULES` like
"JustNothing" forall x . Just x = Nothing
were allowed. Simon Peyton Jones says this seems to have been a
mistake, that such rules have never been supported intentionally,
and that he doesn't know if they can break in horrible ways.
Furthermore, Ben Gamari and Reid Barton are considering trying to
detect the presence of "static data" that the simplifier doesn't
need to traverse at all. Such rules do not play well with that.
So for now, we ban them altogether as requested by #13290. See also #7398.
************************************************************************
* *
Desugaring evidence
* *
************************************************************************
-} | 11,686 | decomposeRuleLhs orig_bndrs orig_lhs
| not (null unbound) -- Check for things unbound on LHS
-- See Note [Unused spec binders]
= Left (vcat (map dead_msg unbound))
| Var funId <- fun2
, Just con <- isDataConId_maybe funId
= Left (constructor_msg con) -- See Note [No RULES on datacons]
| Just (fn_id, args) <- decompose fun2 args2
, let extra_bndrs = mk_extra_bndrs fn_id args
= -- pprTrace "decmposeRuleLhs" (vcat [ text "orig_bndrs:" <+> ppr orig_bndrs
-- , text "orig_lhs:" <+> ppr orig_lhs
-- , text "lhs1:" <+> ppr lhs1
-- , text "extra_dict_bndrs:" <+> ppr extra_dict_bndrs
-- , text "fn_id:" <+> ppr fn_id
-- , text "args:" <+> ppr args]) $
Right (orig_bndrs ++ extra_bndrs, fn_id, args)
| otherwise
= Left bad_shape_msg
where
lhs1 = drop_dicts orig_lhs
lhs2 = simpleOptExpr lhs1 -- See Note [Simplify rule LHS]
(fun2,args2) = collectArgs lhs2
lhs_fvs = exprFreeVars lhs2
unbound = filterOut (`elemVarSet` lhs_fvs) orig_bndrs
orig_bndr_set = mkVarSet orig_bndrs
-- Add extra tyvar binders: Note [Free tyvars in rule LHS]
-- and extra dict binders: Note [Free dictionaries in rule LHS]
mk_extra_bndrs fn_id args
= toposortTyVars unbound_tvs ++ unbound_dicts
where
unbound_tvs = [ v | v <- unbound_vars, isTyVar v ]
unbound_dicts = [ mkLocalId (localiseName (idName d)) (idType d)
| d <- unbound_vars, isDictId d ]
unbound_vars = [ v | v <- exprsFreeVarsList args
, not (v `elemVarSet` orig_bndr_set)
, not (v == fn_id) ]
-- fn_id: do not quantify over the function itself, which may
-- itself be a dictionary (in pathological cases, Trac #10251)
decompose (Var fn_id) args
| not (fn_id `elemVarSet` orig_bndr_set)
= Just (fn_id, args)
decompose _ _ = Nothing
bad_shape_msg = hang (text "RULE left-hand side too complicated to desugar")
2 (vcat [ text "Optimised lhs:" <+> ppr lhs2
, text "Orig lhs:" <+> ppr orig_lhs])
dead_msg bndr = hang (sep [ text "Forall'd" <+> pp_bndr bndr
, text "is not bound in RULE lhs"])
2 (vcat [ text "Orig bndrs:" <+> ppr orig_bndrs
, text "Orig lhs:" <+> ppr orig_lhs
, text "optimised lhs:" <+> ppr lhs2 ])
pp_bndr bndr
| isTyVar bndr = text "type variable" <+> quotes (ppr bndr)
| Just pred <- evVarPred_maybe bndr = text "constraint" <+> quotes (ppr pred)
| otherwise = text "variable" <+> quotes (ppr bndr)
constructor_msg con = vcat
[ text "A constructor," <+> ppr con <>
text ", appears as outermost match in RULE lhs."
, text "This rule will be ignored." ]
drop_dicts :: CoreExpr -> CoreExpr
drop_dicts e
= wrap_lets needed bnds body
where
needed = orig_bndr_set `minusVarSet` exprFreeVars body
(bnds, body) = split_lets (occurAnalyseExpr e)
-- The occurAnalyseExpr drops dead bindings which is
-- crucial to ensure that every binding is used later;
-- which in turn makes wrap_lets work right
split_lets :: CoreExpr -> ([(DictId,CoreExpr)], CoreExpr)
split_lets (Let (NonRec d r) body)
| isDictId d
= ((d,r):bs, body')
where (bs, body') = split_lets body
-- handle "unlifted lets" too, needed for "map/coerce"
split_lets (Case r d _ [(DEFAULT, _, body)])
| isCoVar d
= ((d,r):bs, body')
where (bs, body') = split_lets body
split_lets e = ([], e)
wrap_lets :: VarSet -> [(DictId,CoreExpr)] -> CoreExpr -> CoreExpr
wrap_lets _ [] body = body
wrap_lets needed ((d, r) : bs) body
| rhs_fvs `intersectsVarSet` needed = mkCoreLet (NonRec d r) (wrap_lets needed' bs body)
| otherwise = wrap_lets needed bs body
where
rhs_fvs = exprFreeVars r
needed' = (needed `minusVarSet` rhs_fvs) `extendVarSet` d
{-
Note [Decomposing the left-hand side of a RULE]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are several things going on here.
* drop_dicts: see Note [Drop dictionary bindings on rule LHS]
* simpleOptExpr: see Note [Simplify rule LHS]
* extra_dict_bndrs: see Note [Free dictionaries]
Note [Free tyvars on rule LHS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
data T a = C
foo :: T a -> Int
foo C = 1
{-# RULES "myrule" foo C = 1 #-}
After type checking the LHS becomes (foo alpha (C alpha)), where alpha
is an unbound meta-tyvar. The zonker in TcHsSyn is careful not to
turn the free alpha into Any (as it usually does). Instead it turns it
into a TyVar 'a'. See TcHsSyn Note [Zonking the LHS of a RULE].
Now we must quantify over that 'a'. It's /really/ inconvenient to do that
in the zonker, because the HsExpr data type is very large. But it's /easy/
to do it here in the desugarer.
Moreover, we have to do something rather similar for dictionaries;
see Note [Free dictionaries on rule LHS]. So that's why we look for
type variables free on the LHS, and quantify over them.
Note [Free dictionaries on rule LHS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When the LHS of a specialisation rule, (/\as\ds. f es) has a free dict,
which is presumably in scope at the function definition site, we can quantify
over it too. *Any* dict with that type will do.
So for example when you have
f :: Eq a => a -> a
f = <rhs>
... SPECIALISE f :: Int -> Int ...
Then we get the SpecPrag
SpecPrag (f Int dInt)
And from that we want the rule
RULE forall dInt. f Int dInt = f_spec
f_spec = let f = <rhs> in f Int dInt
But be careful! That dInt might be GHC.Base.$fOrdInt, which is an External
Name, and you can't bind them in a lambda or forall without getting things
confused. Likewise it might have an InlineRule or something, which would be
utterly bogus. So we really make a fresh Id, with the same unique and type
as the old one, but with an Internal name and no IdInfo.
Note [Drop dictionary bindings on rule LHS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drop_dicts drops dictionary bindings on the LHS where possible.
E.g. let d:Eq [Int] = $fEqList $fEqInt in f d
--> f d
Reasoning here is that there is only one d:Eq [Int], and so we can
quantify over it. That makes 'd' free in the LHS, but that is later
picked up by extra_dict_bndrs (Note [Dead spec binders]).
NB 1: We can only drop the binding if the RHS doesn't bind
one of the orig_bndrs, which we assume occur on RHS.
Example
f :: (Eq a) => b -> a -> a
{-# SPECIALISE f :: Eq a => b -> [a] -> [a] #-}
Here we want to end up with
RULE forall d:Eq a. f ($dfEqList d) = f_spec d
Of course, the ($dfEqlist d) in the pattern makes it less likely
to match, but there is no other way to get d:Eq a
NB 2: We do drop_dicts *before* simplOptEpxr, so that we expect all
the evidence bindings to be wrapped around the outside of the
LHS. (After simplOptExpr they'll usually have been inlined.)
dsHsWrapper does dependency analysis, so that civilised ones
will be simple NonRec bindings. We don't handle recursive
dictionaries!
NB3: In the common case of a non-overloaded, but perhaps-polymorphic
specialisation, we don't need to bind *any* dictionaries for use
in the RHS. For example (Trac #8331)
{-# SPECIALIZE INLINE useAbstractMonad :: ReaderST s Int #-}
useAbstractMonad :: MonadAbstractIOST m => m Int
Here, deriving (MonadAbstractIOST (ReaderST s)) is a lot of code
but the RHS uses no dictionaries, so we want to end up with
RULE forall s (d :: MonadAbstractIOST (ReaderT s)).
useAbstractMonad (ReaderT s) d = $suseAbstractMonad s
Trac #8848 is a good example of where there are some interesting
dictionary bindings to discard.
The drop_dicts algorithm is based on these observations:
* Given (let d = rhs in e) where d is a DictId,
matching 'e' will bind e's free variables.
* So we want to keep the binding if one of the needed variables (for
which we need a binding) is in fv(rhs) but not already in fv(e).
* The "needed variables" are simply the orig_bndrs. Consider
f :: (Eq a, Show b) => a -> b -> String
... SPECIALISE f :: (Show b) => Int -> b -> String ...
Then orig_bndrs includes the *quantified* dictionaries of the type
namely (dsb::Show b), but not the one for Eq Int
So we work inside out, applying the above criterion at each step.
Note [Simplify rule LHS]
~~~~~~~~~~~~~~~~~~~~~~~~
simplOptExpr occurrence-analyses and simplifies the LHS:
(a) Inline any remaining dictionary bindings (which hopefully
occur just once)
(b) Substitute trivial lets, so that they don't get in the way.
Note that we substitute the function too; we might
have this as a LHS: let f71 = M.f Int in f71
(c) Do eta reduction. To see why, consider the fold/build rule,
which without simplification looked like:
fold k z (build (/\a. g a)) ==> ...
This doesn't match unless you do eta reduction on the build argument.
Similarly for a LHS like
augment g (build h)
we do not want to get
augment (\a. g a) (build h)
otherwise we don't match when given an argument like
augment (\a. h a a) (build h)
Note [Matching seqId]
~~~~~~~~~~~~~~~~~~~
The desugarer turns (seq e r) into (case e of _ -> r), via a special-case hack
and this code turns it back into an application of seq!
See Note [Rules for seq] in MkId for the details.
Note [Unused spec binders]
~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
f :: a -> a
... SPECIALISE f :: Eq a => a -> a ...
It's true that this *is* a more specialised type, but the rule
we get is something like this:
f_spec d = f
RULE: f = f_spec d
Note that the rule is bogus, because it mentions a 'd' that is
not bound on the LHS! But it's a silly specialisation anyway, because
the constraint is unused. We could bind 'd' to (error "unused")
but it seems better to reject the program because it's almost certainly
a mistake. That's what the isDeadBinder call detects.
Note [No RULES on datacons]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Previously, `RULES` like
"JustNothing" forall x . Just x = Nothing
were allowed. Simon Peyton Jones says this seems to have been a
mistake, that such rules have never been supported intentionally,
and that he doesn't know if they can break in horrible ways.
Furthermore, Ben Gamari and Reid Barton are considering trying to
detect the presence of "static data" that the simplifier doesn't
need to traverse at all. Such rules do not play well with that.
So for now, we ban them altogether as requested by #13290. See also #7398.
************************************************************************
* *
Desugaring evidence
* *
************************************************************************
-} | 11,609 | true | true | 22 | 11 | 3,379 | 1,219 | 588 | 631 | null | null |
ameingast/slisp | src/SLISP/Eval.hs | bsd-3-clause | mapNumOp f xs = List $ map (numUnOp f) xs | 41 | mapNumOp f xs = List $ map (numUnOp f) xs | 41 | mapNumOp f xs = List $ map (numUnOp f) xs | 41 | false | false | 0 | 8 | 9 | 26 | 12 | 14 | null | null |
GaloisInc/ivory-tower-stm32 | ivory-bsp-stm32/src/Ivory/BSP/STM32F405/MemoryMap.hs | bsd-3-clause | ram2_base = 0x2001C000
| 28 | sram2_base = 0x2001C000 | 28 | sram2_base = 0x2001C000 | 28 | false | false | 0 | 4 | 8 | 6 | 3 | 3 | null | null |
tensorflow/haskell | tensorflow-records/tests/Main.hs | apache-2.0 | main :: IO ()
main = defaultMain tests | 38 | main :: IO ()
main = defaultMain tests | 38 | main = defaultMain tests | 24 | false | true | 0 | 7 | 7 | 25 | 10 | 15 | null | null |
tejon/diagrams-contrib | src/Diagrams/TwoD/Path/Metafont/Internal.hs | bsd-3-clause | curlEnds p = p & segs %~ leftEnd where
leftEnd [s] = [s & pj.d1 %~ curlIfEmpty & pj.d2 %~ curlIfEmpty]
leftEnd (s:ss) = (s & pj.d1 %~ curlIfEmpty) : rightEnd ss
leftEnd [] = []
rightEnd [] = []
rightEnd [s] = [s & pj.d2 %~ curlIfEmpty]
rightEnd (s:ss) = s:rightEnd ss
curlIfEmpty Nothing = Just $ PathDirCurl 1
curlIfEmpty d = d
-- rule 3 | 422 | curlEnds p = p & segs %~ leftEnd where
leftEnd [s] = [s & pj.d1 %~ curlIfEmpty & pj.d2 %~ curlIfEmpty]
leftEnd (s:ss) = (s & pj.d1 %~ curlIfEmpty) : rightEnd ss
leftEnd [] = []
rightEnd [] = []
rightEnd [s] = [s & pj.d2 %~ curlIfEmpty]
rightEnd (s:ss) = s:rightEnd ss
curlIfEmpty Nothing = Just $ PathDirCurl 1
curlIfEmpty d = d
-- rule 3 | 422 | curlEnds p = p & segs %~ leftEnd where
leftEnd [s] = [s & pj.d1 %~ curlIfEmpty & pj.d2 %~ curlIfEmpty]
leftEnd (s:ss) = (s & pj.d1 %~ curlIfEmpty) : rightEnd ss
leftEnd [] = []
rightEnd [] = []
rightEnd [s] = [s & pj.d2 %~ curlIfEmpty]
rightEnd (s:ss) = s:rightEnd ss
curlIfEmpty Nothing = Just $ PathDirCurl 1
curlIfEmpty d = d
-- rule 3 | 422 | false | false | 6 | 10 | 150 | 200 | 93 | 107 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'MapS.lookup'
ms_lookup = MapS.lookup | 41 | ms_lookup = MapS.lookup | 23 | ms_lookup = MapS.lookup | 23 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
kawu/nerf-misc | src/Text/NKJP.hs | bsd-3-clause | morphP :: XmlParser String [MorphSent]
morphP = true //> morphSentP | 67 | morphP :: XmlParser String [MorphSent]
morphP = true //> morphSentP | 67 | morphP = true //> morphSentP | 28 | false | true | 0 | 6 | 9 | 23 | 12 | 11 | null | null |
cpennington/h4sh | testsuite/TestFramework.hs | gpl-2.0 | showPath nodes = foldr1 f (map showNode (filterNodes (reverse nodes)))
where f a b = a ++ ":" ++ b
showNode (HU.ListItem n) = show n
showNode (HU.Label label) = safe label (show label)
safe s ss = if ':' `elem` s || "\"" ++ s ++ "\"" /= ss then ss else s
filterNodes (HU.ListItem _ : l@(HU.Label _) : rest) =
l : filterNodes rest
filterNodes [] = []
filterNodes (x:rest) = x : filterNodes rest
{-
`runTestTT` provides the "standard" text-based test controller.
Reporting is made to standard error, and progress reports are
included. For possible programmatic use, the final counts are
returned. The "TT" in the name suggests "Text-based reporting to the
Terminal".
-} | 725 | showPath nodes = foldr1 f (map showNode (filterNodes (reverse nodes)))
where f a b = a ++ ":" ++ b
showNode (HU.ListItem n) = show n
showNode (HU.Label label) = safe label (show label)
safe s ss = if ':' `elem` s || "\"" ++ s ++ "\"" /= ss then ss else s
filterNodes (HU.ListItem _ : l@(HU.Label _) : rest) =
l : filterNodes rest
filterNodes [] = []
filterNodes (x:rest) = x : filterNodes rest
{-
`runTestTT` provides the "standard" text-based test controller.
Reporting is made to standard error, and progress reports are
included. For possible programmatic use, the final counts are
returned. The "TT" in the name suggests "Text-based reporting to the
Terminal".
-} | 725 | showPath nodes = foldr1 f (map showNode (filterNodes (reverse nodes)))
where f a b = a ++ ":" ++ b
showNode (HU.ListItem n) = show n
showNode (HU.Label label) = safe label (show label)
safe s ss = if ':' `elem` s || "\"" ++ s ++ "\"" /= ss then ss else s
filterNodes (HU.ListItem _ : l@(HU.Label _) : rest) =
l : filterNodes rest
filterNodes [] = []
filterNodes (x:rest) = x : filterNodes rest
{-
`runTestTT` provides the "standard" text-based test controller.
Reporting is made to standard error, and progress reports are
included. For possible programmatic use, the final counts are
returned. The "TT" in the name suggests "Text-based reporting to the
Terminal".
-} | 725 | false | false | 0 | 12 | 175 | 218 | 109 | 109 | null | null |
kongo2002/minfo | Data/MInfo/Parser.hs | apache-2.0 | hms :: Parser (Integer, Integer, Integer, Integer)
hms = do
h <- decimal
_ <- char ':'
m <- decimal
_ <- char ':'
s <- decimal
ms <- millis
return (h, m, s, ms)
where
-- not every mongodb logs with milliseconds precision
millis = char '.' *> decimal <|> return 0 | 286 | hms :: Parser (Integer, Integer, Integer, Integer)
hms = do
h <- decimal
_ <- char ':'
m <- decimal
_ <- char ':'
s <- decimal
ms <- millis
return (h, m, s, ms)
where
-- not every mongodb logs with milliseconds precision
millis = char '.' *> decimal <|> return 0 | 286 | hms = do
h <- decimal
_ <- char ':'
m <- decimal
_ <- char ':'
s <- decimal
ms <- millis
return (h, m, s, ms)
where
-- not every mongodb logs with milliseconds precision
millis = char '.' *> decimal <|> return 0 | 235 | false | true | 0 | 8 | 76 | 115 | 56 | 59 | null | null |
silkapp/generic-aeson | src/Generics/Generic/Aeson/Util.hs | bsd-3-clause | conNameT set x = formatLabel set . T.pack . conName $ x | 55 | conNameT set x = formatLabel set . T.pack . conName $ x | 55 | conNameT set x = formatLabel set . T.pack . conName $ x | 55 | false | false | 0 | 8 | 11 | 28 | 13 | 15 | null | null |
snoyberg/ghc | compiler/codeGen/StgCmmClosure.hs | bsd-3-clause | indStaticInfoTable :: CmmInfoTable
indStaticInfoTable
= CmmInfoTable { cit_lbl = mkIndStaticInfoLabel
, cit_rep = indStaticRep
, cit_prof = NoProfilingInfo
, cit_srt = NoC_SRT } | 233 | indStaticInfoTable :: CmmInfoTable
indStaticInfoTable
= CmmInfoTable { cit_lbl = mkIndStaticInfoLabel
, cit_rep = indStaticRep
, cit_prof = NoProfilingInfo
, cit_srt = NoC_SRT } | 233 | indStaticInfoTable
= CmmInfoTable { cit_lbl = mkIndStaticInfoLabel
, cit_rep = indStaticRep
, cit_prof = NoProfilingInfo
, cit_srt = NoC_SRT } | 198 | false | true | 0 | 6 | 78 | 40 | 23 | 17 | null | null |
Proclivis/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_HP_IDENTIFIER :: Int
wxSTC_HP_IDENTIFIER = 102 | 52 | wxSTC_HP_IDENTIFIER :: Int
wxSTC_HP_IDENTIFIER = 102 | 52 | wxSTC_HP_IDENTIFIER = 102 | 25 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
Arguggi/irc-log | backend/app/bot/Main.hs | gpl-3.0 | -- Parse Irc message:
-- :NICKNAME!~NICKNAME@HOST PRIVMSG #haskell.it :MESSAGE
ircParser :: UTCTime -> Parser PrivMsg
ircParser time = PrivMsg <$> ircNickname <*> pure time <*> ircMessage
where
ircNickname = char ':' *> takeTill (== '!')
-- Only save PRIVMSGs
checkPriv = skipWhile (/= ' ') <* string " PRIVMSG "
-- sent to the channel we connect to (so this ignores PRIVMSGs to the bot)
skipChan = string chan <* skipWhile (/= ':') <* char ':'
ircMessage = checkPriv *> skipChan *> takeText | 543 | ircParser :: UTCTime -> Parser PrivMsg
ircParser time = PrivMsg <$> ircNickname <*> pure time <*> ircMessage
where
ircNickname = char ':' *> takeTill (== '!')
-- Only save PRIVMSGs
checkPriv = skipWhile (/= ' ') <* string " PRIVMSG "
-- sent to the channel we connect to (so this ignores PRIVMSGs to the bot)
skipChan = string chan <* skipWhile (/= ':') <* char ':'
ircMessage = checkPriv *> skipChan *> takeText | 464 | ircParser time = PrivMsg <$> ircNickname <*> pure time <*> ircMessage
where
ircNickname = char ':' *> takeTill (== '!')
-- Only save PRIVMSGs
checkPriv = skipWhile (/= ' ') <* string " PRIVMSG "
-- sent to the channel we connect to (so this ignores PRIVMSGs to the bot)
skipChan = string chan <* skipWhile (/= ':') <* char ':'
ircMessage = checkPriv *> skipChan *> takeText | 425 | true | true | 0 | 10 | 134 | 119 | 62 | 57 | null | null |
peterokagey/haskellOEIS | test/External/A180714Spec.hs | apache-2.0 | main :: IO ()
main = hspec spec | 31 | main :: IO ()
main = hspec spec | 31 | main = hspec spec | 17 | false | true | 0 | 7 | 7 | 24 | 10 | 14 | null | null |
sayon/lenses-talk | lenses.hs | gpl-2.0 | makePoint :: (Double, Double) -> Point
makePoint (x, y) = Point x y | 67 | makePoint :: (Double, Double) -> Point
makePoint (x, y) = Point x y | 67 | makePoint (x, y) = Point x y | 28 | false | true | 0 | 6 | 12 | 39 | 20 | 19 | null | null |
Sgoettschkes/learning | haskell/LearnYouAHaskell/04.hs | mit | tell' :: (Show a) => [a] -> String
tell' [] = "Empty" | 53 | tell' :: (Show a) => [a] -> String
tell' [] = "Empty" | 53 | tell' [] = "Empty" | 18 | false | true | 0 | 9 | 11 | 38 | 18 | 20 | null | null |
mpickering/hlint-refactor | src/Refact/Fixity.hs | bsd-3-clause | expFix :: LHsExpr GhcPs -> M (LHsExpr GhcPs)
expFix (L loc (OpApp _ l op r)) =
mkOpAppRn baseFixities loc l op (findFixity baseFixities op) r | 143 | expFix :: LHsExpr GhcPs -> M (LHsExpr GhcPs)
expFix (L loc (OpApp _ l op r)) =
mkOpAppRn baseFixities loc l op (findFixity baseFixities op) r | 143 | expFix (L loc (OpApp _ l op r)) =
mkOpAppRn baseFixities loc l op (findFixity baseFixities op) r | 98 | false | true | 0 | 9 | 27 | 71 | 34 | 37 | null | null |
573/leksah | src/IDE/Completion.hs | gpl-2.0 | cancel :: IDEAction
cancel = do
currentState' <- readIDE currentState
(_, completion') <- readIDE completion
case (currentState',completion') of
(IsCompleting conn , Just (CompletionWindow window tv st)) -> do
cancelCompletion window tv st conn
_ -> return () | 313 | cancel :: IDEAction
cancel = do
currentState' <- readIDE currentState
(_, completion') <- readIDE completion
case (currentState',completion') of
(IsCompleting conn , Just (CompletionWindow window tv st)) -> do
cancelCompletion window tv st conn
_ -> return () | 313 | cancel = do
currentState' <- readIDE currentState
(_, completion') <- readIDE completion
case (currentState',completion') of
(IsCompleting conn , Just (CompletionWindow window tv st)) -> do
cancelCompletion window tv st conn
_ -> return () | 293 | false | true | 0 | 14 | 90 | 108 | 50 | 58 | null | null |
kmels/xmonad-launcher | XMonad/Hooks/FadeWindows.hs | bsd-3-clause | -- ^ An alias for 'transparency'.
translucence = transparency | 61 | translucence = transparency | 27 | translucence = transparency | 27 | true | false | 0 | 4 | 8 | 7 | 4 | 3 | null | null |
mcmaniac/bindrop | src/Utils/FileUtils.hs | apache-2.0 | randomString :: RandomGen g => Int -> g -> String
randomString len gen =
let alphanum = ['0'..'9'] ++ ['a'..'z'] ++ ['A'..'Z']
indxs = take len $ randomRs (0, length alphanum - 1) gen
in map (alphanum !!) indxs | 224 | randomString :: RandomGen g => Int -> g -> String
randomString len gen =
let alphanum = ['0'..'9'] ++ ['a'..'z'] ++ ['A'..'Z']
indxs = take len $ randomRs (0, length alphanum - 1) gen
in map (alphanum !!) indxs | 224 | randomString len gen =
let alphanum = ['0'..'9'] ++ ['a'..'z'] ++ ['A'..'Z']
indxs = take len $ randomRs (0, length alphanum - 1) gen
in map (alphanum !!) indxs | 174 | false | true | 0 | 13 | 52 | 111 | 54 | 57 | null | null |
rfranek/duckling | Duckling/Time/Helpers.hs | bsd-3-clause | inDuration :: DurationData -> TimeData
inDuration dd = TTime.timedata'
{ TTime.timePred = shiftDuration (takeNth 0 False $ timeCycle TG.Second) dd
, TTime.timeGrain = TDuration.grain dd
} | 193 | inDuration :: DurationData -> TimeData
inDuration dd = TTime.timedata'
{ TTime.timePred = shiftDuration (takeNth 0 False $ timeCycle TG.Second) dd
, TTime.timeGrain = TDuration.grain dd
} | 193 | inDuration dd = TTime.timedata'
{ TTime.timePred = shiftDuration (takeNth 0 False $ timeCycle TG.Second) dd
, TTime.timeGrain = TDuration.grain dd
} | 154 | false | true | 0 | 12 | 31 | 74 | 35 | 39 | null | null |
urbanslug/ghc | compiler/utils/ExtsCompat46.hs | bsd-3-clause | sameMVar# :: MVar# s a -> MVar# s a -> Bool
sameMVar# a b = isTrue# (E.sameMVar# a b) | 85 | sameMVar# :: MVar# s a -> MVar# s a -> Bool
sameMVar# a b = isTrue# (E.sameMVar# a b) | 85 | sameMVar# a b = isTrue# (E.sameMVar# a b) | 41 | false | true | 0 | 8 | 18 | 47 | 22 | 25 | null | null |
ekr/tamarin-prover | lib/theory/src/Theory/Constraint/System/Guarded.hs | gpl-3.0 | matchTerm :: SkTerm -> SkTerm -> WithMaude [SkSubst]
matchTerm s t =
solveMatchLTerm sortOfSkol (s `matchWith` t)
where
sortOfSkol (SkName n) = sortOfName n
sortOfSkol (SkConst v) = lvarSort v
------------------------------------------------------------------------------
-- Pretty Printing
------------------------------------------------------------------------------
-- | Pretty print a formula. | 416 | matchTerm :: SkTerm -> SkTerm -> WithMaude [SkSubst]
matchTerm s t =
solveMatchLTerm sortOfSkol (s `matchWith` t)
where
sortOfSkol (SkName n) = sortOfName n
sortOfSkol (SkConst v) = lvarSort v
------------------------------------------------------------------------------
-- Pretty Printing
------------------------------------------------------------------------------
-- | Pretty print a formula. | 416 | matchTerm s t =
solveMatchLTerm sortOfSkol (s `matchWith` t)
where
sortOfSkol (SkName n) = sortOfName n
sortOfSkol (SkConst v) = lvarSort v
------------------------------------------------------------------------------
-- Pretty Printing
------------------------------------------------------------------------------
-- | Pretty print a formula. | 362 | false | true | 0 | 9 | 58 | 91 | 45 | 46 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/HTMLTextAreaElement.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement.select Mozilla HTMLTextAreaElement.select documentation>
select :: (MonadDOM m) => HTMLTextAreaElement -> m ()
select self = liftDOM (void (self ^. jsf "select" ())) | 241 | select :: (MonadDOM m) => HTMLTextAreaElement -> m ()
select self = liftDOM (void (self ^. jsf "select" ())) | 108 | select self = liftDOM (void (self ^. jsf "select" ())) | 54 | true | true | 0 | 11 | 25 | 60 | 29 | 31 | null | null |
ertes/pipes-bytestring | test/Bench.hs | bsd-3-clause | main :: IO ()
main = defaultMain [] | 35 | main :: IO ()
main = defaultMain [] | 35 | main = defaultMain [] | 21 | false | true | 0 | 6 | 7 | 21 | 10 | 11 | null | null |
s9gf4ult/yesod | yesod-bin/AddHandler.hs | mit | addHandlerInteractive :: IO ()
addHandlerInteractive = do
cabal <- getCabal
let routeInput = do
putStr "Name of route (without trailing R): "
hFlush stdout
name <- getLine
checked <- checkRoute name cabal
case checked of
Left err@EmptyRoute -> (error . show) err
Left err@RouteCaseError -> print err >> routeInput
Left err@(RouteExists _) -> do
print err
putStrLn "Try another name or leave blank to exit"
routeInput
Right p -> return p
routePair <- routeInput
putStr "Enter route pattern (ex: /entry/#EntryId): "
hFlush stdout
pattern <- getLine
putStr "Enter space-separated list of methods (ex: GET POST): "
hFlush stdout
methods <- getLine
addHandlerFiles cabal routePair pattern methods | 862 | addHandlerInteractive :: IO ()
addHandlerInteractive = do
cabal <- getCabal
let routeInput = do
putStr "Name of route (without trailing R): "
hFlush stdout
name <- getLine
checked <- checkRoute name cabal
case checked of
Left err@EmptyRoute -> (error . show) err
Left err@RouteCaseError -> print err >> routeInput
Left err@(RouteExists _) -> do
print err
putStrLn "Try another name or leave blank to exit"
routeInput
Right p -> return p
routePair <- routeInput
putStr "Enter route pattern (ex: /entry/#EntryId): "
hFlush stdout
pattern <- getLine
putStr "Enter space-separated list of methods (ex: GET POST): "
hFlush stdout
methods <- getLine
addHandlerFiles cabal routePair pattern methods | 862 | addHandlerInteractive = do
cabal <- getCabal
let routeInput = do
putStr "Name of route (without trailing R): "
hFlush stdout
name <- getLine
checked <- checkRoute name cabal
case checked of
Left err@EmptyRoute -> (error . show) err
Left err@RouteCaseError -> print err >> routeInput
Left err@(RouteExists _) -> do
print err
putStrLn "Try another name or leave blank to exit"
routeInput
Right p -> return p
routePair <- routeInput
putStr "Enter route pattern (ex: /entry/#EntryId): "
hFlush stdout
pattern <- getLine
putStr "Enter space-separated list of methods (ex: GET POST): "
hFlush stdout
methods <- getLine
addHandlerFiles cabal routePair pattern methods | 831 | false | true | 0 | 18 | 276 | 213 | 91 | 122 | null | null |
tsahyt/clingo-haskell | src/Clingo/Internal/AST.hs | mit | fromRawConditionalLiteral :: AstConditionalLiteral
-> IO (ConditionalLiteral (Symbol s))
fromRawConditionalLiteral (AstConditionalLiteral l ls n) = ConditionalLiteral
<$> fromRawLiteral l
<*> (mapM fromRawLiteral =<< peekArray (fromIntegral n) ls) | 283 | fromRawConditionalLiteral :: AstConditionalLiteral
-> IO (ConditionalLiteral (Symbol s))
fromRawConditionalLiteral (AstConditionalLiteral l ls n) = ConditionalLiteral
<$> fromRawLiteral l
<*> (mapM fromRawLiteral =<< peekArray (fromIntegral n) ls) | 283 | fromRawConditionalLiteral (AstConditionalLiteral l ls n) = ConditionalLiteral
<$> fromRawLiteral l
<*> (mapM fromRawLiteral =<< peekArray (fromIntegral n) ls) | 167 | false | true | 5 | 10 | 61 | 80 | 38 | 42 | null | null |
dstruthers/Pyrite | Main.hs | mit | repl :: VM -> IO ()
repl vm = do
putStr prompt
src <- getLine
if src == ""
then repl vm
else case parse src >>= mapM compile >>= foldM eval vm of
Left e -> (putStrLn $ "***" ++ show e) >> repl vm
Right vm' -> (putStrLn $ show vm') >> repl vm'
where prompt = "Pyrite> " | 292 | repl :: VM -> IO ()
repl vm = do
putStr prompt
src <- getLine
if src == ""
then repl vm
else case parse src >>= mapM compile >>= foldM eval vm of
Left e -> (putStrLn $ "***" ++ show e) >> repl vm
Right vm' -> (putStrLn $ show vm') >> repl vm'
where prompt = "Pyrite> " | 292 | repl vm = do
putStr prompt
src <- getLine
if src == ""
then repl vm
else case parse src >>= mapM compile >>= foldM eval vm of
Left e -> (putStrLn $ "***" ++ show e) >> repl vm
Right vm' -> (putStrLn $ show vm') >> repl vm'
where prompt = "Pyrite> " | 272 | false | true | 0 | 14 | 84 | 141 | 65 | 76 | null | null |
haskell-distributed/distributed-process-platform | src/Control/Distributed/Process/Platform/Execution/EventManager.hs | bsd-3-clause | start :: Process EventManager
start = broadcastExchange >>= return . EventManager | 81 | start :: Process EventManager
start = broadcastExchange >>= return . EventManager | 81 | start = broadcastExchange >>= return . EventManager | 51 | false | true | 0 | 6 | 10 | 22 | 11 | 11 | null | null |
brendanhay/gogol | gogol-cloudtasks/gen/Network/Google/Resource/CloudTasks/Projects/Locations/Queues/SetIAMPolicy.hs | mpl-2.0 | -- | REQUIRED: The resource for which the policy is being specified. See the
-- operation documentation for the appropriate value for this field.
plqsipResource :: Lens' ProjectsLocationsQueuesSetIAMPolicy Text
plqsipResource
= lens _plqsipResource
(\ s a -> s{_plqsipResource = a}) | 290 | plqsipResource :: Lens' ProjectsLocationsQueuesSetIAMPolicy Text
plqsipResource
= lens _plqsipResource
(\ s a -> s{_plqsipResource = a}) | 144 | plqsipResource
= lens _plqsipResource
(\ s a -> s{_plqsipResource = a}) | 79 | true | true | 1 | 9 | 47 | 46 | 23 | 23 | null | null |
rueshyna/gogol | gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/Reports/Update.hs | mpl-2.0 | -- | The DFA user profile ID.
ruProFileId :: Lens' ReportsUpdate Int64
ruProFileId
= lens _ruProFileId (\ s a -> s{_ruProFileId = a}) .
_Coerce | 151 | ruProFileId :: Lens' ReportsUpdate Int64
ruProFileId
= lens _ruProFileId (\ s a -> s{_ruProFileId = a}) .
_Coerce | 121 | ruProFileId
= lens _ruProFileId (\ s a -> s{_ruProFileId = a}) .
_Coerce | 80 | true | true | 1 | 9 | 32 | 50 | 24 | 26 | null | null |
osa1/chsc | Core/Parser.hs | bsd-3-clause | argOf :: Description -> Description
argOf = ArgumentOf | 54 | argOf :: Description -> Description
argOf = ArgumentOf | 54 | argOf = ArgumentOf | 18 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
creichert/disque.hs | src/Database/Disque.hs | bsd-3-clause | astack :: [ByteString] -> Disque (Either Reply ByteString)
fastack js = Disque $ sendRequest $ ["FASTACK"] ++ js
| 113 | fastack :: [ByteString] -> Disque (Either Reply ByteString)
fastack js = Disque $ sendRequest $ ["FASTACK"] ++ js | 113 | fastack js = Disque $ sendRequest $ ["FASTACK"] ++ js | 53 | false | true | 0 | 8 | 18 | 50 | 25 | 25 | null | null |
DSLsofMath/Hatlab | src/Hatlab/ParametricCurves.hs | bsd-3-clause | polarCurve :: (Double -> Double) -> (Double, Double) -> String -> Parametric
polarCurve r_fun interval name =
Par
(\theta -> (cos theta)*(r_fun theta))
(\theta -> (sin theta)*(r_fun theta))
interval
name | 221 | polarCurve :: (Double -> Double) -> (Double, Double) -> String -> Parametric
polarCurve r_fun interval name =
Par
(\theta -> (cos theta)*(r_fun theta))
(\theta -> (sin theta)*(r_fun theta))
interval
name | 221 | polarCurve r_fun interval name =
Par
(\theta -> (cos theta)*(r_fun theta))
(\theta -> (sin theta)*(r_fun theta))
interval
name | 144 | false | true | 0 | 10 | 47 | 100 | 53 | 47 | null | null |
urv/fixhs | src/Data/FIX/Spec/FIX43.hs | lgpl-2.1 | tHighPx :: FIXTag
tHighPx = FIXTag
{ tName = "HighPx"
, tnum = 332
, tparser = toFIXDouble
, arbitraryValue = FIXDouble <$> (return (-2.112 :: Double)) } | 166 | tHighPx :: FIXTag
tHighPx = FIXTag
{ tName = "HighPx"
, tnum = 332
, tparser = toFIXDouble
, arbitraryValue = FIXDouble <$> (return (-2.112 :: Double)) } | 166 | tHighPx = FIXTag
{ tName = "HighPx"
, tnum = 332
, tparser = toFIXDouble
, arbitraryValue = FIXDouble <$> (return (-2.112 :: Double)) } | 148 | false | true | 0 | 12 | 40 | 59 | 34 | 25 | null | null |
Paow/encore | src/back/CodeGen/DTrace.hs | bsd-3-clause | dtraceMethodCall :: CCode Lval -> ID.Name -> [CCode Lval] -> CCode Stat
dtraceMethodCall target name args =
dtrace "METHOD_CALL" $ ["(uintptr_t)*_ctx", "(uintptr_t)" ++ pp target, show $ show name] | 199 | dtraceMethodCall :: CCode Lval -> ID.Name -> [CCode Lval] -> CCode Stat
dtraceMethodCall target name args =
dtrace "METHOD_CALL" $ ["(uintptr_t)*_ctx", "(uintptr_t)" ++ pp target, show $ show name] | 199 | dtraceMethodCall target name args =
dtrace "METHOD_CALL" $ ["(uintptr_t)*_ctx", "(uintptr_t)" ++ pp target, show $ show name] | 127 | false | true | 0 | 9 | 30 | 74 | 36 | 38 | null | null |
GU-CLASP/TypedFlow | TypedFlow/Abstract.hs | lgpl-3.0 | -- | maxpool layer. window size is the first type argument.
maxPool1D :: forall window width channels t.
KnownNat width => KnownNat channels => (KnownNat window,KnownBits t) =>
T '[window*width,channels] (Flt t) -> T '[width,channels] (Flt t)
maxPool1D x = squeeze0 (Pool (natSat @1) (typeSShape @'[window]) MaxPool (natSat @channels) (typeSShape @'[width]) (expandDim0 x)) | 399 | maxPool1D :: forall window width channels t.
KnownNat width => KnownNat channels => (KnownNat window,KnownBits t) =>
T '[window*width,channels] (Flt t) -> T '[width,channels] (Flt t)
maxPool1D x = squeeze0 (Pool (natSat @1) (typeSShape @'[window]) MaxPool (natSat @channels) (typeSShape @'[width]) (expandDim0 x)) | 339 | maxPool1D x = squeeze0 (Pool (natSat @1) (typeSShape @'[window]) MaxPool (natSat @channels) (typeSShape @'[width]) (expandDim0 x)) | 130 | true | true | 0 | 13 | 78 | 166 | 86 | 80 | null | null |
rueshyna/gogol | gogol-identity-toolkit/gen/Network/Google/IdentityToolkit/Types/Product.hs | mpl-2.0 | -- | If idToken is STS id token, then this field will be refresh token.
varRefreshToken :: Lens' VerifyAssertionResponse (Maybe Text)
varRefreshToken
= lens _varRefreshToken
(\ s a -> s{_varRefreshToken = a}) | 216 | varRefreshToken :: Lens' VerifyAssertionResponse (Maybe Text)
varRefreshToken
= lens _varRefreshToken
(\ s a -> s{_varRefreshToken = a}) | 144 | varRefreshToken
= lens _varRefreshToken
(\ s a -> s{_varRefreshToken = a}) | 82 | true | true | 1 | 9 | 39 | 52 | 25 | 27 | null | null |
brendanhay/gogol | gogol-bigtableadmin/gen/Network/Google/Resource/BigtableAdmin/Projects/Instances/GetIAMPolicy.hs | mpl-2.0 | -- | OAuth access token.
pigipAccessToken :: Lens' ProjectsInstancesGetIAMPolicy (Maybe Text)
pigipAccessToken
= lens _pigipAccessToken
(\ s a -> s{_pigipAccessToken = a}) | 179 | pigipAccessToken :: Lens' ProjectsInstancesGetIAMPolicy (Maybe Text)
pigipAccessToken
= lens _pigipAccessToken
(\ s a -> s{_pigipAccessToken = a}) | 154 | pigipAccessToken
= lens _pigipAccessToken
(\ s a -> s{_pigipAccessToken = a}) | 85 | true | true | 1 | 9 | 29 | 51 | 25 | 26 | null | null |
nomeata/list-fusion-lab | driver.hs | bsd-3-clause | scaledShow :: [Double] -> Double -> Text
scaledShow list = \v -> showDouble (v/factor) <> singleton ' ' <> unit
where
-- is it really that complicated?
showDouble = toStrict . toLazyText . formatRealFloat Fixed (Just 3)
max = maximum list
(unit, factor) =
fromMaybe ("s", 1) $
find (\(u,s) -> max < 1000 * s)
[ ("ns", 1e-9)
, ("µs", 1e-6)
, ("ms", 1e-3)
] | 421 | scaledShow :: [Double] -> Double -> Text
scaledShow list = \v -> showDouble (v/factor) <> singleton ' ' <> unit
where
-- is it really that complicated?
showDouble = toStrict . toLazyText . formatRealFloat Fixed (Just 3)
max = maximum list
(unit, factor) =
fromMaybe ("s", 1) $
find (\(u,s) -> max < 1000 * s)
[ ("ns", 1e-9)
, ("µs", 1e-6)
, ("ms", 1e-3)
] | 421 | scaledShow list = \v -> showDouble (v/factor) <> singleton ' ' <> unit
where
-- is it really that complicated?
showDouble = toStrict . toLazyText . formatRealFloat Fixed (Just 3)
max = maximum list
(unit, factor) =
fromMaybe ("s", 1) $
find (\(u,s) -> max < 1000 * s)
[ ("ns", 1e-9)
, ("µs", 1e-6)
, ("ms", 1e-3)
] | 380 | false | true | 0 | 10 | 131 | 166 | 91 | 75 | null | null |
ducis/haAni | hs/common/Graphics/UI/GLUT/Raw/Tokens.hs | gpl-2.0 | glut_WINDOW_HEIGHT :: GLenum
glut_WINDOW_HEIGHT = 0x0067 | 56 | glut_WINDOW_HEIGHT :: GLenum
glut_WINDOW_HEIGHT = 0x0067 | 56 | glut_WINDOW_HEIGHT = 0x0067 | 27 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
GU-CLASP/FraCoq | Logic.hs | gpl-3.0 | eqAmount n eqs(AtLeast x) (AtLeast x') = eqNat n eqs x x' | 57 | eqAmount n eqs(AtLeast x) (AtLeast x') = eqNat n eqs x x' | 57 | eqAmount n eqs(AtLeast x) (AtLeast x') = eqNat n eqs x x' | 57 | false | false | 0 | 7 | 11 | 36 | 17 | 19 | null | null |
schell/lamdu | Lamdu/GUI/ExpressionEdit/HoleEdit/Closed.hs | gpl-3.0 | makeWrapperEventMap ::
(MonadA m, MonadA f) =>
Bool -> Sugar.HoleArg f (Sugar.ExpressionN f a) -> Widget.Id ->
ExprGuiM m (Widget.EventHandlers (T f))
makeWrapperEventMap argIsFocused arg myId = do
config <- ExprGuiM.widgetEnv WE.readConfig
let
tryUnwrapEventMap =
case arg ^? Sugar.haUnwrap . Sugar._UnwrapMAction . Lens._Just of
Just unwrap ->
Widget.keysEventMapMovesCursor (Config.acceptKeys config ++ Config.delKeys config)
(E.Doc ["Edit", "Unwrap"]) $ WidgetIds.fromGuid <$> unwrap
Nothing ->
Widget.keysEventMapMovesCursor (Config.wrapKeys config)
(E.Doc ["Navigation", "Hole", "Open"]) .
pure $ diveIntoHole myId
navigateEventMap
| argIsFocused =
Widget.keysEventMapMovesCursor (Config.leaveSubexpressionKeys config)
(E.Doc ["Navigation", "Go to parent wrapper"]) $
pure myId
| otherwise =
maybe mempty
(Widget.keysEventMapMovesCursor (Config.enterSubexpressionKeys config)
(E.Doc ["Navigation", "Go to wrapped expr"]) .
pure . WidgetIds.fromGuid) $
arg ^? Sugar.haExpr . Sugar.rPayload . Sugar.plActions . Lens._Just . Sugar.storedGuid
pure $
mappend tryUnwrapEventMap navigateEventMap | 1,254 | makeWrapperEventMap ::
(MonadA m, MonadA f) =>
Bool -> Sugar.HoleArg f (Sugar.ExpressionN f a) -> Widget.Id ->
ExprGuiM m (Widget.EventHandlers (T f))
makeWrapperEventMap argIsFocused arg myId = do
config <- ExprGuiM.widgetEnv WE.readConfig
let
tryUnwrapEventMap =
case arg ^? Sugar.haUnwrap . Sugar._UnwrapMAction . Lens._Just of
Just unwrap ->
Widget.keysEventMapMovesCursor (Config.acceptKeys config ++ Config.delKeys config)
(E.Doc ["Edit", "Unwrap"]) $ WidgetIds.fromGuid <$> unwrap
Nothing ->
Widget.keysEventMapMovesCursor (Config.wrapKeys config)
(E.Doc ["Navigation", "Hole", "Open"]) .
pure $ diveIntoHole myId
navigateEventMap
| argIsFocused =
Widget.keysEventMapMovesCursor (Config.leaveSubexpressionKeys config)
(E.Doc ["Navigation", "Go to parent wrapper"]) $
pure myId
| otherwise =
maybe mempty
(Widget.keysEventMapMovesCursor (Config.enterSubexpressionKeys config)
(E.Doc ["Navigation", "Go to wrapped expr"]) .
pure . WidgetIds.fromGuid) $
arg ^? Sugar.haExpr . Sugar.rPayload . Sugar.plActions . Lens._Just . Sugar.storedGuid
pure $
mappend tryUnwrapEventMap navigateEventMap | 1,254 | makeWrapperEventMap argIsFocused arg myId = do
config <- ExprGuiM.widgetEnv WE.readConfig
let
tryUnwrapEventMap =
case arg ^? Sugar.haUnwrap . Sugar._UnwrapMAction . Lens._Just of
Just unwrap ->
Widget.keysEventMapMovesCursor (Config.acceptKeys config ++ Config.delKeys config)
(E.Doc ["Edit", "Unwrap"]) $ WidgetIds.fromGuid <$> unwrap
Nothing ->
Widget.keysEventMapMovesCursor (Config.wrapKeys config)
(E.Doc ["Navigation", "Hole", "Open"]) .
pure $ diveIntoHole myId
navigateEventMap
| argIsFocused =
Widget.keysEventMapMovesCursor (Config.leaveSubexpressionKeys config)
(E.Doc ["Navigation", "Go to parent wrapper"]) $
pure myId
| otherwise =
maybe mempty
(Widget.keysEventMapMovesCursor (Config.enterSubexpressionKeys config)
(E.Doc ["Navigation", "Go to wrapped expr"]) .
pure . WidgetIds.fromGuid) $
arg ^? Sugar.haExpr . Sugar.rPayload . Sugar.plActions . Lens._Just . Sugar.storedGuid
pure $
mappend tryUnwrapEventMap navigateEventMap | 1,097 | false | true | 0 | 25 | 284 | 388 | 189 | 199 | null | null |
wxzh/fcore | lib/Src.hs | bsd-2-clause | -- Precedence of operators based on the table in:
-- http://en.wikipedia.org/wiki/Order_of_operations#Programming_languages
opPrec :: Num a => Operator -> a
opPrec (Arith J.Mult) = 3 | 186 | opPrec :: Num a => Operator -> a
opPrec (Arith J.Mult) = 3 | 62 | opPrec (Arith J.Mult) = 3 | 29 | true | true | 0 | 8 | 27 | 35 | 18 | 17 | null | null |
msakai/ptq | src/Translation.hs | lgpl-2.1 | -- T10
translate (F8 phi psi) =
case cat :: Cat c of
Sen -> Op2 And (translate phi) (translate psi) -- T11a
IV -> lambda x $ Op2 And (translate phi :@ FVar x) (translate psi :@ FVar x) -- T12a
where
x = ("x", E) | 227 | translate (F8 phi psi) =
case cat :: Cat c of
Sen -> Op2 And (translate phi) (translate psi) -- T11a
IV -> lambda x $ Op2 And (translate phi :@ FVar x) (translate psi :@ FVar x) -- T12a
where
x = ("x", E) | 220 | translate (F8 phi psi) =
case cat :: Cat c of
Sen -> Op2 And (translate phi) (translate psi) -- T11a
IV -> lambda x $ Op2 And (translate phi :@ FVar x) (translate psi :@ FVar x) -- T12a
where
x = ("x", E) | 220 | true | false | 1 | 12 | 62 | 119 | 57 | 62 | null | null |
bkoropoff/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp v LStrLt [l,r] = v ++ "idris_strlt(vm, " ++ creg l ++ ", " ++ creg r ++ ")" | 80 | doOp v LStrLt [l,r] = v ++ "idris_strlt(vm, " ++ creg l ++ ", " ++ creg r ++ ")" | 80 | doOp v LStrLt [l,r] = v ++ "idris_strlt(vm, " ++ creg l ++ ", " ++ creg r ++ ")" | 80 | false | false | 0 | 9 | 19 | 48 | 22 | 26 | null | null |
lucasbraun/mt-rewrite | src/MtUtils.hs | bsd-3-clause | remover ([],ss) = ([],ss) | 25 | remover ([],ss) = ([],ss) | 25 | remover ([],ss) = ([],ss) | 25 | false | false | 0 | 6 | 3 | 26 | 14 | 12 | null | null |
TomMD/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | translateOp dflags IntRemOp = Just (mo_wordSRem dflags) | 62 | translateOp dflags IntRemOp = Just (mo_wordSRem dflags) | 62 | translateOp dflags IntRemOp = Just (mo_wordSRem dflags) | 62 | false | false | 0 | 7 | 13 | 22 | 9 | 13 | null | null |
BartAdv/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | reifyTTBinderApp reif f [t]
| f == reflm "PVTy" = liftM PVTy (reif t) | 91 | reifyTTBinderApp reif f [t]
| f == reflm "PVTy" = liftM PVTy (reif t) | 91 | reifyTTBinderApp reif f [t]
| f == reflm "PVTy" = liftM PVTy (reif t) | 91 | false | false | 0 | 9 | 35 | 40 | 18 | 22 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.