5

I was wondering if it is possible to match on PATCH requests in Happstack besides the fact that the Method datatype has no constructor for PATCH:

data Method
= GET | HEAD | POST | PUT | DELETE | TRACE | OPTIONS | CONNECT

However, there are situations when the need for a PATCH request might arise, for example it can be handy when using Backbone.js. It would be nice to know, if it's possible to match on different Methods than the defined ones without modifying Happstack. Also I'd like to know if there's a particular reason that the PATCH request is not supported in Happstack.

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
Jakob Runge
  • 2,287
  • 7
  • 36
  • 47
  • It looks like you have to patch HappStack, because ADTs are not C's `enum`s and don't have an integer representation. – Dmytro Sirenko May 28 '13 at 15:44
  • 2
    Haskell programs tend to ignore Postel's Law. I often like that—security and all—but having a Stringly-typed escape hatch here would be beneficial, clearly. – J. Abrahamson May 28 '13 at 15:58
  • A 'Stringly-typed escape' was what I was searching - I'll think about patchin Happstack, then. Or I'll just not use Patch requests, which would be sad semantically, but otherwise not a big drama in my case. – Jakob Runge May 28 '13 at 16:17
  • 1
    Unfortunately, the current version of Happstack does not support extension methods. That is clearly just wrong. It is fixed in the upcoming HTTP backend, but that is still a ways off. I am not opposed to fixing it in Happstack 7 if it helps you. – stepcut May 31 '13 at 15:40

1 Answers1

1

This question was showing up in the unanswered list, so let me just fill in from the comments:

Unfortunately, the current version of Happstack does not support extension methods. That is clearly just wrong. It is fixed in the upcoming HTTP backend, but that is still a ways off. I am not opposed to fixing it in Happstack 7 if it helps you. – stepcut May 31 at 15:40

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108