module Hoogle.DataBase.TypeSearch.All(
createTypeSearch, TypeSearch,
searchTypeSearch, TypeScore
) where
import Hoogle.DataBase.TypeSearch.Graphs
import Hoogle.DataBase.TypeSearch.TypeScore
import Hoogle.DataBase.Instances
import Hoogle.DataBase.Aliases
import Hoogle.Store.All
import Hoogle.Type.All
import Hoogle.Score.All
newtype TypeSearch = TypeSearch Graphs
instance Show TypeSearch where
show (TypeSearch x) = show x
instance Store TypeSearch where
put (TypeSearch x) = put x
get = get1 TypeSearch
createTypeSearch :: Aliases -> Instances -> [(TypeSig, Once Entry)] -> TypeSearch
createTypeSearch aliases instances xs = TypeSearch $ newGraphs aliases instances xs
searchTypeSearch :: Aliases -> Instances -> TypeSearch -> TypeSig -> [(Once Entry,[EntryView],Score)]
searchTypeSearch as is (TypeSearch g) t =
[(a, b, typeScore $ costsTypeScore c) | (a,b,c) <- graphsSearch as is g t]