@@ -4,6 +4,7 @@ use super::lex::{StrPart, Tok, Token};
44use super :: path:: { self , Path } ;
55use super :: { ops, prec_climb} ;
66use alloc:: { boxed:: Box , vec:: Vec } ;
7+ use core:: fmt:: { self , Debug } ;
78
89/// Parse error, storing what we expected and what we got instead.
910pub type Error < S , T = S > = ( Expect < S > , T ) ;
@@ -828,7 +829,7 @@ pub(crate) struct Module<S, B> {
828829/// def map(f): [.[] | f];
829830/// def recurse(f; cond): recurse(f | select(cond));
830831/// ~~~
831- # [ derive ( Debug ) ]
832+ // TODO v3.0: Make this just a tuple?
832833pub struct Def < S , F = Term < S > > {
833834 /// name, e.g. `"double"` or `"map"`
834835 pub name : S ,
@@ -838,6 +839,13 @@ pub struct Def<S, F = Term<S>> {
838839 pub body : F ,
839840}
840841
842+ // required for Haskell interop
843+ impl < S : Debug , F : Debug > Debug for Def < S , F > {
844+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
845+ write ! ( f, "({:?}, {:?}, {:?})" , self . name, self . args, self . body)
846+ }
847+ }
848+
841849impl < S , F > Def < S , F > {
842850 pub ( crate ) fn new ( name : S , args : Vec < S > , body : F ) -> Self {
843851 Self { name, args, body }
0 commit comments