proj-oot-ootLibrariesNotes12

http://shellhaters.org/

---

if malloc rounds up the space it allocates for you, then there should be a way to find out the actual amount of space that it gave you so that you can make use of it

---

https://www.haiku-os.org/legacy-docs/bebook/

---

https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/docs.md

---

https://betterdev.blog/minimal-safe-bash-script-template/ https://news.ycombinator.com/item?id=25429899

-- SNES raytracing custom chip

https://www.shironekolabs.com/posts/superrt/

---

https://genode.org/documentation/genode-foundations/20.05/index.html

---

https://github.com/glouw/ctl https://lobste.rs/s/9gc2ku/c_template_library

"

C TEMPLATE LIBRARY (CTL)

CTL is a fast compiling, type safe, header only, template-like library for ISO C11. Motivation

CTL aims to improve C11 developer productivity by implementing the following STL containers in ISO C11:

deq.h = std::deque lst.h = std::list pqu.h = std::priority_queue que.h = std::queue set.h = std::set stk.h = std::stack str.h = std::string vec.h = std::vector

"

---

t0astbread 3 days ago [–]

Frameworks and languages to build small to mid-sized web applications that aren't no-code or low-code or tied into an online service. Basically, PHP alternatives.

Here's a "wishlist" of features I'd like in such a framework:

reply

---

haskell extension recommendations:

haskell

https://limperg.de/ghc-extensions/ basic track:

    3.1 Syntactic Niceties
        3.1.1 TupleSections
        3.1.2 LambdaCase
        3.1.3 MultiWayIf
        3.1.4 BlockArguments
        3.1.5 TypeOperators
        3.1.6 NumericUnderscores
    3.2 Overloaded Literals
        3.2.1 OverloadedStrings
        3.2.2 OverloadedLists
    3.3 Patterns
        3.3.1 ViewPatterns
        3.3.2 PatternSynonyms
    3.4 Type System
        3.4.1 ExplicitForAll
        3.4.2 TypeApplications
        3.4.3 ScopedTypeVariables
        3.4.4 RankNTypes
        3.4.5 LiberalTypeSynonyms
    3.5 Records
        3.5.1 NamedFieldPuns
        3.5.2 RecordWildCards
    3.6 Classes
        3.6.1 FlexibleInstances
        3.6.2 FlexibleContexts
        3.6.3 DeriveFunctor, DeriveFoldable, DeriveTraversable
        3.6.4 GeneralizedNewtypeDeriving
        3.6.5 InstanceSigs
        3.6.6 ConstrainedClassMethods
        3.6.7 MultiParamTypeClasses
        3.6.8 FunctionalDependencies
        3.6.9 DeriveGeneric
    3.7 Typed Holes
        3.7.1 Typed Holes and Type Wildcards
        3.7.2 NamedWildCards
        3.7.3 PartialTypeSignatures

https://taylor.fausak.me/2020/11/22/haskell-survey-results/#s2q5 <34% net:

+37% -4% DerivingStrategies? +37% -4% MultiParamTypeClasses? +37% -4% TupleSections? +35% -7% DataKinds? +33% -4% KindSignatures? +32% -6% TypeFamilies? +30% -4% StandaloneDeriving? +30% -6% MultiWayIf? +29% -5% DeriveDataTypeable? +28% -5% ConstraintKinds? +28% -5% TypeOperators? +28% -6% ViewPatterns? +26% -4% InstanceSigs? +26% -5% DeriveLift? +25% -4% NumericUnderscores? +24% -6% NamedFieldPuns? +24% -5% EmptyCase? +24% -6% GADTSyntax +24% -6% ExplicitForAll? +23% -5% BinaryLiterals? +23% -6% FunctionalDependencies? +23% -10% DeriveAnyClass? +22% -9% RecordWildCards? +21% -6% DefaultSignatures? +21% -6% ExistentialQuantification? +20% -5% PatternSynonyms? +19% -13% ApplicativeDo?

https://taylor.fausak.me/2019/11/16/haskell-survey-results/#s2q5

