Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion jaq-core/src/load/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use super::lex::{StrPart, Tok, Token};
use super::path::{self, Path};
use super::{ops, prec_climb};
use alloc::{boxed::Box, vec::Vec};
use core::fmt::{self, Debug};

/// Parse error, storing what we expected and what we got instead.
pub type Error<S, T = S> = (Expect<S>, T);
Expand Down Expand Up @@ -828,7 +829,7 @@ pub(crate) struct Module<S, B> {
/// def map(f): [.[] | f];
/// def recurse(f; cond): recurse(f | select(cond));
/// ~~~
#[derive(Debug)]
// TODO v3.0: Make this just a tuple?
pub struct Def<S, F = Term<S>> {
/// name, e.g. `"double"` or `"map"`
pub name: S,
Expand All @@ -838,6 +839,13 @@ pub struct Def<S, F = Term<S>> {
pub body: F,
}

// required for Haskell interop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

impl<S: Debug, F: Debug> Debug for Def<S, F> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "({:?}, {:?}, {:?})", self.name, self.args, self.body)
}
}

impl<S, F> Def<S, F> {
pub(crate) fn new(name: S, args: Vec<S>, body: F) -> Self {
Self { name, args, body }
Expand Down
Loading