
This will create an orphan instance but there's not much that can be done about that short of wrapping Matrix in a newtype. {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} import Opaleye import Data.Profunctor (rmap) import Data.Profunctor.Product.Default (Default, def) import Data.Matrix (Matrix) -- You have to fill this in yourself matrixFromList :: [[Double]] -> Matrix Double matrixFromList = undefined instance Default QueryRunner (Column (PGArray (PGArray PGFloat8))) (Matrix Double) where def = rmap matrixFromList def On Tue, Dec 30, 2014 at 05:01:06PM -0800, info@rotnetix.com wrote:
Would you be willing to send me an example of how I would do that please?
Thanks Riaan
On Tuesday, December 30, 2014 9:01:19 PM UTC+11, Tom Ellis wrote:
On Sun, Dec 28, 2014 at 06:59:26PM -0800, in...@rotnetix.com javascript: wrote:
I am curious as to how easy it will be for me to create a different mapping for PGArray, so that instead of (PGArray (PGArray PGFloat8)) -> [[Double]] I can do (PGArray (PGArray Float8)) -> Matrix Double. It is not a big deal to do the conversion later but if the library allows that kind of thing to be easily done it can make the code more readable.
Sure, you could do it by adding a QueryRunnerDefault instance or just a QueryRunner instance for a compound type like the FromRow instance for IIM.
Tom _______________________________________________ Haskell-Cafe mailing list Haskel...@haskell.org javascript: http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe