Aelve Codesearch

grep over package repositories
Please provide a string to search for.
3+ characters are required.
Index updated 40 minutes ago

total matches: 23

ihaskell-0.10.0.2
7 matches
src/tests/IHaskell/Test/Hoogle.hs
import           IHaskell.Eval.Hoogle
-- import           Data.Text (unpack)
-- import qualified Data.Text.IO as T
preludeFmapJson :: String
preludeFmapJson = [r|
[
  {
    "url": "https://hackage.haskell.org/package/base/docs/Prelude.html#v:fmap",
    "module": {
      "url": "https://hackage.haskell.org/package/base/docs/Prelude.html",
      "name": "Prelude"
    },
    "package": {

            
src/tests/IHaskell/Test/Hoogle.hs
      "url": "https://hackage.haskell.org/package/base",
      "name": "base"
    },
    "item": "<span class=name><0>fmap</0></span> :: Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b",
    "type": "",
    "docs": ""
  }
]|]


            
src/tests/IHaskell/Test/Hoogle.hs
moduleJson = [r|
[
  {
    "url": "https://hackage.haskell.org/package/universum/docs/Universum-Functor-Fmap.html",
    "module": {},
    "package": {
      "url": "https://hackage.haskell.org/package/universum",
      "name": "universum"
    },

            
src/tests/IHaskell/Test/Hoogle.hs
      "url": "https://hackage.haskell.org/package/universum",
      "name": "universum"
    },
    "item": "<b>module</b> Universum.Functor.<span class=name><0>Fmap</0></span>",
    "type": "module",
    "docs": "This module contains useful functions to work with <a>Functor</a> type\nclass.\n"
  }
]|]


            
src/tests/IHaskell/Test/Hoogle.hs

testHoogle :: Spec
testHoogle = describe "Hoogle Search" $ do
  describe "fmap search result" $ do
    let results = parseResponse preludeFmapJson :: [HoogleResult]
    it "should find 1 results" $ do
      length results `shouldBe` 1
    let (SearchResult (HoogleResponse loc signature _docUrl)) = head results
    it "should not contain html markup" $ do
      loc       `shouldBe` "https://hackage.haskell.org/package/base/docs/Prelude.html#v:fmap"

            
src/tests/IHaskell/Test/Hoogle.hs
      length results `shouldBe` 1
    let (SearchResult (HoogleResponse loc signature _docUrl)) = head results
    it "should not contain html markup" $ do
      loc       `shouldBe` "https://hackage.haskell.org/package/base/docs/Prelude.html#v:fmap"
      signature `shouldBe` "fmap :: Functor f => (a -> b) -> f a -> f b"
  describe "module result" $ do
    let results = parseResponse moduleJson :: [HoogleResult]
    let (SearchResult (HoogleResponse _loc signature _docUrl)) = head results
    it "should not contain html markup" $ do
      signature `shouldBe` "module Universum.Functor.Fmap"

            
src/tests/IHaskell/Test/Hoogle.hs
    let results = parseResponse moduleJson :: [HoogleResult]
    let (SearchResult (HoogleResponse _loc signature _docUrl)) = head results
    it "should not contain html markup" $ do
      signature `shouldBe` "module Universum.Functor.Fmap"
    it "should be renderable" $ do
      (render Plain $ head results) `shouldStartWith` "module Universum.Functor.Fmap"
      (render HTML  $ head results) `shouldStartWith` "<span class='hoogle-head'>module</span>"

            
universum-1.6.1
5 matches
src/Universum/Functor/Fmap.hs

-- | This module contains useful functions to work with 'Functor' type class.

module Universum.Functor.Fmap
       ( map
       , (<<$>>)
       ) where

import Universum.Function ((.))
import Universum.Functor.Reexport (Functor (..))

            
src/Universum/Functor/Fmap.hs
-- >>> import Universum.Monad (Maybe (..))
-- >>> import Universum.String (toString)

{- | 'Prelude.map' generalized to 'Functor'.

>>> map not (Just True)
Just False
>>> map not [True,False,True,True]
[False,True,False,False]

-}
map :: Functor f => (a -> b) -> f a -> f b
map = fmap

-- $setup
-- >>> import Universum.Base (negate)
-- >>> import Universum.Monad (Maybe (..))


            
src/Universum/Functor/Fmap.hs
-- >>> import Universum.Base (negate)
-- >>> import Universum.Monad (Maybe (..))

-- | Alias for @fmap . fmap@. Convenient to work with two nested 'Functor's.
--
-- >>> negate <<$>> Just [1,2,3]
-- Just [-1,-2,-3]
(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
(<<$>>) = fmap . fmap

            
src/Universum/Functor/Fmap.hs
-- >>> negate <<$>> Just [1,2,3]
-- Just [-1,-2,-3]
(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
(<<$>>) = fmap . fmap
infixl 4 <<$>>

            
src/Universum/Functor.hs
-- | Convenient functions to work with 'Functor'.

module Universum.Functor
       ( module Universum.Functor.Fmap
       , module Universum.Functor.Reexport
       ) where

import Universum.Functor.Fmap
import Universum.Functor.Reexport