Hoogle Search
Within LTS Haskell 24.58 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
isPrefixOf :: JSString -> JSString -> Booljsaddle Data.JSString O(n) The isPrefixOf function takes two JSStrings and returns True iff the first is a prefix of the second. Subject to fusion.
isSuffixOf :: JSString -> JSString -> Booljsaddle Data.JSString O(n) The isSuffixOf function takes two JSStrings and returns True iff the first is a suffix of the second.
stripPrefix :: JSString -> JSString -> Maybe JSStringjsaddle Data.JSString O(n) Return the suffix of the second string if its prefix matches the entire first string. Examples:
stripPrefix "foo" "foobar" == Just "bar" stripPrefix "" "baz" == Just "baz" stripPrefix "foo" "quux" == Nothing
This is particularly useful with the ViewPatterns extension to GHC, as follows:{-# LANGUAGE ViewPatterns #-} import Data.Text as T fnordLength :: JSString -> Int fnordLength (stripPrefix "fnord" -> Just suf) = T.length suf fnordLength _ = -1stripSuffix :: JSString -> JSString -> Maybe JSStringjsaddle Data.JSString O(n) Return the prefix of the second string if its suffix matches the entire first string. Examples:
stripSuffix "bar" "foobar" == Just "foo" stripSuffix "" "baz" == Just "baz" stripSuffix "foo" "quux" == Nothing
This is particularly useful with the ViewPatterns extension to GHC, as follows:{-# LANGUAGE ViewPatterns #-} import Data.Text as T quuxLength :: Text -> Int quuxLength (stripSuffix "quux" -> Just pre) = T.length pre quuxLength _ = -1isPrefixOf :: Eq a => Stream a -> Stream a -> Booljsaddle Data.JSString.Internal.Fusion.Common O(n) The isPrefixOf function takes two Streams and returns True if and only if the first is a prefix of the second. Properties
isPrefixOf (stream t1) (stream t2) = isPrefixOf t1 t2
-
numeric-prelude Algebra.FloatingPoint No documentation available.
fixFraction :: (C a, Ord a) => a -> anumeric-prelude Algebra.RealRing No documentation available.
fixSplitFraction :: (C a, C b, Ord a) => (b, a) -> (b, a)numeric-prelude Algebra.RealRing No documentation available.
-
Routines and abstractions for Matrices and basic linear algebra over fields or rings. We stick to simple Int indices. Although advanced indices would be nice e.g. for matrices with sub-matrices, this is not easily implemented since arrays do only support a lower and an upper bound but no additional parameters. ToDo: - Matrix inverse, determinant (see htam:Matrix)
-
Fixed point numbers. They are implemented as ratios with fixed denominator. Many routines fail for some arguments. When they work, they can be useful for obtaining approximations of some constants. We have not paid attention to rounding errors and thus some of the trailing digits may be wrong.