Comments (5)
A simple sollution is using identity
instead of empty
like in:
import BasicPrelude hiding (empty)
import Control.Applicative (Alternative(..))
identity = mempty
It would be nice if this would be fixed in BasicPrelude itself!
from basic-prelude.
I'm quite happy with the current situation: the vast majority of packages use the term empty
to mean mempty
(bytestring, text, vector, containers, unordered-containers) and our goal is to fit the common use cases. I think Alternative
is far less often used, and certainly its empty
member even less so. I'd be happy to provide some export such as aempty = Control.Applicative.empty
. For declaring instances, the conflict doesn't cause problems:
import Control.Applicative
import BasicPrelude
import Prelude ()
data Foo a
instance Applicative Foo where
pure = undefined
(<*>) = undefined
instance Functor Foo where
fmap = undefined
instance Alternative Foo where
empty = undefined
(<|>) = undefined
from basic-prelude.
If it doesn't affect instance declaration -- I didn't know -- I totally agree with you. I think bare
would be a nice synonym for Alternatvie.empty
. The name is not used in most libraries (http://www.haskell.org/hoogle/?hoogle=bare), whereas void
for instance is already taken. Alternative
is used a lot in combination with parsers. Although most users only use Alternative.<|>
and Alternative.many
, I think it is nice to have access to it.
from basic-prelude.
I vote for aempty
, but I'm also ok with identity
from basic-prelude.
I have a hard time seeing the Right Way for us to handle this issue, so I would trust @snoyberg's intuition on this one. As I understand it, the Maybe
Monoid instance is the only thing to be concerned about. If we choose to export a synonym for Alternative.empty
, it should not be identity
, a valuable name that is way too general for Alternative to deserve.
from basic-prelude.
Related Issues (20)
- Export Arrow combinators HOT 7
- Export `printf` for `Text`
- Export `Data.Text.Encoding` HOT 4
- Export IOError in CorePrelude HOT 1
- Restrict to packages portable across GHCs?
- CorePrelude doesn't export any instances for LText and LByteString HOT 3
- Extended Kleisli combinators HOT 3
- Better exception handling HOT 8
- Export IsList HOT 2
- Lazy versions don’t export instances HOT 2
- Export Foldable and Traversable HOT 10
- Text version of error? HOT 10
- `asum` missing HOT 7
- ‘show’ is not a (visible) method of class ‘Show’ HOT 4
- Provided ``sum`` is not general enough HOT 4
- Export `for`, `for_`, `traverse_` and `sequenceA_` HOT 1
- Generalize `concat`, `concatMap` and `intercalate`? HOT 5
- Strict `minimum`, `maximum`, `minimumBy` and `maximumBy`? HOT 2
- `MonadIO` for all read*, get* and put*? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from basic-prelude.