Which language extensions would you like to be enabled by default?

Multiple select. 48% OverloadedStrings? 40% LambdaCase? 34% DeriveGeneric? 29% DeriveFunctor? 29% GADTs 28% BangPatterns? 26% FlexibleInstances? 25% FlexibleContexts? 25% ScopedTypeVariables? 25% RankNTypes? DeriveFoldable? GeneralizedNewtypeDeriving? TypeApplications? TypeFamilies? DeriveTraversable? 20% DataKinds? TupleSections? MultiParamTypeClasses? DerivingVia? TypeOperators? 17% KindSignatures? DerivingStrategies? 15% DeriveDataTypeable? MultiWayIf? ViewPatterns? StandaloneDeriving? ConstraintKinds? DeriveAnyClass? RecordWildCards? 13% EmptyCase? ApplicativeDo? 12% FunctionalDependencies? ExplicitForAll? InstanceSigs? 11% GADTSyntax PatternSynonyms? NamedFieldPuns? NumericUnderscores? 10%

http://dev.stephendiehl.com/hask/#language-extensions

The Benign

It’s not obvious which extensions are the most common but it’s fairly safe to say that these extensions are benign and are safely used extensively:

    NoImplicitPrelude
    OverloadedStrings
    LambdaCase
    FlexibleContexts
    FlexibleInstances
    GeneralizedNewtypeDeriving
    TypeSynonymInstances
    MultiParamTypeClasses
    FunctionalDependencies
    NoMonomorphismRestriction
    GADTs
    BangPatterns
    DeriveGeneric
    DeriveAnyClass
    DerivingStrategies
    ScopedTypeVariables

The Advanced

These extensions are typically used by advanced projects that push the limits of what is possible with Haskell to enforce complex invariants and very type-safe APIs.

    PolyKinds
    DataKinds
    DerivingVia
    GADTs
    RankNTypes
    ExistentialQuantification
    TypeFamilies
    TypeOperators
    TypeApplications
    UndecidableInstances

The Lowlevel

These extensions are typically used by low-level libraries that are striving for optimal performance or need to integrate with foreign functions and native code. Most of these are used to manipulate base machine types and interface directly with the low-level byte representations of data structures.

    CPP
    BangPatterns
    CApiFFI
    Strict
    StrictData
    RoleAnnotations
    ForeignFunctionInterface
    InterruptibleFFI
    UnliftedFFITypes
    MagicHash
    UnboxedSums
    UnboxedTuples

https://gist.github.com/mightybyte/6c469c125eb50e0c2ebf4ae26b5adfff

Level 0 - Use at will

Tried and true extensions. Very unlikely to cause problems. You can use these and rarely get any complaints.

    ApplicativeDo
    AutoDeriveTypeable -- Automatic derivation of Typeable
    BangPatterns
    Cpp
    DeriveDataTypeable
    DeriveFoldable
    DeriveFunctor
    DeriveGeneric
    DeriveLift
    DeriveTraversable
    EmptyDataDecls
    ExistentialQuantification
    ExplicitForAll
    FlexibleContexts
    FlexibleInstances
    ForeignFunctionInterface
    GeneralizedNewtypeDeriving
    JavaScriptFFI
    KindSignatures
    LambdaCase
    MagicHash
    MonomorphismRestriction
    MultiParamTypeClasses
    OverloadedLists
    OverloadedStrings
    PackageImports
    PartialTypeSignatures
    RankNTypes
    RecordWildCards -- This one is somewhat controversial
    ScopedTypeVariables
    StandaloneDeriving
    TupleSections
    TypeApplications
    UnboxedTuples
    ViewPatterns

Level 1 - More complex, but well understood

More complexity than level 0, but on the whole quite well understood and useful. Pose a little bit more of an obstacle in terms of concepts you need to understand to use them. Implementations without level 1 are still preferred if possible.

    AllowAmbiguousTypes
    DefaultSignatures
    DerivingStrategies
    FunctionalDependencies
    GADTs
    ImplicitPrelude -- Alternate preludes meh
    QuasiQuotes
    RecursiveDo
    TemplateHaskell
    TypeFamilies
    TypeOperators
    TypeSynonymInstances
    UndecidableInstances

