File: Element.hs

package info (click to toggle)
haskell-foundation 0.0.30-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 932 kB
  • sloc: haskell: 9,124; ansic: 570; makefile: 7
file content (42 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (4)
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
31
32
33
34
35
36
37
38
39
40
41
42
-- |
-- Module      : Foundation.Array.Element
-- License     : BSD-style
-- Maintainer  : Vincent Hanquez <vincent@snarc.org>
-- Stability   : experimental
-- Portability : portable
--

{-# LANGUAGE CPP #-}

module Foundation.Collection.Element
    ( Element
    ) where

import Basement.Compat.Base
import Basement.Block (Block)
import Basement.UArray (UArray)
import Basement.BoxedArray (Array)
import Basement.String (String)
import Basement.Types.AsciiString (AsciiString)
import Basement.Types.Char7 (Char7)
import Basement.NonEmpty

#if MIN_VERSION_base(4,9,0)
import Basement.Sized.Block (BlockN)
import Basement.Sized.List  (ListN)
#endif

-- | Element type of a collection
type family Element container
type instance Element [a] = a
type instance Element (Block ty) = ty
type instance Element (UArray ty) = ty
type instance Element (Array ty) = ty
type instance Element String = Char
type instance Element AsciiString = Char7
type instance Element (NonEmpty a) = Element a

#if MIN_VERSION_base(4,9,0)
type instance Element (BlockN n ty) = ty
type instance Element (ListN n a) = a
#endif