Skip to content

Tactics plugin cannot derive program under certain constraints and bindings #563

Closed
@siraben

Description

@siraben

Consider

-- succeeds
join_ :: Monad m => m (m a) -> m a
join_ = _

The tactics plugin produces the solution (\ x -> (>>=) x (\ x11 -> x11)). However, now consider

-- fails
fJoin :: (Monad m, Monad f) => f (m (m a)) -> f (m a)
fJoin = fmap _

The type of _ is still m (m a) -> m a (with Monad constraint on m), but the tactics plugin fails to find the solution. I tried moving it into a let binding but it still fails.

-- fails
fJoin :: (Monad m, Monad f) => f (m (m a)) -> f (m a)
fJoin = let f = _ in fmap f

However if we generalize the constraint on f to Functor, the tactics plugin succeeds;

-- succeeds
fJoin :: (Monad m, Functor f) => f (m (m a)) -> f (m a)
fJoin = fmap _

Is solved with _ = (\ x -> (>>=) x (\ x11 -> x11)). However moving it into a let binding again causes a failure!

-- fails
fJoin :: (Monad m, Functor f) => f (m (m a)) -> f (m a)
fJoin = let f = _ in fmap f

This has been tested as of commit 6c14163.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions