{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, TypeFamilies #-} {-# OPTIONS -fno-warn-orphans #-} -- | 'Data.ListLike.ListLike' instances for 'Data.FMList.FMList' module Data.ListLike.FMList () where import Prelude hiding (cycle, map) import Data.ListLike.Base import Data.ListLike.FoldableLL --import Data.ListLike.IO import Data.ListLike.String import Data.FMList (FMList(..)) import qualified Data.FMList as FM --import Data.Foldable (Foldable) import qualified Data.Foldable as F --import Data.Traversable (Traversable) --import qualified Data.Traversable as T import Data.String (IsString) import qualified Data.String as S import Control.Monad.Zip (MonadZip) import qualified Control.Monad.Zip as Z --import Data.Function import GHC.Exts (IsList(..)) instance FoldableLL (FMList a) a where foldl :: forall a. (a -> a -> a) -> a -> FMList a -> a foldl = (a -> a -> a) -> a -> FMList a -> a forall (t :: * -> *) b a. Foldable t => (b -> a -> b) -> b -> t a -> b F.foldl foldr :: forall b. (a -> b -> b) -> b -> FMList a -> b foldr = (a -> b -> b) -> b -> FMList a -> b forall (t :: * -> *) a b. Foldable t => (a -> b -> b) -> b -> t a -> b F.foldr foldl1 :: (a -> a -> a) -> FMList a -> a foldl1 = (a -> a -> a) -> FMList a -> a forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a F.foldl1 foldr1 :: (a -> a -> a) -> FMList a -> a foldr1 = (a -> a -> a) -> FMList a -> a forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a F.foldr1 foldl' :: forall a. (a -> a -> a) -> a -> FMList a -> a foldl' = (a -> a -> a) -> a -> FMList a -> a forall (t :: * -> *) b a. Foldable t => (b -> a -> b) -> b -> t a -> b F.foldl' foldr' :: forall b. (a -> b -> b) -> b -> FMList a -> b foldr' = (a -> b -> b) -> b -> FMList a -> b forall (t :: * -> *) a b. Foldable t => (a -> b -> b) -> b -> t a -> b F.foldr' instance IsList (FMList a) where type Item (FMList a) = a fromList :: [Item (FMList a)] -> FMList a fromList = [Item (FMList a)] -> FMList a forall a. [a] -> FMList a FM.fromList toList :: FMList a -> [Item (FMList a)] toList = FMList a -> [Item (FMList a)] forall (t :: * -> *) a. Foldable t => t a -> [a] FM.toList instance ListLike (FMList a) a where empty :: FMList a empty = FMList a forall (f :: * -> *) a. Alternative f => f a FM.empty singleton :: a -> FMList a singleton = a -> FMList a forall a. a -> FMList a FM.singleton cons :: a -> FMList a -> FMList a cons = a -> FMList a -> FMList a forall a. a -> FMList a -> FMList a FM.cons snoc :: FMList a -> a -> FMList a snoc = FMList a -> a -> FMList a forall a. FMList a -> a -> FMList a FM.snoc append :: FMList a -> FMList a -> FMList a append = FMList a -> FMList a -> FMList a forall a. FMList a -> FMList a -> FMList a FM.append head :: FMList a -> a head = FMList a -> a forall a. FMList a -> a FM.head tail :: FMList a -> FMList a tail = FMList a -> FMList a forall a. FMList a -> FMList a FM.tail last :: FMList a -> a last = FMList a -> a forall a. FMList a -> a FM.last init :: FMList a -> FMList a init = FMList a -> FMList a forall a. FMList a -> FMList a FM.init --fromList = FM.fromList --toList = FM.toList null :: FMList a -> Bool null = FMList a -> Bool forall a. FMList a -> Bool FM.null genericLength :: forall a. Num a => FMList a -> a genericLength = FMList a -> a forall b a. Num b => FMList a -> b FM.genericLength length :: FMList a -> Int length = FMList a -> Int forall a. FMList a -> Int FM.length reverse :: FMList a -> FMList a reverse = FMList a -> FMList a forall a. FMList a -> FMList a FM.reverse filter :: (a -> Bool) -> FMList a -> FMList a filter = (a -> Bool) -> FMList a -> FMList a forall a. (a -> Bool) -> FMList a -> FMList a FM.filter take :: Int -> FMList a -> FMList a take = Int -> FMList a -> FMList a forall n a. (Ord n, Num n) => n -> FMList a -> FMList a FM.take takeWhile :: (a -> Bool) -> FMList a -> FMList a takeWhile = (a -> Bool) -> FMList a -> FMList a forall a. (a -> Bool) -> FMList a -> FMList a FM.takeWhile drop :: Int -> FMList a -> FMList a drop = Int -> FMList a -> FMList a forall n a. (Ord n, Num n) => n -> FMList a -> FMList a FM.drop dropWhile :: (a -> Bool) -> FMList a -> FMList a dropWhile = (a -> Bool) -> FMList a -> FMList a forall a. (a -> Bool) -> FMList a -> FMList a FM.dropWhile instance InfiniteListLike (FMList a) a where iterate :: (a -> a) -> a -> FMList a iterate = (a -> a) -> a -> FMList a forall a. (a -> a) -> a -> FMList a FM.iterate repeat :: a -> FMList a repeat = a -> FMList a forall a. a -> FMList a FM.repeat cycle :: FMList a -> FMList a cycle FMList a a = (FMList a a FMList a -> FMList a -> FMList a forall a. FMList a -> FMList a -> FMList a `FM.append` FMList a -> FMList a forall full item. InfiniteListLike full item => full -> full cycle FMList a a) FMList a -> FMList a -> FMList a forall a. FMList a -> FMList a -> FMList a `FM.append` FMList a a instance IsString (FMList Char) where fromString :: String -> FMList Char fromString = String -> FMList Char forall a. [a] -> FMList a FM.fromList instance StringLike (FMList Char) where toString :: FMList Char -> String toString = FMList Char -> String forall (t :: * -> *) a. Foldable t => t a -> [a] FM.toList lines :: forall full. ListLike full (FMList Char) => FMList Char -> full lines = (String -> FMList Char) -> [String] -> full forall full item full' item'. (ListLike full item, ListLike full' item') => (item -> item') -> full -> full' map String -> FMList Char forall a. [a] -> FMList a FM.fromList ([String] -> full) -> (FMList Char -> [String]) -> FMList Char -> full forall b c a. (b -> c) -> (a -> b) -> a -> c . String -> [String] S.lines (String -> [String]) -> (FMList Char -> String) -> FMList Char -> [String] forall b c a. (b -> c) -> (a -> b) -> a -> c . FMList Char -> String forall (t :: * -> *) a. Foldable t => t a -> [a] FM.toList words :: forall full. ListLike full (FMList Char) => FMList Char -> full words = (String -> FMList Char) -> [String] -> full forall full item full' item'. (ListLike full item, ListLike full' item') => (item -> item') -> full -> full' map String -> FMList Char forall a. [a] -> FMList a FM.fromList ([String] -> full) -> (FMList Char -> [String]) -> FMList Char -> full forall b c a. (b -> c) -> (a -> b) -> a -> c . String -> [String] S.words (String -> [String]) -> (FMList Char -> String) -> FMList Char -> [String] forall b c a. (b -> c) -> (a -> b) -> a -> c . FMList Char -> String forall (t :: * -> *) a. Foldable t => t a -> [a] FM.toList unlines :: forall full. ListLike full (FMList Char) => full -> FMList Char unlines = String -> FMList Char forall a. [a] -> FMList a FM.fromList (String -> FMList Char) -> (full -> String) -> full -> FMList Char forall b c a. (b -> c) -> (a -> b) -> a -> c . [String] -> String S.unlines ([String] -> String) -> (full -> [String]) -> full -> String forall b c a. (b -> c) -> (a -> b) -> a -> c . (FMList Char -> String) -> full -> [String] forall full item full' item'. (ListLike full item, ListLike full' item') => (item -> item') -> full -> full' map FMList Char -> String forall (t :: * -> *) a. Foldable t => t a -> [a] FM.toList unwords :: forall full. ListLike full (FMList Char) => full -> FMList Char unwords = String -> FMList Char forall a. [a] -> FMList a FM.fromList (String -> FMList Char) -> (full -> String) -> full -> FMList Char forall b c a. (b -> c) -> (a -> b) -> a -> c . [String] -> String S.unwords ([String] -> String) -> (full -> [String]) -> full -> String forall b c a. (b -> c) -> (a -> b) -> a -> c . (FMList Char -> String) -> full -> [String] forall full item full' item'. (ListLike full item, ListLike full' item') => (item -> item') -> full -> full' map FMList Char -> String forall (t :: * -> *) a. Foldable t => t a -> [a] FM.toList instance MonadZip FMList where mzipWith :: forall a b c. (a -> b -> c) -> FMList a -> FMList b -> FMList c mzipWith = (a -> b -> c) -> FMList a -> FMList b -> FMList c forall a b c. (a -> b -> c) -> FMList a -> FMList b -> FMList c FM.zipWith