ParseableUnit

com.phasmidsoftware.gryphon.parse.Parseable.ParseableUnit
See theParseableUnit companion object
trait ParseableUnit extends Parseable[Unit]

A trait that provides a specific implementation of the Parseable typeclass for the Unit type.

This implementation of Parseable for Unit treats any input string as a valid parseable input and always returns Some(()), regardless of the content of the input string. Parsing inherently succeeds for this type since Unit carries no meaningful information.

This trait can be used wherever Parseable[Unit] is required to signify that parsing is always successful and does not depend on the input string.

This typeclass is defined as a trait, allowing it to be mixed into other components or implemented as an object.

Extends:

  • Parseable[Unit]: Defines the generic contract for parsing a string into a Unit value.

Methods:

  • parse(w: String): Option[Unit]: Always returns Some(()), ignoring the input string.

Use this implementation in contexts where parsing behavior is trivial and the result is guaranteed.

Attributes

Companion
object
Graph
Supertypes
trait Parseable[Unit]
class Object
trait Matchable
class Any
Known subtypes
object ParseableUnit

Members list

Value members

Concrete methods

def message: String

Returns a constant string representation of the Unit type.

Returns a constant string representation of the Unit type.

Attributes

Returns

the string "Unit"

def none: Unit

Returns a default value of type T.

Returns a default value of type T.

Attributes

Returns

the default value of type T, typically representing an "empty" or "none" state.

def parse(w: String): Try[Unit]

Ignores the given string and returns an Option containing Unit.

Ignores the given string and returns an Option containing Unit.

Value parameters

w

the input string to be parsed (ignored)

Attributes

Returns

an Option containing Unit, which is always Some(())

def regex: Regex

The regular expression used for parsing a Parseable[Unit].

The regular expression used for parsing a Parseable[Unit].

Attributes

Returns

A compiled regular expression. The result matches one or more word characters (()).