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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
{- ORMOLU_DISABLE -}
{-# LANGUAGE CPP #-}
-- CPP: GHC >= 7.8 for Safe Haskell
#if __GLASGOW_HASKELL__ >= 708
{-# LANGUAGE Safe #-}
#endif
-----------------------------------------------------------------------------
-- CPP: Ignore unused imports when Haddock is run
#if defined(__HADDOCK_VERSION__)
{-# OPTIONS_GHC -Wno-unused-imports #-}
#endif
-----------------------------------------------------------------------------
{-|
Module: Data.DList.DNonEmpty
Copyright: © 2017-2020 Oleg Grenrus, 2020 Sean Leather
License: BSD-3-Clause
Maintainer: sean.leather@gmail.com
Stability: stable
A __non-empty difference list__ is a difference list paired with a 'head'
element. Like the difference list, it supports \(\mathcal{O}\)(@1@)
'append' and 'snoc' operations.
This module provides the type for a non-empty difference list, 'DNonEmpty', and
a collection of supporting functions for (a) converting to and from 'NonEmpty'
and 'DList' and (b) operating efficiently on 'DNonEmpty' values. The functions
also retain the non-strict semantics of 'NonEmpty'.
-}
{- ORMOLU_ENABLE -}
module Data.DList.DNonEmpty
( -- * Non-Empty Difference List Type
DNonEmpty((:|)),
-- * Conversion
fromNonEmpty,
toNonEmpty,
toList,
fromList,
-- * Basic Functions
singleton,
cons,
snoc,
append,
head,
tail,
unfoldr,
map,
)
where
-----------------------------------------------------------------------------
import Data.DList.DNonEmpty.Internal
-- CPP: Import only for Haddock
#if defined(__HADDOCK_VERSION__)
import Data.List.NonEmpty (NonEmpty)
import Data.DList (DList)
#endif
{- ORMOLU_DISABLE -}
{-
The 'Data.DList.DNonEmpty' module exists only to export names from
'Data.DList.DNonEmpty.Internal'. Some names conflict with 'Prelude', so we hide
all imports from 'Prelude'.
-}
{- ORMOLU_ENABLE -}
import Prelude ()
|