https://lexi-lambda.github.io/blog/2018/02/10/an-opinionated-guide-to-haskell-in-2018/#any-flavor-you-like

Now, with that small digression out of the way, the question becomes precisely which extensions should go into that default-extensions list. I happen to like using most of the features GHC makes available, so I enable a whopping 34 language extensions by default. As of GHC 8.2, here is my list:

    ApplicativeDo
    BangPatterns
    ConstraintKinds
    DataKinds
    DefaultSignatures
    DeriveFoldable
    DeriveFunctor
    DeriveGeneric
    DeriveLift
    DeriveTraversable
    DerivingStrategies
    EmptyCase
    ExistentialQuantification
    FlexibleContexts
    FlexibleInstances
    FunctionalDependencies
    GADTs
    GeneralizedNewtypeDeriving
    InstanceSigs
    KindSignatures
    LambdaCase
    MultiParamTypeClasses
    MultiWayIf
    NamedFieldPuns
    OverloadedStrings
    PatternSynonyms
    RankNTypes
    ScopedTypeVariables
    StandaloneDeriving
    TupleSections
    TypeApplications
    TypeFamilies
    TypeFamilyDependencies
    TypeOperators

https://www.schoolofhaskell.com/user/PthariensFlame/guide-to-ghc-extensions

The extensions which are currently covered are:

    BangPatterns
    BinaryLiterals
    DatatypeContexts
    DoAndIfThenElse
    DoRec
    EmptyCase
    EmptyDataDecls
    ExistentialQuantification
    ExplicitForAll
    GADTs
    GADTSyntax
    Haskell98
    Haskell2010
    LambdaCase
    LiberalTypeSynonyms
    MonadComprehensions
    MultiWayIf
    NegativeLiterals
    NPlusKPatterns
    NondecreasingIndentation
    NumDecimals
    OverloadedLists
    OverloadedStrings
    PackageImports
    ParallelListComp
    PatternGuards
    PatternSignatures
    PatternSynonyms
    PolymorphicComponents
    PostfixOperators
    Rank2Types
    RankNTypes
    RecursiveDo
    ScopedTypeVariables
    TransformListComp
    TupleSections
    UnicodeSyntax
    ViewPatterns

Welcome View Patterns Pattern Synonyms Record WildCards? (and OverloadedStrings?) Bang Patterns Rebindable Syntax (and NoMonomorphismRestriction?) List Comprehensions (and ParallelListComp?, TransformListComp?, MonadComprehensions?, RecordWildCards?) Type Operators Recursive Do Nullary Type Classes Implicit Parameters Type Families (and FlexibleContexts?) Multi Param Type Classes (and FlexibleInstances?) Functional Dependencies Deriving (and DeriveFunctor? DeriveFoldable? DeriveTraversable? DeriveDataTypeable? GeneralizedNewtypeDeriving?) Derive Generic (and UndecidableInstances? FunctionalDependencies? TypeOperators?) Overloaded Strings Rank N Types (and TypeFamilies? GADTs KindSignatures?) Existential Quantification Scoped Type Variables Arrows Template Haskell Static Pointers Thanks

git clone https://github.com/tssm/up-to-date-real-world-haskell.git cd up-to-date-real-world-haskell/ /bin/grep LANGUAGE *.org

BangPatterns? CPP DeriveDataTypeable? FlexibleContexts? ForeignFunctionInterface? FunctionalDependencies? FlexibleInstances? GeneralizedNewtypeDeriving? MultiParamTypeClasses? PatternGuards? TypeSynonymInstances?

git clone https://github.com/tssm/up-to-date-real-world-haskell.git cd up-to-date-real-world-haskell/ /bin/grep LANGUAGE *.org

