-- related to https://stackoverflow.com/questions/66370965/polymorphic-input-function-with-multiple-argument-types/66371082?noredirect=1#comment117368103_66371082
{-# LANGUAGE RankNTypes #-}
foo fn =
let
val1 = fn "hey"
val2 = fn 42
in
val1 <> val2
-- main.hs:3:22: error:
-- * Couldn't match type `a' with `String'
-- `a' is a rigid type variable bound by
-- a type expected by the context:
-- forall a. Show a => a -> String
-- at main.hs:3:18-23
-- Expected type: a -> String
-- Actual type: String -> String
-- * In the first argument of `foo', namely `id'
-- In the first argument of `putStrLn', namely `(foo id)'
-- In the expression: putStrLn (foo id)
-- |
--3 | main = putStrLn (foo id)
-- | ^^
--compiler exit status 1