Skip to content

Conversation

@garyb
Copy link
Member

@garyb garyb commented Oct 8, 2016

No description provided.

@garyb
Copy link
Member Author

garyb commented Oct 8, 2016

Oh, actually, there was the newtype iso thing that we could include here too, right?


instance distributiveCostar :: Distributive f => Distributive (Costar f a) where
distribute f = Costar \g -> map ((_ $ g) <<< unCostar) f
distribute f = Costar \a -> map (\(Costar g) -> g a) f
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the Distributive constraint on f here?

@paf31
Copy link
Contributor

paf31 commented Oct 8, 2016

Looks good. Yes, having something like

mapNewtype :: forall new old p. (Newtype new old, Profunctor p) => p old old -> p new new

would be good, but we can leave it for a minor release if you like.

wrapIso :: forall t a p. (Newtype t a, Profunctor p) => p t t -> p a a
wrapIso = dimap wrap unwrap

unwrapIso :: forall t a p. (Newtype t a, Profunctor p) => p a a -> p t t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we need a a -> t argument here to make type inference work in some cases?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good point, probably. I was going to ask though - do we need both versions here? I know you can turn a profunctor iso lens around, but you need to bring lenses in for that, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both are potentially useful, right? Actually, are these the wrong way around?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if you think the names should make sense... ahem.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On that note, are these names any good anyway?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think they're good.

@garyb garyb merged commit e1eb0e0 into master Oct 8, 2016
@garyb garyb deleted the bump branch October 8, 2016 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants