Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,861
    • Issues 4,861
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 454
    • Merge requests 454
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #7828
Closed
Open
Created Apr 10, 2013 by AlessandroVermeulen@trac-AlessandroVermeulen

RebindableSyntax and Arrow

When trying to add constraints to the types of the arrow primitives I get a type error. I think that doing such a thing should be possible and I've attached the code I used to test this. The errors I get when using the arrow notation for the function test are as follows:

test :: Typeable a => R a a
test = proc n -> returnA -< n
bug-arrow.hs:15:8:
    Could not deduce (Typeable c) arising from a use of `arr'
    from the context (Typeable a)
      bound by the type signature for test :: Typeable a => R a a
      at bug-arrow.hs:14:9-27
    Possible fix:
      add (Typeable c) to the context of
        a type expected by the context: (b -> c) -> R b c
        or the type signature for test :: Typeable a => R a a
    In the expression: arr
    When checking that `arr' (needed by a syntactic construct)
      has the required type: forall b1 c1. (b1 -> c1) -> R b1 c1
      arising from a proc expression at bug-arrow.hs:15:8-29
    In the expression: proc n -> returnA -< n

bug-arrow.hs:15:8:
    Could not deduce (Typeable c) arising from a use of `>>>'
    from the context (Typeable a)
      bound by the type signature for test :: Typeable a => R a a
      at bug-arrow.hs:14:9-27
    Possible fix:
      add (Typeable c) to the context of
        a type expected by the context: R a1 b -> R b c -> R a1 c
        or the type signature for test :: Typeable a => R a a
    In the expression: (>>>)
    When checking that `(>>>)' (needed by a syntactic construct)
      has the required type: forall a2 b1 c1.
                             R a2 b1 -> R b1 c1 -> R a2 c1
      arising from a proc expression at bug-arrow.hs:15:8-29
    In the expression: proc n -> returnA -< n

bug-arrow.hs:15:8:
    Could not deduce (Typeable d) arising from a use of `first'
    from the context (Typeable a)
      bound by the type signature for test :: Typeable a => R a a
      at bug-arrow.hs:14:9-27
    Possible fix:
      add (Typeable d) to the context of
        a type expected by the context: R b c -> R (b, d) (c, d)
        or the type signature for test :: Typeable a => R a a
    In the expression: first
    When checking that `first' (needed by a syntactic construct)
      has the required type: forall b1 c1 d1.
                             R b1 c1 -> R (b1, d1) (c1, d1)
      arising from a proc expression at bug-arrow.hs:15:8-29
    In the expression: proc n -> returnA -< n

When I replace the definition with the translated core code (minus type applications and scoped type variables) the code compiles:

test :: Typeable a => R a a
test =
    (>>>)
      (arr (\ (n_apd) -> n_apd))
      ((>>>)
         (arr (\ (ds_dst) -> ds_dst))
         (returnA)
         )
Trac metadata
Trac field Value
Version 7.6.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking