Giter Club home page Giter Club logo

intro's Introduction

Intro: Safe and minimal Haskell Prelude

Hackage Build Status

Intro is a modern Prelude which provides safe alternatives for most of the partial functions and follows other best practices, e.g., Text is preferred over String. For String overloading the extension 'OverloadedStrings' should be used. Container types and Monad transformers are provided.

Most important - this Prelude tries to keep things simple and minimal. This means it just reexports from base and commonly used libraries and adds only very few additional functions.

List of design decisions:

  • Keep everything at one place
  • Conservative extension over the base Prelude
  • Rely only on common additional libraries
  • Avoid writing custom functions
  • Export everything explicitly to provide a stable interface and good documentation
  • Export only total functions or provide safe alternatives (Very few exceptions like div etc.)
  • Prefer Text over String, provide ConvertString and EncodeString
  • Provide monad transformers
  • Provide container types
  • Prefer generic functions
  • Debugging functions, like 'Intro.Trustworthy.trace' and 'undefined' are available but produce compile time warnings
  • Replace error with panic
  • Compatibility with unqualified import of Control.Lens and Optics

intro's People

Contributors

minad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

intro's Issues

Should isPrefixOf come from Data.List?

Hi,

I'm currently exploring the different alternative Preludes out there using this list to guide me. I have to say that I like Intro a lot. The feature I appreciate the most is that you list all exported functions explicitly to provide usable Haddock documentation. That makes your library just so much easier to use than most of the others.

Now, my main interest pursuing other Preludes is in consistent support of Text rather than String. Intro goes a long way to wards that end. I noticed, though, that some functions like isPrefixOf are exported from Data.List by default. Personally, I've found that I use that function almost always for String operations and therefore I'd be much happier to have the version from Data.Text in scope by default. Do you have any thoughts on that issue? Do you apply some guiding principle to make these kind of choices that I am not aware of?

Best regards,
Peter

Adding eventlog trace functions for profiling.

First, thanks for writing this, it's quickly become my favorite custom Prelude.

I was wondering if you could add traceEvent, traceEventIO, traceMarker, and traceMarkerIO from Debug.Trace to Intro. You're already exporting a number of other functions from that module, and heap profiling seems like a natural extension.

Possibly with links to https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html and/or https://mpickering.github.io/eventlog2html/ in the haddocks so people can see how to use them.

intro-0.5.2.0 testsuite fails to build in Stackage Nightly

In the Stackage Nightly build:

Building test suite 'test' for intro-0.5.2.0..
[1 of 4] Compiling BaseCompat       ( test/BaseCompat.hs, dist/build/test/test-tmp/BaseCompat.o )

test/BaseCompat.hs:4:3: error:
    Conflicting exports for ‘cycle’:
       ‘module X’ exports ‘X.cycle’
         imported from ‘Intro’ at test/BaseCompat.hs:7:1-17
         (and originally defined in ‘Data.List.NonEmpty’)
       ‘module X’ exports ‘X.cycle’
         imported from ‘Prelude’ at test/BaseCompat.hs:61:1-178
         (and originally defined in ‘GHC.List’)
  |
4 |   module X
  |   ^^^^^^^^

test/BaseCompat.hs:4:3: error:
    Conflicting exports for ‘head’:
       ‘module X’ exports ‘X.head’
         imported from ‘Intro’ at test/BaseCompat.hs:7:1-17
         (and originally defined in ‘Data.List.NonEmpty’)
       ‘module X’ exports ‘X.head’
         imported from ‘Prelude’ at test/BaseCompat.hs:61:1-178
         (and originally defined in ‘GHC.List’)
  |
4 |   module X
  |   ^^^^^^^^

test/BaseCompat.hs:4:3: error:
    Conflicting exports for ‘init’:
       ‘module X’ exports ‘X.init’
         imported from ‘Intro’ at test/BaseCompat.hs:7:1-17
         (and originally defined in ‘Data.List.NonEmpty’)
       ‘module X’ exports ‘X.init’
         imported from ‘Prelude’ at test/BaseCompat.hs:61:1-178
         (and originally defined in ‘GHC.List’)
  |
4 |   module X
  |   ^^^^^^^^

test/BaseCompat.hs:4:3: error:
    Conflicting exports for ‘last’:
       ‘module X’ exports ‘X.last’
         imported from ‘Intro’ at test/BaseCompat.hs:7:1-17
         (and originally defined in ‘Data.List.NonEmpty’)
       ‘module X’ exports ‘X.last’
         imported from ‘Prelude’ at test/BaseCompat.hs:61:1-178
         (and originally defined in ‘GHC.List’)
  |
4 |   module X
  |   ^^^^^^^^

test/BaseCompat.hs:4:3: error:
    Conflicting exports for ‘tail’:
       ‘module X’ exports ‘X.tail’
         imported from ‘Intro’ at test/BaseCompat.hs:7:1-17
         (and originally defined in ‘Data.List.NonEmpty’)
       ‘module X’ exports ‘X.tail’
         imported from ‘Prelude’ at test/BaseCompat.hs:61:1-178
         (and originally defined in ‘GHC.List’)
  |
4 |   module X
  |   ^^^^^^^^

drop maximumDef etc functions

I think these functions are ill-defined. The result should always be greater or equal the default. This is not the case with the safe functions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.