All Downloads are FREE. Search and download functionalities are using the official Maven repository.

parsley.internal.deepembedding.singletons.SequenceEmbedding.scala Maven / Gradle / Ivy

There is a newer version: 5.0.0-M6
Show newest version
/* SPDX-FileCopyrightText: © 2022 Parsley Contributors 
 * SPDX-License-Identifier: BSD-3-Clause
 */
package parsley.internal.deepembedding.singletons

import parsley.internal.machine.instructions

// Core Embedding
private [parsley] final class Pure[A](private [Pure] val x: A) extends Singleton[A] {
    // $COVERAGE-OFF$
    override def pretty: String = s"pure($x)"
    // $COVERAGE-ON$
    override def instr: instructions.Instr = new instructions.Push(x)
}

private [parsley] final class Fresh[A](x: =>A) extends Singleton[A] {
    // $COVERAGE-OFF$
    override def pretty: String = s"fresh($x)"
    // $COVERAGE-ON$
    override def instr: instructions.Instr = new instructions.Fresh(x)
}

private [deepembedding] object Pure {
    def unapply[A](self: Pure[A]): Some[A] = Some(self.x)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy