Skip to content

Overlapping Instances #10

@kirel

Description

@kirel

I have built a very minimal example where I am having trouble with overlapping instances using exportIO. I'm probably doing something dumb so sorry if my error is obvious.

minimal/minimal.hs:14:13:
    Overlapping instances for FFI.Anything.TypeUncurry.DataKinds.ToTypeList
                                (IO ()) '[] (IO ())
      arising from a use of ‘exportIO’
    Matching instances:
      instance (FFI.Anything.TypeUncurry.DataKinds.Param f ~ '[],
                FFI.Anything.TypeUncurry.DataKinds.Result f ~ r, f ~ r) =>
               FFI.Anything.TypeUncurry.DataKinds.ToTypeList f '[] r
        -- Defined in ‘FFI.Anything.TypeUncurry.DataKinds’
      instance FFI.Anything.TypeUncurry.DataKinds.ToTypeList
                 (IO r) '[] (IO r)
        -- Defined in ‘FFI.Anything.TypeUncurry.DataKinds’
    In the expression: exportIO io
    In an equation for ‘io_export’: io_export = exportIO io

minimal.hs

{-# LANGUAGE ForeignFunctionInterface #-}

module Minimal where

import Foreign.C
import FFI.Anything.TypeUncurry.Msgpack

io :: IO ()
io = do
  return ()

foreign export ccall io_export :: CString -> IO CString
io_export :: CString -> IO CString
io_export = exportIO io

from .cabal file

executable minimal.so
  default-language:    Haskell2010
  hs-source-dirs: minimal
  main-is: minimal.hs
  build-depends:
    base ==4.8.2.0
    , call-haskell-from-anything ==1.0.0.0
  ghc-options:
    -no-hs-main -O2 -fPIC -shared -dynamic
  extra-libraries:
    HSrts-ghc7.10.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions