[Haskell-beginners] How to link two Types

David McBride toad3k at gmail.com
Wed Feb 22 16:34:43 UTC 2017


I should mention I just wrote that code off the cuff.  It's probably
not even close to right.  I recommend you mess with type families a
little to see if they get you where you want to go in your existing
code.

On Wed, Feb 22, 2017 at 11:29 AM, David McBride <toad3k at gmail.com> wrote:
> It is hard to tell from your code what you intend, but it works
> however you want it to, so long as it type checks.
>
> class Frame a where
>   type Whatever a
>   len :: Whatever a -> IO (Maybe Int)
>   row :: Whatever a -> MaybeT IO (DifTomoFrame a DIM1)
>
> instance Frame DataFrameH5Path  where
>   type Whatever DataFrameH5Path = DataFrameH5
>   len = undefined -- :: DataFrameH5 -> IO (Maybe Int)
>   row = undefined -- :: DataFrameH5 -> Int -> MaybeT (DifTomoFrame
> DataFrameH5Path DIM1)
>
>
>
> On Wed, Feb 22, 2017 at 11:19 AM, PICCA Frederic-Emmanuel
> <frederic-emmanuel.picca at synchrotron-soleil.fr> wrote:
>> Hello thanks, I will investigate, but I like this solution.
>> I can ad more type to a type family right ?
>>
>>
>> Is it possible with this type family to be able to link in the other way ?
>>
>> a -> t
>>
>> Cheers
>>
>> Fred
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


More information about the Beginners mailing list