module HaskellWorks.Data.MQuery.ToBool where

import qualified Data.DList as DL

class ToBool a where
  toBool :: a -> Bool

instance ToBool Bool where
  toBool :: Bool -> Bool
toBool = Bool -> Bool
forall a. a -> a
id

instance ToBool [a] where
  toBool :: [a] -> Bool
toBool (a
_:[a]
_) = Bool
True
  toBool    [a]
_  = Bool
False

instance ToBool (DL.DList a) where
  toBool :: DList a -> Bool
toBool = [a] -> Bool
forall a. ToBool a => a -> Bool
toBool ([a] -> Bool) -> (DList a -> [a]) -> DList a -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DList a -> [a]
forall a. DList a -> [a]
DL.toList