From 9944420ab92a30a2ecfb24122fb71fee37a050f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Jano=C5=A1=C3=ADk?= <5196749+zlondrej@users.noreply.github.com> Date: Tue, 5 Nov 2024 23:40:18 +0100 Subject: [PATCH] Make `for` more generic (#15) --- scrive-prelude.cabal | 2 +- src/Prelude.hs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scrive-prelude.cabal b/scrive-prelude.cabal index 7a3c3de..51545d9 100644 --- a/scrive-prelude.cabal +++ b/scrive-prelude.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: scrive-prelude -version: 1.0.3.0 +version: 1.0.3.1 author: Scrive AB maintainer: Scrive AB copyright: 2021 diff --git a/src/Prelude.hs b/src/Prelude.hs index 657bd13..f7584cc 100644 --- a/src/Prelude.hs +++ b/src/Prelude.hs @@ -202,9 +202,9 @@ copy x fromThis toThat = set x (view x fromThis) toThat ---------------------------------------- --- | Just @flip map@. -for :: [a] -> (a -> b) -> [b] -for = flip map +-- | Just @flip fmap@. +for :: Functor f => f a -> (a -> b) -> f b +for = flip fmap -- | Read a value and return 'Nothing' if an error occurs during parsing. maybeRead :: Read a => Text -> Maybe a