 
            
            
            
            
                18 Aug
                
                    2020
                
            
            
                18 Aug
                
                '20
                
            
            
            
        
    
                2:54 a.m.
            
        On Mon, 17 Aug 2020, Carter Schonwald wrote:
There’s an interesting idea or two in here. Like, should we support having non-nullable pointers?
That was my first idea, too. newtype NonNullPtr a = NonNullPtr (Ptr a) maybeNonNull :: Ptr a -> Maybe (NonNullPtr a) Using NonNullPtr in FFI declarations would make the interfaces safer. E.g. dst <- mallocArray n for (maybeNonNull dst) $ \dstNonNull -> copyArray dstNonNull srcNonNull n That seems better than testing for nullPtr and then forgeting this information in the type, again.