profile
viewpoint

Gabriel439/Haskell-Pipes-Library 447

Compositional pipelines

ekmett/machines 320

Networks of composable stream transducers

haskell-unordered-containers/unordered-containers 214

Efficient hashing-based container types

haskell/primitive 96

This package provides various primitive memory-related operations.

fumieval/witherable 65

Filter with effects

haskell-boxes/boxes 35

A pretty-printing library for laying out text in two dimensions, using a simple box model.

atzeus/type-aligned 20

Various type-aligned sequence data structures.

lspitzner/pqueue 7

Haskell priority queue package

dagit/logict-sequence 6

A variation of the LogicT monad with better asymptotics from the Reflection without Remorse paper

ezyang/nf 6

NF data type to statically enforce normal form

issue commentbasvandijk/scientific

Tweaking internal representation

Other possible flavors:

data Scientific = Scientific
  (# (# Int#, Int# #) | (# Int#, Integer #) | (# Integer, Int# #) | (# Integer, Integer #)
data Scientific
  = SmallSmall !Int !Int
  | BigSmall !Integer !Int
  | SmallBig !Int !Integer
  | BigBig !Integer !Integer

It would also be possible to select just a couple of these options.

andrewthad

comment created time in 2 days

pull request commentghc-proposals/ghc-proposals

Custom type warnings (under review)

Why can't we get erasure (without deferred type errors)?

adamgundry

comment created time in 2 days

push eventhaskell/primitive

David Feuer

commit sha 5f1bf8c2dc2d862c01332ef422247c7ffb340107

Fix strictness mistake Forgot to force on a single-element lift.

view details

push time in 3 days

PR merged haskell/primitive

Fix strictness mistake

Forgot to force on a single-element lift.

+4 -4

0 comment

2 changed files

treeowl

pr closed time in 3 days

issue commenthaskell/core-libraries-committee

Clarify laws of TestEquality

So like tryTestEquality :: f a -> f b -> Maybe (a :~: b)? Fine. And then we may want things like

data Decision a = No (a -> Void) | Yes a
class DecidableEquality f where
  decideEquality :: f a -> f b -> Decision (a :~: b)

Getting type families to reduce is currently mostly impossible, but special cases could be handled like this:

type family a === b where
  a === a = True
  _ === _ = False

data EqualityRes a b where
  YesEqual :: EqualityRes a a
  NotEqual :: (a === b) ~ 'False => EqualityRes a b

class Blahblahblah f where
  yeppers :: f a -> f b -> EqualityRes a b
Ericson2314

comment created time in 3 days

PR opened haskell/primitive

Fix strictness mistake

Forgot to force on a single-element lift.

+4 -4

0 comment

2 changed files

pr created time in 3 days

create barnchtreeowl/primitive

branch : strictness-wibble

created branch time in 3 days

PR merged haskell/primitive

Reviewers
Add Lift instances

Closes #331

+183 -48

1 comment

6 changed files

treeowl

pr closed time in 3 days

push eventhaskell/primitive

David Feuer

commit sha 2484a5b254716dd5ee511a304cb968d609886e51

Add Lift instances (#332) * Add `Lift` instances * Expose `copyPtrToMutablePrimArray` some more Closes #331

view details

push time in 3 days

pull request commenthaskell/primitive

Add Lift instances

Thanks, @phadej! I'll merge.

treeowl

comment created time in 3 days

issue commenthaskell/core-libraries-committee

Clarify laws of TestEquality

I know I'm coming really late, but I think either:

  1. The type should be changed to provide a witness to inequality.
  2. The weak option should be weakened further, so that Nothing means no type equality information is available.
Ericson2314

comment created time in 3 days

PullRequestReviewEvent

issue openedhaskell/primitive

Adapt to recent GHC changes in runRW# compilation

GHC now tries to push a few things (I'm not sure what exactly) into runRW# blocks. I guess this is sometimes good? But when inlining doesn't happen, it's rather bad, because our trick of pulling constructors out of those blocks is now being defeated. Ugh! I'm not sure exactly what to do about this, aside from complaining to GHC HQ.

created time in 3 days

Pull request review commenthaskell/primitive

Add Lift instances

 instance TH.Lift ByteArray where #if __GLASGOW_HASKELL__ >= 802       pinned = isByteArrayPinned ba #else-      pinned = False+      pinned = True

Yeah, primops rarely if ever have @since annotations, which is awful but not something I can fix. I tried to make that notice more visible just now.

treeowl

comment created time in 3 days

PullRequestReviewEvent

push eventtreeowl/primitive

David Feuer

commit sha 649df4963d9dd482fd89dba19b838efaf17e539f

Try to make version warning more prominent.

view details

push time in 3 days

push eventtreeowl/primitive

David Feuer

commit sha a6bc691eb4975c3187b46897d229516b19b4c6b2

Swap pinnedness for old GHC Pinning an array the user wants unpinned is much less likely to break code than failing to pin one the user wants pinned.

view details

push time in 3 days

push eventtreeowl/primitive

David Feuer

commit sha 098fb954d3c1ab08b4dcffd3323ab46657274b31

Be smarter about array initialization

view details

push time in 3 days

Pull request review commenthaskell/primitive

Add Lift instances

 import qualified Text.ParserCombinators.ReadPrec as RdPrc import Text.ParserCombinators.ReadP  import Data.Functor.Classes (Eq1(..), Ord1(..), Show1(..), Read1(..))+import Language.Haskell.TH.Syntax (Lift (..))  -- | Boxed arrays. data Array a = Array   { array# :: Array# a }   deriving ( Typeable ) +instance Lift a => Lift (Array a) where+#if MIN_VERSION_template_haskell(2,16,0)+  liftTyped ary+    | len == 0 = [|| Array (emptyArray# (##)) ||]+    | len == 1 = [|| pure frst ||]+    | otherwise = [|| unsafeArrayFromListN' len lst ||]+#else+  lift ary = [| unsafeArrayFromListN' len lst |]+#endif+    where+      len = length ary+      lst = toList ary+      frst = ary `indexArray` 0++-- | Strictly create an array from a list of a known length. If the length+-- of the list does not match the given length, this makes demons fly+-- out of your nose. We use it in the 'Lift' instance. If you edit the+-- splice and break it, you get to keep both pieces.+unsafeArrayFromListN' :: Int -> [a] -> Array a

If I make the fold INLINABLE, it doesn't actually seem to do anything. If I make it INLINE, I get pokes up to around 32 elements, which suggests some judgement has been used. Unfortunately, going bigger seems to lead to some useless code duplication. So we might be better off just choosing our own cutoff, whatever that should be (currently set to 1, essentially). Another reasonable option would be to just leave it as I have it right now and push GHC for array literals or something.

treeowl

comment created time in 3 days

PullRequestReviewEvent

Pull request review commenthaskell/primitive

Add Lift instances

 copyByteArrayToPtr (Ptr dst#) (ByteArray src#) soff sz   where   siz# = sizeOf# (undefined :: a) +-- | Copy from an unmanaged pointer address to a byte array. These must not+-- overlap. The offset and length are given in elements, not in bytes.+--+-- /Note:/ this function does not do bounds or overlap checking.+copyPtrToByteArray+  :: forall m a. (PrimMonad m, PrimState m ~ RealWorld, Prim a)+  => MutableByteArray RealWorld -- ^ destination array+  -> Int -- ^ offset into destination array, interpreted as elements of type @a@+  -> Ptr a -- ^ source+  -> Int -- ^ number of elements to copy+  -> m ()+{-# INLINE copyPtrToByteArray #-}+copyPtrToByteArray (MutableByteArray dst#) soff (Ptr src#) sz+  = primitive_ (copyAddrToByteArray# src# dst# (unI# soff *# siz# ) (unI# sz))+  where+  siz# = sizeOf# (undefined :: a)+

Added a commit to export copyPtrToMutablePrimArray from PrimArray.

treeowl

comment created time in 3 days

PullRequestReviewEvent

push eventtreeowl/primitive

David Feuer

commit sha 0870b386f2611f987c4a986c833bcaf6f2d62303

Expose copyPtrToMutablePrimArray some more

view details

push time in 3 days

Pull request review commenthaskell/primitive

Add Lift instances

 copyByteArrayToPtr (Ptr dst#) (ByteArray src#) soff sz   where   siz# = sizeOf# (undefined :: a) +-- | Copy from an unmanaged pointer address to a byte array. These must not+-- overlap. The offset and length are given in elements, not in bytes.+--+-- /Note:/ this function does not do bounds or overlap checking.+copyPtrToByteArray+  :: forall m a. (PrimMonad m, PrimState m ~ RealWorld, Prim a)+  => MutableByteArray RealWorld -- ^ destination array+  -> Int -- ^ offset into destination array, interpreted as elements of type @a@+  -> Ptr a -- ^ source+  -> Int -- ^ number of elements to copy+  -> m ()+{-# INLINE copyPtrToByteArray #-}+copyPtrToByteArray (MutableByteArray dst#) soff (Ptr src#) sz+  = primitive_ (copyAddrToByteArray# src# dst# (unI# soff *# siz# ) (unI# sz))+  where+  siz# = sizeOf# (undefined :: a)+

Yes, I think so.

treeowl

comment created time in 4 days

PullRequestReviewEvent

issue commenthaskell/primitive

Ptr operations have the wrong types

So I'd want a "copyPtrToMutableByteArraythat works *only* inRealWorld, and an identicalcopyImmutablePtrToMutableByteArray` (or whatever name) that works in any state thread.

treeowl

comment created time in 4 days

issue commenthaskell/primitive

Ptr operations have the wrong types

@andrewthad I think it would make sense to offer an s-scoped version of Ptr for that purpose, but I don't think it's at all reasonable to write to a Ptr in general ST s. I'd also very much prefer if the "in any state thread" functions that read from Ptrs had ImmutablePtr or similar in their names.

treeowl

comment created time in 4 days

push eventtreeowl/primitive

David Feuer

commit sha 1a207581b1bde4620599881721055a862a742557

Add Lift instances Closes #331

view details

push time in 4 days

issue commenthaskell/primitive

Ptr operations have the wrong types

Okay, it's actually more subtle than that. Sometimes a Ptr is actually immutable, or treated as such, and copying from it in pure code is fine. But we currently also allow writing to a Ptr in pure code, which is utterly bogus.

treeowl

comment created time in 4 days

more