Skip to content

Commit 894e8f9

Browse files
Add toRep (#238)
* Add toRep * Update type variable names to match class names * Rename toRep to repOf
1 parent b8e3453 commit 894e8f9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Data/Generic/Rep.purs

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module Data.Generic.Rep
22
( class Generic
33
, to
44
, from
5+
, repOf
56
, NoConstructors
67
, NoArguments(..)
78
, Sum(..)
@@ -10,6 +11,8 @@ module Data.Generic.Rep
1011
, Argument(..)
1112
) where
1213

14+
import Type.Proxy (Proxy(..))
15+
1316
-- | A representation for types with no constructors.
1417
data NoConstructors
1518

@@ -34,3 +37,6 @@ newtype Argument a = Argument a
3437
class Generic a rep | a -> rep where
3538
to :: rep -> a
3639
from :: a -> rep
40+
41+
repOf :: forall a rep. Generic a rep => Proxy a -> Proxy rep
42+
repOf _ = Proxy

0 commit comments

Comments
 (0)