# How to use RequiredTypeArguments with typeclasse methods?

**URL:** <https://discourse.haskell.org/t/how-to-use-requiredtypearguments-with-typeclasse-methods/12187>\
**Category:** Uncategorized\
**Created:** [May 28, 2025, 11:18am UTC](https://discourse.haskell.org/t/how-to-use-requiredtypearguments-with-typeclasse-methods/12187 "2025-05-28T11:18:17Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![jaror](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/jaror/32/3271_2.png) [@jaror](https://discourse.haskell.org/u/jaror)\
**Post date:** [May 28, 2025, 11:31am UTC](https://discourse.haskell.org/t/how-to-use-requiredtypearguments-with-typeclasse-methods/12187/3 "2025-05-28T11:31:22Z")

</div>

The recommended way, currently, is just to use a separate function:

```haskell
{-# LANGUAGE RequiredTypeArguments, AllowAmbiguousTypes #-}

import Data.Kind (Type)

class Storable (a :: Type) where
  _sizeOf :: Int
  
instance Storable Int where
  _sizeOf = 8

sizeOf :: forall a -> Storable a => Int
sizeOf a = _sizeOf @a

```

Source: [https://github.com/ghc-proposals/ghc-proposals/pull/267#issuecomment-528449235](https://github.com/ghc-proposals/ghc-proposals/pull/267#issuecomment-528449235)

---

_[View the full topic](https://discourse.haskell.org/t/how-to-use-requiredtypearguments-with-typeclasse-methods/12187)._
