simpler question

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE TypeFamilies #-}

data RequestFunctions req resp = RequestFunctions
  { genRequest :: req -> Int
  , parseResponse :: Int -> resp
  }

class Request a where
  type Parameters a
  f :: RequestFunctions (Parameters a) a

discogs :: Request a => Parameters a -> a
discogs params = parseResponse f req
  where
    req :: Int
    req = genRequest f params