Commit 2c541f99 authored by Simon Peyton Jones's avatar Simon Peyton Jones Committed by Marge Bot
Browse files

Improve floated dicts in Specialise

Second fix to #21391.  It turned out that we missed calling
bringFloatedDictsIntoScope when specialising imports, which
led to the same bug as before.

I refactored to move that call to a single place, in specCalls,
so we can't forget it.

This meant making `FloatedDictBinds` into its own type, pairing
the dictionary bindings themselves with the set of their binders.
Nicer this way.
parent 1e4dcf23
Pipeline #50697 failed with stages
in 163 minutes and 40 seconds
This diff is collapsed.
module T21391a (readYamlFile) where
import Control.Monad (liftM)
import Control.Monad.Trans.Writer.Strict (tell, WriterT(..))
discard :: a -> b
discard x = discard x
data Pipe a = MkPipe a
sinkValue :: m ~ ResourceT IO => () -> Pipe (WriterT String m ())
sinkValue _ = tell' ()
tell' _ = lift' discard (tell "")
lift' rest mr = MkPipe (liftM rest mr)
{-# INLINE [1] lift' #-}
class FromYaml a where
fromYaml :: () -> a
readYamlFile :: FromYaml a => a
readYamlFile = fromYaml (discard sinkValue)
newtype ResourceT m a = ResourceT { unResourceT :: IO a }
instance Monad m => Functor (ResourceT m) where
fmap = discard
instance Monad m => Applicative (ResourceT m) where
pure = discard
(<*>) = discard
instance Monad m => Monad (ResourceT m) where
(>>=) = discard
......@@ -405,3 +405,4 @@ test('T17966', [ grep_errmsg(r'SPEC') ], compile, ['-O -ddump-spec'])
test('T19644', [ grep_errmsg(r'SPEC') ], compile, ['-O -ddump-spec'])
test('T21391', normal, compile, ['-O -dcore-lint'])
test('T21391a', normal, compile, ['-O -dcore-lint'])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment