haskpy.types.monoids.String

String

class String(string)[source]

Bases: Monoid, Hashable

String monoid

__add__(other)

Append two monoids

Using + operator to append two monoid values seems natural because that’s what Python is doing by default because lists are concatenated with +.

__annotations__ = {}
__eq__(other)[source]

Mark method non-existing

This is a workaround for Python forcefully creating some methods. One cannot create objects that don’t have __eq__, __ge__, __gt__ and many other methods. They are there and it’s not possible to delete them. With this wrapper you can override those methods so that they won’t show up in __dir__ listing and if accessed in any way, AttributeError is raised. Note that it just hides the methods, one can still access them as object.__getattribute__(obj, "__eq__").

__hash__()[source]

Mark method non-existing

This is a workaround for Python forcefully creating some methods. One cannot create objects that don’t have __eq__, __ge__, __gt__ and many other methods. They are there and it’s not possible to delete them. With this wrapper you can override those methods so that they won’t show up in __dir__ listing and if accessed in any way, AttributeError is raised. Note that it just hides the methods, one can still access them as object.__getattribute__(obj, "__eq__").

__ne__(other)

Inequality comparison: Eq a => a -> a -> bool

Can be used as != operator.

The default implementation uses __eq__.

append(s)[source]

m -> m -> m

empty = String('')[source]