BangPatterns? CPP DeriveDataTypeable? FlexibleContexts? FlexibleInstances? ForeignFunctionInterface? FunctionalDependencies? GeneralizedNewtypeDeriving? MultiParamTypeClasses? PatternGuards? TypeSynonymInstances?

git clone https://github.com/bos/rwh.git cd rwh /bin/grep -r LANGUAGE *

BangPatterns? CPP DeriveDataTypeable? EmptyDataDecls? FlexibleContexts? FlexibleInstances? ForeignFunctionInterface? FunctionalDependencies? GeneralizedNewtypeDeriving? MultiParamTypeClasses? OverlappingInstances? PatternGuards? TypeSynonymInstances? UndecidableInstances?

(so these two lists are the same except the second one adds: EmptyDataDecls? OverlappingInstances? UndecidableInstances? )

>34% net 2020:

BangPatterns? DeriveFoldable? DeriveFunctor? DeriveGeneric? DeriveTraversable? DerivingVia? FlexibleContexts? FlexibleInstances? GADTs GeneralizedNewtypeDeriving? LambdaCase? OverloadedStrings? RankNTypes? ScopedTypeVariables? TypeApplications?

>%20 2019 takes out

DerivingVia? (>17%)

and adds

TypeFamilies?

2020 >25% net would add:

+37% -4% DerivingStrategies? +37% -4% MultiParamTypeClasses? +37% -4% TupleSections? +35% -7% DataKinds? +33% -4% KindSignatures? +32% -6% TypeFamilies? +30% -4% StandaloneDeriving?

all of which, except StandaloneDeriving? (between 15% and 13%) and TypeFamilies? (above 20%), were in between 20% and 15% in 2019

so i think we can stick with orig 34% list, minus DerivingVia?:

the following is >34% net in 2020 and >20% in 2019 State of Haskell surveys:

BangPatterns? DeriveFoldable? DeriveFunctor? DeriveGeneric? DeriveTraversable? FlexibleContexts? FlexibleInstances? GADTs GeneralizedNewtypeDeriving? LambdaCase? OverloadedStrings? RankNTypes? ScopedTypeVariables? TypeApplications?

all of these are in https://limperg.de/ghc-extensions/ 's "basic track" except the following which are in eis "Advanced Track":

BangPatterns? GADTs

So labeling those:

BangPatterns? (advanced in Limperg) DeriveFoldable? DeriveFunctor? DeriveGeneric? DeriveTraversable? FlexibleContexts? FlexibleInstances? GADTs (advanced in Limperg) GeneralizedNewtypeDeriving? LambdaCase? OverloadedStrings? RankNTypes? ScopedTypeVariables? TypeApplications?

considering http://dev.stephendiehl.com/hask/#language-extensions 's Benign/Advanced/Lowlevel lists):

and https://gist.github.com/mightybyte/6c469c125eb50e0c2ebf4ae26b5adfff (Beardsley's lists)

