Skip to content

Conversation

hdgarrood
Copy link
Contributor

This seemed to be the most appropriate place I could think of for it. I also added some tests for ZipList.

Also add tests for ZipList.
-- | Transpose any structure which is both `Foldable` and `Unfoldable`,
-- | via `ZipList`; note that `sequence` for `ZipList` is the same as
-- | `transpose`.
transpose :: forall f a. (Foldable f, Unfoldable f) => f (f a) -> f (f a)
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 these overloaded functions have their place, but I'd prefer to expose a List version too, since we're going via that function anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about this, but what about name collisions? There's always straight sequence if you want to avoid all the other stuff, eg for performance.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just concerned that a beginner won't know to use sequence, and may not understand the more general type signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already have generalized type signatures for all kinds of things, though? foldr, replicate, (<>), even (+) and (*).

Just so that we're on the same page - are you suggesting we put specialized versions of transpose into Data.List and Data.List.Lazy, as well as this generalized version here?

@hdgarrood
Copy link
Contributor Author

See #59 for a second attempt.

@hdgarrood hdgarrood closed this Feb 27, 2016
@hdgarrood hdgarrood deleted the transpose branch February 27, 2016 15:18
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