Hi, I find it usefull to get fixity information from the :info command 
if it is different from the default like this:

   Prelude> :i mod . [] Num
   mod :: Integral a => a -> a -> a  -- class member  -- infixl 7

   . :: (a -> b) -> (c -> a) -> c -> b  -- infixr 9

   -- type constructor
   data [a]

   -- constructors:
   [] :: [a]
   (:) :: a -> [a] -> [a]  -- infixr 5

   -- instances:
[...]

   [] :: [a]  -- data constructor

   -- type class
   class (Eval a, Show a, Eq a) => Num a where
     (+) :: a -> a -> a  -- infixl 6
     (-) :: a -> a -> a  -- infixl 6
     (*) :: a -> a -> a  -- infixl 7
     negate :: a -> a
     abs :: a -> a
     signum :: a -> a
     fromInteger :: Integer -> a
     fromInt :: Int -> a

   -- instances:
[...]

Here is a patch (relative to version 980430) that does it. Hope you
like it:

*** hugs.c.org  Mon May 11 00:09:07 1998
--- hugs.c      Mon May 11 00:19:43 1998
***************
*** 51,56 ****
--- 51,57 ----
  static Void   local stopAnyPrinting   Args((Void));
  static Void   local showtype          Args((Void));
  static Void   local info              Args((Void));
+ static Void   local PrintSyntax       Args((Text));
  static Void   local showInst          Args((Inst));
  static Void   local describe          Args((Text));
  static Void   local listNames         Args((Void));
***************
*** 1179,1184 ****
--- 1180,1186 ----
                                          printExp(stdout,hd(cs));
                                          Printf(" :: ");
                                          printType(stdout,name(hd(cs)).type);
+                                         PrintSyntax(name(hd(cs)).text);
                                      }
                                      if (nonNull(cs))
                                          Printf("\n\n-- selectors:");
***************
*** 1252,1257 ****
--- 1254,1260 ----
                      t = ap(QUAL,pair(tl(fst(snd(t))),snd(snd(t))));
                }
                  printType(stdout,t);
+                 PrintSyntax(name(hd(ms)).text);
                  ms = tl(ms);
              } while (nonNull(ms));
          }
***************
*** 1285,1295 ****
--- 1288,1315 ----
  
          if (name(nm).primDef)
              Printf("   -- primitive");
+ 
+         PrintSyntax(t);
+ 
          Printf("\n\n");
      }
  
      if (isNull(tc) && isNull(cl) && isNull(nm)) {
          Printf("Unknown reference `%s'\n",textToStr(t));
+     }
+ }
+ 
+ static Void local PrintSyntax(t)
+ Text t; {
+     Syntax sy=syntaxOf(t);
+     if (sy != defaultSyntax(t)) {
+         Printf("  -- infix");
+         switch (assocOf(sy)) {
+            case LEFT_ASS  : Printf("l"); break;
+            case RIGHT_ASS : Printf("r"); break;
+            case NON_ASS   : break;
+         }
+         Printf(" %i",precOf(sy));
      }
  }
  


Christian Sievers

Reply via email to