Skip to content

Weirdness when using fromIntegral in quosiquoter

Using idiom brackets, is this a bug?

import Control.Applicative.QQ.Idiom

c :: Int -> IO Integer
c n = [i| fromIntegral n::Integer |]

This works. Removing the type annotation:

import Control.Applicative.QQ.Idiom

c :: Int -> IO Integer
c n = [i| fromIntegral n |]
t0sj.hs:4:10-27: error: …
    • Couldn't match expected type ‘IO Integer’ with actual type ‘Int’
    • In the second argument of ‘(<*>)’, namely ‘n’
      In the expression: (((pure fromIntegral) <*> n))
      In an equation for ‘c’: c n = (((pure fromIntegral) <*> n))
Compilation failed.
Edited by Icelandjack
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information