task_id stringlengths 53 83 | poly_type stringclasses 5 values | signature stringlengths 16 74 | code stringlengths 9 481 | dependencies listlengths 0 14 |
|---|---|---|---|---|
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Data/Maybe.hs--maybe | Parametric | maybe :: b -> (a -> b) -> Maybe a -> b | maybe _ f (Just x) = f x
maybe n _ Nothing = n | [
"data Maybe a = Nothing | Just a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Data/Either.hs--either | Parametric | either :: (a -> c) -> (b -> c) -> Either a b -> c | either _ g (Right y) = g y
either f _ (Left x) = f x | [
"data Either a b = Left a | Right b"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Enum.hs--enumFrom | Ad-hoc | enumFrom :: Enum a => a -> [a] | enumFrom x = map toEnum [fromEnum x ..] | [
"map :: (a -> b) -> [a] -> [b]",
"toEnum :: Enum a => Int -> a",
"fromEnum :: Enum a => a -> Int"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Data/Foldable.hs--notElem | Ad-hoc | notElem :: (Foldable t, Eq a) => a -> t a -> Bool | notElem x = not . elem x | [
"elem :: (Foldable t, Eq a) => a -> t a -> Bool",
"not :: Bool -> Bool",
"(.) :: (b -> c) -> (a -> b) -> a -> c"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/List.hs--lookup | Ad-hoc | lookup :: (Eq a) => a -> [(a,b)] -> Maybe b | lookup _key [] = Nothing
lookup key ((x,y):xys)
| key == x = Just y
| otherwise = lookup key xys | [
"data Maybe a = Nothing | Just a",
"(==) :: Eq a => a -> a -> Bool"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/List.hs--zip | Parametric | zip :: [a] -> [b] -> [(a,b)] | zip (a:as) (b:bs) = (a,b) : zip as bs
zip [] _bs = []
zip _as [] = [] | [] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/List.hs--zip3 | Parametric | zip3 :: [a] -> [b] -> [c] -> [(a,b,c)] | zip3 (a:as) (b:bs) (c:cs) = (a,b,c) : zip3 as bs cs
zip3 _ _ _ = [] | [] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/List.hs--zipWith | Parametric | zipWith :: (a->b->c) -> [a]->[b]->[c] | zipWith f = go
where
go [] _ = []
go _ [] = []
go (x:xs) (y:ys) = f x y : go xs ys | [] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/List.hs--zipWith3 | Parametric | zipWith3 :: (a->b->c->d) -> [a]->[b]->[c]->[d] | zipWith3 z = go
where
go (a:as) (b:bs) (c:cs) = z a b c : go as bs cs
go _ _ _ = [] | [] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/List.hs--unzip | Parametric | unzip :: [(a,b)] -> ([a],[b]) | unzip = foldr (\(a,b) ~(as,bs) -> (a:as,b:bs)) ([],[]) | [
"foldr :: (a -> b -> b) -> b -> [a] -> b"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Data/OldList.hs--lines | Monomorphic | lines :: String -> [String] | lines emptyStr = []
lines s = cons (case break (== newLine) s of
(l, s') -> (l, case s' of
[] -> []
_:s'' -> lines s''))
where
cons ~(h, t) = h : t | [
"break :: (a -> Bool) -> [a] -> ([a],[a])",
"emptyStr :: String",
"newLine :: Char",
"(==) :: Eq a => a -> a -> Bool"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Data/OldList.hs--words | Monomorphic | words :: String -> [String] | words s = case dropWhile isSpace s of
emptyStr -> []
s' -> w : words s''
where (w, s'') = break isSpace s' | [
"break :: (a -> Bool) -> [a] -> ([a],[a])",
"dropWhile :: (a -> Bool) -> [a] -> [a]",
"isSpace :: Char -> Bool",
"emptyStr :: String"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Data/OldList.hs--unwords | Monomorphic | unwords :: [String] -> String | unwords [] = emptyStr
unwords ws = foldr1 (\w s -> w ++ space:s) ws | [
"(++) :: [a] -> [a] -> [a]",
"foldr1 :: Foldable t => (a -> a -> a) -> t a -> a",
"space :: Char",
"emptyStr :: String"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Enum.hs--enumFromThen | Ad-hoc | enumFromThen :: Enum a => a -> a -> [a] | enumFromThen x y = map toEnum [fromEnum x, fromEnum y ..] | [
"map :: (a -> b) -> [a] -> [b]",
"toEnum :: Enum a => Int -> a",
"fromEnum :: Enum a => a -> Int"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Show.hs--showsPrec | Ad-hoc | showsPrec :: Show a => Int -> a -> ShowS | showsPrec _ x s = show x ++ s | [
"show ::Show a => a -> String",
"(++) :: [a] -> [a] -> [a]",
"type ShowS = String -> String"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Show.hs--showList--Char | Monomorphic | showList :: [Char] -> ShowS | showList cs = showChar quotationMark . showLitString cs . showChar quotationMark | [
"showChar :: Char -> ShowS",
"showLitString :: String -> ShowS",
"type ShowS = String -> String",
"(.) :: (b -> c) -> (a -> b) -> a -> c",
"quotationMark :: Char"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Show.hs--showList | Ad-hoc | showList :: Show a => [a] -> ShowS | showList ls s = showList__ shows ls s | [
"showList__ :: (a -> ShowS) -> [a] -> ShowS",
"shows :: Show a => a -> ShowS",
"type ShowS = String -> String"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Show.hs--show | Ad-hoc | show :: Show a => a -> String | show x = shows x emptyStr | [
"shows :: (Show a) => a -> ShowS",
"type ShowS = String -> String",
"emptyStr :: String"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Show.hs--showParen | Monomorphic | showParen :: Bool -> ShowS -> ShowS | showParen b p = if b then showChar leftParenthesis . p . showChar rightParenthesis else p | [
"showChar :: Char -> ShowS",
"(.) :: (b -> c) -> (a -> b) -> a -> c",
"leftParenthesis :: Char",
"rightParenthesis :: Char",
"type ShowS = String -> String"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Read.hs--readsPrec | Ad-hoc | readsPrec :: Read a => Int -> ReadS a | readsPrec = readPrec_to_S readPrec | [
"readPrec_to_S :: ReadPrec a -> (Int -> ReadS a)",
"readPrec :: ReadPrec a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Read.hs--readParen | Parametric | readParen :: Bool -> ReadS a -> ReadS a | readParen b g = if b then mandatory else optional
where optional r = g r ++ mandatory r
mandatory r =
lex r >>= \([leftParenthesis], s) ->
optional s >>= \(x, t) ->
lex t >>= \([rightParenthesis], u) ->
return (x, u)
| [
"(++) :: [a] -> [a] -> [a]",
"return :: Monad m => a -> m a",
"lex :: String -> [(String, String)]",
"(>>=) :: Monad m => m a -> (a -> m b) -> m b",
"type ReadS a = String -> [(a, String)]",
"leftParenthesis :: Char",
"rightParenthesis :: Char"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Text/Read.hs--read | Ad-hoc | read :: Read a => String -> a | read s = either errorWithoutStackTrace id (readEither s) | [
"either :: (a -> c) -> (b -> c) -> Either a b -> c",
"readEither :: Read a => String -> Either String a",
"id :: a -> a",
"errorWithoutStackTrace :: String -> a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/System/IO.hs--putChar | Monomorphic | putChar :: Char -> IO () | putChar c = hPutChar stdout c | [
"hPutChar :: Handle -> Char -> IO ()",
"stdout :: Handle"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/System/IO.hs--putStr | Monomorphic | putStr :: String -> IO () | putStr s = hPutStr stdout s | [
"hPutStr :: Handle -> String -> IO ()",
"stdout :: Handle"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/System/IO.hs--putStrLn | Monomorphic | putStrLn :: String -> IO () | putStrLn s = hPutStrLn stdout s | [
"hPutStrLn :: Handle -> String -> IO ()",
"stdout :: Handle"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Enum.hs--enumFromTo | Ad-hoc | enumFromTo :: Enum a => a -> a -> [a] | enumFromTo x y = map toEnum [fromEnum x .. fromEnum y] | [
"map :: (a -> b) -> [a] -> [b]",
"toEnum :: Enum a => Int -> a",
"fromEnum :: Enum a => a -> Int"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/System/IO.hs--print | Ad-hoc | print :: Show a => a -> IO () | print x = putStrLn (show x) | [
"putStrLn :: String -> IO ()",
"show :: Show a => a -> String"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/System/IO.hs--interact | Monomorphic | interact :: (String -> String) -> IO () | interact f = getContents >>= \s -> putStr (f s) | [
"putStr :: String -> IO ()",
"getContents :: IO String",
"(>>=) :: IO a -> (a -> IO b) -> IO b"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/System/IO.hs--readFile | Monomorphic | readFile :: FilePath -> IO String | readFile name = openFile name ReadMode >>= hGetContents | [
"openFile :: FilePath -> IOMode -> IO Handle",
"(>>=) :: IO a -> (a -> IO b) -> IO b",
"hGetContents :: Handle -> IO String",
"data IOMode = ReadMode | WriteMode | AppendMode | ReadWriteMode"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/System/IO.hs--writeFile | Monomorphic | writeFile :: FilePath -> String -> IO () | writeFile f txt = withFile f WriteMode (\ hdl -> hPutStr hdl txt) | [
"hPutStr :: Handle -> String -> IO ()",
"withFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO r",
"data IOMode = ReadMode | WriteMode | AppendMode | ReadWriteMode"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/System/IO.hs--appendFile | Monomorphic | appendFile :: FilePath -> String -> IO () | appendFile f txt = withFile f AppendMode (\ hdl -> hPutStr hdl txt) | [
"hPutStr :: Handle -> String -> IO ()",
"withFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO r",
"data IOMode = ReadMode | WriteMode | AppendMode | ReadWriteMode"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Enum.hs--enumFromThenTo | Ad-hoc | enumFromThenTo :: Enum a => a -> a -> a -> [a] | enumFromThenTo x1 x2 y = map toEnum [fromEnum x1, fromEnum x2 .. fromEnum y] | [
"map :: (a -> b) -> [a] -> [b]",
"toEnum :: Enum a => Int -> a",
"fromEnum :: Enum a => a -> Int"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Base.hs--($) | Parametric | ($) :: (a -> b) -> a -> b | ($) f = f | [] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Base.hs--(++) | Parametric | (++) :: [a] -> [a] -> [a] | (++) (x:xs) ys = x : xs ++ ys
(++) [] ys = ys | [] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Base.hs--(.) | Parametric | (.) :: (b -> c) -> (a -> b) -> a -> c | (.) f g = \x -> f (g x) | [] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Base.hs--(&&) | Monomorphic | (&&) :: Bool -> Bool -> Bool | (&&) True True = True
(&&) _ _ = False | [
"data Bool = True | False"
] |
data/repos/libraries/ghc-prim/GHC/Classes.hs--compare | Ad-hoc | compare :: Ord a => a -> a -> Ordering | compare x y = if x == y then EQ
else if x <= y then LT
else GT | [
"(==) :: Eq a => a -> a -> Bool",
"(<=) :: Ord a => a -> a -> Bool",
"data Ordering = LT | EQ | GT"
] |
data/repos/ghc/libraries/ghc-prim/GHC/Classes.hs--(==) | Ad-hoc | (==) :: Eq a => a -> a -> Bool | x == y = not (x /= y) | [
"not :: Bool -> Bool",
"(/=) :: Eq a => a -> a -> Bool"
] |
data/repos/ghc/libraries/ghc-prim/GHC/Classes.hs--(/=) | Ad-hoc | (/=) :: Eq a => a -> a -> Bool | x /= y = not (x == y) | [
"not :: Bool -> Bool",
"(==) :: Eq a => a -> a -> Bool"
] |
data/repos/ghc/libraries/ghc-prim/GHC/Classes.hs--(<=) | Ad-hoc | (<=) :: Ord a => a -> a -> Bool | x <= y = case compare x y of { GT -> False; _ -> True } | [
"compare :: Ord a => a -> a -> Ordering",
"data Ordering = LT | EQ | GT"
] |
data/repos/ghc/libraries/ghc-prim/GHC/Classes.hs--(>=) | Ad-hoc | (>=) :: Ord a => a -> a -> Bool | x >= y = y <= x | [
"(<=) :: Ord a => a -> a -> Bool"
] |
data/repos/ghc/libraries/ghc-prim/GHC/Classes.hs--(<) | Ad-hoc | (<) :: Ord a => a -> a -> Bool | x < y = not (y <= x>) | [
"(<=) :: Ord a => a -> a -> Bool"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Num.hs--negate-Int | Monomorphic | negate :: Int -> Int | negate x = zero - x | [
"(-) :: Num a => a -> a -> a",
"zero :: Int"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Num.hs--negate | Ad-hoc | negate :: Num a => a -> a | negate x = zero - x | [
"(-) :: Num a => a -> a -> a",
"zero :: Num a => a"
] |
data/repos/ghc/libraries/ghc-prim/GHC/Classes.hs--(>) | Ad-hoc | (>) :: Ord a => a -> a -> Bool | x > y = not (x <= y) | [
"(>) :: Ord a => a -> a -> Bool"
] |
data/repos/ghc/libraries/ghc-prim/GHC/Classes.hs--max | Ad-hoc | max :: Ord a => a -> a -> a | max x y = if x <= y then y else x | [
"(<=) :: Ord a => a -> a -> Bool"
] |
data/repos/ghc/libraries/ghc-prim/GHC/Classes.hs--min | Ad-hoc | min :: Ord a => a -> a -> a | min x y = if x <= y then x else y | [
"(<=) :: Ord a => a -> a -> Bool"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Num.hs--(-) | Ad-hoc | (-) :: Num a => a -> a -> a | x - y = x + negate y | [
"(+) :: Num a => a -> a -> a",
"negate :: Num a => a -> a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--sqrt | Ad-hoc | sqrt :: Floating a => a -> a | sqrt x = x ** oneHalf | [
"(**) :: Floating a => a -> a -> a",
"oneHalf :: Floating a => a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--(**) | Ad-hoc | (**) :: Floating a => a -> a -> a | x ** y = exp (log x * y) | [
"exp :: Floating a => a -> a",
"log :: Floating a => a -> a",
"(*) :: Num a => a -> a -> a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--logBase | Ad-hoc | logBase :: Floating a => a -> a -> a | logBase x y = log y / log x | [
"log :: Floating a => a -> a",
"(/) :: Fractional a => a -> a -> a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--tan | Ad-hoc | tan :: Floating a => a -> a | tan x = sin x / cos x | [
"sin :: Floating a => a -> a",
"cos :: Floating a => a -> a",
"(/) :: Fractional a => a -> a -> a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--tanh | Ad-hoc | tanh :: Floating a => a -> a | tanh x = sinh x / cosh x | [
"sinh :: Floating a => a -> a",
"cosh :: Floating a => a -> a",
"(/) :: Fractional a => a -> a -> a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--even | Ad-hoc | even :: Integral a => a -> Bool | even n = n `rem` two == zero | [
"rem :: Integral a => a -> a -> a",
"(==) :: Eq a => a -> a -> Bool",
"two :: Integral a => a",
"zero :: Integral a => a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Num.hs--abs-Int | Monomorphic | abs :: Int -> Int | abs n = if n > zero then n else negate n | [
"(>) :: Ord a => a -> a -> Bool",
"negate :: Num a => a -> a",
"zero :: Int"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Num.hs--abs-Natural | Monomorphic | abs :: Natural -> Natural | abs x = id x | [
"id :: a -> a",
"x :: Natural"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--odd | Ad-hoc | odd :: Integral a => a -> Bool | odd = not . even | [
"not :: Bool -> Bool",
"(.) :: (b -> c) -> (a -> b) -> a -> c",
"even :: Integral a => a -> Bool"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--(^) | Ad-hoc | (^) :: (Num a, Integral b) => a -> b -> a | x ^ y | y < zero = error "negative"
| y == zero = one
| otherwise = powImpl x y | [
"(<) :: Ord a => a -> a -> Bool",
"(==) :: Eq a => a -> a -> Bool",
"powImpl :: (Num a, Integral b) => a -> b -> a",
"zero :: Num a => a",
"one :: Num a => a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--(^^) | Ad-hoc | (^^) :: (Fractional a, Integral b) => a -> b -> a | x ^^ n = if n >= 0 then x^n else recip (x^(negate n)) | [
"(>=) :: Ord a => a -> a -> Bool",
"(^) :: (Num a, Integral b) => a -> b -> a",
"recip :: Fractional a => a -> a",
"negate :: Num a => a -> a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--fromIntegral | Ad-hoc | fromIntegral :: (Integral a, Num b) => a -> b | fromIntegral = fromInteger . toInteger | [
"fromInteger :: Num a => Integer -> a",
"toInteger :: Integral a => a -> Integer",
"(.) :: (b -> c) -> (a -> b) -> a -> c"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--realToFrac | Ad-hoc | realToFrac :: (Real a, Fractional b) => a -> b | realToFrac = fromRational . toRational | [
"fromRational :: Fractional a => Rational -> a",
"toRational :: Real a => a -> Rational",
"(.) :: (b -> c) -> (a -> b) -> a -> c"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Base.hs--mempty | Ad-hoc | mempty :: Monoid a => a | mempty = mconcat [] | [
"mconcat :: Monoid a => [a] -> a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Base.hs--(<$) | Ad-hoc | (<$) :: Functor f => a -> f b -> f a | (<$) = fmap . const | [
"fmap :: Functor f => (a -> b) -> f a -> f b",
"const :: a -> b -> a",
"(.) :: (b -> c) -> (a -> b) -> a -> c"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Base.hs--(<*>)-(,) | Parametric | (<*>) :: (a, (a -> b)) -> (a0, a) -> (a0, b) | (u, f) <*> (v, x) = (u <> v, f x) | [
"(<>) :: Semigroup a => a -> a -> a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Base.hs--(<*>) | Ad-hoc | (<*>) :: Applicative f => f (a -> b) -> f a -> f b | (<*>) = liftA2 id | [
"id :: a -> a",
"liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Num.hs--signum-Int | Monomorphic | signum :: Int -> Int | signum n | n `ltInt` zero = negate one
| n `eqInt` zero = zero
| otherwise = one | [
"negate :: Num a => a -> a",
"ltInt :: Int -> Int -> Bool",
"eqInt :: Int -> Int -> Bool",
"zero :: Int",
"one :: Int"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Base.hs--(<*) | Ad-hoc | (<*) :: Applicative f => f a -> f b -> f a | (<*) = liftA2 const | [
"liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c",
"const :: a -> b -> a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Base.hs--(*>)-[] | Parametric | (*>) :: [a] -> [b] -> [b] | xs *> ys = [y | _ <- xs, y <- ys] | [] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Base.hs--(*>) | Ad-hoc | (*>) :: Applicative f => f a -> f b -> f b | a1 *> a2 = (id <$ a1) <*> a2 | [
"id :: a -> a",
"(<$) :: Functor f => a -> f b -> f a",
"(<*>) :: Applicative f => f (a -> b) -> f a -> f b"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/List.hs--reverse | Parametric | reverse :: [a] -> [a] | reverse = foldl (flip (:)) [] | [
"foldl :: (b -> a -> b) -> b -> [a] -> b",
"flip :: (a -> b -> c) -> b -> a -> c"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/List.hs--(!!) | Parametric | (!!) :: [a] -> Int -> a | xs !! n | n < zero = error "negative index"
[] !! _ = error "too large"
(x:_) !! zero = x
(_:xs) !! n = xs !! (n-one) | [
"(<) :: Ord a => a -> a -> Bool",
"(-) :: Num a => a -> a -> a",
"zero :: Int",
"one :: Int"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Num.hs--fromInteger-Int | Monomorphic | fromInteger :: Integer -> Int | fromInteger i = I_ (integerToInt_ i) | [
"integerToInt_ :: Integer -> Int_",
"data Int = I_ Int_"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--toRational-Int | Monomorphic | toRational :: Int -> Rational | toRational x = toInteger x :% one | [
"toInteger :: Int -> Integer",
"one :: Integer",
"data Ratio a = !a :% !a",
"type Rational = Ratio Integer"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--toRational-Integer | Monomorphic | toRational :: Integer -> Rational | toRational x = x :% one | [
"one :: Integer",
"data Ratio a = !a :% !a",
"type Rational = Ratio Integer"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--toRational-Natural | Monomorphic | toRational :: Natural -> Rational | toRational n = integerFromNatural n :% one | [
"integerFromNatural :: Natural -> Integer",
"one :: Integer",
"data Ratio a = !a :% !a",
"type Rational = Ratio Integer"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--quot | Ad-hoc | quot :: Integral a => a -> a -> a | n `quot` d = fst (quotRem n d) | [
"fst :: (a, b) -> a",
"quotRem :: Integral => a -> a -> (a, a)"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Data/Tuple.hs--fst | Parametric | fst :: (a,b) -> a | fst (x,_) = x | [] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--rem | Ad-hoc | rem :: Integral a => a -> a -> a | n `rem` d = snd (quotRem n d) | [
"snd :: (a, b) -> b",
"quotRem :: Integral a => a -> a -> (a, a)"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--div | Ad-hoc | div :: Integral a => a -> a -> a | n `div` d = fst (divMod n d) | [
"fst :: (a, b) -> a",
"divMod :: Integral a => a -> a -> (a, a)"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--mod | Ad-hoc | mod :: Integral a => a -> a -> a | n `mod` d = snd (divMod n d) | [
"snd :: (a, b) -> b",
"divMod :: Integral a => a -> a -> (a, a)"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--quotRem-Int | Monomorphic | quotRem :: Int -> Int -> (Int, Int) | quotRem a b = quotRemInt a b | [
"quotRemInt :: Int -> Int -> (Int, Int)"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--divMod | Ad-hoc | divMod :: Integral a => a -> a -> (a,a) | divMod n d = if signum r == negate (signum d) then (q-1, r+d) else qr
where qr@(q,r) = quotRem n d | [
"quotRem :: Integral a => a -> a -> (a, a)",
"negate :: Num a => a -> a",
"(+) :: Num a => a -> a -> a",
"(-) :: Num a => a -> a -> a",
"signum :: Num a => a -> a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--toInteger--Natural | Monomorphic | toInteger :: Natural -> Integer | toInteger x = integerFromNatural x | [
"integerFromNatural :: Natural -> Integer"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--recip | Ad-hoc | recip :: Fractional a => a -> a | recip x = one / x | [
"(/) :: Fractional a => a -> a -> a",
"one :: Fractional a => a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--fromRational | Ad-hoc | fromRational :: Fractional a => Rational -> a | fromRational (x:%y) = fromInteger x % fromInteger y | [
"fromInteger :: Num a => Integer -> a",
"(%) :: (Integral a) => a -> a -> Ratio a",
"data Ratio a = !a :% !a",
"type Rational = Ratio Integer"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--properFraction | Ad-hoc | properFraction :: (RealFrac a, Integral b) => a -> (b,a) | properFraction (x:%y) = (fromInteger (toInteger q), r:%y)
where (q,r) = quotRem x y | [
"quotRem :: Integral a => a -> a -> (a,a)",
"toInteger :: Integral => a -> Integer",
"fromInteger :: Integral => Integer -> a",
"data Ratio a = !a :% !a",
"type Rational = Ratio Integer"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--truncate | Ad-hoc | truncate :: (RealFrac a, Integral b) => a -> b | truncate x = fst (properFraction x) | [
"fst :: (a, b) -> a",
"properFraction :: (RealFrac a, Integral b) => a -> (b, a)"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Data/Tuple.hs--snd | Parametric | snd :: (a,b) -> b | snd (_,y) = y | [] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--round | Ad-hoc | round :: (RealFrac a, Integral b) => a -> b | round x =
let (n, r) = properFraction x
m = if r < zero then n - one else n + one
in case signum (abs r - oneHalf) of
negOne -> n
zero -> if even n then n else m
one -> m
_ -> error "Bad value" | [
"properFraction :: (RealFrac a, Integral b) => a -> (b, a)",
"abs :: Num a => a -> a",
"(+) :: Num a => a -> a -> a",
"(-) :: Num a => a -> a -> a",
"signum :: Num a => a -> a",
"even :: Integral a => a -> Bool",
"(<) :: Ord a => a -> a -> Bool",
"oneHalf :: Fractional a => a",
"zero :: Num a => a",
"one :: Num a => a",
"negOne :: Num a => a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--ceiling | Ad-hoc | ceiling :: (RealFrac a, Integral b) => a -> b | ceiling x = if r > zero then n + one else n
where (n,r) = properFraction x | [
"properFraction :: (RealFrac a, Integral b) => a -> (b, a)",
"(+) :: Num a => a -> a -> a",
"(>) :: Ord a => a -> a -> Bool",
"zero :: Num a => a",
"one :: Num a => a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Real.hs--floor | Ad-hoc | floor :: (RealFrac a, Integral b) => a -> b | floor x = if r < zero then n - one else n
where (n,r) = properFraction x | [
"properFraction :: (RealFrac a, Integral b) => a -> (b, a)",
"(-) :: Num a => a -> a -> a",
"(<) :: Ord a => a -> a -> Bool",
"zero :: Num a => a",
"one :: Num a => a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--floatRadix-Float | Monomorphic | floatRadix :: Float -> Integer | floatRadix x = flt_radix | [
"flt_radix :: Integer",
"x :: Float"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--floatDigits-Float | Monomorphic | floatDigits :: Float -> Int | floatDigits x = dbl_mant_dig | [
"dbl_mant_dig :: Int",
"x :: Float"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--floatRange-Float | Monomorphic | floatRange :: Float -> (Int,Int) | floatRange x = (dbl_min_exp, dbl_max_exp) | [
"dbl_min_exp :: Int",
"dbl_min_exp :: Int",
"x :: Float"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--decodeFloat-Float | Monomorphic | decodeFloat :: Float -> (Integer, Int) | decodeFloat (F f) = case decodeFloat_Int_ f_ of
(i, e) -> (IS i, I e) | [
"data Float = F_ Float_",
"decodeFloat_Int_ :: Float_ -> (Int_, Int_)",
"data Integer = IS Int_",
"data Int = I_ Int_"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--decodeFloat-Double | Monomorphic | decodeFloat :: Double -> (Integer, Int) | decodeFloat (D_ x_) = case integerDecodeDouble_ x_ of
(i, j) -> (i, I_ j) | [
"data Double = D_ Double_",
"integerDecodeDouble_ :: Double_ -> (Integer, Int_)",
"data Int = I_ Int_"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--encodeFloat-Float | Monomorphic | encodeFloat :: Integer -> Int -> Float | encodeFloat i (I_ e) = F_ (integerEncodeFloat_ i e) | [
"data Int = I_ Int_",
"data Float = F_ Float_",
"integerEncodeFloat_ :: Integer -> Int_ -> Float_"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--encodeFloat-Double | Monomorphic | encodeFloat :: Integer -> Int -> Double | encodeFloat i (I_ j) = D_ (integerEncodeDouble_ i j) | [
"data Double = D_ Double_",
"integerEncodeDouble_ :: Integer -> Int_ -> Double_",
"data Int = I_ Int_"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--exponent | Ad-hoc | exponent :: RealFloat a => a -> Int | exponent x = if m == zero then zero else n + floatDigit
where (m,n) = decodeFloat x | [
"decodeFloat :: RealFloat a => a -> (Integer, Int)",
"floatDigits :: RealFloat a => a -> Int",
"(+) :: Num a => a -> a -> a",
"(==) :: Eq a => a -> a -> Bool",
"zero :: Num a => a"
] |
data/repos/ghc-internal-9.1001.0/src/GHC/Internal/Float.hs--significand | Ad-hoc | significand :: RealFloat a => a -> a | significand x = encodeFloat m (negate (floatDigits x))
where (m,_) = decodeFloat x | [
"encodeFloat :: RealFloat a => Integer -> Int -> a",
"decodeFloat :: RealFloat a => a -> (Integer, Int)",
"floatDigits :: RealFloat a => a -> Int",
"negate :: Num a => a -> a"
] |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 8