Ticket #5593: 0001-Add-extra-Num-constraints-since-the-Num-superclass-o.patch

File 0001-Add-extra-Num-constraints-since-the-Num-superclass-o.patch, 1.8 KB (added by basvandijk, 2 years ago)

Patch for ghc

  • compiler/utils/Util.lhs

    From 6402729f7a097fd970352bb1eb3266e42ac8bd09 Mon Sep 17 00:00:00 2001
    From: Bas van Dijk <v.dijk.bas@gmail.com>
    Date: Sat, 29 Oct 2011 03:38:07 +0200
    Subject: [PATCH] Add extra Num constraints since the Num superclass of Bits
     is removed
    
    ---
     compiler/utils/Util.lhs |    6 +++---
     1 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs
    index dccb52d..7f7b607 100644
    a b restrictedDamerauLevenshteinDistanceWithLengths m n str1 str2 
    744744    else restrictedDamerauLevenshteinDistance' (undefined :: Integer) n m str2 str1 
    745745 
    746746restrictedDamerauLevenshteinDistance' 
    747   :: (Bits bv) => bv -> Int -> Int -> String -> String -> Int 
     747  :: (Bits bv, Num bv) => bv -> Int -> Int -> String -> String -> Int 
    748748restrictedDamerauLevenshteinDistance' _bv_dummy m n str1 str2  
    749749  | [] <- str1 = n 
    750750  | otherwise  = extractAnswer $ 
    restrictedDamerauLevenshteinDistance' _bv_dummy m n str1 str2 
    757757    extractAnswer (_, _, _, _, distance) = distance 
    758758 
    759759restrictedDamerauLevenshteinDistanceWorker 
    760       :: (Bits bv) => IM.IntMap bv -> bv -> bv 
     760      :: (Bits bv, Num bv) => IM.IntMap bv -> bv -> bv 
    761761      -> (bv, bv, bv, bv, Int) -> Char -> (bv, bv, bv, bv, Int) 
    762762restrictedDamerauLevenshteinDistanceWorker str1_mvs top_bit_mask vector_mask 
    763763                                           (pm, d0, vp, vn, distance) char2 
    restrictedDamerauLevenshteinDistanceWorker str1_mvs top_bit_mask vector_mask 
    786786sizedComplement :: Bits bv => bv -> bv -> bv 
    787787sizedComplement vector_mask vect = vector_mask `xor` vect 
    788788 
    789 matchVectors :: Bits bv => String -> IM.IntMap bv 
     789matchVectors :: (Bits bv, Num bv) => String -> IM.IntMap bv 
    790790matchVectors = snd . foldl' go (0 :: Int, IM.empty) 
    791791  where 
    792792    go (ix, im) char = let ix' = ix + 1