Implement Valuable for all Value constructors
This commit is contained in:
		@@ -61,12 +61,36 @@ instance Valuable Bool where
 | 
			
		||||
    Bool a -> a
 | 
			
		||||
    _ -> error "unexpected"
 | 
			
		||||
 | 
			
		||||
instance Valuable Image where
 | 
			
		||||
  toValue = Image
 | 
			
		||||
  fromValue = \case
 | 
			
		||||
    Image a -> a
 | 
			
		||||
    _ -> error "unexpected"
 | 
			
		||||
 | 
			
		||||
instance Valuable ImageConversionSettings where
 | 
			
		||||
  toValue = ImageConversionSettings
 | 
			
		||||
  fromValue = \case
 | 
			
		||||
    ImageConversionSettings a -> a
 | 
			
		||||
    _ -> error "unexpected"
 | 
			
		||||
 | 
			
		||||
instance Valuable Template where
 | 
			
		||||
  toValue = Template
 | 
			
		||||
  fromValue = \case
 | 
			
		||||
    Template a -> a
 | 
			
		||||
    _ -> error "unexpected"
 | 
			
		||||
 | 
			
		||||
instance Valuable () where
 | 
			
		||||
  toValue () = Empty
 | 
			
		||||
  fromValue = \case
 | 
			
		||||
    Empty -> ()
 | 
			
		||||
    _ -> error "unexpected"
 | 
			
		||||
 | 
			
		||||
instance (Valuable a, Valuable b) => Valuable (a, b) where
 | 
			
		||||
  toValue (a, b) = Tuple (toValue a, toValue b)
 | 
			
		||||
  fromValue = \case
 | 
			
		||||
    Tuple (va, vb) -> (fromValue va, fromValue vb)
 | 
			
		||||
    _ -> error "unexpected"
 | 
			
		||||
 | 
			
		||||
instance Valuable a => Valuable [a] where
 | 
			
		||||
  toValue = List . map toValue
 | 
			
		||||
  fromValue = \case
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user