BangPatterns? (advanced in Limperg, lowlevel in Diehl; is in RWH) DeriveFoldable? (not in Diehl's Benign/Advanced/Lowlevel lists, not in PthariensFlame?'s list) DeriveFunctor? (not in Diehl's Benign/Advanced/Lowlevel lists, not in PthariensFlame?'s list) DeriveGeneric? (not in PthariensFlame?'s list) DeriveTraversable? (not in Diehl's Benign/Advanced/Lowlevel lists, not in PthariensFlame?'s list) FlexibleContexts? (not in PthariensFlame?'s list; is in RWH) FlexibleInstances? (not in PthariensFlame?'s list; is in RWH) GADTs (advanced in Limperg, Diehl, "More complex, but well understood" in Beardsley) GeneralizedNewtypeDeriving? (not in PthariensFlame?'s list; is in RWH) LambdaCase? (not in 24 Days of GHC Extensions) OverloadedStrings? RankNTypes? (advanced in Diehl) ScopedTypeVariables? TypeApplications? (advanced in Diehl, not in PthariensFlame?'s list, not in 24 Days of GHC Extensions)

and all were in Diehl's Benign list except for as labeled, and all were in Beardsley's "Use at will" list except GADTs which were in his "More complex, but well understood" as labeled. All were in https://lexi-lambda.github.io/blog/2018/02/10/an-opinionated-guide-to-haskell-in-2018/#any-flavor-you-like 's list of 34 extensions used by default. Those not in https://www.schoolofhaskell.com/user/PthariensFlame/guide-to-ghc-extensions are labeled. Those not in https://ocharles.org.uk/pages/2014-12-01-24-days-of-ghc-extensions.html are labeled.

now considering adding more:

other items in 2020 SOH >=20% net:

ConstraintKinds? DataKinds? DeriveLift? DeriveDataTypeable? DerivingStrategies? DerivingVia? InstanceSigs? KindSignatures? MultiParamTypeClasses? MultiWayIf? NumericUnderscores? StandaloneDeriving? TupleSections? TypeFamilies? TypeOperators? ViewPatterns?

other items in 2019 SOH >=14% removes:

ConstraintKinds? DeriveLift? InstanceSigs? NumericUnderscores?

leaving:

DataKinds? (Limperg advanced, Diehl advanced, Beardsley's lists as "Avoid unless you have a VERY good reason", not in 24 Days of GHC Extensions) DeriveDataTypeable? (Limperg notes "Recent GHCs derive instances of Typeable without you even writing a deriving clause, so you don’t need DeriveDataTypeable? for that anymore." and places in Misc; not in Diehl's Benign/Advanced/Lowlevel lists, not in lexi-lambda's list) DerivingStrategies? (Limperg advanced, Beardsley's "More complex, but well understood" list, not in 24 Days of GHC Extensions) DerivingVia? (Limperg advanced, Diehl advanced, not in Beardsley's lists, not in lexi-lambda's default list, not in 24 Days of GHC Extensions) KindSignatures? (Limperg advanced, Diehl advanced (implied by TypeFamilies?)) MultiParamTypeClasses? MultiWayIf? (not in Diehl's Benign/Advanced/Lowlevel lists, Beardsley hasn't decided where to put this yet, is in PthariensFlame?'s list, not in 24 Days of GHC Extensions) StandaloneDeriving? (Limperg advanced, not in Diehl's Benign/Advanced/Lowlevel lists, not in 24 Days of GHC Extensions) TupleSections? (is in PthariensFlame?'s list, not in 24 Days of GHC Extensions) TypeFamilies? (Limperg advanced, Diehl advanced, Beardsley's "More complex, but well understood" list) TypeOperators? (Diehl advanced, Beardsley's "More complex, but well understood" list)) ViewPatterns? (not in Diehl's Benign/Advanced/Lowlevel lists, not in lexi-lambda's default list, is in PthariensFlame?'s list)

all of these are in https://limperg.de/ghc-extensions/ 's "basic track" except as labeled and all were in Diehl's Benign list except for as labeled, and all were in Beardsley's "Use at will" list except GADTs which were in his "More complex, but well understood" as labeled. All were in https://lexi-lambda.github.io/blog/2018/02/10/an-opinionated-guide-to-haskell-in-2018/#any-flavor-you-like 's list of 34 extensions used by default except as labeled Those IN https://www.schoolofhaskell.com/user/PthariensFlame/guide-to-ghc-extensions are labeled. Only one on this list was in Real World Haskell: MultiParamTypeClasses?

So the following are >33% net in 2020 State of Haskell survey and >19% in 2019 State of Haskell survey, and on Diehl's Benign list, and in Beardsley's "Use at will list", and in lexi-lambda's list of extensions to use by default, and are on at least 2 of 3 of (PthariensFlame?'s list, Real World Haskell, 24 Days of GHC extensions):

