Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. bitmap image with transparent background (Letizia Galli)
2. Re: bitmap image with transparent background (Norbert Melzer)
3. Associated data type confusion (Alex Hammel)
4. Re: Associated data type confusion (Michael Orlitzky)
5. Re: Associated data type confusion (Alex Hammel)
6. Re: bitmap image with transparent background (Marcin Mrotek)
7. Re: bitmap image with transparent background (Letizia Galli)
----------------------------------------------------------------------
Message: 1
Date: Mon, 12 Jan 2015 19:24:54 +0100
From: Letizia Galli <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] bitmap image with transparent background
Message-ID:
<CAE02C-4i2YScBYAdd0QLKc6tfJx9CNkFr4xGFKX6+vKd=gz...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi :-)
I have just joined and I don't know if this is a beginner question,
anyway I have been given an Haskell code which uses images,
but when I convert a tiff with transparent background into a bitmap, their
background becomes
white and I need it to be transparent.
Is there a way in Haskel to convert a bitmap with solid background into a
bitmap with transparent
background?
Is there another format that can be used instead of bitmap in Haskell?
Best,
Letizia
--
Letizia Galli
0039 328 6917393
www.letiziagalli.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20150112/ff429af4/attachment-0001.html>
------------------------------
Message: 2
Date: Mon, 12 Jan 2015 19:57:41 +0100
From: Norbert Melzer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] bitmap image with transparent
background
Message-ID:
<ca+bcvsumwks6yuddsofcmyobh-srxgwneo7ugdga2iyh1yu...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Bitmap means exactly which Format? If you refer to BMP, IT does not support
an alpha channel, so no transparency in the picture itself.
Am 12.01.2015 19:25 schrieb "Letizia Galli" <[email protected]>:
> Hi :-)
> I have just joined and I don't know if this is a beginner question,
> anyway I have been given an Haskell code which uses images,
> but when I convert a tiff with transparent background into a bitmap, their
> background becomes
> white and I need it to be transparent.
> Is there a way in Haskel to convert a bitmap with solid background into a
> bitmap with transparent
> background?
> Is there another format that can be used instead of bitmap in Haskell?
> Best,
> Letizia
>
> --
> Letizia Galli
> 0039 328 6917393
> www.letiziagalli.it
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20150112/ac5f7502/attachment-0001.html>
------------------------------
Message: 3
Date: Mon, 12 Jan 2015 11:25:54 -0800
From: Alex Hammel <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Associated data type confusion
Message-ID:
<ca+_xferw6bbu84trs81rqt7vvsbgvsan8spday1k6va-sdy...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hello list,
I've got a collection of types which come from generated code (it's
protocol buffer stuff). I'd like to write a polymorphic function which maps
the protocol buffer generated data types to native data types. I've tried
something like this:
class FromProto a where
type InputDataType
fromProto :: InputDataType -> a
instance ToProto SomeNativeType where
type OutputDataType = SomeGeneratedType
toProto =
{- etc -}
instance FromProto SomeOtherNativeType where
type InputDataType = SomeOtherGeneratedType
fromProto =
{- etc -}
Which works fine for mapping one native data type to *one* generated data
type, but breaks when I want to define different *InputDataType*s for
different instances of *FromProto*.
I feel like I'm making this more complicated than I need to. Is there an
easy way to get the data type to data type mapping that I'm looking for?
Cheers,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20150112/b9fd9377/attachment-0001.html>
------------------------------
Message: 4
Date: Mon, 12 Jan 2015 15:39:36 -0500
From: Michael Orlitzky <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Associated data type confusion
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
On 01/12/2015 02:25 PM, Alex Hammel wrote:
> Hello list,
>
> I've got a collection of types which come from generated code (it's
> protocol buffer stuff). I'd like to write a polymorphic function which
> maps the protocol buffer generated data types to native data types. I've
> tried something like this:
>
This should get you started. My ProtoBool and ProtoInt types are just
dumb wrappers -- your conversions will be more complicated. But this
will compile and run in ghci:
ghci> toProto (3::Int)
ProtoInt {mkProtoInt = 3}
ghci> toProto True
ProtoBool {mkProtoBool = True}
If the toProto and fromProto definitions look goofy in the instances
it's because they're in point-free style. You could just as well have e.g.,
toProto b = ProtoBool b
or,
fromProto i = mkProtoInt i
----
{-# LANGUAGE TypeFamilies #-}
module Proto
where
-- | Just a wrapper around a 'Bool'.
newtype ProtoBool = ProtoBool { mkProtoBool :: Bool } deriving (Show)
-- | Just a wrapper around an 'Int'.
newtype ProtoInt = ProtoInt { mkProtoInt :: Int } deriving (Show)
class ToFromProto a where
-- | The type 'a' has another type associated with it, the
-- "protocol buffer type" that we can convert to/from. 'Proto'
-- below is a type function which when applied to 'a' should
-- return this associated type.
type Proto a :: *
toProto :: a -> (Proto a)
fromProto :: (Proto a) -> a
instance ToFromProto Bool where
-- | The type associated with 'Bool' is 'ProtoBool'
type Proto Bool = ProtoBool
-- | How do we make a 'ProtoBool' from a 'Bool'? Just wrap it.
toProto = ProtoBool
-- | How do we get a 'Bool' From a 'ProtoBool'? Unwrap it.
fromProto = mkProtoBool
-- | The same for 'Int' and 'ProtoInt'.
instance ToFromProto Int where
type Proto Int = ProtoInt
toProto = ProtoInt
fromProto = mkProtoInt
------------------------------
Message: 5
Date: Mon, 12 Jan 2015 13:35:11 -0800
From: Alex Hammel <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Associated data type confusion
Message-ID:
<CA+_xFer4hxX+Wb-ZnY=fncxq0lkbb9utrb2yxrbnrvaxtdu...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Awesome, that did the trick! I think I need a bit more practice with 'type
functions' before I'm really comfortable with them.
Thanks a lot!
Cheers,
Alex
On Mon, Jan 12, 2015 at 12:39 PM, Michael Orlitzky <[email protected]>
wrote:
> On 01/12/2015 02:25 PM, Alex Hammel wrote:
> > Hello list,
> >
> > I've got a collection of types which come from generated code (it's
> > protocol buffer stuff). I'd like to write a polymorphic function which
> > maps the protocol buffer generated data types to native data types. I've
> > tried something like this:
> >
>
> This should get you started. My ProtoBool and ProtoInt types are just
> dumb wrappers -- your conversions will be more complicated. But this
> will compile and run in ghci:
>
> ghci> toProto (3::Int)
> ProtoInt {mkProtoInt = 3}
>
> ghci> toProto True
> ProtoBool {mkProtoBool = True}
>
>
> If the toProto and fromProto definitions look goofy in the instances
> it's because they're in point-free style. You could just as well have e.g.,
>
> toProto b = ProtoBool b
>
> or,
>
> fromProto i = mkProtoInt i
>
>
> ----
>
> {-# LANGUAGE TypeFamilies #-}
>
> module Proto
> where
>
> -- | Just a wrapper around a 'Bool'.
> newtype ProtoBool = ProtoBool { mkProtoBool :: Bool } deriving (Show)
>
> -- | Just a wrapper around an 'Int'.
> newtype ProtoInt = ProtoInt { mkProtoInt :: Int } deriving (Show)
>
>
> class ToFromProto a where
> -- | The type 'a' has another type associated with it, the
> -- "protocol buffer type" that we can convert to/from. 'Proto'
> -- below is a type function which when applied to 'a' should
> -- return this associated type.
> type Proto a :: *
>
> toProto :: a -> (Proto a)
> fromProto :: (Proto a) -> a
>
> instance ToFromProto Bool where
> -- | The type associated with 'Bool' is 'ProtoBool'
> type Proto Bool = ProtoBool
>
> -- | How do we make a 'ProtoBool' from a 'Bool'? Just wrap it.
> toProto = ProtoBool
>
> -- | How do we get a 'Bool' From a 'ProtoBool'? Unwrap it.
> fromProto = mkProtoBool
>
>
> -- | The same for 'Int' and 'ProtoInt'.
> instance ToFromProto Int where
> type Proto Int = ProtoInt
> toProto = ProtoInt
> fromProto = mkProtoInt
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20150112/da8519e6/attachment-0001.html>
------------------------------
Message: 6
Date: Mon, 12 Jan 2015 23:37:12 +0100
From: Marcin Mrotek <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] bitmap image with transparent
background
Message-ID:
<cajcfpznyi0i5c2dpl8+edaqi5gj8jgn7hkaskndjlq8kujp...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Not sure if it helps you, but the Juicy Pixels library can load many
different formats, including TIFF:
https://hackage.haskell.org/package/JuicyPixels Can you show your code
that causes trouble?
Regards,
Marcin
------------------------------
Message: 7
Date: Tue, 13 Jan 2015 08:53:05 +0100
From: Letizia Galli <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] bitmap image with transparent
background
Message-ID:
<cae02c-7fxzgbqsfvanemyo3nksyd8y4rpnnky4twthdef1o...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi
thank you for your reply, yes I mean BMP
and I know it doesn't have a alpha channel
I was just asking if there is a way to use
images in a format with a transparent background.
Best
Letizia
2015-01-12 19:57 GMT+01:00 Norbert Melzer <[email protected]>:
> Bitmap means exactly which Format? If you refer to BMP, IT does not
> support an alpha channel, so no transparency in the picture itself.
> Am 12.01.2015 19:25 schrieb "Letizia Galli" <[email protected]>:
>
>> Hi :-)
>> I have just joined and I don't know if this is a beginner question,
>> anyway I have been given an Haskell code which uses images,
>> but when I convert a tiff with transparent background into a bitmap,
>> their background becomes
>> white and I need it to be transparent.
>> Is there a way in Haskel to convert a bitmap with solid background into a
>> bitmap with transparent
>> background?
>> Is there another format that can be used instead of bitmap in Haskell?
>> Best,
>> Letizia
>>
>> --
>> Letizia Galli
>> 0039 328 6917393
>> www.letiziagalli.it
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
--
Letizia Galli
0039 328 6917393
www.letiziagalli.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20150113/666c5423/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 79, Issue 13
*****************************************