What do you want the type of `omap` to be for `UserName`? There are two reasonable definitions:

omap :: (Text -> Text) -> (UserName -> UserName)
omap :: (Char -> Char) -> (UserName -> UserName)

The first one is saying that a UserName is a container of a single Text value. The second is that a UserName is a container of a sequence of Char values. Once you figure out what the answer to this question is, you'll need to use an associated type called Element to specify what you intend, e.g.:

type Element UserName = Char

On Thu, Aug 10, 2017 at 11:35 AM, Baa <aquagnu@gmail.com> wrote:
Hello, Dear List!

I want to make functor of my type like

  newtype UserName = UserName { unName :: Text }

sure, it's impossible, so I will make MonoFunctor instead of (from
library mono-traversable). So, I try:

  instance MonoFunctor UserName where
    omap fn (UserName n) = UserName $ fn $ n

but I get error

        • Couldn't match expected type ‘Element UserName’
                      with actual type ‘Text’
        • In the second argument of ‘($)’, namely ‘unName an’
          In the second argument of ‘($)’, namely ‘fn $ unName an’
          In the expression: UserName $ fn $ unName an

interesting is that Text "type Element Text" of "type family Element
mono" (instance?). So, how to make mono-functor for such `UserName`
structure?


--
Best regards, Paul
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners