module PPOL.Permutation
(
	toPermutationIndex
, fromPermutationIndex

	--
, fromList
, toList

	--
, PPOL.Permutation.length
)
where

import qualified Data.List  as List
import qualified Data.Array as Array
import qualified Data.Maybe as Maybe

type Permutation = Array.Array Int Int

type PermutationSize  = Int
type PermutationIndex = Int


rank :: Permutation -> PermutationIndex
rank p = 0

toPermutationIndex = rank

unrank :: PermutationIndex -> PermutationSize -> Permutation


fromPermutationIndex = unrank

fromList :: [Int] -> Maybe.Maybe Permutation
fromList xs = if List.sort xs == [1..n] then Just xs else Nothing
	where
		n = List.length xs

toList :: Permutation -> [Int]
toList = id

length :: Permutation -> Int
length = List.length 

elem :: Permutation -> Permutation -> Bool
elem p p' = True

