geojson-4.0.4: A thin GeoJSON Layer above the aeson library
Copyright(C) 2014-2019 HS-GeoJSON Project
LicenseBSD-style (see the file LICENSE.md)
MaintainerAndrew Newman
Safe HaskellNone
LanguageHaskell2010

Data.LineString

Description

Refer to the GeoJSON Spec http://geojson.org/geojson-spec.html#linestring

A LinearString is a List with at least 2 elements

Synopsis

Type

data LineString a Source #

a LineString has at least 2 elements

Instances

Instances details
Functor LineString Source # 
Instance details

Defined in Data.LineString

Methods

fmap :: (a -> b) -> LineString a -> LineString b #

(<$) :: a -> LineString b -> LineString a #

Foldable LineString Source #

This will run through the line string.

Instance details

Defined in Data.LineString

Methods

fold :: Monoid m => LineString m -> m #

foldMap :: Monoid m => (a -> m) -> LineString a -> m #

foldMap' :: Monoid m => (a -> m) -> LineString a -> m #

foldr :: (a -> b -> b) -> b -> LineString a -> b #

foldr' :: (a -> b -> b) -> b -> LineString a -> b #

foldl :: (b -> a -> b) -> b -> LineString a -> b #

foldl' :: (b -> a -> b) -> b -> LineString a -> b #

foldr1 :: (a -> a -> a) -> LineString a -> a #

foldl1 :: (a -> a -> a) -> LineString a -> a #

toList :: LineString a -> [a] #

null :: LineString a -> Bool #

length :: LineString a -> Int #

elem :: Eq a => a -> LineString a -> Bool #

maximum :: Ord a => LineString a -> a #

minimum :: Ord a => LineString a -> a #

sum :: Num a => LineString a -> a #

product :: Num a => LineString a -> a #

Traversable LineString Source # 
Instance details

Defined in Data.LineString

Methods

traverse :: Applicative f => (a -> f b) -> LineString a -> f (LineString b) #

sequenceA :: Applicative f => LineString (f a) -> f (LineString a) #

mapM :: Monad m => (a -> m b) -> LineString a -> m (LineString b) #

sequence :: Monad m => LineString (m a) -> m (LineString a) #

Eq a => Eq (LineString a) Source # 
Instance details

Defined in Data.LineString

Methods

(==) :: LineString a -> LineString a -> Bool #

(/=) :: LineString a -> LineString a -> Bool #

Show a => Show (LineString a) Source # 
Instance details

Defined in Data.LineString

Generic (LineString a) Source # 
Instance details

Defined in Data.LineString

Associated Types

type Rep (LineString a) :: Type -> Type #

Methods

from :: LineString a -> Rep (LineString a) x #

to :: Rep (LineString a) x -> LineString a #

ToJSON a => ToJSON (LineString a) Source # 
Instance details

Defined in Data.LineString

(FromJSON a, Show a) => FromJSON (LineString a) Source # 
Instance details

Defined in Data.LineString

NFData a => NFData (LineString a) Source # 
Instance details

Defined in Data.LineString

Methods

rnf :: LineString a -> () #

type Rep (LineString a) Source # 
Instance details

Defined in Data.LineString

data ListToLineStringError Source #

When converting a List to a LineString, here is a list of things that can go wrong:

  • The list was empty
  • The list only had one element

Constructors

ListEmpty 
SingletonList 

data SequenceToLineStringError Source #

When converting a Sequence to a LineString, here is a list of things that can go wrong:

  • The sequence was empty
  • The sequence only had one element

Functions

toSeq :: LineString a -> Seq a Source #

create a sequence from a LineString. LineString 1 2 [3,4] --> Sequence [1,2,3,4]

combineToSeq :: (a -> a -> b) -> LineString a -> Seq b Source #

create a sequence from a LineString by combining values. LineString 1 2 3,4 --> Sequence [(1,2),(2,3),(3,4)]

fromSeq :: Validate v => Seq a -> v SequenceToLineStringError (LineString a) Source #

creates a LineString out of a sequence of elements, if there are enough elements (needs at least 2) elements

fromLineString :: LineString a -> [a] Source #

This function converts it into a list and appends the given element to the end.

fromList :: Validate v => [a] -> v ListToLineStringError (LineString a) Source #

creates a LineString out of a list of elements, if there are enough elements (needs at least 2) elements

makeLineString Source #

Arguments

:: a

The first element

-> a

The second element

-> Seq a

The rest of the optional elements

-> LineString a 

Creates a LineString makeLineString x y zs creates a LineString homomorphic to the list [x, y] ++ zs

lineStringHead :: LineString a -> a Source #

returns the element at the head of the string

lineStringLast :: LineString a -> a Source #

returns the last element in the string

lineStringLength :: LineString a -> Int Source #

returns the number of elements in the list, including the replicated element at the end of the list.