‘toSample’ is not a (visible) method of class ‘ToSample’

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

‘toSample’ is not a (visible) method of class ‘ToSample’

juan.lulkin
Hey,

I'm trying to use servant-docs with a fairly simple example. Something like:

```
newtype User = User { username :: String }
  deriving (Eq, Show, Arbitrary, Generic)

instance ToJSON User

type AuthAPI = "user" :> Get '[JSON] User

instance ToSample User where
  toSample = Just g
    where g = User "john-doe"

api :: Proxy AuthAPI
api = Proxy

md :: String
md = markdown $ docs api
```

And I get 

```
.../src/AuthAPI.hs:23:3: error:
    ‘toSample’ is not a (visible) method of class ‘ToSample’
```

If it helps I'm using servant 0.8.1 and haskell2010. Any idea?

--