Tuesday, September 13, 2011

debug-diff: Colorized diffs between Haskell values

Today I uploaded a small library for comparing Haskell values using a textual diff. This has served me well when diagnosing failing tests, or comparing a function with a proposed replacement.

Let's try it on some disassembled x86 code:

$ ghci
λ> :m + Hdis86 Debug.Diff Data.ByteString 
λ> let f = disassemble amd64 . pack 
λ> diff (f [0x31,0xff,0x41,0x5e,0x48,0x89,0xc7]) 
        (f [0x31,0xff,0x41,0x5c,0x48,0x89,0xc7])
--- /tmp/ddiff_x15061   2011-09-13 22:52:13.911842969 -0400 
+++ /tmp/ddiff_y15061   2011-09-13 22:52:13.911842969 -0400 
@@ -1,3 +1,3 @@
 [Inst [] Ixor [Reg (Reg32 RDI), Reg (Reg32 RDI)],
- Inst [Rex] Ipop [Reg (Reg64 R14)], 
+ Inst [Rex] Ipop [Reg (Reg64 R12)], 
  Inst [Rex] Imov [Reg (Reg64 RDI), Reg (Reg64 RAX)]]

This uses groom as a pretty-printer, and shells out to colordiff by default.

Sadly, a textual diff does not always produce usable results. I'm also interested in generic diffs for algebraic data types. There are some packages for this (1, 2) but I haven't yet learned how to use them. This could also be a good application for the new generics support in GHC 7.2.

17 comments:

  1. You know a lot about web developing. Thanks for sharing your experience with us. Nice job!

    ReplyDelete
  2. very interesting, good job and thanks for sharing such a good blog. Seo Services Delhi

    ReplyDelete
  3. I read this post your post so nice and very informative post thanks for sharing this post. Youtube Mp3 Converter

    ReplyDelete
  4. Everybody loves it when individuals get together and share sees. Incredible blog, keep it up!unblocked tamilrockers

    ReplyDelete

  5. يعتبر ستوديو الفهد للتصوير النسائي من أفضل الاستديوهات للتصوير بالأخص لحفلات الأعراس. تعمل
    مصورات من النساء على تقديم صور في غاية الحرفية والمهنية بالإضافة إلى فيديوهات إبداعية. يشمل هذا الإستديو كل أنواع التصوير من ديكورات داخلية وصور زفاف بالإضافة إلى جلسات تصويرية وتصوير شخصي وعائلي إلى جانب تصوير الأطفال داخل الإستديو.
    إذا كنت تبحثين عن استديو احترافي في مجال التصوير، إليك استديو الفهد الذي يقدّم أفضل الخدمات مع الأخذ بعين الإعتبار خصوصية المرأة. يعمل فريق كامل من النساء المتخصصات في فن التصوير من أجل تخليد أجمل المناسبات السعيدة واللقطات الخاصة. يقدّّم هذا الإستديو صوراً فردية وجماعية لمختلف أنواع المناسبات إلى جانب تصوير الفيديوهات
    إليك استديو الفهد للتصوير النسائي الذي يقدّم كل أنواع التصوير النسائي لمختلف المناسبات من تصوير شخصي وتصوير حفلات تخرج وتصوير مواليد وغيرها من أنواع الصور. يتميّز هذا الإستديو بالجودة العالية في الصور إلى جانب السرعة في التسليم.

    استديو تصوير نسائي
    المناسبات السعيدة هي تلك اللحظات التي نلتقطها من هذه الحياة التي نحياها ، تلك اللحظات التي تبقى محفورة في ذاكرتنا مهما طالت الأيام ، و هناك العديد من الطرق التي يمكن الاعتماد عليها في تنسيق الحفلات ، و لكن يفضل الاعتماد على شركات متخصصة في هذا الأمر ، و هناك العديد من شركات كوش افراح الرياض و لعل افضلهم و اشهرهم على الاطلاق شركة الفهد :
    الشركة توفر العديد من الخدمات المختلفة التي تتعلق باعياد الميلاد العملاء ، هذا بالإضافة إلى توفير مختلف أنواع الديكورات الخاصة بهذه الحفلات ،.
    كوفي يسوي عيد ميلاد بالرياض
    الشركة توفر العديد من الخدمات المختلفة التي تتعلق بتنسيق الحفلات ، حيث تعمل الشركة على توفير قاعات مختلفة بمساحات متنوعة ، لإقامة مختلف أنواع الحفلات التي يحتاجها العملاء ، هذا بالإضافة إلى توفير مختلف أنواع الديكورات الخاصة بهذه الحفلات ، و من بينها كوش الأفراح ، هذا فضلا عن توفير دي جي و تغليف هدايا و غيرها ،.
    و هذه الشركة أيضا تعتبر واحدة من أشهر الشركات المتخصصة في تجهيز الحفلات و المناسبات و الأعراس ،و حفلات التخرج حيث تعمل الشركة على توفير مختلف الأماكن الخاصة بإقامة الحفلات ، و التي يمكن الاعتماد عليها في مختلف المناسبات الخاصة بالعملاء ، هذا بالإضافة إلى إمكانية تأجير لوازم الأفراح من قبل الشركة ، كذلك توفر الشركة أيضا مختلف الديكورات المعتمد عليها في المناسبات ، و التي تشمل كوش الأفراح و أشكال البلالين و غيرها العديد من الأفكار المختلفة ، مع توفير قائمة عريضة بأشكال الورود و أشكال الهدايا المقدمة للضيوف.
    كوش افراح الرياض

    ReplyDelete
  6. Gutt Websäit : Zonahobisaya
    Gutt Websäit : Zonahobisaya
    Gutt Websäit : Sinopsis Film
    Gutt Websäit : Zonahobisaya
    Gutt Websäit : Zonahobisaya
    Gutt Websäit : Zonahobisaya
    Gutt Websäit : Zonahobisaya
    Gutt Websäit : One Piece

    ReplyDelete
  7. This weblog gives useful facts to us, keep it up.

    ReplyDelete
  8. What’s up to every one, the contents existing at this web page are truly remarkable

    ReplyDelete
  9. for people knowledge, well, keep up the good work fellows.

    ReplyDelete
  10. Thanks for sharing your info. I truly appreciate your efforts

    ReplyDelete
  11. iAutomation Training Hub'' is leading Industrial Automation Training and automation recruitment provider. We provide training in PLC Programming, Automation Training, HMI Programming and Training, SCADA Training.

    Address: 1st Floor, Vishal Arcade Building, Opposite Roopam Cloth Center, Khed taluka, Maharashtra 410501

    For Details: Contact: 091306 34757
    IoT, Robotics are very hot topics nowadays, particularly in the manufacturing sector. Companies who are making use of cutting-edge technology to make their product world-class and affordable to the customer with value for money is going to be the market leader in respective sectors. Industrial Automation plays a very important role in our life w.r.t the product and services that we use in our day-to-day life.

    We at ‘iAutomation Training Hub’ has come up with a list of the top 10 Industrial Automation Companies in India

    Table of Contents

    General Electric or GE
    Rockwell Automation
    Siemens India Ltd.
    Honeywell Automation India Ltd.
    ABB India Ltd.
    L&T(Larsen and Toubro)
    B&R Industrial Automation Private Ltd.
    Schneider Electric
    Mitsubishi Electric
    https://www.iautomationtraininghub.com/industrial-automation-training-chakan-pune

    ReplyDelete