Skip to content

Commit c480aed

Browse files
authored
Fix Data.Lens.Zoom.zoom (#123)
Without the type annotation Data.Lens.Zoom.zoom yields the following error: ``` [1/1 NoInstanceFound] src/Data/Lens/Zoom.purs:22:21 22 zoom p = StateT <<< underF Focusing (under Star p) <<< runStateT ^^^^^^^^^^^^^^^ No type class instance was found for Prim.Coerce.Coercible t4 (m7 (Tuple r8 s6)) The instance head contains unknown type variables. Consider adding a type annotation. while solving type class constraint Prim.Coerce.Coercible (s6 -> t4) (s6 -> m7 (Tuple r8 s6)) while applying a function underF of type Coercible @type (t0 t1) (t0 t2) => Coercible @type (t3 t4) (t3 t5) => Newtype t1 t2 => Newtype t4 t5 => (t2 -> t1) -> (t0 t1 -> t3 t4) -> t0 t2 -> t3 t5 to argument Focusing while inferring the type of underF Focusing in value declaration zoom where s6 is a rigid type variable bound at (line 0, column 0 - line 0, column 0) r8 is a rigid type variable bound at (line 0, column 0 - line 0, column 0) m7 is a rigid type variable bound at (line 0, column 0 - line 0, column 0) t0 is an unknown type t3 is an unknown type t1 is an unknown type t2 is an unknown type t4 is an unknown type t5 is an unknown type ``` I suspect this happens because the functional dependency computing `s -> Focusing m r s` from `Star (Focusing m r) s s` in `under Star p` doesn’t propagate its result, so the compiler cannot solve the Coercible constraints implied by the Newtype constraints in `underF Focusing (under Star p)`.
1 parent 456cb1f commit c480aed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Data/Lens/Zoom.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ zoom
1919
. Optic' (Star (Focusing m r)) s a
2020
-> StateT a m r
2121
-> StateT s m r
22-
zoom p = StateT <<< underF Focusing (under Star p) <<< runStateT
22+
zoom p = StateT <<< underF Focusing (under Star p :: (a -> Focusing m r a) -> s -> Focusing m r s) <<< runStateT

0 commit comments

Comments
 (0)