hoogle 4.2.35 → 4.2.36
raw patch · 7 files changed
+72/−64 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.txt +2/−0
- README.md +1/−1
- hoogle.cabal +2/−2
- src/General/FMIndex.hs +60/−60
- src/General/Web.hs +1/−0
- src/Hoogle/Language/Haskell.hs +5/−1
- src/Web/Server.hs +1/−0
CHANGES.txt view
@@ -1,5 +1,7 @@ Changelog for Hoogle +4.2.36+ #85, add support for missing type constructors 4.2.35 Allow haskell-src-exts-1.16 4.2.34
README.md view
@@ -1,4 +1,4 @@-# Hoogle [](https://travis-ci.org/ndmitchell/hoogle)+# Hoogle [](http://hackage.haskell.org/package/hoogle) [](https://travis-ci.org/ndmitchell/hoogle) Hoogle is a Haskell API search engine, which allows you to search many standard Haskell libraries by either function name, or by approximate type signature. To experiment, visit the online version at http://haskell.org/hoogle.
hoogle.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.10 build-type: Simple name: hoogle-version: 4.2.35+version: 4.2.36 license: BSD3 license-file: docs/LICENSE category: Development@@ -15,7 +15,7 @@ or by approximate type signature. homepage: http://www.haskell.org/hoogle/ bug-reports: https://github.com/ndmitchell/hoogle/issues-tested-with: GHC==7.8.2, GHC==7.6.3, GHC==7.4.2+tested-with: GHC==7.8.2, GHC==7.6.3 extra-source-files: README.md CHANGES.txt
src/General/FMIndex.hs view
@@ -1,60 +1,60 @@- -module General.FMIndex( - FMIndex, - create, fromHandle, - extract, - Find(..), count, locate - ) where - -import qualified Data.ByteString as BS -import qualified Data.ByteString.Lazy as LBS -import Data.Binary -import Control.Applicative -import Control.Arrow -import System.IO - - -data FMIndex a = FMIndex Char [(BS.ByteString, a)] deriving Show - -{- -data FMIndex a = FMIndex - {specialChar :: Char -- Character used to separate words, and which there are associations for - ,positions :: V.Vector Word32 -- if positions[c] = n, that means there are n substrings that are less than c - ,associated :: V.Vector a -- values associated with each specialChar - ,rankAll :: V.Vector Word32 -- ranks, stored every 1024 entries, where rankAll[(n*256)/1024 + c] = rank of c at character n - ,contents :: BS.ByteString - } --} - -instance Functor FMIndex where - fmap f (FMIndex a b) = FMIndex a $ map (second f) b - -instance Binary a => Binary (FMIndex a) where - put (FMIndex a b) = put a >> put b - get = FMIndex <$> get <*> get - --- assign these indicies to this information -create :: Char -> [(BS.ByteString, a)] -> FMIndex a -create = FMIndex - -extract :: FMIndex a -> [(BS.ByteString, a)] -extract (FMIndex _ x) = x - -data Find = Exact | Prefix | Suffix | Infix - -count :: FMIndex a -> Find -> BS.ByteString -> Int -count idx mode x = length $ locate idx mode x - - -locate :: FMIndex a -> Find -> BS.ByteString -> [(a, Int)] -- The int is how many characters you are along this string -locate (FMIndex _ xs) mode x = [(i, p) | (a,i) <- xs, Just p <- [op a]] - where - op = case mode of - Exact -> \a -> if x == a then Just 0 else Nothing - Prefix -> \a -> if x `BS.isPrefixOf` a then Just 0 else Nothing - Suffix -> \a -> if x `BS.isSuffixOf` a then Just $ BS.length a - BS.length x else Nothing - Infix -> \a -> let (y,z) = BS.breakSubstring x a in if BS.null z then Nothing else Just $ BS.length y - - -fromHandle :: Binary a => Handle -> IO (FMIndex a) -fromHandle = fmap decode . LBS.hGetContents ++module General.FMIndex(+ FMIndex,+ create, fromHandle,+ extract,+ Find(..), count, locate+ ) where++import qualified Data.ByteString as BS+import qualified Data.ByteString.Lazy as LBS+import Data.Binary+import Control.Applicative+import Control.Arrow+import System.IO+++data FMIndex a = FMIndex Char [(BS.ByteString, a)] deriving Show++{-+data FMIndex a = FMIndex+ {specialChar :: Char -- Character used to separate words, and which there are associations for+ ,positions :: V.Vector Word32 -- if positions[c] = n, that means there are n substrings that are less than c+ ,associated :: V.Vector a -- values associated with each specialChar+ ,rankAll :: V.Vector Word32 -- ranks, stored every 1024 entries, where rankAll[(n*256)/1024 + c] = rank of c at character n+ ,contents :: BS.ByteString+ }+-}++instance Functor FMIndex where+ fmap f (FMIndex a b) = FMIndex a $ map (second f) b++instance Binary a => Binary (FMIndex a) where+ put (FMIndex a b) = put a >> put b+ get = FMIndex <$> get <*> get++-- assign these indicies to this information+create :: Char -> [(BS.ByteString, a)] -> FMIndex a+create = FMIndex++extract :: FMIndex a -> [(BS.ByteString, a)]+extract (FMIndex _ x) = x++data Find = Exact | Prefix | Suffix | Infix++count :: FMIndex a -> Find -> BS.ByteString -> Int+count idx mode x = length $ locate idx mode x+++locate :: FMIndex a -> Find -> BS.ByteString -> [(a, Int)] -- The int is how many characters you are along this string+locate (FMIndex _ xs) mode x = [(i, p) | (a,i) <- xs, Just p <- [op a]]+ where+ op = case mode of+ Exact -> \a -> if x == a then Just 0 else Nothing+ Prefix -> \a -> if x `BS.isPrefixOf` a then Just 0 else Nothing+ Suffix -> \a -> if x `BS.isSuffixOf` a then Just $ BS.length a - BS.length x else Nothing+ Infix -> \a -> let (y,z) = BS.breakSubstring x a in if BS.null z then Nothing else Just $ BS.length y+++fromHandle :: Binary a => Handle -> IO (FMIndex a)+fromHandle = fmap decode . LBS.hGetContents
src/General/Web.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE PatternGuards #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} -- becomes confusing with all the CPP {- | General web utility functions.
src/Hoogle/Language/Haskell.hs view
@@ -208,7 +208,11 @@ transType (TyParen _ x) = transType x transType (TyInfix _ y1 x y2) = TApp (TLit $ unbracket $ prettyPrint x) [transType y1, transType y2] transType (TyKind _ x _) = transType x-+transType (TyPromoted _ _) = TLit "promoted"+transType (TyParArray _ x) = TApp (TLit "[::]") [transType x]+transType (TyEquals _ x y) = TApp (TLit "~") [transType x, transType y]+transType (TySplice _ _) = TLit "splice"+transType (TyBang _ _ x) = transType x transContext :: Maybe (Context S) -> Constraint transContext = maybe [] g
src/Web/Server.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE RecordWildCards, ScopedTypeVariables, PatternGuards, CPP #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} -- becomes confusing with all the CPP module Web.Server(server) where