FlexibleContexts? (not in PthariensFlame?'s list; is in RWH) FlexibleInstances? (not in PthariensFlame?'s list; is in RWH) GeneralizedNewtypeDeriving? (not in PthariensFlame?'s list; is in RWH) LambdaCase? (not in 24 Days of GHC Extensions) MultiParamTypeClasses? TupleSections? (not in 24 Days of GHC Extensions) OverloadedStrings? ScopedTypeVariables?

And the following are >33% net in 2020 State of Haskell survey and >19% in 2019 State of Haskell survey, and on Diehl's Benign or Advanced list (or with Diehl use classfication General/Deriving), and in Beardsley's "Use at will" list or "More complex, but well understood", and on at least one of (Diehl's Benign or Diehl's Lowlevel or Beardsley's "Use at will"), and in lexi-lambda's list of extensions to use by default, and are on at least 1 of 3 of (PthariensFlame?'s list, Real World Haskell, 24 Days of GHC extensions):

BangPatterns? (advanced in Limperg, lowlevel in Diehl; is in RWH) DeriveFoldable? (not in Diehl's Benign/Advanced/Lowlevel lists but General/Deriving, not in PthariensFlame?'s list) DeriveFunctor? (not in Diehl's Benign/Advanced/Lowlevel lists but General/Deriving, not in PthariensFlame?'s list) DeriveGeneric? (not in PthariensFlame?'s list) DeriveTraversable? (not in Diehl's Benign/Advanced/Lowlevel lists but General/Deriving, not in PthariensFlame?'s list) GADTs (advanced in Limperg, both benign and advanced in Diehl, "More complex, but well understood" in Beardsley; also in 24 Days of GHC Extensions) RankNTypes? (advanced in Diehl) TypeApplications? (advanced in Diehl, not in PthariensFlame?'s list, not in 24 Days of GHC Extensions)

And the following are >33% net in 2020 State of Haskell survey and >15% in 2019 State of Haskell survey and on the lists Limperg Advanced, Diehl's Benign or Advanced, Beardsley's "More complex, but well understood", lexi-lambda, PthariensFlame?:

DerivingStrategies? (Limperg advanced, Beardsley's "More complex, but well understood" list, not in 24 Days of GHC Extensions)

And the following are >20% net in 2020 State of Haskell survey and >14% in 2019 State of Haskell survey, and on at least one of Limperg's Basic list, Diehl's Benign list, or Beardsley's "Use at will list" and at least one of the other two out of (Limperg, Diehl, Beardsley) list as either basic/benign/use at will or advanced/more complex but well understood, and in lexi-lambda's list of extensions to use by default unless listed, and are on at least 1 of (PthariensFlame?'s list, Real World Haskell, 24 Days of GHC extensions):

KindSignatures? (Limperg advanced, Diehl advanced (implied by TypeFamilies?, is in 24 Days of GHC Extensions) TypeOperators? (Diehl advanced, Beardsley's "More complex, but well understood" list, is in 24 Days of GHC Extensions) ViewPatterns? (not in Diehl's Benign/Advanced/Lowlevel lists, not in lexi-lambda's default list, is in PthariensFlame?'s list and 24 days of GHC extensions)

And the following are >20% net in 2020 State of Haskell survey and >14% in 2019 State of Haskell survey, and on at least one of Limperg's Basic or Advanced list, Diehl's Advanced list, or Beardsley's "Use at will" or "More complex but still well understood", and in lexi-lambda's list of extensions to use by default unless listed:

DataKinds? (Limperg advanced, Diehl advanced, Beardsley's lists as "Avoid unless you have a VERY good reason") DerivingVia? (Limperg advanced, Diehl advanced, not in Beardsley's lists, not in lexi-lambda's default list) MultiWayIf? (not in Diehl's Benign/Advanced/Lowlevel lists, Beardsley hasn't decided where to put this yet; is in PthariensFlame?'s list) StandaloneDeriving? (Limperg advanced, not in Diehl's Benign/Advanced/Lowlevel lists) TypeFamilies? (Limperg advanced, Diehl advanced, Beardsley's "More complex, but well understood" list, is in 24 days of GHC extensions)

obsolete: DeriveDataTypeable? (Limperg notes "Recent GHCs derive instances of Typeable without you even writing a deriving clause, so you don’t need DeriveDataTypeable?