Hello, Im back and in need of help.
I have created a function with the intent of outputting an array of tuples of a key and an object. However whenever I try to use any properties from the object I get an error stating that No type class instance was found for Data.Monoid.Monoid MediaRSSKey
or No type class instance was found for Data.Monoid.Monoid Screenfeed
. I understand that the objects are not monoids but I dont understand why it is required for them to be one in the first place. Below I will include the problem function, a similar function that works as well as some object definitions. I could really use some help on this. Let me know if you need more because I have been working on this for nearly 3 days now and Im at the end of my patience and will take any assistance.
Problem function
getInnerZoneMedias β· Edict β CatArray (Tuple MediaRSSKey Screenfeed)
getInnerZoneMedias (Edict {playlists}) =
flip foldMap playlists \(Playlist {key, media}) β
flip foldMap media \(MuMedia (MediaMeta { particular })) β
(on symContentDesigner (\(ContentDesigner {zones}) β
flip foldMap zones \(Zone {media}) β
CatArray.fromArray (flip map media \(MuMedia (MediaMeta { particular })) β
(on symScreenfeed (\(Screenfeed x) β
Tuple x.rssKey (Screenfeed x)
)
$ (\_ β mempty)) particular β ERROR APPEARING HERE
)
)
$ (\_ β mempty)) particular
Working Function:
getZoneMedias β· Edict β CatArray (Tuple PlaylistKey (CatArray MuMedia))
getZoneMedias (Edict {playlists}) =
flip foldMap playlists \(Playlist {key, media}) β
flip foldMap media \(MuMedia (MediaMeta { particular })) β
(on symContentDesigner (\(ContentDesigner {zones}) β
CatA.fromArray (flip map zones \(Zone z) β Tuple z.key (CatA.fromArray z.media))
)
$ (\_ β mempty)) particular
Zone and Screenfeed defs:
newtype Screenfeed = Screenfeed
{ rssKey β· MediaRSSKey
, playAll β· Boolean
, expireDays β· Days
, hideAnimation β· Boolean
, hideDescription β· Boolean
, hideTitle β· Boolean
, lineColour β· String
, backgroundColour β· String
, descriptionColour β· String
, titleColour β· String
, font β· String
, overlayStyleId β· Int
}
--
derive instance newtypeScreenfeed β· Newtype Screenfeed _
derive instance genericScreenfeed β· Generic Screenfeed _
derive newtype instance eqScreenfeed β· Eq Screenfeed
derive instance ordScreenfeed β· Ord Screenfeed
instance showScreenfeed β· Show Screenfeed where
show = genericShow
--
symScreenfeed β· SProxy "screenfeed"
symScreenfeed = SProxy
newtype Zone media =
Zone
{ key β· PlaylistKey
, media β· Array media
, randomise β· Boolean
, timelineMeta β· Maybe PlaylistTimelineMeta
}
--
derive instance newtypeZone β· Newtype (Zone media) _
derive instance zoneGeneric β· Generic (Zone media) _
instance zoneShow β· Show media β Show (Zone media) where
show = genericShow
--
derive newtype instance zoneEq β· Eq media β Eq (Zone media)
derive instance eq1Zone β· Eq1 Zone
-- | access to the media property
_media β· β a b. Lens (Zone a) (Zone b) (Array a) (Array b)
_media = _Newtype <<< prop (SProxyβ·_"media")