1-- |
2-- Module      : Basement.Compat.IsList
3-- License     : BSD-style
4-- Maintainer  : Vincent Hanquez <vincent@snarc.org>
5-- Stability   : experimental
6-- Portability : portable
7--
8-- compat friendly version of IsList
9{-# LANGUAGE TypeFamilies #-}
10{-# LANGUAGE CPP #-}
11module Basement.Compat.IsList
12    ( IsList(..)
13    ) where
14
15#if MIN_VERSION_base(4,7,0)
16
17import           GHC.Exts
18
19#else
20
21import qualified Prelude
22
23class IsList l where
24  type Item l
25  fromList  :: [Item l] -> l
26  toList    :: l -> [Item l]
27
28  fromListN :: Prelude.Int -> [Item l] -> l
29  fromListN _ = fromList
30
31instance IsList [a] where
32    type Item [a] = a
33    fromList = Prelude.id
34    toList   = Prelude.id
35
36#endif
37