Skip to content

Instantly share code, notes, and snippets.

@Taneb
Created June 13, 2020 12:04
Show Gist options
  • Save Taneb/3515dcdf2b8d63f454f6200ae3385f5f to your computer and use it in GitHub Desktop.
Save Taneb/3515dcdf2b8d63f454f6200ae3385f5f to your computer and use it in GitHub Desktop.
{-# LANGUAGE DataKinds #-}
module GenerateStatus where
import qualified Network.HTTP.Types.Status as Status
import GHC.TypeNats
class KnownNat n => KnownStatus n where
statusVal :: proxy n -> Status.Status
instance KnownStatus 100 where
statusVal _ = Status.status100
instance KnownStatus 101 where
statusVal _ = Status.status101
instance KnownStatus 200 where
statusVal _ = Status.status200
instance KnownStatus 201 where
statusVal _ = Status.status201
instance KnownStatus 202 where
statusVal _ = Status.status202
instance KnownStatus 203 where
statusVal _ = Status.status203
instance KnownStatus 204 where
statusVal _ = Status.status204
instance KnownStatus 205 where
statusVal _ = Status.status205
instance KnownStatus 206 where
statusVal _ = Status.status206
instance KnownStatus 300 where
statusVal _ = Status.status300
instance KnownStatus 301 where
statusVal _ = Status.status301
instance KnownStatus 302 where
statusVal _ = Status.status302
instance KnownStatus 303 where
statusVal _ = Status.status303
instance KnownStatus 304 where
statusVal _ = Status.status304
instance KnownStatus 305 where
statusVal _ = Status.status305
instance KnownStatus 307 where
statusVal _ = Status.status307
instance KnownStatus 308 where
statusVal _ = Status.status308
instance KnownStatus 400 where
statusVal _ = Status.status400
instance KnownStatus 401 where
statusVal _ = Status.status401
instance KnownStatus 402 where
statusVal _ = Status.status402
instance KnownStatus 403 where
statusVal _ = Status.status403
instance KnownStatus 404 where
statusVal _ = Status.status404
instance KnownStatus 405 where
statusVal _ = Status.status405
instance KnownStatus 406 where
statusVal _ = Status.status406
instance KnownStatus 407 where
statusVal _ = Status.status407
instance KnownStatus 408 where
statusVal _ = Status.status408
instance KnownStatus 409 where
statusVal _ = Status.status409
instance KnownStatus 410 where
statusVal _ = Status.status410
instance KnownStatus 411 where
statusVal _ = Status.status411
instance KnownStatus 412 where
statusVal _ = Status.status412
instance KnownStatus 413 where
statusVal _ = Status.status413
instance KnownStatus 414 where
statusVal _ = Status.status414
instance KnownStatus 415 where
statusVal _ = Status.status415
instance KnownStatus 416 where
statusVal _ = Status.status416
instance KnownStatus 417 where
statusVal _ = Status.status417
instance KnownStatus 418 where
statusVal _ = Status.status418
instance KnownStatus 422 where
statusVal _ = Status.status422
instance KnownStatus 426 where
statusVal _ = Status.status426
instance KnownStatus 428 where
statusVal _ = Status.status428
instance KnownStatus 429 where
statusVal _ = Status.status429
instance KnownStatus 431 where
statusVal _ = Status.status431
instance KnownStatus 500 where
statusVal _ = Status.status500
instance KnownStatus 501 where
statusVal _ = Status.status501
instance KnownStatus 502 where
statusVal _ = Status.status502
instance KnownStatus 503 where
statusVal _ = Status.status503
instance KnownStatus 504 where
statusVal _ = Status.status504
instance KnownStatus 505 where
statusVal _ = Status.status505
instance KnownStatus 511 where
statusVal _ = Status.status511
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment