Skip to content

Instantly share code, notes, and snippets.

@JakobBruenker
Last active December 19, 2019 12:43
Show Gist options
  • Save JakobBruenker/69f99a23138169a6221d06b5028167f8 to your computer and use it in GitHub Desktop.
Save JakobBruenker/69f99a23138169a6221d06b5028167f8 to your computer and use it in GitHub Desktop.
How.hs:24:13: error:
• Could not deduce (Storable t0)
from the context: Storable t
bound by the type signature for:
method :: forall t. Storable t => Int
at How.hs:24:13-44
The type variable ‘t0’ is ambiguous
• When checking that instance signature for ‘method’
is more general than its signature in the class
Instance sig: forall t. Storable t => Int
Class sig: forall t. Storable t => Int
In the instance declaration for ‘Class String’
|
24 | method :: forall t . Storable t => Int t
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.
{-# LANGUAGE NoStarIsType #-}
{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
import Foreign.Storable
class Class where
method :: forall t . Storable t => Int
instance Class where
method :: forall t . Storable t => Int
method = sizeOf $ (undefined :: t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment