Changes between Version 12 and Version 13 of LinearTypes


Ignore:
Timestamp:
Jul 26, 2017 12:17:15 PM (3 months ago)
Author:
andreas.abel
Comment:

"Linear types, take 1" example: Fixed let recursion bug, more systematic indentation.

Legend:

Unmodified
Added
Removed
Modified
  • LinearTypes

    v12 v13  
    216216  s1 <- open file1
    217217  s2 <- open file2
    218   let Just (s2,file3) = read s2
     218  let Just (s2',file3) = read s2
    219219  lift $ withFile file3 WriteMode $ \h3 -> do
    220     (s1,s2) <- interleave s2 s1 h3
     220    (s1,s2) <- interleave s2' s1 h3
    221221    close s2
    222222    close s1
    223223    hPutStrLn h3 "Done"
    224 
    225 where interleave :: Stream ⊸ Stream ⊸ IO (Stream ⊗ Stream)
    226       interleave (read -> Just (s1,l1)) (read -> Just (s2,l2)) = do
    227         hPutStrLn h3 l1
    228         hPutStrLn h3 l2
    229         interleave s1 s2
    230       interleave s1@(read -> Nothing) s2 = return (s1,s2)
    231       interleave s1 s2@(read -> Nothing) = return (s1,s2)
     224where
     225  interleave :: Stream ⊸ Stream ⊸ IO (Stream ⊗ Stream)
     226  interleave (read -> Just (s1,l1)) (read -> Just (s2,l2)) = do
     227    hPutStrLn h3 l1
     228    hPutStrLn h3 l2
     229    interleave s1 s2
     230  interleave s1@(read -> Nothing) s2 = return (s1,s2)
     231  interleave s1 s2@(read -> Nothing) = return (s1,s2)
    232232}}}
    233233==== Linear types, take 2 ====