@@ -149,6 +149,9 @@ module LAoP.Matrix.Type
149149 fromF,
150150 fromF',
151151
152+ -- * Relation
153+ toRel,
154+
152155 -- * Matrix printing
153156 pretty,
154157 prettyPrint
@@ -160,6 +163,7 @@ import Data.Proxy
160163import Data.Kind
161164import GHC.TypeLits
162165import Control.DeepSeq
166+import LAoP.Utils
163167import qualified Control.Category as C
164168import qualified LAoP.Matrix.Internal as I
165169
@@ -341,6 +345,19 @@ fromF' ::
341345 Matrix e a b
342346fromF' = M . I.fromF'
343347
348+-- | Lifts relation functions to Boolean Matrix
349+toRel ::
350+ ( Bounded a,
351+ Bounded b,
352+ Enum a,
353+ Enum b,
354+ Eq b,
355+ KnownNat (I.Count (I.Normalize a)),
356+ KnownNat (I.Count (I.Normalize b)),
357+ I.FromLists (Natural 0 1) (I.Normalize b) (I.Normalize a)
358+ ) => (a -> b -> Bool) -> Matrix (Natural 0 1) a b
359+toRel = M . I.toRel
360+
344361-- Conversion
345362
346363-- | Converts a matrix to a list of lists of elements.