length -package:vector -package:memory package:rio

O(1) length returns the length of a ByteString as an Int.
O(c) length returns the length of a ByteString as an Int64
Returns the size/length of a finite structure as an Int. The default implementation just counts elements starting with the leftmost. Instances for structures that can compute the element count faster than via element-by-element counting, should provide a specialised implementation.

Examples

Basic usage:
>>> length []
0
>>> length ['a', 'b', 'c']
3

>>> length [1..]
* Hangs forever *
Number of elements in NonEmpty list.
The number of elements in the sequence.
O(n) Returns the number of characters in a Text.
O(n) Returns the number of characters in a Text.
The genericLength function is an overloaded version of length. In particular, instead of returning an Int, it returns any type which is an instance of Num. It is, however, less efficient than length.

Examples

>>> genericLength [1, 2, 3] :: Int
3

>>> genericLength [1, 2, 3] :: Float
3.0
Users should take care to pick a return type that is wide enough to contain the full length of the list. If the width is insufficient, the overflow behaviour will depend on the (+) implementation in the selected Num instance. The following example overflows because the actual list length of 200 lies outside of the Int8 range of -128..127.
>>> genericLength [1..200] :: Int8
-56
Returns the size/length of a finite structure as an Int.

Examples

Basic usage:
>>> bilength (True, 42)
2
>>> bilength (Right 42)
1
>>> bilength (BiList [1,2,3] [4,5])
5
>>> bilength (BiList [] [])
0
On infinite structures, this function hangs:
> bilength (BiList [1..] [])
* Hangs forever *
O(min(n,c)) Compare the count of characters in a Text to a number.
compareLength t c = compare (length t) c
This function gives the same answer as comparing against the result of length, but can short circuit if the count of characters is greater than the number, and hence be more efficient.
O(min(n,c)) Compare the count of characters in a Text to a number.
compareLength t c = compare (length t) c
This function gives the same answer as comparing against the result of length, but can short circuit if the count of characters is greater than the number, and hence be more efficient.
The number of days in a given month according to the proleptic Gregorian calendar.
The number of days in this period.