horde-ad icon indicating copy to clipboard operation
horde-ad copied to clipboard

Generalize HordeAd.External.Adaptor from [a] to Traversable a and also to MonoTraversable

Open Mikolaj opened this issue 2 years ago • 0 comments

This would need to be changed a lot, because for definition

instance (AdaptableDomains a, Traversable t)
         => AdaptableDomains (t a) where
  type Scalar (t a) = Scalar a
  toDomains l = unefined  -- use unzip x = (fmap fst x, fmap snd x), etc.
  fromDomains lInit source =
    let f = swap . flip fromDomains
    in swap $ mapAccumL f source lInit

I'm getting errors like

src/HordeAd/External/Adaptor.hs:237:8: error:
    Conflicting family instance declarations:
      Scalar (t a) = Scalar a
        -- Defined at src/HordeAd/External/Adaptor.hs:237:8
      Scalar (a, b, c) = Scalar a
        -- Defined at src/HordeAd/External/Adaptor.hs:271:8
    |
237 |   type Scalar (t a) = Scalar a
    |        ^^^^^^

src/HordeAd/External/Adaptor.hs:245:8: error:
    Conflicting family instance declarations:
      Value (t a) = t (Value a)
        -- Defined at src/HordeAd/External/Adaptor.hs:245:8
      Value (a, b) = (Value a, Value b)
        -- Defined at src/HordeAd/External/Adaptor.hs:312:8
    |
245 |   type Value (t a) = t (Value a)
    |        ^^^^^

Mikolaj avatar Nov 21 '22 22:11 Mikolaj