Re: debuggin types in records

"Daniel C. Wang" <[email protected]> Sat, 27 Jan 2007 12:16:38 -0800
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
I learned this trick while writing proofs in Twelf. :) another variation 
is to declare some local holes with known type..

ie
val hole1 : type1 = hole()
then use hole1 to fill in places which you think should be of type1 and 
see if the type checker complains.
http://www.cs.washington.edu/homes/djg/publications.html
Dan Grossman has a nice paper that automates this general idea to 
improve error reporting.


brian wrote:
> ignore that last post.
>
> The key is to make the assignment field=hole(), not field=hole
>
> works great - clever trick.
>
> Thanks !
>
> Brian
>
> On Jan 25, 2007, at 10:29 PM, Daniel C. Wang wrote:
>
>> My favorite type-debugging  trick is the following
>>
>> fun hole () = raise (Fail  "place holder")
>> than I start replacing expressions with hole() until the type error 
>> goes away. Once, I find the expression that makes the problem go away 
>> I at least know what to blame.
>>
>> brian wrote:
>>> I ran across the rather self-explanatory error
>>>
>>>    operator domain: XEventTypes.key_xevtinfo
>>>    operand:         {child:word, event:word, event_pt:Geometry.point,
>>>                      keycode:int, mbut_state:XProtTypes.mbutton_state,
>>>                      mod_state:XProtTypes.modkey_state, root:word,
>>>                      root_pt:Geometry.point, same_screen:bool,
>>>                      time:Word32.word}
>>>
>>> The problem is that I _think_ the error is due to the fact that 
>>> I've  got the type of one of the entries wrong.  Naturally I think 
>>> I've got  it right, and clearly I am wrong  :-)
>>>
>>> Is there some way to turn up some debugging flags so I would know  
>>> which one ?
>>>
>>> Any good stratgey for figuring this out ?
>>>
>>>
>
>


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV