File: Bare.hs

package info (click to toggle)
haskell-barbies 2.0.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 460 kB
  • sloc: haskell: 5,483; makefile: 3
file content (30 lines) | stat: -rw-r--r-- 843 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{-# LANGUAGE AllowAmbiguousTypes #-}
module Spec.Bare ( laws )

where

import Barbies.Bare (BareB(..), Covered)
import Data.Functor.Identity

import Data.Typeable (Typeable, typeRep, Proxy(..))

import Test.Tasty(testGroup, TestTree)
import Test.Tasty.QuickCheck(Arbitrary(..), testProperty, (===))

laws
  :: forall b
  . ( BareB b
    , Eq (b Covered Identity) , Show (b Covered Identity) , Arbitrary (b Covered Identity)
    -- , Show (b Bare Identity), Eq (b Bare Identity), Arbitrary (b Bare Identity)
    , Typeable b
    )
  => TestTree
laws
  = testGroup (show (typeRep (Proxy :: Proxy b)))
      [ testProperty "bcover . bstrip = id" $ \b ->
          bcover (bstrip b) === (b :: b Covered Identity)

      -- TODO: FIXME
      -- , testProperty "bstrip . bcover = id" $ \b ->
      --     bstrip (bcover b) === (b :: b Bare)
      ]